-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(npmignore): add npm prepublish script to remove bower_components …
…directory
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# folders | ||
# ======= | ||
bower_components/ | ||
bower_components/ # also see scripts/prepublish.js | ||
dist/ | ||
|
||
# dot files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require('colors') | ||
|
||
var getSeparator = function(msg) { | ||
var i = 0 | ||
var sep = '' | ||
var len = msg.length | ||
for (; i < len; i++) { | ||
sep += '-' | ||
} | ||
return sep | ||
} | ||
|
||
var logMsg = function(msg) { | ||
var sep = getSeparator(msg) | ||
console.log(sep) | ||
console.log(msg.toUpperCase().yellow) | ||
console.log(sep) | ||
return | ||
} | ||
|
||
module.exports = logMsg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Ensure bower_components dir gets removed before publishing to npm. | ||
* .npmignore is not enough because some bower packages | ||
* contain: package.json and/or README.md | ||
* and these files never get ignored. | ||
**********************************************************************/ | ||
var bowerPath, cwd, fse, logMsg, path, q; | ||
|
||
q = require('q') | ||
path = require('path') | ||
fse = require('fs-extra') | ||
logMsg = require('./helpers/log-msg') | ||
cwd = process.cwd() | ||
bowerPath = path.join(cwd, 'src', 'client', 'bower_components'); // ; required | ||
|
||
/** | ||
* Init | ||
*/ | ||
(function() { | ||
var defer = q.defer() | ||
logMsg('npm prepublish') | ||
fse.remove(bowerPath, function(e) { | ||
if (e) return console.log(e) | ||
console.log('removed bower_components directory') | ||
return defer.resolve() | ||
}) | ||
return defer.promise | ||
})() |