Skip to content

Commit

Permalink
chore(build): new build system with npm scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sebholstein committed Oct 13, 2016
1 parent 53b2b3b commit 6473cce
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 2,712 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ dist
docs_generated
src/**/*.js
src/**/*.map
src/**/*.ngfactory.js
.tmp
test-built
test-built
npm-debug.log
45 changes: 18 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,27 @@
"maps"
],
"scripts": {
"ci": "gulp build && gulp test"
"clean": "rimraf dist && rimraf .tmp && mkdir dist && mkdir .tmp && rimraf 'src/**/*.ngfactory.ts'",
"prebuild": "npm run clean",
"build": "npm run lint && npm run scripts && npm run packagejson && npm run copyassets",
"lint": "tslint -c tslint.json 'src/**/*.ts' && clang-format --glob='src/**/*.ts'",
"packagejson": "node ./scripts/create-package-json.js",
"copyassets": "cp -R assets/release/* dist/ && cp LICENSE dist/",
"scripts": "npm run ngc:es5 && npm run ngc:es2015 && npm run bundle:umd",
"bundle:umd": "rollup -c rollup.config.js",
"ngc:es5": "ngc -p tsconfig.json",
"postngc:es5": "cp -R .tmp/es5/src/* dist/",
"ngc:es2015": "ngc -p tsconfig.es2015.json",
"postngc:es2015": "cp -R .tmp/esm/src dist/esm/",
"test": "echo TODO",
"ci": "npm run build && npm run test"
},
"author": "Sebastian Müller <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/SebastianM/angular2-google-maps/issues"
},
"homepage": "https://github.com/SebastianM/angular2-google-maps#readme",
"homepage": "https://angular-maps.com",
"dependencies": {
"@angular/common": "^2.1.0",
"@angular/compiler": "^2.1.0",
Expand All @@ -35,39 +48,17 @@
"@angular/compiler-cli": "^0.6.0",
"@ngtools/webpack": "^1.1.0",
"@types/jasmine": "^2.5.35",
"babel-eslint": "6.0.4",
"clang-format": "1.0.42",
"del": "2.2.2",
"eslint": "^3.0.0",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.0",
"gulp": "3.9.1",
"gulp-bump": "2.4.0",
"gulp-clang-format": "1.0.23",
"gulp-connect": "4.1.0",
"gulp-conventional-changelog": "1.1.0",
"gulp-eslint": "3.0.1",
"gulp-git": "1.8.0",
"gulp-header": "^1.7.1",
"gulp-load-plugins": "1.2.4",
"gulp-rename": "1.2.2",
"gulp-shell": "0.5.2",
"gulp-sourcemaps": "1.6.0",
"gulp-tslint": "5.0.0",
"gulp-typescript": "^2.13.4",
"conventional-changelog": "^1.1.0",
"copyfiles": "^1.0.0",
"jasmine-core": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "2.0.0",
"karma-jasmine": "1.0.2",
"merge2": "1.0.2",
"replace": "0.3.0",
"require-dir": "0.3.0",
"rimraf": "^2.5.4",
"rollup": "0.35.7",
"run-sequence": "1.2.2",
"systemjs": "0.19.38",
"tslint": "3.13.0",
"typescript": "^2.0.2",
"watchify": "3.7.0",
"webpack": "2.1.0-beta.25"
},
"jspm": {
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export default {
entry: 'dist/esm/core/index.js',
dest: '.tmp/core.umd.js',
dest: 'dist/core/core.umd.js',
format: 'umd',
moduleName: 'ngmaps.core',
sourceMap: true,
globals: {
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
Expand Down
7 changes: 7 additions & 0 deletions scripts/changelog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var conventionalChangelog = require('conventional-changelog');

conventionalChangelog({
preset: 'angular',
path: __dirname + '/../package.json'
})
.pipe(process.stdout);
20 changes: 20 additions & 0 deletions scripts/create-package-json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Creates a package.json for the release NPM package structure.
*/
const fs = require('fs');
const path = require('path');

const basePkgJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));

// remove scripts
delete basePkgJson.scripts;

// remove devDependencies (as there are important for the sourcecode only)
delete basePkgJson.devDependencies;

// transform dependencies to peerDependencies for the release
basePkgJson.peerDependencies = Object.assign({}, basePkgJson.dependencies);
basePkgJson.dependencies = {};

const filepath = path.join(__dirname, '../dist/package.json');
fs.writeFileSync(filepath, JSON.stringify(basePkgJson, null, 2), 'utf-8');
5 changes: 0 additions & 5 deletions scripts/npm-publish.sh

This file was deleted.

9 changes: 4 additions & 5 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ set -e

# PLEASE NOTE - make sure that you have set up these things before running this script!!:
# - bump the package.json version
# - generate the project with gulp build (dist folder should lookin good)
# - generate the project with npm build (dist folder should lookin good)
# - Create Git tag
./node_modules/.bin/gulp changelog
git add CHANGELOG.md package.json
git commit -m "chore(release): add changelog and bump version"
git push origin master
./node_modules/.bin/gulp create-tag
git push origin master --tags
echo "--- DONE RELEASING --- Please publish to NPM now (run npm publish dist)"
# create tag
# git push origin master --tags
# npm publish dist
28 changes: 28 additions & 0 deletions tsconfig.es2015.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "es2015",
"target": "es2015",
"noImplicitAny": true,
"experimentalDecorators": true,
"outDir": ".tmp/esm",
"rootDir": ".",
"sourceMap": true,
"removeComments": false,
"moduleResolution": "node",
"declaration": true,
"lib": [
"es2015",
"dom"
],
"types": [
"jasmine"
]
},
"angularCompilerOptions": {
"genDir": ".",
"debug": true
},
"include": [
"src/**/*"
]
}
13 changes: 4 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,25 @@
"target": "es5",
"noImplicitAny": true,
"experimentalDecorators": true,
"outDir": "d",
"outDir": ".tmp/es5",
"rootDir": ".",
"sourceMap": true,
"removeComments": false,
"moduleResolution": "node",
"declaration": true,
"lib": [
"es2015",
"dom"
"dom"
],
"types": [
"jasmine"
],
"listEmittedFiles": true
]
},
"angularCompilerOptions": {
"genDir": ".",
"debug": true
},
"include": [
"src/**/*"
],
"exclude": [
"gulp",
"dist",
"assets"
]
}
Loading

0 comments on commit 6473cce

Please sign in to comment.