just-task 1.10.0 → 1.12.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 +37 -1
- package/CHANGELOG.md +19 -2
- package/lib/cache.js +9 -9
- package/lib/chain.js +2 -2
- package/lib/cli.js +6 -6
- package/lib/condition.js +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +14 -6
- package/lib/enableTypeScript.js +2 -2
- package/lib/package/findDependents.js +6 -6
- package/lib/package/findPackageRoot.js +1 -1
- package/lib/resolve.js +2 -2
- package/lib/task.js +6 -6
- package/lib/undertaker.js +3 -3
- package/package.json +2 -2
- package/src/config.ts +11 -3
- package/src/enableTypeScript.ts +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,43 @@
|
|
|
2
2
|
"name": "just-task",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 28 Mar 2025 08:01:39 GMT",
|
|
6
|
+
"version": "1.12.0",
|
|
7
|
+
"tag": "just-task_v1.12.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "elcraig@microsoft.com",
|
|
12
|
+
"package": "just-task",
|
|
13
|
+
"commit": "b08901cb0e1ca7833027ae1e6473ff8dff7b4529",
|
|
14
|
+
"comment": "Build with TypeScript 4.5"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "just-task",
|
|
19
|
+
"comment": "Bump just-task-logger to v1.3.0",
|
|
20
|
+
"commit": "not available"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Tue, 10 Dec 2024 22:22:46 GMT",
|
|
27
|
+
"version": "1.11.0",
|
|
28
|
+
"tag": "just-task_v1.11.0",
|
|
29
|
+
"comments": {
|
|
30
|
+
"minor": [
|
|
31
|
+
{
|
|
32
|
+
"author": "tigeroakes@microsoft.com",
|
|
33
|
+
"package": "just-task",
|
|
34
|
+
"commit": "55e52e9274b9e42d8b243a7a67ec73188dd222c3",
|
|
35
|
+
"comment": "Add .cjs config support"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Tue, 26 Mar 2024 00:12:38 GMT",
|
|
6
42
|
"version": "1.10.0",
|
|
7
43
|
"tag": "just-task_v1.10.0",
|
|
8
44
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# Change Log - just-task
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Fri, 28 Mar 2025 08:01:39 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.12.0
|
|
8
|
+
|
|
9
|
+
Fri, 28 Mar 2025 08:01:39 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Build with TypeScript 4.5 (elcraig@microsoft.com)
|
|
14
|
+
- Bump just-task-logger to v1.3.0
|
|
15
|
+
|
|
16
|
+
## 1.11.0
|
|
17
|
+
|
|
18
|
+
Tue, 10 Dec 2024 22:22:46 GMT
|
|
19
|
+
|
|
20
|
+
### Minor changes
|
|
21
|
+
|
|
22
|
+
- Add .cjs config support (tigeroakes@microsoft.com)
|
|
23
|
+
|
|
7
24
|
## 1.10.0
|
|
8
25
|
|
|
9
|
-
Tue, 26 Mar 2024 00:12:
|
|
26
|
+
Tue, 26 Mar 2024 00:12:38 GMT
|
|
10
27
|
|
|
11
28
|
### Minor changes
|
|
12
29
|
|
package/lib/cache.js
CHANGED
|
@@ -62,7 +62,7 @@ function saveCache(taskName) {
|
|
|
62
62
|
exports.saveCache = saveCache;
|
|
63
63
|
function getPackageRootPath() {
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
65
|
-
const packageJsonFilePath = resolve_1.resolveCwd('package.json');
|
|
65
|
+
const packageJsonFilePath = (0, resolve_1.resolveCwd)('package.json');
|
|
66
66
|
return path.dirname(packageJsonFilePath);
|
|
67
67
|
}
|
|
68
68
|
function getCachePath() {
|
|
@@ -72,8 +72,8 @@ function getCachePath() {
|
|
|
72
72
|
function getLockFileHashes() {
|
|
73
73
|
const results = {};
|
|
74
74
|
const lockFiles = ['shrinkwrap.yml', 'package-lock.json', 'yarn.lock', 'pnpmfile.js'];
|
|
75
|
-
const gitRoot = findGitRoot_1.findGitRoot();
|
|
76
|
-
const lsFileResults = child_process_1.spawnSync('git', ['ls-files', ...lockFiles], { cwd: gitRoot });
|
|
75
|
+
const gitRoot = (0, findGitRoot_1.findGitRoot)();
|
|
76
|
+
const lsFileResults = (0, child_process_1.spawnSync)('git', ['ls-files', ...lockFiles], { cwd: gitRoot });
|
|
77
77
|
if (lsFileResults.status !== 0) {
|
|
78
78
|
return {};
|
|
79
79
|
}
|
|
@@ -81,7 +81,7 @@ function getLockFileHashes() {
|
|
|
81
81
|
.toString()
|
|
82
82
|
.split(/\n/)
|
|
83
83
|
.map(l => l.trim());
|
|
84
|
-
const hashResults = child_process_1.spawnSync('git', ['hash-object', ...foundLockFiles], { cwd: gitRoot });
|
|
84
|
+
const hashResults = (0, child_process_1.spawnSync)('git', ['hash-object', ...foundLockFiles], { cwd: gitRoot });
|
|
85
85
|
if (hashResults.status !== 0) {
|
|
86
86
|
return {};
|
|
87
87
|
}
|
|
@@ -95,11 +95,11 @@ function getLockFileHashes() {
|
|
|
95
95
|
return results;
|
|
96
96
|
}
|
|
97
97
|
function getHash(taskName) {
|
|
98
|
-
just_task_logger_1.mark('cache:getHash');
|
|
99
|
-
const { ...args } = option_1.argv();
|
|
98
|
+
(0, just_task_logger_1.mark)('cache:getHash');
|
|
99
|
+
const { ...args } = (0, option_1.argv)();
|
|
100
100
|
const packageRootPath = getPackageRootPath();
|
|
101
101
|
const packageDeps = {
|
|
102
|
-
...Object.fromEntries(package_deps_hash_1.getPackageDeps(packageRootPath)),
|
|
102
|
+
...Object.fromEntries((0, package_deps_hash_1.getPackageDeps)(packageRootPath)),
|
|
103
103
|
...getLockFileHashes(),
|
|
104
104
|
};
|
|
105
105
|
const hash = {
|
|
@@ -112,8 +112,8 @@ function getHash(taskName) {
|
|
|
112
112
|
return hash;
|
|
113
113
|
}
|
|
114
114
|
function getDependentHashTimestamps() {
|
|
115
|
-
just_task_logger_1.mark('cache:getDependentHashTimestamps');
|
|
116
|
-
const dependentPkgPaths = findDependents_1.findDependents();
|
|
115
|
+
(0, just_task_logger_1.mark)('cache:getDependentHashTimestamps');
|
|
116
|
+
const dependentPkgPaths = (0, findDependents_1.findDependents)();
|
|
117
117
|
const timestampsByPackage = {};
|
|
118
118
|
for (const pkgDepInfo of dependentPkgPaths) {
|
|
119
119
|
const pkgPath = pkgDepInfo.path;
|
package/lib/chain.js
CHANGED
|
@@ -11,13 +11,13 @@ function chain(subjectTaskName) {
|
|
|
11
11
|
const id = `${taskName}_before_${counter++}?`;
|
|
12
12
|
const subject = undertaker_1.undertaker.task(subjectTaskName);
|
|
13
13
|
undertaker_1.undertaker.task(id, undertaker_1.undertaker.task(taskName));
|
|
14
|
-
undertaker_1.undertaker.task(taskName, undertaker_1.series(subject, id));
|
|
14
|
+
undertaker_1.undertaker.task(taskName, (0, undertaker_1.series)(subject, id));
|
|
15
15
|
},
|
|
16
16
|
after: function runAfter(taskName) {
|
|
17
17
|
const id = `${taskName}_after_${counter++}?`;
|
|
18
18
|
const subject = undertaker_1.undertaker.task(subjectTaskName);
|
|
19
19
|
undertaker_1.undertaker.task(id, undertaker_1.undertaker.task(taskName));
|
|
20
|
-
undertaker_1.undertaker.task(taskName, undertaker_1.series(id, subject));
|
|
20
|
+
undertaker_1.undertaker.task(taskName, (0, undertaker_1.series)(id, subject));
|
|
21
21
|
},
|
|
22
22
|
};
|
|
23
23
|
}
|
package/lib/cli.js
CHANGED
|
@@ -30,26 +30,26 @@ function showHelp() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
// Define a built-in option of "config" so users can specify which path to choose for configurations
|
|
33
|
-
option_1.option('config', {
|
|
33
|
+
(0, option_1.option)('config', {
|
|
34
34
|
describe: 'path to a just configuration file (includes the file name, e.g. /path/to/just.config.ts)',
|
|
35
35
|
});
|
|
36
|
-
option_1.option('defaultConfig', {
|
|
36
|
+
(0, option_1.option)('defaultConfig', {
|
|
37
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)',
|
|
38
38
|
});
|
|
39
|
-
option_1.option('esm', {
|
|
39
|
+
(0, option_1.option)('esm', {
|
|
40
40
|
describe: 'Configure ts-node to support imports of ESM package (changes TS module/moduleResolution settings to Node16)',
|
|
41
41
|
});
|
|
42
42
|
const registry = undertaker_1.undertaker.registry();
|
|
43
|
-
const configModule = config_1.readConfig();
|
|
43
|
+
const configModule = (0, config_1.readConfig)();
|
|
44
44
|
// Support named task function as exports of a config module
|
|
45
45
|
if (configModule && typeof configModule === 'object') {
|
|
46
46
|
for (const taskName of Object.keys(configModule)) {
|
|
47
47
|
if (typeof configModule[taskName] == 'function') {
|
|
48
|
-
task_1.task(taskName, configModule[taskName]);
|
|
48
|
+
(0, task_1.task)(taskName, configModule[taskName]);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
const command = option_1.parseCommand();
|
|
52
|
+
const command = (0, option_1.parseCommand)();
|
|
53
53
|
if (command) {
|
|
54
54
|
if (registry.get(command)) {
|
|
55
55
|
undertaker_1.undertaker.series(registry.get(command))(() => undefined);
|
package/lib/condition.js
CHANGED
|
@@ -5,7 +5,7 @@ const undertaker_1 = require("./undertaker");
|
|
|
5
5
|
function condition(taskName, conditional) {
|
|
6
6
|
return function (done) {
|
|
7
7
|
if (conditional && conditional()) {
|
|
8
|
-
undertaker_1.parallel(taskName)(done);
|
|
8
|
+
(0, undertaker_1.parallel)(taskName)(done);
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
11
|
done();
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,WAAW,GAAG,QAAQ,cAAc,CAAC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,WAAW,GAAG,QAAQ,cAAc,CAAC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,GAAG,MAAM,GAAG,IAAI,CAiB5E;AAED,wBAAgB,UAAU,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAE,GAAG,IAAI,CAmCnE"}
|
package/lib/config.js
CHANGED
|
@@ -8,8 +8,16 @@ const resolve_1 = require("./resolve");
|
|
|
8
8
|
const just_task_logger_1 = require("just-task-logger");
|
|
9
9
|
const enableTypeScript_1 = require("./enableTypeScript");
|
|
10
10
|
function resolveConfigFile(args) {
|
|
11
|
-
for (const entry of [
|
|
12
|
-
|
|
11
|
+
for (const entry of [
|
|
12
|
+
args.config,
|
|
13
|
+
'./just.config.js',
|
|
14
|
+
'./just.config.cjs',
|
|
15
|
+
'./just-task.js',
|
|
16
|
+
'./just.config.ts',
|
|
17
|
+
'./just.config.cts',
|
|
18
|
+
args.defaultConfig,
|
|
19
|
+
]) {
|
|
20
|
+
const configFile = (0, resolve_1.resolve)(entry);
|
|
13
21
|
if (configFile) {
|
|
14
22
|
return configFile;
|
|
15
23
|
}
|
|
@@ -19,17 +27,17 @@ function resolveConfigFile(args) {
|
|
|
19
27
|
exports.resolveConfigFile = resolveConfigFile;
|
|
20
28
|
function readConfig() {
|
|
21
29
|
// uses a separate instance of yargs to first parse the config (without the --help in the way) so we can parse the configFile first regardless
|
|
22
|
-
const args = option_1.argv();
|
|
30
|
+
const args = (0, option_1.argv)();
|
|
23
31
|
const configFile = resolveConfigFile(args);
|
|
24
32
|
if (configFile && fs.existsSync(configFile)) {
|
|
25
33
|
const ext = path.extname(configFile);
|
|
26
|
-
if (ext === '.ts' || ext === '.tsx') {
|
|
34
|
+
if (ext === '.cts' || ext === '.ts' || ext === '.tsx') {
|
|
27
35
|
// TODO: add option to do typechecking as well
|
|
28
|
-
enableTypeScript_1.enableTypeScript({ transpileOnly: true, esm: args.esm });
|
|
36
|
+
(0, enableTypeScript_1.enableTypeScript)({ transpileOnly: true, esm: args.esm });
|
|
29
37
|
}
|
|
30
38
|
try {
|
|
31
39
|
const configModule = require(configFile);
|
|
32
|
-
just_task_logger_1.mark('registry:configModule');
|
|
40
|
+
(0, just_task_logger_1.mark)('registry:configModule');
|
|
33
41
|
if (typeof configModule === 'function') {
|
|
34
42
|
configModule();
|
|
35
43
|
}
|
package/lib/enableTypeScript.js
CHANGED
|
@@ -5,7 +5,7 @@ const resolve_1 = require("./resolve");
|
|
|
5
5
|
const just_task_logger_1 = require("just-task-logger");
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
7
7
|
function enableTypeScript({ transpileOnly = true, esm = false }) {
|
|
8
|
-
const tsNodeModule = resolve_1.resolve('ts-node');
|
|
8
|
+
const tsNodeModule = (0, resolve_1.resolve)('ts-node');
|
|
9
9
|
if (tsNodeModule) {
|
|
10
10
|
const tsNode = require(tsNodeModule);
|
|
11
11
|
tsNode.register({
|
|
@@ -21,7 +21,7 @@ function enableTypeScript({ transpileOnly = true, esm = false }) {
|
|
|
21
21
|
allowJs: true,
|
|
22
22
|
esModuleInterop: true,
|
|
23
23
|
},
|
|
24
|
-
files: ['just.config.ts'],
|
|
24
|
+
files: ['just.config.ts', 'just.config.cts'],
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -9,14 +9,14 @@ const just_task_logger_1 = require("just-task-logger");
|
|
|
9
9
|
const findGitRoot_1 = require("./findGitRoot");
|
|
10
10
|
const paths_1 = require("../paths");
|
|
11
11
|
function findDependents() {
|
|
12
|
-
just_task_logger_1.mark('cache:findDependents');
|
|
13
|
-
const results = collectAllDependentPaths(findPackageRoot_1.findPackageRoot());
|
|
12
|
+
(0, just_task_logger_1.mark)('cache:findDependents');
|
|
13
|
+
const results = collectAllDependentPaths((0, findPackageRoot_1.findPackageRoot)());
|
|
14
14
|
just_task_logger_1.logger.perf('cache:findDependents');
|
|
15
15
|
return results;
|
|
16
16
|
}
|
|
17
17
|
exports.findDependents = findDependents;
|
|
18
18
|
function getDepsPaths(pkgPath) {
|
|
19
|
-
const gitRoot = findGitRoot_1.findGitRoot();
|
|
19
|
+
const gitRoot = (0, findGitRoot_1.findGitRoot)();
|
|
20
20
|
const packageJsonFile = path.join(pkgPath, 'package.json');
|
|
21
21
|
try {
|
|
22
22
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString());
|
|
@@ -29,13 +29,13 @@ function getDepsPaths(pkgPath) {
|
|
|
29
29
|
return deps
|
|
30
30
|
.map(dep => {
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
|
-
const depPackageJson = resolve_1.resolveCwd(path.join(dep, 'package.json'));
|
|
32
|
+
const depPackageJson = (0, resolve_1.resolveCwd)(path.join(dep, 'package.json'));
|
|
33
33
|
if (!depPackageJson) {
|
|
34
34
|
return null;
|
|
35
35
|
}
|
|
36
36
|
return { name: dep, path: path.dirname(fs.realpathSync(depPackageJson)) };
|
|
37
37
|
})
|
|
38
|
-
.filter(p => p && p.path.indexOf('node_modules') === -1 && paths_1.isChildOf(p.path, gitRoot));
|
|
38
|
+
.filter(p => p && p.path.indexOf('node_modules') === -1 && (0, paths_1.isChildOf)(p.path, gitRoot));
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
41
|
just_task_logger_1.logger.error(`Invalid package.json detected at ${packageJsonFile} `, e);
|
|
@@ -43,7 +43,7 @@ function getDepsPaths(pkgPath) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function collectAllDependentPaths(pkgPath, collected = new Set()) {
|
|
46
|
-
just_task_logger_1.mark(`collectAllDependentPaths:${pkgPath}`);
|
|
46
|
+
(0, just_task_logger_1.mark)(`collectAllDependentPaths:${pkgPath}`);
|
|
47
47
|
const depPaths = getDepsPaths(pkgPath);
|
|
48
48
|
depPaths.forEach(depPath => collected.add(depPath));
|
|
49
49
|
for (const depPath of depPaths) {
|
|
@@ -5,7 +5,7 @@ const path = require("path");
|
|
|
5
5
|
const resolve_1 = require("../resolve");
|
|
6
6
|
function findPackageRoot() {
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8
|
-
const packageJsonFilePath = resolve_1.resolveCwd('package.json');
|
|
8
|
+
const packageJsonFilePath = (0, resolve_1.resolveCwd)('package.json');
|
|
9
9
|
return path.dirname(packageJsonFilePath);
|
|
10
10
|
}
|
|
11
11
|
exports.findPackageRoot = findPackageRoot;
|
package/lib/resolve.js
CHANGED
|
@@ -36,7 +36,7 @@ function _tryResolve(moduleName, options) {
|
|
|
36
36
|
try {
|
|
37
37
|
const { cwd, ...rest } = options;
|
|
38
38
|
const nameToResolve = _isFileNameLike(moduleName) ? `./${moduleName}` : moduleName;
|
|
39
|
-
return resolve_1.sync(nameToResolve, { basedir: cwd, ...rest, preserveSymlinks: true });
|
|
39
|
+
return (0, resolve_1.sync)(nameToResolve, { basedir: cwd, ...rest, preserveSymlinks: true });
|
|
40
40
|
}
|
|
41
41
|
catch (e) {
|
|
42
42
|
return null;
|
|
@@ -51,7 +51,7 @@ function _getResolvePaths(cwd) {
|
|
|
51
51
|
if (!cwd) {
|
|
52
52
|
cwd = process.cwd();
|
|
53
53
|
}
|
|
54
|
-
const configArg = option_1.argv().config;
|
|
54
|
+
const configArg = (0, option_1.argv)().config;
|
|
55
55
|
const configFilePath = configArg ? path.resolve(path.dirname(configArg)) : undefined;
|
|
56
56
|
return [cwd, ...(configFilePath ? [configFilePath] : []), ...customResolvePaths, __dirname];
|
|
57
57
|
}
|
package/lib/task.js
CHANGED
|
@@ -11,9 +11,9 @@ function task(firstParam, secondParam, thirdParam) {
|
|
|
11
11
|
}
|
|
12
12
|
else if (argCount === 2 && isString(firstParam) && isString(secondParam)) {
|
|
13
13
|
// task('default', 'build');
|
|
14
|
-
const wrapped = wrapTask_1.wrapTask(undertaker_1.undertaker.series(secondParam));
|
|
14
|
+
const wrapped = (0, wrapTask_1.wrapTask)(undertaker_1.undertaker.series(secondParam));
|
|
15
15
|
wrapped.cached = () => {
|
|
16
|
-
cache_1.registerCachedTask(firstParam);
|
|
16
|
+
(0, cache_1.registerCachedTask)(firstParam);
|
|
17
17
|
};
|
|
18
18
|
undertaker_1.undertaker.task(firstParam, wrapped);
|
|
19
19
|
return wrapped;
|
|
@@ -21,18 +21,18 @@ function task(firstParam, secondParam, thirdParam) {
|
|
|
21
21
|
else if (argCount === 2 && isString(firstParam) && isTaskFunction(secondParam)) {
|
|
22
22
|
// task('pretter', prettierTask());
|
|
23
23
|
// task('custom', () => { ... });
|
|
24
|
-
const wrapped = wrapTask_1.wrapTask(secondParam);
|
|
24
|
+
const wrapped = (0, wrapTask_1.wrapTask)(secondParam);
|
|
25
25
|
wrapped.cached = () => {
|
|
26
|
-
cache_1.registerCachedTask(firstParam);
|
|
26
|
+
(0, cache_1.registerCachedTask)(firstParam);
|
|
27
27
|
};
|
|
28
28
|
undertaker_1.undertaker.task(firstParam, wrapped);
|
|
29
29
|
return wrapped;
|
|
30
30
|
}
|
|
31
31
|
else if (argCount === 3 && isString(firstParam) && isString(secondParam) && isTaskFunction(thirdParam)) {
|
|
32
32
|
// task('custom', 'describes this thing', () => { ... })
|
|
33
|
-
const wrapped = wrapTask_1.wrapTask(thirdParam);
|
|
33
|
+
const wrapped = (0, wrapTask_1.wrapTask)(thirdParam);
|
|
34
34
|
wrapped.cached = () => {
|
|
35
|
-
cache_1.registerCachedTask(firstParam);
|
|
35
|
+
(0, cache_1.registerCachedTask)(firstParam);
|
|
36
36
|
};
|
|
37
37
|
wrapped.description = secondParam;
|
|
38
38
|
undertaker_1.undertaker.task(firstParam, wrapped);
|
package/lib/undertaker.js
CHANGED
|
@@ -65,7 +65,7 @@ undertaker.on('error', function (args) {
|
|
|
65
65
|
logger_1.logger.error(args.error.stderr);
|
|
66
66
|
}
|
|
67
67
|
logger_1.logger.error(chalk.yellow('------------------------------------'));
|
|
68
|
-
cache_1.clearCache();
|
|
68
|
+
(0, cache_1.clearCache)();
|
|
69
69
|
process.exitCode = 1;
|
|
70
70
|
}
|
|
71
71
|
else if (shouldLog(args)) {
|
|
@@ -94,7 +94,7 @@ function parallel(...tasks) {
|
|
|
94
94
|
return task;
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
return wrapTask_1.wrapTask(task);
|
|
97
|
+
return (0, wrapTask_1.wrapTask)(task);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return undertaker.parallel(newTasks);
|
|
@@ -106,7 +106,7 @@ function series(...tasks) {
|
|
|
106
106
|
return task;
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
-
return wrapTask_1.wrapTask(task);
|
|
109
|
+
return (0, wrapTask_1.wrapTask)(task);
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
return undertaker.series(newTasks);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-task",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Build task definition library",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"chalk": "^4.0.0",
|
|
35
35
|
"chokidar": "^3.5.2",
|
|
36
36
|
"fs-extra": "^11.0.0",
|
|
37
|
-
"just-task-logger": ">=1.
|
|
37
|
+
"just-task-logger": ">=1.3.0 <2.0.0",
|
|
38
38
|
"resolve": "^1.19.0",
|
|
39
39
|
"undertaker": "^2.0.0",
|
|
40
40
|
"undertaker-registry": "^2.0.0",
|
package/src/config.ts
CHANGED
|
@@ -9,7 +9,15 @@ import yargsParser = require('yargs-parser');
|
|
|
9
9
|
import { TaskFunction } from './interfaces';
|
|
10
10
|
|
|
11
11
|
export function resolveConfigFile(args: yargsParser.Arguments): string | null {
|
|
12
|
-
for (const entry of [
|
|
12
|
+
for (const entry of [
|
|
13
|
+
args.config,
|
|
14
|
+
'./just.config.js',
|
|
15
|
+
'./just.config.cjs',
|
|
16
|
+
'./just-task.js',
|
|
17
|
+
'./just.config.ts',
|
|
18
|
+
'./just.config.cts',
|
|
19
|
+
args.defaultConfig,
|
|
20
|
+
]) {
|
|
13
21
|
const configFile = resolve(entry);
|
|
14
22
|
if (configFile) {
|
|
15
23
|
return configFile;
|
|
@@ -26,7 +34,7 @@ export function readConfig(): { [key: string]: TaskFunction } | void {
|
|
|
26
34
|
|
|
27
35
|
if (configFile && fs.existsSync(configFile)) {
|
|
28
36
|
const ext = path.extname(configFile);
|
|
29
|
-
if (ext === '.ts' || ext === '.tsx') {
|
|
37
|
+
if (ext === '.cts' || ext === '.ts' || ext === '.tsx') {
|
|
30
38
|
// TODO: add option to do typechecking as well
|
|
31
39
|
enableTypeScript({ transpileOnly: true, esm: args.esm });
|
|
32
40
|
}
|
|
@@ -45,7 +53,7 @@ export function readConfig(): { [key: string]: TaskFunction } | void {
|
|
|
45
53
|
return configModule;
|
|
46
54
|
} catch (e) {
|
|
47
55
|
logger.error(`Invalid configuration file: ${configFile}`);
|
|
48
|
-
logger.error(`Error: ${e.stack || e.message || e}`);
|
|
56
|
+
logger.error(`Error: ${(e as Error).stack || (e as Error).message || e}`);
|
|
49
57
|
process.exit(1);
|
|
50
58
|
}
|
|
51
59
|
} else {
|
package/src/enableTypeScript.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function enableTypeScript({ transpileOnly = true, esm = false }): void {
|
|
|
19
19
|
allowJs: true,
|
|
20
20
|
esModuleInterop: true,
|
|
21
21
|
},
|
|
22
|
-
files: ['just.config.ts'],
|
|
22
|
+
files: ['just.config.ts', 'just.config.cts'],
|
|
23
23
|
});
|
|
24
24
|
} else {
|
|
25
25
|
logger.error(`In order to use TypeScript with just.config.ts, you need to install "ts-node" module:
|