just-task 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +136 -1
- package/CHANGELOG.md +27 -2
- package/README.md +2 -5
- package/lib/cache.js +5 -15
- package/lib/chain.d.ts.map +1 -1
- package/lib/chain.js +1 -0
- package/lib/cli.js +5 -2
- package/lib/resolve.js +3 -14
- package/lib/task.d.ts.map +1 -1
- package/lib/undertaker.d.ts.map +1 -1
- package/lib/watch.d.ts +5 -2
- package/lib/watch.d.ts.map +1 -1
- package/lib/watch.js +12 -8
- package/lib/wrapTask.d.ts.map +1 -1
- package/lib/wrapTask.js +3 -1
- package/package.json +20 -18
- package/src/__tests__/resolve.spec.ts +22 -6
- package/src/__tests__/task.spec.ts +3 -1
- package/src/__tests__/watch.spec.ts +2 -0
- package/src/cache.ts +6 -7
- package/src/chain.ts +6 -4
- package/src/cli.ts +11 -3
- package/src/task.ts +5 -1
- package/src/undertaker.ts +5 -1
- package/src/watch.ts +18 -10
- package/src/wrapTask.ts +3 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,142 @@
|
|
|
2
2
|
"name": "just-task",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 10 Sep 2022 00:18:54 GMT",
|
|
6
|
+
"tag": "just-task_v1.5.1",
|
|
7
|
+
"version": "1.5.1",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "elcraig@microsoft.com",
|
|
12
|
+
"package": "just-task",
|
|
13
|
+
"commit": "9fd466eb0c24ae5f5fed3381acfe229e74cc1bde",
|
|
14
|
+
"comment": "Specify Node 12+ engines requirement"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "just-task",
|
|
19
|
+
"comment": "Bump just-task-logger to v1.1.2",
|
|
20
|
+
"commit": "9fd466eb0c24ae5f5fed3381acfe229e74cc1bde"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 09 Sep 2022 08:02:06 GMT",
|
|
27
|
+
"tag": "just-task_v1.5.0",
|
|
28
|
+
"version": "1.5.0",
|
|
29
|
+
"comments": {
|
|
30
|
+
"none": [
|
|
31
|
+
{
|
|
32
|
+
"author": "email not defined",
|
|
33
|
+
"package": "just-task",
|
|
34
|
+
"commit": "c08c46745a95efabab5dbfc0f216d2e3b94ae03f",
|
|
35
|
+
"comment": "Update devDependency mock-fs to v4.14.0"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "renovate@whitesourcesoftware.com",
|
|
39
|
+
"package": "just-task",
|
|
40
|
+
"commit": "32b2d44a637fcfca27c0a2c1fbc80d25bb60d7ce",
|
|
41
|
+
"comment": "Update devDependency ts-jest to v26.5.6"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"author": "elcraig@microsoft.com",
|
|
45
|
+
"package": "just-task",
|
|
46
|
+
"commit": "9e1d1962e81b119d818514b3e8dd03be8d5e051e",
|
|
47
|
+
"comment": "Run prettier on all files"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"date": "Fri, 09 Sep 2022 01:49:38 GMT",
|
|
54
|
+
"tag": "just-task_v1.5.0",
|
|
55
|
+
"version": "1.5.0",
|
|
56
|
+
"comments": {
|
|
57
|
+
"none": [
|
|
58
|
+
{
|
|
59
|
+
"author": "email not defined",
|
|
60
|
+
"package": "just-task",
|
|
61
|
+
"commit": "a88704b4f1f046e1440c0944145a8045273904c3",
|
|
62
|
+
"comment": "Update devDependency @types/node to v12"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"author": "email not defined",
|
|
66
|
+
"package": "just-task",
|
|
67
|
+
"commit": "f080946c01915c3cff7445928b2697729fc2e93d",
|
|
68
|
+
"comment": "Update @types packages"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"date": "Fri, 09 Sep 2022 00:10:23 GMT",
|
|
75
|
+
"tag": "just-task_v1.5.0",
|
|
76
|
+
"version": "1.5.0",
|
|
77
|
+
"comments": {
|
|
78
|
+
"none": [
|
|
79
|
+
{
|
|
80
|
+
"author": "email not defined",
|
|
81
|
+
"package": "just-task",
|
|
82
|
+
"comment": "Update devDependency @types/fs-extra to v8.1.2",
|
|
83
|
+
"commit": "ac702fe1b1b115a243f418fea2821729e38eb3ec"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"date": "Fri, 09 Sep 2022 00:04:18 GMT",
|
|
90
|
+
"tag": "just-task_v1.5.0",
|
|
91
|
+
"version": "1.5.0",
|
|
92
|
+
"comments": {
|
|
93
|
+
"none": [
|
|
94
|
+
{
|
|
95
|
+
"author": "email not defined",
|
|
96
|
+
"package": "just-task",
|
|
97
|
+
"comment": "Pin devDependencies",
|
|
98
|
+
"commit": "0dca4fef66c833623c3b923f426ee44d6887c5fe"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"author": "email not defined",
|
|
102
|
+
"package": "just-task",
|
|
103
|
+
"commit": "0dca4fef66c833623c3b923f426ee44d6887c5fe",
|
|
104
|
+
"comment": "Bump just-task to v1.5.0"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"date": "Thu, 31 Mar 2022 17:04:30 GMT",
|
|
111
|
+
"tag": "just-task_v1.5.0",
|
|
112
|
+
"version": "1.5.0",
|
|
113
|
+
"comments": {
|
|
114
|
+
"minor": [
|
|
115
|
+
{
|
|
116
|
+
"author": "dzearing@microsoft.com",
|
|
117
|
+
"package": "just-task",
|
|
118
|
+
"comment": "Upgrading package-deps-hash to latest major to remove transitive security vulnerability in validator package.",
|
|
119
|
+
"commit": "0c2e911432d9c09a7b3396d40c811260d84749ac"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"date": "Fri, 10 Sep 2021 23:58:46 GMT",
|
|
126
|
+
"tag": "just-task_v1.4.2",
|
|
127
|
+
"version": "1.4.2",
|
|
128
|
+
"comments": {
|
|
129
|
+
"patch": [
|
|
130
|
+
{
|
|
131
|
+
"author": "kchau@microsoft.com",
|
|
132
|
+
"package": "just-task",
|
|
133
|
+
"comment": "changes the dep from glob-parent which is old with chokidar directly",
|
|
134
|
+
"commit": "c08ccdcce333d655504263efd18f7fc5e82da534"
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"date": "Thu, 15 Apr 2021 19:00:12 GMT",
|
|
6
141
|
"tag": "just-task_v1.4.1",
|
|
7
142
|
"version": "1.4.1",
|
|
8
143
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - just-task
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 10 Sep 2022 00:18:54 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.5.1
|
|
8
|
+
|
|
9
|
+
Sat, 10 Sep 2022 00:18:54 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Specify Node 12+ engines requirement (elcraig@microsoft.com)
|
|
14
|
+
- Bump just-task-logger to v1.1.2
|
|
15
|
+
|
|
16
|
+
## 1.5.0
|
|
17
|
+
|
|
18
|
+
Thu, 31 Mar 2022 17:04:30 GMT
|
|
19
|
+
|
|
20
|
+
### Minor changes
|
|
21
|
+
|
|
22
|
+
- Upgrading package-deps-hash to latest major to remove transitive security vulnerability in validator package. (dzearing@microsoft.com)
|
|
23
|
+
|
|
24
|
+
## 1.4.2
|
|
25
|
+
|
|
26
|
+
Fri, 10 Sep 2021 23:58:46 GMT
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- changes the dep from glob-parent which is old with chokidar directly (kchau@microsoft.com)
|
|
31
|
+
|
|
7
32
|
## 1.4.1
|
|
8
33
|
|
|
9
|
-
Thu, 15 Apr 2021 19:00:
|
|
34
|
+
Thu, 15 Apr 2021 19:00:12 GMT
|
|
10
35
|
|
|
11
36
|
### Patches
|
|
12
37
|
|
package/README.md
CHANGED
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
`Just` is a library that organizes build tasks for your JS projects. It consists of
|
|
7
7
|
|
|
8
|
-
- a build task
|
|
8
|
+
- a build task definition library
|
|
9
9
|
- sane preset build flows for node and browser projects featuring TypeScript, Webpack and jest
|
|
10
|
-
- project scaffold tool that generates no-ejection needed repos that tracks template changes
|
|
11
10
|
|
|
12
11
|
# Documentation
|
|
13
12
|
|
|
@@ -41,11 +40,9 @@ yarn test
|
|
|
41
40
|
|
|
42
41
|
| Package | Description |
|
|
43
42
|
| ------------------ | --------------------------------------------------------------------------------------- |
|
|
44
|
-
| create-just | Invoked by `npm init just`, a tool that scaffolds project repos |
|
|
45
43
|
| just-task | The task definition library that wraps `undertaker` and `yargs` libraries |
|
|
46
44
|
| just-scripts | A reusable preset of frequently used tasks in node and browser projects |
|
|
47
|
-
| just-
|
|
48
|
-
| just-scripts-utils | A set of utilities that are shared between `just-scripts` and `create-just` |
|
|
45
|
+
| just-scripts-utils | A set of utilities for `just-scripts` |
|
|
49
46
|
| just-task-logger | A shared pretty logger used to display timestamps along with a message |
|
|
50
47
|
| documentation | The Docusaurus site content and styles which generates the Github page for this library |
|
|
51
48
|
|
package/lib/cache.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.saveCache = exports.isCached = exports.clearCache = exports.registerCachedTask = void 0;
|
|
15
4
|
const package_deps_hash_1 = require("@rushstack/package-deps-hash");
|
|
@@ -107,11 +96,12 @@ function getLockFileHashes() {
|
|
|
107
96
|
}
|
|
108
97
|
function getHash(taskName) {
|
|
109
98
|
just_task_logger_1.mark('cache:getHash');
|
|
110
|
-
const args =
|
|
99
|
+
const { ...args } = option_1.argv();
|
|
111
100
|
const packageRootPath = getPackageRootPath();
|
|
112
|
-
const packageDeps =
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
const packageDeps = {
|
|
102
|
+
...Object.fromEntries(package_deps_hash_1.getPackageDeps(packageRootPath)),
|
|
103
|
+
...getLockFileHashes(),
|
|
104
|
+
};
|
|
115
105
|
const hash = {
|
|
116
106
|
args,
|
|
117
107
|
taskName,
|
package/lib/chain.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../src/chain.ts"],"names":[],"mappings":"AAOA,wBAAgB,KAAK,CAAC,eAAe,EAAE,MAAM;uBAEJ,MAAM;sBAQR,MAAM;EAQ5C"}
|
package/lib/chain.js
CHANGED
package/lib/cli.js
CHANGED
|
@@ -6,8 +6,9 @@ const just_task_logger_1 = require("just-task-logger");
|
|
|
6
6
|
const config_1 = require("./config");
|
|
7
7
|
const task_1 = require("./task");
|
|
8
8
|
const originalEmitWarning = process.emitWarning;
|
|
9
|
+
process.emitWarning = function emitWarning(_warning, _type, code,
|
|
9
10
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
10
|
-
|
|
11
|
+
_ctor) {
|
|
11
12
|
if (code === 'DEP0097') {
|
|
12
13
|
// Undertaker uses a deprecated approach that causes NodeJS 10 to print
|
|
13
14
|
// this warning to stderr:
|
|
@@ -29,7 +30,9 @@ function showHelp() {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
// Define a built-in option of "config" so users can specify which path to choose for configurations
|
|
32
|
-
option_1.option('config', {
|
|
33
|
+
option_1.option('config', {
|
|
34
|
+
describe: 'path to a just configuration file (includes the file name, e.g. /path/to/just.config.ts)',
|
|
35
|
+
});
|
|
33
36
|
option_1.option('defaultConfig', {
|
|
34
37
|
describe: 'path to a default just configuration file that will be used when the current project does not have a just configuration file. (includes the file name, e.g. /path/to/just.config.ts)',
|
|
35
38
|
});
|
package/lib/resolve.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.resolveCwd = exports.resolve = exports._getResolvePaths = exports._tryResolve = exports._isFileNameLike = exports.resetResolvePaths = exports.addResolvePath = void 0;
|
|
15
4
|
const resolve_1 = require("resolve");
|
|
@@ -45,9 +34,9 @@ exports._isFileNameLike = _isFileNameLike;
|
|
|
45
34
|
*/
|
|
46
35
|
function _tryResolve(moduleName, options) {
|
|
47
36
|
try {
|
|
48
|
-
const { cwd
|
|
37
|
+
const { cwd, ...rest } = options;
|
|
49
38
|
const nameToResolve = _isFileNameLike(moduleName) ? `./${moduleName}` : moduleName;
|
|
50
|
-
return resolve_1.sync(nameToResolve,
|
|
39
|
+
return resolve_1.sync(nameToResolve, { basedir: cwd, ...rest, preserveSymlinks: true });
|
|
51
40
|
}
|
|
52
41
|
catch (e) {
|
|
53
42
|
return null;
|
|
@@ -78,7 +67,7 @@ function resolve(moduleName, cwdOrOptions) {
|
|
|
78
67
|
const allResolvePaths = _getResolvePaths(options.cwd);
|
|
79
68
|
let resolved = null;
|
|
80
69
|
for (const tryPath of allResolvePaths) {
|
|
81
|
-
resolved = _tryResolve(moduleName,
|
|
70
|
+
resolved = _tryResolve(moduleName, { ...options, cwd: tryPath });
|
|
82
71
|
if (resolved) {
|
|
83
72
|
return resolved;
|
|
84
73
|
}
|
package/lib/task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,IAAI,
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../src/task.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,IAAI,CAClB,UAAU,EAAE,MAAM,GAAG,YAAY,EACjC,WAAW,CAAC,EAAE,MAAM,GAAG,YAAY,EACnC,UAAU,CAAC,EAAE,YAAY,GACxB,YAAY,CA0Cd"}
|
package/lib/undertaker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"undertaker.d.ts","sourceRoot":"","sources":["../src/undertaker.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,UAAU,GAAG,QAAQ,YAAY,CAAC,CAAC;AAE1C,QAAA,MAAM,UAAU,YAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"undertaker.d.ts","sourceRoot":"","sources":["../src/undertaker.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,UAAU,GAAG,QAAQ,YAAY,CAAC,CAAC;AAE1C,QAAA,MAAM,UAAU,YAAmB,CAAC;AAgHpC,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,YAAY,CAUlE;AAED,wBAAgB,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,YAAY,CAUhE;AAID,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/watch.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
2
|
import type { WatchOptions, FSWatcher } from 'chokidar';
|
|
3
|
-
|
|
3
|
+
import type { Stats } from 'fs';
|
|
4
|
+
declare type WatchListener = (path: string, stats?: Stats) => void;
|
|
5
|
+
export declare function watch(globs: string | string[], optionsOrListener?: WatchListener | WatchOptions | undefined, listener?: WatchListener | undefined): FSWatcher;
|
|
6
|
+
export {};
|
|
4
7
|
//# sourceMappingURL=watch.d.ts.map
|
package/lib/watch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAEhC,aAAK,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAE3D,wBAAgB,KAAK,CACnB,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,iBAAiB,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,EAC5D,QAAQ,CAAC,EAAE,aAAa,GAAG,SAAS,GACnC,SAAS,CAoBX"}
|
package/lib/watch.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.watch = void 0;
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
function watch(globs, optionsOrTaskFunction, taskFunction) {
|
|
4
|
+
function watch(globs, optionsOrListener, listener) {
|
|
5
|
+
const chokidar = require('chokidar');
|
|
7
6
|
let options = {};
|
|
8
|
-
if (typeof
|
|
9
|
-
|
|
7
|
+
if (typeof optionsOrListener === 'function') {
|
|
8
|
+
listener = optionsOrListener;
|
|
10
9
|
options = {};
|
|
11
10
|
}
|
|
12
11
|
else {
|
|
13
|
-
options =
|
|
12
|
+
options = optionsOrListener;
|
|
14
13
|
}
|
|
14
|
+
options = { ...options, ignoreInitial: true };
|
|
15
15
|
// Wrapping this function teaches the glob-watcher about how to deal with sync taskFunction
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const innerListener = listener; // eslint-disable-line
|
|
17
|
+
const watcher = chokidar.watch(globs, options);
|
|
18
|
+
for (const evt of ['add', 'change', 'unlink']) {
|
|
19
|
+
watcher.on(evt, innerListener);
|
|
20
|
+
}
|
|
21
|
+
return watcher;
|
|
18
22
|
}
|
|
19
23
|
exports.watch = watch;
|
package/lib/wrapTask.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrapTask.d.ts","sourceRoot":"","sources":["../src/wrapTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"wrapTask.d.ts","sourceRoot":"","sources":["../src/wrapTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,YAAY,CAwB9C"}
|
package/lib/wrapTask.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-task",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Build task definition library",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -19,33 +19,35 @@
|
|
|
19
19
|
"start-test": "jest --watch",
|
|
20
20
|
"test": "jest"
|
|
21
21
|
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=12"
|
|
24
|
+
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@rushstack/package-deps-hash": "^2.
|
|
26
|
+
"@rushstack/package-deps-hash": "^3.2.5",
|
|
24
27
|
"bach": "^1.2.0",
|
|
25
28
|
"chalk": "^4.0.0",
|
|
26
29
|
"fs-extra": "^8.0.0",
|
|
27
|
-
"just-task-logger": ">=1.1.
|
|
30
|
+
"just-task-logger": ">=1.1.2 <2.0.0",
|
|
28
31
|
"resolve": "^1.19.0",
|
|
29
32
|
"undertaker": "^1.3.0",
|
|
30
33
|
"undertaker-registry": "^1.0.1",
|
|
31
34
|
"yargs-parser": "^20.2.3",
|
|
32
|
-
"
|
|
35
|
+
"chokidar": "^3.5.2"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
|
-
"@types/chokidar": "
|
|
36
|
-
"@types/fs-extra": "
|
|
37
|
-
"@types/
|
|
38
|
-
"@types/
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/undertaker": "
|
|
43
|
-
"@types/
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"typescript": "~4.1.3"
|
|
38
|
+
"@types/chokidar": "2.1.3",
|
|
39
|
+
"@types/fs-extra": "8.1.2",
|
|
40
|
+
"@types/jest": "26.0.24",
|
|
41
|
+
"@types/mock-fs": "4.13.1",
|
|
42
|
+
"@types/node": "12.20.55",
|
|
43
|
+
"@types/resolve": "1.20.2",
|
|
44
|
+
"@types/undertaker": "1.2.8",
|
|
45
|
+
"@types/undertaker-registry": "1.0.1",
|
|
46
|
+
"@types/yargs-parser": "20.2.2",
|
|
47
|
+
"jest": "26.6.3",
|
|
48
|
+
"mock-fs": "4.14.0",
|
|
49
|
+
"ts-jest": "26.5.6",
|
|
50
|
+
"typescript": "4.1.3"
|
|
49
51
|
},
|
|
50
52
|
"typing": "lib/index.d.ts"
|
|
51
53
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
_isFileNameLike,
|
|
4
|
+
_tryResolve,
|
|
5
|
+
resetResolvePaths,
|
|
6
|
+
resolveCwd,
|
|
7
|
+
addResolvePath,
|
|
8
|
+
resolve,
|
|
9
|
+
_getResolvePaths,
|
|
10
|
+
} from '../resolve';
|
|
3
11
|
import * as option from '../option';
|
|
4
12
|
import * as config from '../config';
|
|
5
13
|
import mockfs = require('mock-fs');
|
|
@@ -202,7 +210,7 @@ describe('resolveConfigFile', () => {
|
|
|
202
210
|
},
|
|
203
211
|
'just.config.ts': 'localConfig',
|
|
204
212
|
});
|
|
205
|
-
const resolvedConfig = config.resolveConfigFile({ config: undefined, defaultConfig: undefined } as any)
|
|
213
|
+
const resolvedConfig = config.resolveConfigFile({ config: undefined, defaultConfig: undefined } as any);
|
|
206
214
|
expect(resolvedConfig).toContain('just.config.ts');
|
|
207
215
|
});
|
|
208
216
|
|
|
@@ -214,7 +222,10 @@ describe('resolveConfigFile', () => {
|
|
|
214
222
|
},
|
|
215
223
|
'just.config.ts': 'localConfig',
|
|
216
224
|
});
|
|
217
|
-
const resolvedConfig = config.resolveConfigFile({
|
|
225
|
+
const resolvedConfig = config.resolveConfigFile({
|
|
226
|
+
config: './config/configArgument.ts',
|
|
227
|
+
defaultConfig: './config/defaultConfigArgument.ts',
|
|
228
|
+
} as any);
|
|
218
229
|
expect(resolvedConfig).toContain('configArgument.ts');
|
|
219
230
|
});
|
|
220
231
|
|
|
@@ -226,7 +237,10 @@ describe('resolveConfigFile', () => {
|
|
|
226
237
|
},
|
|
227
238
|
'just.config.ts': 'localConfig',
|
|
228
239
|
});
|
|
229
|
-
const resolvedConfig = config.resolveConfigFile({
|
|
240
|
+
const resolvedConfig = config.resolveConfigFile({
|
|
241
|
+
config: undefined,
|
|
242
|
+
defaultConfig: './config/defaultConfigArgument.ts',
|
|
243
|
+
} as any);
|
|
230
244
|
expect(resolvedConfig).toContain('just.config.ts');
|
|
231
245
|
});
|
|
232
246
|
|
|
@@ -237,8 +251,10 @@ describe('resolveConfigFile', () => {
|
|
|
237
251
|
'defaultConfigArgument.ts': 'formDefaultConfig',
|
|
238
252
|
},
|
|
239
253
|
});
|
|
240
|
-
const resolvedConfig = config.resolveConfigFile({
|
|
254
|
+
const resolvedConfig = config.resolveConfigFile({
|
|
255
|
+
config: undefined,
|
|
256
|
+
defaultConfig: './config/defaultConfigArgument.ts',
|
|
257
|
+
} as any);
|
|
241
258
|
expect(resolvedConfig).toContain('defaultConfigArgument.ts');
|
|
242
259
|
});
|
|
243
|
-
|
|
244
260
|
});
|
|
@@ -7,7 +7,9 @@ import UndertakerRegistry = require('undertaker-registry');
|
|
|
7
7
|
|
|
8
8
|
describe('task', () => {
|
|
9
9
|
beforeAll(() => {
|
|
10
|
-
jest
|
|
10
|
+
jest
|
|
11
|
+
.spyOn(option, 'argv')
|
|
12
|
+
.mockImplementation(() => ({ config: path.resolve(__dirname, '__mocks__/just-task.js') } as any));
|
|
11
13
|
jest.spyOn(logger, 'info').mockImplementation(() => undefined);
|
|
12
14
|
});
|
|
13
15
|
|
|
@@ -13,6 +13,7 @@ describe('watch', () => {
|
|
|
13
13
|
|
|
14
14
|
const cleanup = () => {
|
|
15
15
|
watcher.close();
|
|
16
|
+
|
|
16
17
|
fs.unlinkSync(changeFile);
|
|
17
18
|
fs.rmdirSync(tmpDir);
|
|
18
19
|
};
|
|
@@ -27,6 +28,7 @@ describe('watch', () => {
|
|
|
27
28
|
done(error);
|
|
28
29
|
}
|
|
29
30
|
};
|
|
31
|
+
|
|
30
32
|
const watcher = watch([path.join(changeFile)], callback);
|
|
31
33
|
|
|
32
34
|
watcher.on('ready', () => {
|
package/src/cache.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPackageDeps
|
|
1
|
+
import { getPackageDeps } from '@rushstack/package-deps-hash';
|
|
2
2
|
import { argv } from './option';
|
|
3
3
|
import { resolveCwd } from './resolve';
|
|
4
4
|
import * as fs from 'fs-extra';
|
|
@@ -83,7 +83,7 @@ function getCachePath() {
|
|
|
83
83
|
interface CacheHash {
|
|
84
84
|
args: { [arg: string]: string };
|
|
85
85
|
taskName: string;
|
|
86
|
-
hash:
|
|
86
|
+
hash: Record<string, string>;
|
|
87
87
|
dependentHashTimestamps: { [pkgName: string]: number };
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -127,11 +127,10 @@ function getHash(taskName: string): CacheHash | null {
|
|
|
127
127
|
|
|
128
128
|
const packageRootPath = getPackageRootPath();
|
|
129
129
|
|
|
130
|
-
const packageDeps =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
packageDeps.files = { ...packageDeps.files, ...lockFileHashes };
|
|
130
|
+
const packageDeps = {
|
|
131
|
+
...Object.fromEntries(getPackageDeps(packageRootPath)),
|
|
132
|
+
...getLockFileHashes(),
|
|
133
|
+
};
|
|
135
134
|
|
|
136
135
|
const hash = {
|
|
137
136
|
args,
|
package/src/chain.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
+
|
|
1
3
|
import { undertaker, series } from './undertaker';
|
|
2
4
|
|
|
3
5
|
let counter = 0;
|
|
@@ -9,16 +11,16 @@ export function chain(subjectTaskName: string) {
|
|
|
9
11
|
const id = `${taskName}_before_${counter++}?`;
|
|
10
12
|
const subject = undertaker.task(subjectTaskName);
|
|
11
13
|
|
|
12
|
-
undertaker.task(id, undertaker.task(taskName));
|
|
13
|
-
undertaker.task(taskName, series(subject
|
|
14
|
+
undertaker.task(id, undertaker.task(taskName)!);
|
|
15
|
+
undertaker.task(taskName, series(subject!, id));
|
|
14
16
|
},
|
|
15
17
|
|
|
16
18
|
after: function runAfter(taskName: string) {
|
|
17
19
|
const id = `${taskName}_after_${counter++}?`;
|
|
18
20
|
const subject = undertaker.task(subjectTaskName);
|
|
19
21
|
|
|
20
|
-
undertaker.task(id, undertaker.task(taskName));
|
|
21
|
-
undertaker.task(taskName, series(id, subject));
|
|
22
|
+
undertaker.task(id, undertaker.task(taskName)!);
|
|
23
|
+
undertaker.task(taskName, series(id, subject!));
|
|
22
24
|
},
|
|
23
25
|
};
|
|
24
26
|
}
|
package/src/cli.ts
CHANGED
|
@@ -7,8 +7,14 @@ import { task } from './task';
|
|
|
7
7
|
|
|
8
8
|
const originalEmitWarning = process.emitWarning;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
(process.emitWarning as any) = function emitWarning(
|
|
11
|
+
this: any,
|
|
12
|
+
_warning: string,
|
|
13
|
+
_type: string,
|
|
14
|
+
code: string,
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
16
|
+
_ctor?: Function,
|
|
17
|
+
) {
|
|
12
18
|
if (code === 'DEP0097') {
|
|
13
19
|
// Undertaker uses a deprecated approach that causes NodeJS 10 to print
|
|
14
20
|
// this warning to stderr:
|
|
@@ -34,7 +40,9 @@ function showHelp() {
|
|
|
34
40
|
}
|
|
35
41
|
|
|
36
42
|
// Define a built-in option of "config" so users can specify which path to choose for configurations
|
|
37
|
-
option('config', {
|
|
43
|
+
option('config', {
|
|
44
|
+
describe: 'path to a just configuration file (includes the file name, e.g. /path/to/just.config.ts)',
|
|
45
|
+
});
|
|
38
46
|
option('defaultConfig', {
|
|
39
47
|
describe:
|
|
40
48
|
'path to a default just configuration file that will be used when the current project does not have a just configuration file. (includes the file name, e.g. /path/to/just.config.ts)',
|
package/src/task.ts
CHANGED
|
@@ -3,7 +3,11 @@ import { wrapTask } from './wrapTask';
|
|
|
3
3
|
import { TaskFunction } from './interfaces';
|
|
4
4
|
import { registerCachedTask } from './cache';
|
|
5
5
|
|
|
6
|
-
export function task(
|
|
6
|
+
export function task(
|
|
7
|
+
firstParam: string | TaskFunction,
|
|
8
|
+
secondParam?: string | TaskFunction,
|
|
9
|
+
thirdParam?: TaskFunction,
|
|
10
|
+
): TaskFunction {
|
|
7
11
|
const argCount = arguments.length;
|
|
8
12
|
|
|
9
13
|
if (argCount === 1 && typeof firstParam === 'string') {
|
package/src/undertaker.ts
CHANGED
|
@@ -90,7 +90,11 @@ undertaker.on('error', function (args: any) {
|
|
|
90
90
|
} else if (shouldLog(args)) {
|
|
91
91
|
const duration = args.duration;
|
|
92
92
|
const durationInSecs = Math.round(((duration[0] * NS_PER_SEC + duration[1]) / NS_PER_SEC) * 100) / 100;
|
|
93
|
-
logger.error(
|
|
93
|
+
logger.error(
|
|
94
|
+
`finished '${colorizeTaskName(args.name)}' in ${chalk.yellow(String(durationInSecs) + 's')} with ${chalk.red(
|
|
95
|
+
'errors',
|
|
96
|
+
)}`,
|
|
97
|
+
);
|
|
94
98
|
process.exitCode = 1;
|
|
95
99
|
}
|
|
96
100
|
|
package/src/watch.ts
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
import * as globWatch from 'glob-watcher';
|
|
2
|
-
import { wrapTask } from './wrapTask';
|
|
3
|
-
import { TaskFunction } from './interfaces';
|
|
4
1
|
import type { WatchOptions, FSWatcher } from 'chokidar';
|
|
2
|
+
import type { Stats } from 'fs';
|
|
3
|
+
|
|
4
|
+
type WatchListener = (path: string, stats?: Stats) => void;
|
|
5
5
|
|
|
6
6
|
export function watch(
|
|
7
7
|
globs: string | string[],
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
optionsOrListener?: WatchListener | WatchOptions | undefined,
|
|
9
|
+
listener?: WatchListener | undefined,
|
|
10
10
|
): FSWatcher {
|
|
11
|
+
const chokidar = require('chokidar');
|
|
12
|
+
|
|
11
13
|
let options: WatchOptions = {};
|
|
12
|
-
if (typeof
|
|
13
|
-
|
|
14
|
+
if (typeof optionsOrListener === 'function') {
|
|
15
|
+
listener = optionsOrListener;
|
|
14
16
|
options = {};
|
|
15
17
|
} else {
|
|
16
|
-
options =
|
|
18
|
+
options = optionsOrListener as WatchOptions;
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
options = { ...options, ignoreInitial: true };
|
|
22
|
+
|
|
19
23
|
// Wrapping this function teaches the glob-watcher about how to deal with sync taskFunction
|
|
20
|
-
const
|
|
21
|
-
|
|
24
|
+
const innerListener = listener!; // eslint-disable-line
|
|
25
|
+
const watcher = chokidar.watch(globs, options) as FSWatcher;
|
|
26
|
+
for (const evt of ['add', 'change', 'unlink']) {
|
|
27
|
+
watcher.on(evt, innerListener);
|
|
28
|
+
}
|
|
29
|
+
return watcher;
|
|
22
30
|
}
|