Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
feat(build): include bumped version in npm publish
Browse files Browse the repository at this point in the history
 - use async task to wait for publish to finish
 - move typings to same relative place in local copy and npm package (so package.json resolves them in both cases)
 - change temporary build for bundles from lib/ to dist/ to match npm package.
  • Loading branch information
justindujardin committed Dec 13, 2015
1 parent 708526b commit 88f7134
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.baseDir.*
.idea
lib/
dist/
out/

ng2-material/**/*.css
Expand Down
15 changes: 9 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function (grunt) {
sourceRoot: 'ng2-material',
outPath: 'out',
clean: [
"lib/",
"dist/",
"<%- outPath %>/",
"<%- sourceRoot %>/**/*.js",
"<%- sourceRoot %>/**/*.d.ts",
Expand All @@ -14,7 +14,7 @@ module.exports = function (grunt) {
],
copy: {
styles: {
files: [{src: ['<%- sourceRoot %>/all.css'], dest: 'lib/ng2-material/ng2-material.css'}]
files: [{src: ['<%- sourceRoot %>/all.css'], dest: 'dist/ng2-material.css'}]
},
release: {
files: [
Expand All @@ -30,7 +30,7 @@ module.exports = function (grunt) {
{expand: true, cwd: 'ng2-material/', src: ['**/*.ts'], dest: '<%- outPath %>/source'},

// Bundled js and css files
{expand: true, cwd: 'lib/ng2-material/', src: ['*.*'], dest: '<%- outPath %>/dist'},
{expand: true, cwd: 'dist/', src: ['*.*'], dest: '<%- outPath %>/dist'},
{expand: true, cwd: 'public/font/', src: ['*.*'], dest: '<%- outPath %>/dist'},


Expand Down Expand Up @@ -122,7 +122,7 @@ module.exports = function (grunt) {
options: {
name: 'ng2-material',
baseDir: '<%- sourceRoot %>',
out: 'lib/ng2-material/<%=pkg.name%>.d.ts'
out: 'dist/<%=pkg.name%>.d.ts'
},
default: {
src: ['<%- sourceRoot %>/**/*.ts']
Expand Down Expand Up @@ -160,12 +160,12 @@ module.exports = function (grunt) {
var Builder = require('systemjs-builder');
var builder = new Builder('./', './config.bundle.js');
builder
.bundle('ng2-material', 'lib/ng2-material/ng2-material.js', {
.bundle('ng2-material', 'dist/ng2-material.js', {
minify: false,
sourceMaps: true
})
.then(function () {
return builder.bundle('ng2-material', 'lib/ng2-material/ng2-material.min.js', {
return builder.bundle('ng2-material', 'dist/ng2-material.min.js', {
minify: true,
sourceMaps: true
});
Expand All @@ -186,6 +186,7 @@ module.exports = function (grunt) {
'npm-contributors',
'bump:' + type + ':bump-only',
'conventionalChangelog',
'copy:release',
'bump-commit',
'publish'
]);
Expand All @@ -194,13 +195,15 @@ module.exports = function (grunt) {

grunt.registerTask('publish', 'Build metadata files describing example usages', function (tag) {
var exec = require('child_process').exec;
var done = this.async();
process.chdir('out');
exec('npm publish' + (tag ? ' --tag ' + tag : ''), function (err) {
process.chdir('../');
if (err) {
return grunt.fatal(err.message.replace(/\n$/, '.'));
}
grunt.log.ok('Published to NPM' + (tag ? ' @' + tag : ''));
done();
});
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"typescript": "^1.8.0-dev.20151122",
"zone.js": "^0.5.8"
},
"typings": "lib/ng2-material/ng2-material.d.ts",
"typings": "dist/ng2-material.d.ts",
"devDependencies": {
"dts-generator": "^1.6.3",
"grunt": "^0.4.5",
Expand Down

0 comments on commit 88f7134

Please sign in to comment.