turbo-ignore 0.0.5 → 0.0.8
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/index.js +40 -0
- package/package.json +5 -2
package/index.js
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { exec } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const { getWorkspaceRoot } = require('workspace-tools');
|
|
7
|
+
|
|
8
|
+
function searchUp(pathName, cwd) {
|
|
9
|
+
const root = path.parse(cwd).root;
|
|
10
|
+
|
|
11
|
+
let found = false;
|
|
12
|
+
|
|
13
|
+
while (!found && cwd !== root) {
|
|
14
|
+
if (fs.existsSync(path.join(cwd, pathName))) {
|
|
15
|
+
found = true;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
cwd = path.dirname(cwd);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (found) {
|
|
23
|
+
return cwd;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let root = searchUp('turbo.json', process.cwd());
|
|
30
|
+
|
|
31
|
+
if (!root) {
|
|
32
|
+
root = getWorkspaceRoot(process.cwd());
|
|
33
|
+
if (!root) {
|
|
34
|
+
console.error('Error: workspace root not found.');
|
|
35
|
+
} else {
|
|
36
|
+
console.error('Error: "turbo.json" not found.');
|
|
37
|
+
}
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
4
41
|
exec(
|
|
5
42
|
`npx turbo@canary run build --scope=${process.argv[2]} --since=HEAD^ --dry=json`,
|
|
43
|
+
{
|
|
44
|
+
cwd: root,
|
|
45
|
+
},
|
|
6
46
|
(error, stdout, stderr) => {
|
|
7
47
|
if (error) {
|
|
8
48
|
console.error(`exec error: ${error}`);
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turbo-ignore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": "index.js",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"author": "Jared Palmer",
|
|
9
|
-
"license": "MPL-2.0"
|
|
9
|
+
"license": "MPL-2.0",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"workspace-tools": "^0.18.2"
|
|
12
|
+
}
|
|
10
13
|
}
|