diff --git a/.gitignore b/.gitignore index 8af2bce..2ee5373 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,8 @@ test/*/*.js.map npm-debug.log .npmignore dist -npm-debug.log.* \ No newline at end of file +npm-debug.log.* +src/*.ngsummary.json +src/*/*.ngsummary.json +src/*/*.ngfactory.ts +src/*/*.ngstyle.ts diff --git a/README.md b/README.md index d233f21..e1d733c 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,7 @@ widget.content = CustomComponent; ### Systemjs Users ```typescript map: { -'ng2-grid-component':'npm:ng2-grid-component/dist'.... -}, -packages: { - 'ng2-grid-component':{ - main: './main.js', - defaultExtension: 'js' - } +'ng2-grid-component':'npm:ng2-grid-component/dist/bundles/ng2-grid.umd.min.js'.... +} ``` diff --git a/gulpfile.js b/gulpfile.js index 74ee6d1..13cd6b3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,9 +1,5 @@ var gulp = require('gulp'); var path = require('path'); -var del = require('del'); -var sourcemaps = require('gulp-sourcemaps'); -var typescript = require('gulp-typescript'); -var merge = require('merge2'); var sass = require('gulp-sass'); var minifyCss = require('gulp-minify-css'); var runSequence = require('run-sequence'); @@ -27,31 +23,11 @@ const fs = require('fs'); const glob = require('glob'); const readFile = promiseify(fs.readFile); const writeFile = promiseify(fs.writeFile); -const gulpRollup = require('gulp-better-rollup'); var paths = { sass: ['./src/**/*.scss'] }; -var tsProject = typescript.createProject('tsconfig.build.json'); - -//removes dist folder -gulp.task('clean', function() { - return del(['dist']); -}); - -//builds ts files -gulp.task('ts',function(){ - var tsResult = tsProject.src() - .pipe(sourcemaps.init()) - .pipe(tsProject()); - - return merge([ - tsResult.js.pipe(sourcemaps.write('')).pipe(gulp.dest(path.join('dist'))), - tsResult.dts.pipe(gulp.dest(path.join('dist'))) - ]); -}); - //compiles sass gulp.task('sass',function(){ gulp.src(paths.sass, {base: "./"}).pipe(sass().on('error', sass.logError)) @@ -59,11 +35,6 @@ gulp.task('sass',function(){ .pipe(gulp.dest(".")); }); -//build task for prod -gulp.task('build', function() { - runSequence('sass','copy','ts','inline'); -}); - //copies css and html files gulp.task('copy',function(){ gulp.src(['src/**/*.css'], { diff --git a/package.json b/package.json index 42cce61..ff3f965 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,21 @@ { "name": "ng2-grid-component", - "version": "0.2.82", + "version": "0.2.9", "description": "angular 2 grid layout", - "main": "dist/main.js", + "main": "dist/bundles/ng2-grid.umd.js", + "module": "index.js", "scripts": { "start": "concurrently \"tsc -w\" \"lite-server\" \"gulp watch\" ", "lite": "lite-server", "tsc": "tsc", "tsc:w": "tsc -w", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "transpile": "ngc -p tsconfig.build.json", + "package": "rollup -c", + "minify": "uglifyjs dist/bundles/ng2-grid.umd.js --screw-ie8 --compress --mangle --comments --output dist/bundles/ng2-grid.umd.min.js", + "aot": "rimraf dist && npm run transpile", + "compile": "gulp sass && gulp copy && gulp inline && npm run package && npm run minify", + "build":"npm run aot && npm run compile" }, "repository": { "type": "git", @@ -19,33 +26,35 @@ "grid" ], "author": "lunzhang", - "license": "ISC", + "license": "MIT", "homepage": "https://github.com/lunzhang/ng2-grid", "files": [ "dist/*" ], "devDependencies": { "@angular/common": "~2.4.0", - "@angular/compiler": "~2.4.0", + "@angular/compiler": "^2.4.5", + "@angular/compiler-cli": "^2.4.5", "@angular/core": "~2.4.0", - "@angular/forms": "~2.4.0", "@angular/platform-browser": "~2.4.0", "@angular/platform-browser-dynamic": "~2.4.0", - "systemjs": "0.19.40", - "core-js": "^2.4.1", - "rxjs": "5.0.1", - "zone.js": "^0.7.4", - "@types/core-js": "^0.9.34", - "@types/node": "^6.0.45", + "@types/node": "^7.0.4", "concurrently": "^3.0.0", + "core-js": "^2.4.1", + "gulp": "^3.9.1", + "gulp-better-rollup": "^1.0.2", "gulp-minify-css": "^1.2.4", "gulp-sass": "^3.0.0", - "gulp-sourcemaps": "^1.9.1", - "gulp-typescript": "^3.1.3", "lite-server": "^2.2.2", "reflect-metadata": "^0.1.8", + "rimraf": "^2.5.4", + "rollup": "^0.41.4", "run-sequence": "^1.2.2", - "typescript": "^2.0.3" + "rxjs": "5.0.1", + "systemjs": "0.19.40", + "typescript": "^2.1.5", + "uglify-js": "^2.7.5", + "zone.js": "^0.7.4" }, "typings": "dist/main.d.ts" } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..9254f17 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,10 @@ +export default { + entry: 'dist/main.js', + dest: 'dist/bundles/ng2-grid.umd.js', + sourceMap: false, + format: 'umd', + moduleName: 'ng.ng2-grid', + globals: { + '@angular/core': 'ng.core' + } +} diff --git a/src/module/app.module.ts b/src/module/app.module.ts index 0ef37be..1179f80 100644 --- a/src/module/app.module.ts +++ b/src/module/app.module.ts @@ -1,11 +1,11 @@ import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; +import { CommonModule } from '@angular/common'; import { NgGrid } from '../grid/grid'; import { NgWidget } from '../widget/widget'; import { NgWidgetShadow } from '../widgetshadow/widgetshadow'; @NgModule({ - imports:[BrowserModule], + imports:[CommonModule], declarations:[ NgGrid,NgWidget,NgWidgetShadow ], exports:[ NgGrid,NgWidget,NgWidgetShadow ] }) diff --git a/tsconfig.build.json b/tsconfig.build.json index a6c5c2d..2213345 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,19 +1,36 @@ { "compilerOptions": { - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "emitDecoratorMetadata": true, + "baseUrl": ".", + "declaration": true, + "stripInternal": true, "experimentalDecorators": true, - "removeComments": false, + "strictNullChecks": false, "noImplicitAny": false, - "declaration":true, - "rootDir":"src", - "outDir":"dist" + "module": "es2015", + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "paths": { + "@angular/core": ["node_modules/@angular/core"] + }, + "rootDir": "src", + "outDir": "dist", + "sourceMap": true, + "inlineSources": true, + "target": "es5", + "skipLibCheck": true, + "lib": [ + "es2015", + "dom" + ] }, - "exclude": [ + "files": [ + "src/main.ts" + ], + "exclude": [ "node_modules", "test" - ] + ], + "angularCompilerOptions": { + "strictMetadataEmit": true + } }