Skip to content

Commit e12a3ae

Browse files
committed
exposed utility function to report file operations
this helps promote consistent reporting within plugins in the process, updated and fixed CHANGELOG ("significant changes" sounded too much like breaking changes)
1 parent d1f4be6 commit e12a3ae

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

CHANGELOG.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,35 @@ faucet-pipeline-core version history
22
====================================
33

44

5+
v1.2.0
6+
------
7+
8+
_2018-11-29_
9+
10+
improvements for end users:
11+
12+
* ensured parent paths (i.e. `../`) are permitted where configuration expects
13+
relative paths
14+
* ensured consistent manifest representation, avoiding changes due to arbitrary
15+
ordering
16+
17+
improvements for developers:
18+
19+
* added `loadExtension` utility function to prompt for installation of missing
20+
packages
21+
* added `reportFileStatus` utility function
22+
* fixed `Manifest#toJSON` return value
23+
24+
525
v1.1.0
626
------
727

828
_2018-10-23_
929

10-
significant changes for end users:
30+
improvements for end users:
1131

1232
* `manifest.target` is now optional, defaulting to an in-memory manifest
13-
* ensured parent paths (i.e. `../`) are considered relative as well
1433

15-
programmatic API:
34+
improvements for developers:
1635

1736
* added `resolvePath` utility function

lib/manager.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
let Manifest = require("./manifest");
44
let createFile = require("./util/files");
55
let resolvePath = require("./util/resolve");
6-
let { abort, generateFingerprint } = require("./util");
6+
let { reportFileStatus, abort, generateFingerprint } = require("./util");
77
let path = require("path");
88

99
module.exports = class AssetManager {
@@ -33,7 +33,7 @@ module.exports = class AssetManager {
3333
then(_ => this.manifest &&
3434
this._updateManifest(originalPath, filepath, targetDir)).
3535
then(_ => {
36-
this._report(originalPath, error);
36+
reportFileStatus(originalPath, this.referenceDir, error);
3737
if(error && this.exitOnError) {
3838
throw error;
3939
}
@@ -57,13 +57,4 @@ module.exports = class AssetManager {
5757
actualPath = path.relative(referenceDir, actualPath);
5858
return this.manifest.set(originalPath, actualPath, targetDir);
5959
}
60-
61-
_report(filepath, error) {
62-
let relPath = path.relative(this.referenceDir, filepath);
63-
if(error) {
64-
console.error(`✗ ${relPath}: ${error.message || error}`);
65-
} else {
66-
console.error(`✓ ${relPath}`);
67-
}
68-
}
6960
};

lib/util/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ let crypto = require("crypto");
66
exports.abort = abort;
77
exports.repr = repr;
88

9+
// reports success or failure for a given file path (typically regarding
10+
// compilation or write operations)
11+
exports.reportFileStatus = (filepath, referenceDir, error) => {
12+
let ref = path.relative(referenceDir, filepath);
13+
console.error(error ? `✗ ${ref}: ${error.message || error}` : `✓ ${ref}`);
14+
};
15+
916
// attempts to `require` a module, prompting the user to install the
1017
// corresponding package if it is unavailable
1118
exports.loadExtension = (pkg, errorMessage, supplier = pkg) => {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "faucet-pipeline-core",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "faucet-pipeline's core library",
55
"author": "FND",
66
"contributors": [
@@ -28,7 +28,7 @@
2828
"browserslist": "~4.3.4",
2929
"minimist": "~1.2.0",
3030
"mkdirp": "~0.5.1",
31-
"nite-owl": "~3.3.2"
31+
"nite-owl": "~5.0.0"
3232
},
3333
"devDependencies": {
3434
"eslint-config-fnd": "^1.6.0",

0 commit comments

Comments
 (0)