@smoothbricks/nx-plugin 0.3.10 → 0.3.11
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/dist/executors/clean-outputs/executor.js +17 -3
- package/dist/executors/napi-cross-toolchain/executor.d.ts.map +1 -1
- package/dist/executors/napi-cross-toolchain/executor.js +8 -0
- package/package.json +1 -1
- package/src/executors/clean-outputs/executor.ts +17 -3
- package/src/executors/napi-cross-toolchain/executor.ts +8 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { rm } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
export default async function cleanOutputsExecutor(options, context) {
|
|
@@ -60,9 +60,23 @@ function isWithin(candidate, parent) {
|
|
|
60
60
|
}
|
|
61
61
|
function containsTrackedFiles(outputDir, workspaceRoot) {
|
|
62
62
|
const relativeOutputDir = path.relative(workspaceRoot, outputDir);
|
|
63
|
-
const
|
|
63
|
+
const result = spawnSync('git', ['ls-files', '--', relativeOutputDir], {
|
|
64
64
|
cwd: workspaceRoot,
|
|
65
65
|
encoding: 'utf8',
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
const command = `git ls-files -- ${relativeOutputDir}`;
|
|
68
|
+
if (typeof result.stdout === 'string' && result.stdout.length > 0) {
|
|
69
|
+
process.stdout.write(result.stdout);
|
|
70
|
+
}
|
|
71
|
+
if (typeof result.stderr === 'string' && result.stderr.length > 0) {
|
|
72
|
+
process.stderr.write(result.stderr);
|
|
73
|
+
}
|
|
74
|
+
if (result.error) {
|
|
75
|
+
console.error(result.error.message);
|
|
76
|
+
throw new Error(`${command} failed with exit code ${result.status ?? 1}`, { cause: result.error });
|
|
77
|
+
}
|
|
78
|
+
if (result.status !== 0) {
|
|
79
|
+
throw new Error(`${command} failed with exit code ${result.status ?? 1}`);
|
|
80
|
+
}
|
|
81
|
+
return result.stdout.trim().length > 0;
|
|
68
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/napi-cross-toolchain/executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE;QACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7C,CAAC;CACH;AAaD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAExE,wBAA8B,0BAA0B,CACtD,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAe/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/executors/napi-cross-toolchain/executor.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE;QACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7C,CAAC;CACH;AAaD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAExE,wBAA8B,0BAA0B,CACtD,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAe/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,cAAc,CAyEjB"}
|
|
@@ -84,6 +84,7 @@ export function prewarmCrossToolchain(options) {
|
|
|
84
84
|
}
|
|
85
85
|
mkdirSync(path.dirname(destination), { recursive: true });
|
|
86
86
|
const staging = mkdtempSync(`${destination}.staging-`);
|
|
87
|
+
const command = `tar -xJf ${tarball} -C ${staging}`;
|
|
87
88
|
try {
|
|
88
89
|
execFileSync('tar', ['-xJf', tarball, '-C', staging], { stdio: 'inherit' });
|
|
89
90
|
if (!existsSync(path.join(staging, 'package.json'))) {
|
|
@@ -97,6 +98,13 @@ export function prewarmCrossToolchain(options) {
|
|
|
97
98
|
if ((code === 'ENOTEMPTY' || code === 'EEXIST') && existsSync(marker)) {
|
|
98
99
|
return 'ready';
|
|
99
100
|
}
|
|
101
|
+
const status = error instanceof Error && 'status' in error ? error.status : undefined;
|
|
102
|
+
if (status !== undefined) {
|
|
103
|
+
if (error instanceof Error) {
|
|
104
|
+
console.error(error.message);
|
|
105
|
+
}
|
|
106
|
+
throw new Error(`${command} failed with exit code ${typeof status === 'number' ? status : 1}`, { cause: error });
|
|
107
|
+
}
|
|
100
108
|
throw error;
|
|
101
109
|
}
|
|
102
110
|
return 'extracted';
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { rm } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
|
|
@@ -107,10 +107,24 @@ function isWithin(candidate: string, parent: string): boolean {
|
|
|
107
107
|
|
|
108
108
|
function containsTrackedFiles(outputDir: string, workspaceRoot: string): boolean {
|
|
109
109
|
const relativeOutputDir = path.relative(workspaceRoot, outputDir);
|
|
110
|
-
const
|
|
110
|
+
const result = spawnSync('git', ['ls-files', '--', relativeOutputDir], {
|
|
111
111
|
cwd: workspaceRoot,
|
|
112
112
|
encoding: 'utf8',
|
|
113
113
|
});
|
|
114
|
+
const command = `git ls-files -- ${relativeOutputDir}`;
|
|
115
|
+
if (typeof result.stdout === 'string' && result.stdout.length > 0) {
|
|
116
|
+
process.stdout.write(result.stdout);
|
|
117
|
+
}
|
|
118
|
+
if (typeof result.stderr === 'string' && result.stderr.length > 0) {
|
|
119
|
+
process.stderr.write(result.stderr);
|
|
120
|
+
}
|
|
121
|
+
if (result.error) {
|
|
122
|
+
console.error(result.error.message);
|
|
123
|
+
throw new Error(`${command} failed with exit code ${result.status ?? 1}`, { cause: result.error });
|
|
124
|
+
}
|
|
125
|
+
if (result.status !== 0) {
|
|
126
|
+
throw new Error(`${command} failed with exit code ${result.status ?? 1}`);
|
|
127
|
+
}
|
|
114
128
|
|
|
115
|
-
return
|
|
129
|
+
return result.stdout.trim().length > 0;
|
|
116
130
|
}
|
|
@@ -120,6 +120,7 @@ export function prewarmCrossToolchain(options: {
|
|
|
120
120
|
|
|
121
121
|
mkdirSync(path.dirname(destination), { recursive: true });
|
|
122
122
|
const staging = mkdtempSync(`${destination}.staging-`);
|
|
123
|
+
const command = `tar -xJf ${tarball} -C ${staging}`;
|
|
123
124
|
try {
|
|
124
125
|
execFileSync('tar', ['-xJf', tarball, '-C', staging], { stdio: 'inherit' });
|
|
125
126
|
if (!existsSync(path.join(staging, 'package.json'))) {
|
|
@@ -134,6 +135,13 @@ export function prewarmCrossToolchain(options: {
|
|
|
134
135
|
if ((code === 'ENOTEMPTY' || code === 'EEXIST') && existsSync(marker)) {
|
|
135
136
|
return 'ready';
|
|
136
137
|
}
|
|
138
|
+
const status = error instanceof Error && 'status' in error ? error.status : undefined;
|
|
139
|
+
if (status !== undefined) {
|
|
140
|
+
if (error instanceof Error) {
|
|
141
|
+
console.error(error.message);
|
|
142
|
+
}
|
|
143
|
+
throw new Error(`${command} failed with exit code ${typeof status === 'number' ? status : 1}`, { cause: error });
|
|
144
|
+
}
|
|
137
145
|
throw error;
|
|
138
146
|
}
|
|
139
147
|
return 'extracted';
|