Skip to content

Commit

Permalink
Refactor on build
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Mar 13, 2021
1 parent fbf2e53 commit eb5e0de
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/public/resources/**/*.map
/public/resources/images/
.DS_Store
/dist
/build
/vscode
/.vscode
Expand Down
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.sass-cache
node_modules
/dist
public
src
.gitignore
Expand All @@ -11,4 +12,6 @@ yarn.lock
exports
vscode
.vscode
.editorconfig
.editorconfig
package-lock.json
npm-shrinkwrap.json
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2020 PrimeTek
Copyright (c) 2016-2021 PrimeTek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
23 changes: 16 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var gulp = require('gulp'),
concat = require('gulp-concat'),
uglifycss = require('gulp-uglifycss'),
rename = require('gulp-rename'),
del = require('del'),
flatten = require('gulp-flatten');

gulp.task('build-css', function() {
Expand All @@ -13,10 +12,10 @@ gulp.task('build-css', function() {
'src/components/**/*.css'
])
.pipe(concat('primereact.css'))
.pipe(gulp.dest('resources'))
.pipe(gulp.dest('dist/resources'))
.pipe(uglifycss({"uglyComments": true}))
.pipe(rename('primereact.min.css'))
.pipe(gulp.dest('resources'));
.pipe(gulp.dest('dist/resources'));
});

gulp.task('build-themes', function() {
Expand All @@ -28,20 +27,30 @@ gulp.task('build-themes', function() {
'!public/themes/nano/**/*'
])
//.pipe(uglifycss({"uglyComments": true}))
.pipe(gulp.dest('resources/themes'));
.pipe(gulp.dest('dist/resources/themes'));
})

gulp.task('images', function() {
return gulp.src(['src/components/**/images/*.png', 'src/components/**/images/*.gif'])
.pipe(flatten())
.pipe(gulp.dest('resources/images'));
.pipe(gulp.dest('dist/resources/images'));
});

gulp.task('build-exports', function() {
return gulp.src(['exports/*.js','exports/*.d.ts'])
.pipe(gulp.dest('./'));
.pipe(gulp.dest('dist'));
});

gulp.task('build-meta', function() {
return gulp.src(['README.md','LICENSE.md', 'package-build.json'])
.pipe(rename(function(path) {
if (path.basename === 'package-build') {
path.basename = path.basename.replace('package-build', 'package');
}
}))
.pipe(gulp.dest('dist'));
});

//Building project with run sequence
gulp.task('build-resources', gulp.series('build-css','images', 'build-themes'));
gulp.task('build-resources', gulp.series('build-css','images', 'build-themes', 'build-meta'));

25 changes: 25 additions & 0 deletions package-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "primereact",
"version": "6.1.1",
"homepage": "https://www.primefaces.org/primereact",
"repository": {
"type": "git",
"url": "https://github.com/primefaces/primereact.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/primefaces/primereact/issues"
},
"keywords": [
"primereact",
"react",
"ui framework",
"component framework",
"ui library",
"component library",
"material",
"bootstrap",
"react components",
"responsive components"
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"classnames": "^2.2.6",
"codesandbox": "2.1.14",
"core-js": "^3.6.5",
"del": "^2.2.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-flatten": "^0.4.0",
Expand Down Expand Up @@ -63,7 +62,8 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"compile-components": "./node_modules/\\@babel/cli/bin/babel.js src/components --out-dir components --presets=@babel/env,@babel/react --plugins=@babel/plugin-proposal-class-properties --copy-files",
"build-lib": "npm run compile-components && npm run build-resources && npm run build-exports",
"compile-components": "./node_modules/\\@babel/cli/bin/babel.js src/components --out-dir dist/components --presets=@babel/env,@babel/react --plugins=@babel/plugin-proposal-class-properties --copy-files",
"build-resources": "gulp build-resources",
"build-exports": "gulp build-exports"
},
Expand Down

0 comments on commit eb5e0de

Please sign in to comment.