Skip to content

Commit

Permalink
fixed #22
Browse files Browse the repository at this point in the history
  • Loading branch information
yanni4night committed Jul 30, 2016
1 parent 6d6d7cc commit 262efc6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "panto",
"version": "0.0.29",
"version": "0.0.30",
"description": "PantoJS®️ is an extreme flexible file-transforming task runner",
"main": "index.js",
"scripts": {
"test": "eslint src test && PANTO_LOG_LEVEL=data ./node_modules/.bin/mocha",
"test": "eslint src test && PANTO_LOG_LEVEL=error ./node_modules/.bin/mocha",
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"precommit": "test",
Expand Down Expand Up @@ -39,15 +39,15 @@
"panto-file-utils": "^0.3.0",
"panto-logger": "^0.2.2",
"panto-options": "^0.1.1",
"panto-stream": "^0.7.5",
"panto-stream": "^0.7.6",
"subdir": "0.0.3",
"table": "^3.7.8"
},
"devDependencies": {
"coveralls": "^2.11.9",
"mocha": "^2.5.3",
"mocha-lcov-reporter": "^1.2.0",
"panto-transformer": "^0.2.2",
"panto-transformer": "^0.2.4",
"pre-commit": "^1.1.3"
}
}
20 changes: 6 additions & 14 deletions src/panto.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
* 2016-07-21[21:30:45]:throw error if src and output matches
* 2016-07-22[23:18:53]:emit start event
* 2016-07-30[14:24:55]:optimize
* 2016-07-31[00:43:20]:remove useless log
*
* @author yanni4night@gmail.com
* @version 0.0.29
* @version 0.0.30
* @since 0.0.1
*/
'use strict';
Expand Down Expand Up @@ -298,11 +299,6 @@ class Panto extends EventEmitter {
watchOptions.ignored = [`${rel}/**/*`, /^\./];
}

this.log.info('\n' + table([
['Watching for changes'],
[src]
]));

const watcher = chokidar.watch(`**/*`, watchOptions);

watcher.on('add', path => {
Expand Down Expand Up @@ -337,12 +333,11 @@ class Panto extends EventEmitter {
const tableData = [];

this._streams.forEach(({stream}, i) => {
tableData[i] = [stream.tag, 'ready', '-'];
tableData[i] = [stream.tag, '-'];
});

const print = () => {
const data = table(tableData);
this.log.info('\n' + data);
process.stdout.write(table(tableData));
};

return new Promise((resolve, reject) => {
Expand All @@ -357,7 +352,7 @@ class Panto extends EventEmitter {
if (startStreamIdx === this._streams.length) {
const diff = process.hrtime(startTime);
const totalMs = parseInt(diff[0] * 1e3 + diff[1] / 1e6, 10);
tableData.push(['Total', `complete`, `${totalMs}ms`]);
tableData.push(['Total', `${totalMs}ms`]);
print();

resolve(flattenDeep(ret));
Expand All @@ -366,17 +361,14 @@ class Panto extends EventEmitter {
let streamStartTime = process.hrtime();
const idx = startStreamIdx;
tableData[idx][1] = 'running';

this.log.info(`Processing ${stream.tag}...[${1 + startStreamIdx}/${this._streams.length}]`);

stream.flow(files.values())
.then(
data => {
let streamDiff = process.hrtime(streamStartTime);
const streamMs = parseInt(streamDiff[0] * 1e3 + streamDiff[1] / 1e6, 10);

tableData[idx][1] = `complete`;
tableData[idx][2] = `${streamMs}ms`;
tableData[idx][1] = `${streamMs}ms`;

ret.push(data);
_walkStream();
Expand Down
3 changes: 3 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ describe('panto', () => {
isTorrential() {
return false;
}
isCacheable() {
return true;
}
}

panto.pick('**/*.css').tag('css');
Expand Down

0 comments on commit 262efc6

Please sign in to comment.