Skip to content

Commit

Permalink
ngc build
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhang committed Jan 26, 2017
1 parent 3150096 commit 2577e96
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 65 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ test/*/*.js.map
npm-debug.log
.npmignore
dist
npm-debug.log.*
npm-debug.log.*
src/*.ngsummary.json
src/*/*.ngsummary.json
src/*/*.ngfactory.ts
src/*/*.ngstyle.ts
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'....
}

```
29 changes: 0 additions & 29 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -27,43 +23,18 @@ 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))
.pipe(minifyCss())
.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'], {
Expand Down
39 changes: 24 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
}
10 changes: 10 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -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'
}
}
4 changes: 2 additions & 2 deletions src/module/app.module.ts
Original file line number Diff line number Diff line change
@@ -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 ]
})
Expand Down
39 changes: 28 additions & 11 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -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
}
}

1 comment on commit 2577e96

@lunzhang
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1 and #2

Please sign in to comment.