Skip to content

Commit

Permalink
remove bower and simplify build configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmoore committed Mar 15, 2018
1 parent 113f1b3 commit c025a27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 71 deletions.
29 changes: 0 additions & 29 deletions bower.json

This file was deleted.

40 changes: 10 additions & 30 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,6 @@ var jshint = require('jshint').JSHINT;
var babel = require('babel');
var gaze = require('gaze');

function writeBower() {
var bower = {
name: pkg.config.bower.name,
description: pkg.description,
dependencies: pkg.dependencies,
keywords: pkg.keywords,
authors: [pkg.author],
license: pkg.license,
homepage: pkg.homepage,
ignore: pkg.config.bower.ignore,
repository: pkg.repository,
main: pkg.main,
moduleType: pkg.config.bower.moduleType,
};
fs.writeFile('bower.json', JSON.stringify(bower, null, '\t'));
return true;
}

function lint(full) {
jshint(full.toString(), {
browser: true,
Expand All @@ -49,18 +31,16 @@ function lint(full) {
function build(code) {
var minified = ugly.minify(code, {fromString: true}).code;
var header = [
'/*!',
' '+pkg.config.title+' '+pkg.version,
' license: MIT',
' '+pkg.homepage,
'*/',
''
`/*!`,
` ${pkg.name} ${pkg.version}`,
` license: ${pkg.license}`,
` ${pkg.homepage}`,
`*/`,
``
].join('\n');

fs.writeFile('dist/'+pkg.config.filename+'.js', header+code);
fs.writeFile('dist/'+pkg.config.filename+'.min.js', header+minified);
writeBower();

fs.writeFile('dist/'+pkg.name+'.js', header+code);
fs.writeFile('dist/'+pkg.name+'.min.js', header+minified);
console.log('dist built');
}

Expand All @@ -75,7 +55,7 @@ function transform(filepath) {
});
}

gaze('src/'+pkg.config.filename+'.js', function(err, watcher){
gaze('src/'+pkg.name+'.js', function(err, watcher){
// On file changed
this.on('changed', function(filepath) {
transform(filepath);
Expand All @@ -84,4 +64,4 @@ gaze('src/'+pkg.config.filename+'.js', function(err, watcher){
console.log('watching');
});

transform('src/'+pkg.config.filename+'.js');
transform('src/'+pkg.name+'.js');
12 changes: 0 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@
"jshint": "^2.9.4",
"uglify-js": "^2.7.4"
},
"config": {
"bower": {
"name": "autosize",
"ignore": [],
"moduleType": [
"amd",
"node"
]
},
"title": "Autosize",
"filename": "autosize"
},
"scripts": {
"build": "node build"
}
Expand Down

0 comments on commit c025a27

Please sign in to comment.