just-task 1.4.0 → 1.5.0
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 +46 -1
- package/CHANGELOG.md +26 -2
- package/README.md +2 -5
- package/lib/cache.js +5 -15
- package/lib/cli.js +3 -1
- package/lib/resolve.js +3 -14
- 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 +3 -4
- package/src/__tests__/watch.spec.ts +2 -0
- package/src/cache.ts +6 -7
- package/src/cli.ts +3 -1
- package/src/watch.ts +18 -10
- package/src/wrapTask.ts +3 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,52 @@
|
|
|
2
2
|
"name": "just-task",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 31 Mar 2022 17:04:25 GMT",
|
|
6
|
+
"tag": "just-task_v1.5.0",
|
|
7
|
+
"version": "1.5.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "dzearing@microsoft.com",
|
|
12
|
+
"package": "just-task",
|
|
13
|
+
"comment": "Upgrading package-deps-hash to latest major to remove transitive security vulnerability in validator package.",
|
|
14
|
+
"commit": "0c2e911432d9c09a7b3396d40c811260d84749ac"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 10 Sep 2021 23:58:46 GMT",
|
|
21
|
+
"tag": "just-task_v1.4.2",
|
|
22
|
+
"version": "1.4.2",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "kchau@microsoft.com",
|
|
27
|
+
"package": "just-task",
|
|
28
|
+
"comment": "changes the dep from glob-parent which is old with chokidar directly",
|
|
29
|
+
"commit": "c08ccdcce333d655504263efd18f7fc5e82da534"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Thu, 15 Apr 2021 19:00:12 GMT",
|
|
36
|
+
"tag": "just-task_v1.4.1",
|
|
37
|
+
"version": "1.4.1",
|
|
38
|
+
"comments": {
|
|
39
|
+
"patch": [
|
|
40
|
+
{
|
|
41
|
+
"comment": "adding a check to make sure the tasks are registered only for task functions",
|
|
42
|
+
"author": "kchau@microsoft.com",
|
|
43
|
+
"commit": "52359d26690342474ce9e224f6bc2dfb94766089",
|
|
44
|
+
"package": "just-task"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Fri, 02 Apr 2021 23:21:50 GMT",
|
|
6
51
|
"tag": "just-task_v1.4.0",
|
|
7
52
|
"version": "1.4.0",
|
|
8
53
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# Change Log - just-task
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 31 Mar 2022 17:04:25 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.5.0
|
|
8
|
+
|
|
9
|
+
Thu, 31 Mar 2022 17:04:25 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Upgrading package-deps-hash to latest major to remove transitive security vulnerability in validator package. (dzearing@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 1.4.2
|
|
16
|
+
|
|
17
|
+
Fri, 10 Sep 2021 23:58:46 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- changes the dep from glob-parent which is old with chokidar directly (kchau@microsoft.com)
|
|
22
|
+
|
|
23
|
+
## 1.4.1
|
|
24
|
+
|
|
25
|
+
Thu, 15 Apr 2021 19:00:12 GMT
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- adding a check to make sure the tasks are registered only for task functions (kchau@microsoft.com)
|
|
30
|
+
|
|
7
31
|
## 1.4.0
|
|
8
32
|
|
|
9
|
-
Fri, 02 Apr 2021 23:21:
|
|
33
|
+
Fri, 02 Apr 2021 23:21:50 GMT
|
|
10
34
|
|
|
11
35
|
### Minor changes
|
|
12
36
|
|
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/cli.js
CHANGED
|
@@ -38,7 +38,9 @@ const configModule = config_1.readConfig();
|
|
|
38
38
|
// Support named task function as exports of a config module
|
|
39
39
|
if (configModule && typeof configModule === 'object') {
|
|
40
40
|
for (const taskName of Object.keys(configModule)) {
|
|
41
|
-
|
|
41
|
+
if (typeof configModule[taskName] == 'function') {
|
|
42
|
+
task_1.task(taskName, configModule[taskName]);
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
const command = option_1.parseCommand();
|
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/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.0",
|
|
4
4
|
"description": "Build task definition library",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test": "jest"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@rushstack/package-deps-hash": "^2.
|
|
23
|
+
"@rushstack/package-deps-hash": "^3.2.5",
|
|
24
24
|
"bach": "^1.2.0",
|
|
25
25
|
"chalk": "^4.0.0",
|
|
26
26
|
"fs-extra": "^8.0.0",
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
"undertaker": "^1.3.0",
|
|
30
30
|
"undertaker-registry": "^1.0.1",
|
|
31
31
|
"yargs-parser": "^20.2.3",
|
|
32
|
-
"
|
|
32
|
+
"chokidar": "^3.5.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/chokidar": "^2.1.3",
|
|
36
36
|
"@types/fs-extra": "^8.0.0",
|
|
37
|
-
"@types/glob-watcher": "^5.0.0",
|
|
38
37
|
"@types/jest": "^26.0.20",
|
|
39
38
|
"@types/mock-fs": "^4.13.0",
|
|
40
39
|
"@types/node": "^10.12.18",
|
|
@@ -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/cli.ts
CHANGED
|
@@ -47,7 +47,9 @@ const configModule = readConfig();
|
|
|
47
47
|
// Support named task function as exports of a config module
|
|
48
48
|
if (configModule && typeof configModule === 'object') {
|
|
49
49
|
for (const taskName of Object.keys(configModule)) {
|
|
50
|
-
|
|
50
|
+
if (typeof configModule[taskName] == 'function') {
|
|
51
|
+
task(taskName, configModule[taskName]);
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
|
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
|
}
|