just-task 1.13.0 → 1.14.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/lib/cache.d.ts +4 -3
- package/lib/cache.d.ts.map +1 -1
- package/lib/cache.js +6 -128
- package/lib/interfaces.d.ts +1 -0
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/task.d.ts.map +1 -1
- package/lib/task.js +0 -10
- package/lib/undertaker.d.ts.map +1 -1
- package/lib/undertaker.js +0 -2
- package/package.json +1 -2
- package/src/cache.ts +5 -168
- package/src/interfaces.ts +1 -0
- package/src/task.ts +0 -10
- package/src/undertaker.ts +0 -3
- package/CHANGELOG.json +0 -1329
- package/CHANGELOG.md +0 -637
- package/lib/package/findDependents.d.ts +0 -7
- package/lib/package/findDependents.d.ts.map +0 -1
- package/lib/package/findDependents.js +0 -56
- package/lib/package/findGitRoot.d.ts +0 -2
- package/lib/package/findGitRoot.d.ts.map +0 -1
- package/lib/package/findGitRoot.js +0 -26
- package/lib/package/findPackageRoot.d.ts +0 -2
- package/lib/package/findPackageRoot.d.ts.map +0 -1
- package/lib/package/findPackageRoot.js +0 -11
- package/lib/paths.d.ts +0 -2
- package/lib/paths.d.ts.map +0 -1
- package/lib/paths.js +0 -9
- package/src/package/findDependents.ts +0 -68
- package/src/package/findGitRoot.ts +0 -28
- package/src/package/findPackageRoot.ts +0 -8
- package/src/paths.ts +0 -6
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findGitRoot = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs-extra");
|
|
6
|
-
let gitRootCache = '';
|
|
7
|
-
function findGitRoot() {
|
|
8
|
-
if (gitRootCache) {
|
|
9
|
-
return gitRootCache;
|
|
10
|
-
}
|
|
11
|
-
let cwd = process.cwd();
|
|
12
|
-
const root = path.parse(cwd).root;
|
|
13
|
-
let found = false;
|
|
14
|
-
while (!found && cwd !== root) {
|
|
15
|
-
if (fs.pathExistsSync(path.join(cwd, '.git'))) {
|
|
16
|
-
found = true;
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
cwd = path.dirname(cwd);
|
|
20
|
-
}
|
|
21
|
-
if (found) {
|
|
22
|
-
gitRootCache = path.join(cwd);
|
|
23
|
-
}
|
|
24
|
-
return gitRootCache;
|
|
25
|
-
}
|
|
26
|
-
exports.findGitRoot = findGitRoot;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findPackageRoot.d.ts","sourceRoot":"","sources":["../../src/package/findPackageRoot.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,IAAI,MAAM,CAIxC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findPackageRoot = void 0;
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const resolve_1 = require("../resolve");
|
|
6
|
-
function findPackageRoot() {
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8
|
-
const packageJsonFilePath = (0, resolve_1.resolveCwd)('package.json');
|
|
9
|
-
return path.dirname(packageJsonFilePath);
|
|
10
|
-
}
|
|
11
|
-
exports.findPackageRoot = findPackageRoot;
|
package/lib/paths.d.ts
DELETED
package/lib/paths.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGhE"}
|
package/lib/paths.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isChildOf = void 0;
|
|
4
|
-
const path = require('path');
|
|
5
|
-
function isChildOf(child, parent) {
|
|
6
|
-
const relativePath = path.relative(child, parent);
|
|
7
|
-
return /^[.\/\\]+$/.test(relativePath);
|
|
8
|
-
}
|
|
9
|
-
exports.isChildOf = isChildOf;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { resolveCwd } from '../resolve';
|
|
4
|
-
import { findPackageRoot } from './findPackageRoot';
|
|
5
|
-
import { logger, mark } from '../logger';
|
|
6
|
-
import { findGitRoot } from './findGitRoot';
|
|
7
|
-
import { isChildOf } from '../paths';
|
|
8
|
-
|
|
9
|
-
interface DepInfo {
|
|
10
|
-
name: string;
|
|
11
|
-
path: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function findDependents(): Set<DepInfo> {
|
|
15
|
-
mark('cache:findDependents');
|
|
16
|
-
const results = collectAllDependentPaths(findPackageRoot());
|
|
17
|
-
logger.perf('cache:findDependents');
|
|
18
|
-
return results;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function getDepsPaths(pkgPath: string): DepInfo[] {
|
|
22
|
-
const gitRoot = findGitRoot();
|
|
23
|
-
const packageJsonFile = path.join(pkgPath, 'package.json');
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonFile).toString());
|
|
27
|
-
|
|
28
|
-
let deps: string[] = [];
|
|
29
|
-
deps = [
|
|
30
|
-
...deps,
|
|
31
|
-
...(packageJson.dependencies ? Object.keys(packageJson.dependencies) : []),
|
|
32
|
-
...(packageJson.devDependencies ? Object.keys(packageJson.devDependencies) : []),
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
return deps
|
|
36
|
-
.map(dep => {
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
|
-
const depPackageJson = resolveCwd(path.join(dep, 'package.json'))!;
|
|
39
|
-
|
|
40
|
-
if (!depPackageJson) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return { name: dep, path: path.dirname(fs.realpathSync(depPackageJson)) };
|
|
45
|
-
})
|
|
46
|
-
.filter(p => p && p.path.indexOf('node_modules') === -1 && isChildOf(p.path, gitRoot)) as DepInfo[];
|
|
47
|
-
} catch (e) {
|
|
48
|
-
logger.error(`Invalid package.json detected at ${packageJsonFile} `, e);
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function collectAllDependentPaths(pkgPath: string, collected: Set<DepInfo> = new Set<DepInfo>()) {
|
|
54
|
-
mark(`collectAllDependentPaths:${pkgPath}`);
|
|
55
|
-
|
|
56
|
-
const depPaths = getDepsPaths(pkgPath);
|
|
57
|
-
depPaths.forEach(depPath => collected.add(depPath));
|
|
58
|
-
|
|
59
|
-
for (const depPath of depPaths) {
|
|
60
|
-
if (!collected.has(depPath)) {
|
|
61
|
-
collectAllDependentPaths(depPath.path, collected);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
logger.perf(`collectAllDependentPaths:${pkgPath}`);
|
|
66
|
-
|
|
67
|
-
return collected;
|
|
68
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import * as fs from 'fs-extra';
|
|
3
|
-
|
|
4
|
-
let gitRootCache = '';
|
|
5
|
-
|
|
6
|
-
export function findGitRoot(): string {
|
|
7
|
-
if (gitRootCache) {
|
|
8
|
-
return gitRootCache;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
let cwd = process.cwd();
|
|
12
|
-
const root = path.parse(cwd).root;
|
|
13
|
-
let found = false;
|
|
14
|
-
while (!found && cwd !== root) {
|
|
15
|
-
if (fs.pathExistsSync(path.join(cwd, '.git'))) {
|
|
16
|
-
found = true;
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
cwd = path.dirname(cwd);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (found) {
|
|
24
|
-
gitRootCache = path.join(cwd);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return gitRootCache;
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import { resolveCwd } from '../resolve';
|
|
3
|
-
|
|
4
|
-
export function findPackageRoot(): string {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
6
|
-
const packageJsonFilePath = resolveCwd('package.json')!;
|
|
7
|
-
return path.dirname(packageJsonFilePath);
|
|
8
|
-
}
|