bun-workspaces 1.0.1-alpha → 1.0.1
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/LICENSE.md +1 -1
- package/README.md +189 -70
- package/bin/cli.js +1 -2
- package/package.json +27 -30
- package/src/cli/commands/commandHandlerUtils.d.ts +49 -0
- package/src/cli/commands/commandHandlerUtils.mjs +91 -0
- package/src/cli/commands/commands.d.ts +10 -0
- package/src/cli/commands/commands.mjs +23 -0
- package/src/cli/commands/commandsConfig.d.ts +351 -0
- package/src/cli/commands/commandsConfig.mjs +183 -0
- package/src/cli/commands/handleSimpleCommands.d.ts +15 -0
- package/src/cli/commands/handleSimpleCommands.mjs +174 -0
- package/src/cli/commands/index.d.ts +3 -0
- package/src/cli/commands/index.mjs +3 -0
- package/src/cli/commands/runScript/handleRunScript.d.ts +3 -0
- package/src/cli/commands/runScript/handleRunScript.mjs +249 -0
- package/src/cli/commands/runScript/index.d.ts +2 -0
- package/src/cli/commands/runScript/index.mjs +2 -0
- package/src/cli/commands/runScript/output/index.d.ts +1 -0
- package/src/cli/commands/runScript/output/index.mjs +1 -0
- package/src/cli/commands/runScript/output/outputStyle.d.ts +8 -0
- package/src/cli/commands/runScript/output/outputStyle.mjs +17 -0
- package/src/cli/commands/runScript/output/renderGroupedOutput.d.ts +73 -0
- package/src/cli/commands/runScript/output/renderGroupedOutput.mjs +308 -0
- package/src/cli/commands/runScript/output/renderPlainOutput.d.ts +24 -0
- package/src/cli/commands/runScript/output/renderPlainOutput.mjs +44 -0
- package/src/cli/commands/runScript/output/sanitizeChunk.d.ts +4 -0
- package/src/cli/commands/runScript/output/sanitizeChunk.mjs +101 -0
- package/src/cli/createCli.d.ts +25 -0
- package/src/cli/createCli.mjs +154 -0
- package/src/cli/fatalErrorLogger.d.ts +1 -0
- package/src/cli/fatalErrorLogger.mjs +7 -0
- package/src/cli/globalOptions/globalOptions.d.ts +40 -0
- package/src/cli/globalOptions/globalOptions.mjs +105 -0
- package/src/cli/globalOptions/globalOptionsConfig.d.ts +43 -0
- package/src/cli/globalOptions/globalOptionsConfig.mjs +34 -0
- package/src/cli/globalOptions/index.d.ts +2 -0
- package/src/cli/globalOptions/index.mjs +2 -0
- package/src/cli/index.d.ts +3 -0
- package/src/cli/index.mjs +3 -0
- package/src/cli/middleware.d.ts +72 -0
- package/src/cli/middleware.mjs +38 -0
- package/src/config/index.d.ts +3 -0
- package/src/config/index.mjs +3 -0
- package/src/config/rootConfig/errors.d.ts +1 -0
- package/src/config/rootConfig/errors.mjs +6 -0
- package/src/config/rootConfig/index.d.ts +5 -0
- package/src/config/rootConfig/index.mjs +5 -0
- package/src/config/rootConfig/loadRootConfig.d.ts +3 -0
- package/src/config/rootConfig/loadRootConfig.mjs +22 -0
- package/src/config/rootConfig/rootConfig.d.ts +17 -0
- package/src/config/rootConfig/rootConfig.mjs +43 -0
- package/src/config/rootConfig/rootConfigLocation.d.ts +2 -0
- package/src/config/rootConfig/rootConfigLocation.mjs +5 -0
- package/src/config/rootConfig/rootConfigSchema.d.ts +21 -0
- package/src/config/rootConfig/rootConfigSchema.mjs +24 -0
- package/src/config/userEnvVars/index.d.ts +1 -0
- package/src/config/userEnvVars/index.mjs +1 -0
- package/src/config/userEnvVars/userEnvVars.d.ts +13 -0
- package/src/config/userEnvVars/userEnvVars.mjs +10 -0
- package/src/config/util/ajvTypes.d.ts +10 -0
- package/src/config/util/ajvTypes.mjs +2 -0
- package/src/config/util/configLocation.d.ts +12 -0
- package/src/config/util/configLocation.mjs +11 -0
- package/src/config/util/index.d.ts +4 -0
- package/src/config/util/index.mjs +3 -0
- package/src/config/util/loadConfig.d.ts +16 -0
- package/src/config/util/loadConfig.mjs +118 -0
- package/src/config/util/validateConfig.d.ts +8 -0
- package/src/config/util/validateConfig.mjs +17 -0
- package/src/config/workspaceConfig/errors.d.ts +1 -0
- package/src/config/workspaceConfig/errors.mjs +6 -0
- package/src/config/workspaceConfig/index.d.ts +5 -0
- package/src/config/workspaceConfig/index.mjs +5 -0
- package/src/config/workspaceConfig/loadWorkspaceConfig.d.ts +3 -0
- package/src/config/workspaceConfig/loadWorkspaceConfig.mjs +25 -0
- package/src/config/workspaceConfig/workspaceConfig.d.ts +22 -0
- package/src/config/workspaceConfig/workspaceConfig.mjs +31 -0
- package/src/config/workspaceConfig/workspaceConfigLocation.d.ts +2 -0
- package/src/config/workspaceConfig/workspaceConfigLocation.mjs +5 -0
- package/src/config/workspaceConfig/workspaceConfigSchema.d.ts +25 -0
- package/src/config/workspaceConfig/workspaceConfigSchema.mjs +28 -0
- package/src/doctor/doctor.d.ts +35 -0
- package/src/doctor/doctor.mjs +52 -0
- package/src/doctor/index.d.ts +1 -0
- package/src/doctor/index.mjs +1 -0
- package/src/index.d.ts +37 -0
- package/src/index.mjs +16 -0
- package/src/internal/bun/bunLock.d.ts +20 -0
- package/src/internal/bun/bunLock.mjs +70 -0
- package/src/internal/bun/bunVersion.d.ts +21 -0
- package/src/internal/bun/bunVersion.mjs +43 -0
- package/src/internal/bun/index.d.ts +2 -0
- package/src/internal/bun/index.mjs +2 -0
- package/src/internal/core/error/error.d.ts +13 -0
- package/src/internal/{error.ts → core/error/error.mjs} +16 -18
- package/src/internal/core/error/index.d.ts +1 -0
- package/src/internal/core/error/index.mjs +1 -0
- package/src/internal/core/index.d.ts +4 -0
- package/src/internal/core/index.mjs +4 -0
- package/src/internal/core/json/index.d.ts +2 -0
- package/src/internal/core/json/index.mjs +2 -0
- package/src/internal/core/json/json.d.ts +49 -0
- package/src/internal/core/json/json.mjs +12 -0
- package/src/internal/core/json/jsonc.d.ts +9 -0
- package/src/internal/core/json/jsonc.mjs +117 -0
- package/src/internal/core/language/array/index.d.ts +1 -0
- package/src/internal/core/language/array/index.mjs +1 -0
- package/src/internal/core/language/array/optionalArray.d.ts +15 -0
- package/src/internal/core/language/array/optionalArray.mjs +8 -0
- package/src/internal/core/language/asyncIterable/asyncIterableQueue.d.ts +16 -0
- package/src/internal/core/language/asyncIterable/asyncIterableQueue.mjs +81 -0
- package/src/internal/core/language/asyncIterable/index.d.ts +2 -0
- package/src/internal/core/language/asyncIterable/index.mjs +2 -0
- package/src/internal/core/language/asyncIterable/mergeAsyncIterables.d.ts +5 -0
- package/src/internal/core/language/asyncIterable/mergeAsyncIterables.mjs +27 -0
- package/src/internal/core/language/events/typedEventTarget.d.ts +50 -0
- package/src/internal/core/language/events/typedEventTarget.mjs +14 -0
- package/src/internal/core/language/index.d.ts +5 -0
- package/src/internal/core/language/index.mjs +5 -0
- package/src/internal/core/language/regex/index.d.ts +1 -0
- package/src/internal/core/language/regex/index.mjs +1 -0
- package/src/internal/core/language/regex/regex.d.ts +3 -0
- package/src/internal/core/language/regex/regex.mjs +10 -0
- package/src/internal/core/language/string/id.d.ts +1 -0
- package/src/internal/core/language/string/id.mjs +10 -0
- package/src/internal/core/language/string/index.d.ts +1 -0
- package/src/internal/core/language/string/index.mjs +1 -0
- package/src/internal/core/language/string/utf/eastAsianWidth.d.ts +16 -0
- package/src/internal/core/language/string/utf/eastAsianWidth.mjs +326 -0
- package/src/internal/core/language/string/utf/visibleLength.d.ts +5 -0
- package/src/internal/core/language/string/utf/visibleLength.mjs +29 -0
- package/src/internal/core/language/types/index.d.ts +2 -0
- package/src/internal/core/language/types/index.mjs +1 -0
- package/src/internal/core/language/types/typeof.d.ts +102 -0
- package/src/internal/core/language/types/typeof.mjs +123 -0
- package/src/internal/core/language/types/types.d.ts +14 -0
- package/src/internal/core/language/types/types.mjs +2 -0
- package/src/internal/core/runtime/env.d.ts +6 -0
- package/src/internal/core/runtime/env.mjs +36 -0
- package/src/internal/core/runtime/index.d.ts +5 -0
- package/src/internal/core/runtime/index.mjs +5 -0
- package/src/internal/core/runtime/onExit.d.ts +4 -0
- package/src/internal/core/runtime/onExit.mjs +54 -0
- package/src/internal/core/runtime/os.d.ts +4 -0
- package/src/internal/core/runtime/os.mjs +7 -0
- package/src/internal/core/runtime/tempFile.d.ts +20 -0
- package/src/internal/core/runtime/tempFile.mjs +87 -0
- package/src/internal/core/runtime/terminal.d.ts +1 -0
- package/src/internal/core/runtime/terminal.mjs +4 -0
- package/src/internal/generated/ajv/validateRootConfig.mjs +1 -0
- package/src/internal/generated/ajv/validateWorkspaceConfig.mjs +1 -0
- package/src/internal/logger/index.d.ts +1 -0
- package/src/internal/logger/index.mjs +1 -0
- package/src/internal/logger/logger.d.ts +45 -0
- package/src/internal/logger/logger.mjs +133 -0
- package/src/internal/version.d.ts +1 -0
- package/src/internal/version.mjs +6 -0
- package/src/project/errors.d.ts +5 -0
- package/src/project/errors.mjs +10 -0
- package/src/project/implementations/fileSystemProject.d.ts +148 -0
- package/src/project/implementations/fileSystemProject.mjs +455 -0
- package/src/project/implementations/memoryProject.d.ts +41 -0
- package/src/project/implementations/memoryProject.mjs +148 -0
- package/src/project/implementations/projectBase.d.ts +35 -0
- package/src/project/implementations/projectBase.mjs +197 -0
- package/src/project/index.d.ts +5 -0
- package/src/project/index.mjs +4 -0
- package/src/project/project.d.ts +75 -0
- package/src/project/project.mjs +6 -0
- package/src/runScript/index.d.ts +7 -0
- package/src/runScript/index.mjs +7 -0
- package/src/runScript/output/index.d.ts +3 -0
- package/src/runScript/output/index.mjs +2 -0
- package/src/runScript/output/multiProcessOutput.d.ts +14 -0
- package/src/runScript/output/multiProcessOutput.mjs +21 -0
- package/src/runScript/output/outputStream.d.ts +1 -0
- package/src/runScript/output/outputStream.mjs +1 -0
- package/src/runScript/output/processOutput.d.ts +33 -0
- package/src/runScript/output/processOutput.mjs +124 -0
- package/src/runScript/parallel.d.ts +15 -0
- package/src/runScript/parallel.mjs +56 -0
- package/src/runScript/recursion.d.ts +4 -0
- package/src/runScript/recursion.mjs +17 -0
- package/src/runScript/runScript.d.ts +45 -0
- package/src/runScript/runScript.mjs +89 -0
- package/src/runScript/runScripts.d.ts +65 -0
- package/src/runScript/runScripts.mjs +263 -0
- package/src/runScript/scriptCommand.d.ts +33 -0
- package/src/runScript/scriptCommand.mjs +19 -0
- package/src/runScript/scriptExecution.d.ts +9 -0
- package/src/runScript/scriptExecution.mjs +50 -0
- package/src/runScript/scriptRuntimeMetadata.d.ts +73 -0
- package/src/runScript/scriptRuntimeMetadata.mjs +61 -0
- package/src/runScript/scriptShellOption.d.ts +8 -0
- package/src/runScript/scriptShellOption.mjs +39 -0
- package/src/runScript/subprocesses.d.ts +11 -0
- package/src/runScript/subprocesses.mjs +34 -0
- package/src/workspaces/dependencyGraph/cycles.d.ts +9 -0
- package/src/workspaces/dependencyGraph/cycles.mjs +91 -0
- package/src/workspaces/dependencyGraph/index.d.ts +2 -0
- package/src/workspaces/dependencyGraph/index.mjs +2 -0
- package/src/workspaces/dependencyGraph/resolveDependencies.d.ts +18 -0
- package/src/workspaces/dependencyGraph/resolveDependencies.mjs +52 -0
- package/src/workspaces/errors.d.ts +13 -0
- package/src/workspaces/errors.mjs +18 -0
- package/src/workspaces/findWorkspaces.d.ts +24 -0
- package/src/workspaces/findWorkspaces.mjs +217 -0
- package/src/workspaces/index.d.ts +4 -0
- package/src/workspaces/index.mjs +3 -0
- package/src/workspaces/packageJson.d.ts +31 -0
- package/src/workspaces/packageJson.mjs +188 -0
- package/src/workspaces/{workspace.ts → workspace.d.ts} +11 -6
- package/src/workspaces/workspace.mjs +2 -0
- package/src/workspaces/workspacePattern.d.ts +21 -0
- package/src/workspaces/workspacePattern.mjs +104 -0
- package/bun.lock +0 -576
- package/src/cli/cli.ts +0 -87
- package/src/cli/globalOptions.ts +0 -122
- package/src/cli/index.ts +0 -1
- package/src/cli/projectCommands.ts +0 -396
- package/src/config/bunWorkspacesConfig.ts +0 -62
- package/src/config/configFile.ts +0 -33
- package/src/config/index.ts +0 -7
- package/src/index.ts +0 -3
- package/src/internal/bunVersion.ts +0 -26
- package/src/internal/env.ts +0 -25
- package/src/internal/logger.ts +0 -145
- package/src/internal/regex.ts +0 -5
- package/src/project/errors.ts +0 -6
- package/src/project/index.ts +0 -6
- package/src/project/project.ts +0 -155
- package/src/project/scriptCommand.ts +0 -40
- package/src/workspaces/errors.ts +0 -14
- package/src/workspaces/findWorkspaces.ts +0 -137
- package/src/workspaces/index.ts +0 -7
- package/src/workspaces/packageJson.ts +0 -166
- package/tsconfig.json +0 -28
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { logger } from "../../logger/index.mjs"; // CONCATENATED MODULE: external "../../logger/index.mjs"
|
|
2
|
+
// CONCATENATED MODULE: ./src/internal/core/runtime/onExit.ts
|
|
3
|
+
|
|
4
|
+
let handlers = [];
|
|
5
|
+
let listenersRegistered = false;
|
|
6
|
+
const runAllHandlers = (exit) => {
|
|
7
|
+
for (const handler of handlers) {
|
|
8
|
+
try {
|
|
9
|
+
handler(exit);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
logger.error("Error running exit handler");
|
|
12
|
+
logger.error(error);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
logger.debug("Exit handlers ran");
|
|
16
|
+
handlers = [];
|
|
17
|
+
};
|
|
18
|
+
const registerListeners = () => {
|
|
19
|
+
if (listenersRegistered) return;
|
|
20
|
+
listenersRegistered = true;
|
|
21
|
+
logger.debug("Registering exit listeners");
|
|
22
|
+
process.on("exit", (code) => {
|
|
23
|
+
runAllHandlers(code);
|
|
24
|
+
process.exit(code);
|
|
25
|
+
});
|
|
26
|
+
for (const signal of [
|
|
27
|
+
"SIGINT",
|
|
28
|
+
"SIGTERM",
|
|
29
|
+
"SIGUSR1",
|
|
30
|
+
"SIGUSR2",
|
|
31
|
+
"SIGHUP",
|
|
32
|
+
"SIGQUIT",
|
|
33
|
+
]) {
|
|
34
|
+
const handleSignal = () => {
|
|
35
|
+
runAllHandlers(signal);
|
|
36
|
+
process.off(signal, handleSignal);
|
|
37
|
+
process.kill(process.pid, signal);
|
|
38
|
+
};
|
|
39
|
+
process.on(signal, handleSignal);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const runOnExit = (fn) => {
|
|
43
|
+
registerListeners();
|
|
44
|
+
let ran = false;
|
|
45
|
+
const wrapped = (exit) => {
|
|
46
|
+
if (ran) return;
|
|
47
|
+
ran = true;
|
|
48
|
+
fn(exit);
|
|
49
|
+
handlers = handlers.filter((handler) => handler !== wrapped);
|
|
50
|
+
};
|
|
51
|
+
handlers.push(wrapped);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { runOnExit };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// CONCATENATED MODULE: ./src/internal/core/runtime/os.ts
|
|
2
|
+
const IS_WINDOWS = process.platform === "win32";
|
|
3
|
+
const IS_MACOS = process.platform === "darwin";
|
|
4
|
+
const IS_LINUX = process.platform === "linux";
|
|
5
|
+
const IS_UNIX = IS_MACOS || IS_LINUX;
|
|
6
|
+
|
|
7
|
+
export { IS_LINUX, IS_MACOS, IS_UNIX, IS_WINDOWS };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
export type CreateTempFileOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
content: string;
|
|
5
|
+
mode?: fs.Mode;
|
|
6
|
+
};
|
|
7
|
+
declare class TempDir {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly dir: string;
|
|
10
|
+
constructor();
|
|
11
|
+
initialize(clean?: boolean): void;
|
|
12
|
+
createFilePath(fileName: string): string;
|
|
13
|
+
createFile({ name, content, mode }: CreateTempFileOptions): {
|
|
14
|
+
filePath: string;
|
|
15
|
+
cleanup: () => void;
|
|
16
|
+
};
|
|
17
|
+
cleanup(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare let DEFAULT_TEMP_DIR: TempDir;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { validateCurrentBunVersion } from "../../bun/bunVersion.mjs";
|
|
5
|
+
import { logger } from "../../logger/index.mjs";
|
|
6
|
+
import { BUN_WORKSPACES_VERSION } from "../../version.mjs";
|
|
7
|
+
import { createShortId } from "../language/string/id.mjs";
|
|
8
|
+
import { runOnExit } from "./onExit.mjs"; // CONCATENATED MODULE: external "fs"
|
|
9
|
+
// CONCATENATED MODULE: external "os"
|
|
10
|
+
// CONCATENATED MODULE: external "path"
|
|
11
|
+
// CONCATENATED MODULE: external "../../bun/bunVersion.mjs"
|
|
12
|
+
// CONCATENATED MODULE: external "../../logger/index.mjs"
|
|
13
|
+
// CONCATENATED MODULE: external "../../version.mjs"
|
|
14
|
+
// CONCATENATED MODULE: external "../language/string/id.mjs"
|
|
15
|
+
// CONCATENATED MODULE: external "./onExit.mjs"
|
|
16
|
+
// CONCATENATED MODULE: ./src/internal/core/runtime/tempFile.ts
|
|
17
|
+
|
|
18
|
+
const getTempBasePackageDir = () => path.join(os.tmpdir(), "bun-workspaces");
|
|
19
|
+
const getTempParentDir = () =>
|
|
20
|
+
path.join(getTempBasePackageDir(), BUN_WORKSPACES_VERSION);
|
|
21
|
+
class TempDir {
|
|
22
|
+
id = createShortId(6);
|
|
23
|
+
dir;
|
|
24
|
+
constructor() {
|
|
25
|
+
this.dir = path.join(getTempParentDir(), this.id);
|
|
26
|
+
}
|
|
27
|
+
initialize(clean = false) {
|
|
28
|
+
if (fs.existsSync(this.dir)) return;
|
|
29
|
+
fs.mkdirSync(this.dir, {
|
|
30
|
+
recursive: true,
|
|
31
|
+
});
|
|
32
|
+
fs.chmodSync(this.dir, 448);
|
|
33
|
+
if (clean) {
|
|
34
|
+
for (const dir of fs.readdirSync(path.resolve(getTempBasePackageDir()))) {
|
|
35
|
+
if (dir !== BUN_WORKSPACES_VERSION) {
|
|
36
|
+
logger.debug(
|
|
37
|
+
`Removing temp dir: ${path.join(getTempBasePackageDir(), dir)}`,
|
|
38
|
+
);
|
|
39
|
+
fs.rmSync(path.join(getTempBasePackageDir(), dir), {
|
|
40
|
+
force: true,
|
|
41
|
+
recursive: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
runOnExit(() => {
|
|
47
|
+
logger.debug(`Removing temp dir: ${this.dir}`);
|
|
48
|
+
fs.rmSync(this.dir, {
|
|
49
|
+
force: true,
|
|
50
|
+
recursive: true,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
logger.debug(`Created temp dir: ${this.dir}`);
|
|
54
|
+
}
|
|
55
|
+
createFilePath(fileName) {
|
|
56
|
+
return path.join(this.dir, fileName);
|
|
57
|
+
}
|
|
58
|
+
createFile({ name, content, mode }) {
|
|
59
|
+
this.initialize();
|
|
60
|
+
const filePath = this.createFilePath(name);
|
|
61
|
+
fs.writeFileSync(filePath, content, {
|
|
62
|
+
encoding: "utf8",
|
|
63
|
+
mode,
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
filePath,
|
|
67
|
+
cleanup: () =>
|
|
68
|
+
fs.rmSync(filePath, {
|
|
69
|
+
force: true,
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
cleanup() {
|
|
74
|
+
fs.rmSync(this.dir, {
|
|
75
|
+
force: true,
|
|
76
|
+
recursive: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
let DEFAULT_TEMP_DIR;
|
|
81
|
+
if (!validateCurrentBunVersion()) {
|
|
82
|
+
DEFAULT_TEMP_DIR = new TempDir();
|
|
83
|
+
} else {
|
|
84
|
+
DEFAULT_TEMP_DIR = null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { DEFAULT_TEMP_DIR };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IS_TTY: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports = validate11;module.exports.default = validate11;const schema12 = {"type":"object","additionalProperties":false,"properties":{"defaults":{"type":"object","additionalProperties":false,"properties":{"parallelMax":{"type":["number","string"]},"shell":{"type":"string"},"includeRootWorkspace":{"type":"boolean"}}}}};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){const _errs1 = errors;for(const key0 in data){if(!(key0 === "defaults")){validate11.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.defaults !== undefined){let data0 = data.defaults;const _errs2 = errors;if(errors === _errs2){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){const _errs4 = errors;for(const key1 in data0){if(!(((key1 === "parallelMax") || (key1 === "shell")) || (key1 === "includeRootWorkspace"))){validate11.errors = [{instancePath:instancePath+"/defaults",schemaPath:"#/properties/defaults/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key1},message:"must NOT have additional properties"}];return false;break;}}if(_errs4 === errors){if(data0.parallelMax !== undefined){let data1 = data0.parallelMax;const _errs5 = errors;if((!((typeof data1 == "number") && (isFinite(data1)))) && (typeof data1 !== "string")){validate11.errors = [{instancePath:instancePath+"/defaults/parallelMax",schemaPath:"#/properties/defaults/properties/parallelMax/type",keyword:"type",params:{type: schema12.properties.defaults.properties.parallelMax.type},message:"must be number,string"}];return false;}var valid1 = _errs5 === errors;}else {var valid1 = true;}if(valid1){if(data0.shell !== undefined){const _errs7 = errors;if(typeof data0.shell !== "string"){validate11.errors = [{instancePath:instancePath+"/defaults/shell",schemaPath:"#/properties/defaults/properties/shell/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs7 === errors;}else {var valid1 = true;}if(valid1){if(data0.includeRootWorkspace !== undefined){const _errs9 = errors;if(typeof data0.includeRootWorkspace !== "boolean"){validate11.errors = [{instancePath:instancePath+"/defaults/includeRootWorkspace",schemaPath:"#/properties/defaults/properties/includeRootWorkspace/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs9 === errors;}else {var valid1 = true;}}}}}else {validate11.errors = [{instancePath:instancePath+"/defaults",schemaPath:"#/properties/defaults/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";module.exports = validate10;module.exports.default = validate10;const schema11 = {"type":"object","additionalProperties":false,"properties":{"alias":{"type":["string","array"],"items":{"type":"string"},"uniqueItems":true},"scripts":{"type":"object","additionalProperties":{"type":"object","properties":{"order":{"type":"number"}},"additionalProperties":false}}}};function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){const _errs1 = errors;for(const key0 in data){if(!((key0 === "alias") || (key0 === "scripts"))){validate10.errors = [{instancePath,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key0},message:"must NOT have additional properties"}];return false;break;}}if(_errs1 === errors){if(data.alias !== undefined){let data0 = data.alias;const _errs2 = errors;if((typeof data0 !== "string") && (!(Array.isArray(data0)))){validate10.errors = [{instancePath:instancePath+"/alias",schemaPath:"#/properties/alias/type",keyword:"type",params:{type: schema11.properties.alias.type},message:"must be string,array"}];return false;}if(errors === _errs2){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0<len0; i0++){const _errs4 = errors;if(typeof data0[i0] !== "string"){validate10.errors = [{instancePath:instancePath+"/alias/" + i0,schemaPath:"#/properties/alias/items/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs4 === errors;if(!valid1){break;}}if(valid1){let i1 = data0.length;let j0;if(i1 > 1){const indices0 = {};for(;i1--;){let item0 = data0[i1];if(typeof item0 !== "string"){continue;}if(typeof indices0[item0] == "number"){j0 = indices0[item0];validate10.errors = [{instancePath:instancePath+"/alias",schemaPath:"#/properties/alias/uniqueItems",keyword:"uniqueItems",params:{i: i1, j: j0},message:"must NOT have duplicate items (items ## "+j0+" and "+i1+" are identical)"}];return false;break;}indices0[item0] = i1;}}}}}var valid0 = _errs2 === errors;}else {var valid0 = true;}if(valid0){if(data.scripts !== undefined){let data2 = data.scripts;const _errs6 = errors;if(errors === _errs6){if(data2 && typeof data2 == "object" && !Array.isArray(data2)){for(const key1 in data2){let data3 = data2[key1];const _errs9 = errors;if(errors === _errs9){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){const _errs11 = errors;for(const key2 in data3){if(!(key2 === "order")){validate10.errors = [{instancePath:instancePath+"/scripts/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/scripts/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"}];return false;break;}}if(_errs11 === errors){if(data3.order !== undefined){let data4 = data3.order;if(!((typeof data4 == "number") && (isFinite(data4)))){validate10.errors = [{instancePath:instancePath+"/scripts/" + key1.replace(/~/g, "~0").replace(/\//g, "~1")+"/order",schemaPath:"#/properties/scripts/additionalProperties/properties/order/type",keyword:"type",params:{type: "number"},message:"must be number"}];return false;}}}}else {validate10.errors = [{instancePath:instancePath+"/scripts/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/properties/scripts/additionalProperties/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid3 = _errs9 === errors;if(!valid3){break;}}}else {validate10.errors = [{instancePath:instancePath+"/scripts",schemaPath:"#/properties/scripts/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs6 === errors;}else {var valid0 = true;}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logger";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./logger.mjs"; // CONCATENATED MODULE: ./src/internal/logger/index.ts
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const LOG_LEVELS: readonly ["debug", "info", "warn", "error"];
|
|
2
|
+
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
3
|
+
export type LogLevelSetting = LogLevel | "silent";
|
|
4
|
+
export declare const LOGGER_ERRORS: import("../core").DefinedErrors<"InvalidLogLevel">;
|
|
5
|
+
export declare const validateLogLevel: (level: LogLevelSetting) => void;
|
|
6
|
+
export type LogMetadata = Record<string, unknown>;
|
|
7
|
+
export interface Log<
|
|
8
|
+
Message extends string | Error = string,
|
|
9
|
+
Metadata extends LogMetadata = LogMetadata,
|
|
10
|
+
> {
|
|
11
|
+
message: Message;
|
|
12
|
+
level: LogLevel;
|
|
13
|
+
metadata: Metadata;
|
|
14
|
+
time: Date;
|
|
15
|
+
}
|
|
16
|
+
export type Logger = {
|
|
17
|
+
name: string;
|
|
18
|
+
log<
|
|
19
|
+
Message extends string | Error = string,
|
|
20
|
+
Metadata extends LogMetadata = LogMetadata,
|
|
21
|
+
>(
|
|
22
|
+
message: Message,
|
|
23
|
+
level: LogLevel,
|
|
24
|
+
metadata?: Metadata,
|
|
25
|
+
): Log<Message, Metadata>;
|
|
26
|
+
printLevel: LogLevelSetting;
|
|
27
|
+
setPrintStdout: (
|
|
28
|
+
stdout: (...args: Parameters<typeof process.stdout.write>) => void,
|
|
29
|
+
) => void;
|
|
30
|
+
setPrintStderr: (
|
|
31
|
+
stderr: (...args: Parameters<typeof process.stderr.write>) => void,
|
|
32
|
+
) => void;
|
|
33
|
+
} & {
|
|
34
|
+
[Level in LogLevel]: <
|
|
35
|
+
Message extends string | Error = string,
|
|
36
|
+
Metadata extends LogMetadata = LogMetadata,
|
|
37
|
+
>(
|
|
38
|
+
message: Message,
|
|
39
|
+
metadata?: Metadata,
|
|
40
|
+
) => Log<Message, Metadata>;
|
|
41
|
+
};
|
|
42
|
+
export declare const createLogger: (name: string) => Logger;
|
|
43
|
+
export declare const logger: Logger;
|
|
44
|
+
/** Set the global logging level. Defaults to "info" or "error" when `NODE_ENV` is "test" */
|
|
45
|
+
export declare const setLogLevel: (level: LogLevelSetting) => void;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { defineErrors } from "../core/error/index.mjs";
|
|
2
|
+
import { IS_TEST } from "../core/runtime/env.mjs"; // CONCATENATED MODULE: external "../core/error/index.mjs"
|
|
3
|
+
// CONCATENATED MODULE: external "../core/runtime/env.mjs"
|
|
4
|
+
// CONCATENATED MODULE: ./src/internal/logger/logger.ts
|
|
5
|
+
|
|
6
|
+
const LOG_LEVELS = ["debug", "info", "warn", "error"];
|
|
7
|
+
const getLevelNumber = (level) => LOG_LEVELS.indexOf(level);
|
|
8
|
+
const LOGGER_ERRORS = defineErrors("InvalidLogLevel");
|
|
9
|
+
const validateLogLevel = (level) => {
|
|
10
|
+
if (level === "silent") return;
|
|
11
|
+
if (!LOG_LEVELS.includes(level)) {
|
|
12
|
+
throw new LOGGER_ERRORS.InvalidLogLevel(
|
|
13
|
+
`Invalid log level: ${JSON.stringify(level)}. Accepted values: ${LOG_LEVELS.join(", ") + ", silent"}`,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const createLogger = (name) => new _Logger(name);
|
|
18
|
+
const YELLOW = "\x1b[0;33m";
|
|
19
|
+
const NC = "\x1b[0m";
|
|
20
|
+
const RED = "\x1b[0;31m";
|
|
21
|
+
const LEVEL_OUTPUT_TARGETS = {
|
|
22
|
+
debug: "stderr",
|
|
23
|
+
info: "stdout",
|
|
24
|
+
warn: "stderr",
|
|
25
|
+
error: "stderr",
|
|
26
|
+
};
|
|
27
|
+
class _Logger {
|
|
28
|
+
name;
|
|
29
|
+
constructor(name) {
|
|
30
|
+
this.name = name;
|
|
31
|
+
}
|
|
32
|
+
log(message, level, metadata) {
|
|
33
|
+
const log = {
|
|
34
|
+
message,
|
|
35
|
+
level,
|
|
36
|
+
metadata: metadata ?? {},
|
|
37
|
+
time: new Date(),
|
|
38
|
+
};
|
|
39
|
+
if (this.shouldPrint(level)) {
|
|
40
|
+
const formattedMessage = this.formatLogMessage(message, level);
|
|
41
|
+
if (message instanceof Error) {
|
|
42
|
+
message.message = formattedMessage;
|
|
43
|
+
}
|
|
44
|
+
const mainMessage = message instanceof Error ? message : formattedMessage;
|
|
45
|
+
const metadataMessages = metadata
|
|
46
|
+
? [
|
|
47
|
+
{
|
|
48
|
+
metadata,
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
: [];
|
|
52
|
+
this[
|
|
53
|
+
LEVEL_OUTPUT_TARGETS[level] === "stderr"
|
|
54
|
+
? "_printStderr"
|
|
55
|
+
: "_printStdout"
|
|
56
|
+
](
|
|
57
|
+
(typeof mainMessage === "string"
|
|
58
|
+
? mainMessage
|
|
59
|
+
: Bun.inspect(mainMessage, {
|
|
60
|
+
colors: true,
|
|
61
|
+
})) +
|
|
62
|
+
metadataMessages
|
|
63
|
+
.map((m) =>
|
|
64
|
+
Bun.inspect(m, {
|
|
65
|
+
colors: true,
|
|
66
|
+
}),
|
|
67
|
+
)
|
|
68
|
+
.join("\n") +
|
|
69
|
+
"\n",
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return log;
|
|
73
|
+
}
|
|
74
|
+
debug(message, metadata) {
|
|
75
|
+
return this.log(message, "debug", metadata);
|
|
76
|
+
}
|
|
77
|
+
info(message, metadata) {
|
|
78
|
+
return this.log(message, "info", metadata);
|
|
79
|
+
}
|
|
80
|
+
warn(message, metadata) {
|
|
81
|
+
return this.log(message, "warn", metadata);
|
|
82
|
+
}
|
|
83
|
+
error(message, metadata) {
|
|
84
|
+
return this.log(message, "error", metadata);
|
|
85
|
+
}
|
|
86
|
+
get printLevel() {
|
|
87
|
+
return this._printLevel;
|
|
88
|
+
}
|
|
89
|
+
set printLevel(level) {
|
|
90
|
+
validateLogLevel(level);
|
|
91
|
+
this._printLevel = level;
|
|
92
|
+
}
|
|
93
|
+
// Info prints normally for standard user-facing logs. Debug and Warn are highlighted with a prefix. Errors print as Error instances
|
|
94
|
+
formatLogMessage(message, level) {
|
|
95
|
+
const content = message instanceof Error ? message.message : message;
|
|
96
|
+
const prefixed =
|
|
97
|
+
level === "debug" || level === "warn"
|
|
98
|
+
? `[${this.name} ${level.toUpperCase()}]: ${content}`
|
|
99
|
+
: content;
|
|
100
|
+
return level === "warn"
|
|
101
|
+
? `${YELLOW}${prefixed}${NC}`
|
|
102
|
+
: level === "error"
|
|
103
|
+
? `${RED}${prefixed}${NC}`
|
|
104
|
+
: prefixed;
|
|
105
|
+
}
|
|
106
|
+
_printLevel = IS_TEST ? "error" : "info";
|
|
107
|
+
shouldPrint(level) {
|
|
108
|
+
if (this.printLevel === "silent") return false;
|
|
109
|
+
return getLevelNumber(level) >= getLevelNumber(this.printLevel);
|
|
110
|
+
}
|
|
111
|
+
_printStdout = (...args) => process.stdout.write(...args);
|
|
112
|
+
_printStderr = (...args) => process.stderr.write(...args);
|
|
113
|
+
setPrintStdout(stdout) {
|
|
114
|
+
this._printStdout = stdout;
|
|
115
|
+
}
|
|
116
|
+
setPrintStderr(stderr) {
|
|
117
|
+
this._printStderr = stderr;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const logger = createLogger("bun-workspaces");
|
|
121
|
+
/** Set the global logging level. Defaults to "info" or "error" when `NODE_ENV` is "test" */ const setLogLevel =
|
|
122
|
+
(level) => {
|
|
123
|
+
logger.printLevel = level;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
LOGGER_ERRORS,
|
|
128
|
+
LOG_LEVELS,
|
|
129
|
+
createLogger,
|
|
130
|
+
logger,
|
|
131
|
+
setLogLevel,
|
|
132
|
+
validateLogLevel,
|
|
133
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BUN_WORKSPACES_VERSION: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineErrors } from "../internal/core/index.mjs"; // CONCATENATED MODULE: external "../internal/core/index.mjs"
|
|
2
|
+
// CONCATENATED MODULE: ./src/project/errors.ts
|
|
3
|
+
|
|
4
|
+
const PROJECT_ERRORS = defineErrors(
|
|
5
|
+
"ProjectWorkspaceNotFound",
|
|
6
|
+
"WorkspaceScriptDoesNotExist",
|
|
7
|
+
"RecursiveWorkspaceScript",
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export { PROJECT_ERRORS };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Simplify } from "../../internal/core";
|
|
2
|
+
import {
|
|
3
|
+
type RunScriptsParallelOptions,
|
|
4
|
+
type RunScriptsSummary,
|
|
5
|
+
type RunScriptExit,
|
|
6
|
+
type OutputStreamName,
|
|
7
|
+
type ScriptEventName,
|
|
8
|
+
} from "../../runScript";
|
|
9
|
+
import type { MultiProcessOutput } from "../../runScript/output/multiProcessOutput";
|
|
10
|
+
import { type ScriptShellOption } from "../../runScript/scriptShellOption";
|
|
11
|
+
import { type Workspace } from "../../workspaces";
|
|
12
|
+
import type { Project, ProjectConfig } from "../project";
|
|
13
|
+
import { ProjectBase } from "./projectBase";
|
|
14
|
+
/** Arguments for {@link createFileSystemProject} */
|
|
15
|
+
export type CreateFileSystemProjectOptions = {
|
|
16
|
+
/** The directory containing the root package.json. Often the same root as a git repository. Relative to process.cwd(). The default is process.cwd(). */
|
|
17
|
+
rootDirectory?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The name of the project.
|
|
20
|
+
*
|
|
21
|
+
* By default will use the root package.json name
|
|
22
|
+
*/
|
|
23
|
+
name?: string;
|
|
24
|
+
/** Whether to include the root workspace as a normal workspace. This overrides any config or env var settings. */
|
|
25
|
+
includeRootWorkspace?: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type ShellOption = ScriptShellOption | "default";
|
|
28
|
+
export type InlineScriptOptions = {
|
|
29
|
+
/** A name to act as a label for the inline script */
|
|
30
|
+
scriptName?: string;
|
|
31
|
+
/** Whether to run the script as an inline command */
|
|
32
|
+
shell?: ShellOption;
|
|
33
|
+
};
|
|
34
|
+
/** Arguments for `FileSystemProject.runWorkspaceScript` */
|
|
35
|
+
export type RunWorkspaceScriptOptions = {
|
|
36
|
+
/** The name of the workspace to run the script in */
|
|
37
|
+
workspaceNameOrAlias: string;
|
|
38
|
+
/** The name of the script to run, or an inline command when `inline` is true */
|
|
39
|
+
script: string;
|
|
40
|
+
/** Whether to run the script as an inline command */
|
|
41
|
+
inline?: boolean | InlineScriptOptions;
|
|
42
|
+
/** The arguments to append to the script command */
|
|
43
|
+
args?: string;
|
|
44
|
+
/** Set to `true` to ignore all output from the script. This saves memory when you don't need script output. */
|
|
45
|
+
ignoreOutput?: boolean;
|
|
46
|
+
};
|
|
47
|
+
/** Metadata associated with a workspace script */
|
|
48
|
+
export type RunWorkspaceScriptMetadata = {
|
|
49
|
+
/** The workspace that the script was run in */
|
|
50
|
+
workspace: Workspace;
|
|
51
|
+
};
|
|
52
|
+
export type RunWorkspaceScriptExit = Simplify<
|
|
53
|
+
RunScriptExit<RunWorkspaceScriptMetadata>
|
|
54
|
+
>;
|
|
55
|
+
export type RunWorkspaceScriptProcessOutput = MultiProcessOutput<
|
|
56
|
+
RunWorkspaceScriptMetadata & {
|
|
57
|
+
streamName: OutputStreamName;
|
|
58
|
+
}
|
|
59
|
+
>;
|
|
60
|
+
/** Result of `FileSystemProject.runWorkspaceScript` */
|
|
61
|
+
export type RunWorkspaceScriptResult = {
|
|
62
|
+
/** Use to get the output of the script */
|
|
63
|
+
output: RunWorkspaceScriptProcessOutput;
|
|
64
|
+
/** The exit result of the script */
|
|
65
|
+
exit: Promise<RunWorkspaceScriptExit>;
|
|
66
|
+
};
|
|
67
|
+
export type ParallelOption = boolean | RunScriptsParallelOptions;
|
|
68
|
+
export type ScriptEventMetadata = {
|
|
69
|
+
/** The workspace that the script event occurred in */
|
|
70
|
+
workspace: Workspace;
|
|
71
|
+
/** The exit result of the script */
|
|
72
|
+
exitResult: RunScriptExit<RunWorkspaceScriptMetadata> | null;
|
|
73
|
+
};
|
|
74
|
+
export type OnScriptEventCallback = (
|
|
75
|
+
/** The event that occurred */
|
|
76
|
+
event: ScriptEventName,
|
|
77
|
+
/** The metadata for the script event */
|
|
78
|
+
metadata: ScriptEventMetadata,
|
|
79
|
+
) => unknown;
|
|
80
|
+
/** Arguments for `FileSystemProject.runScriptAcrossWorkspaces` */
|
|
81
|
+
export type RunScriptAcrossWorkspacesOptions = {
|
|
82
|
+
/**
|
|
83
|
+
* Workspace names, aliases, or patterns including a wildcard.
|
|
84
|
+
*
|
|
85
|
+
* When not provided, all workspaces that the script can be ran in will be used.
|
|
86
|
+
*/
|
|
87
|
+
workspacePatterns?: string[];
|
|
88
|
+
/** The name of the script to run, or an inline command when `inline` is true */
|
|
89
|
+
script: string;
|
|
90
|
+
/** Whether to run the script as an inline command */
|
|
91
|
+
inline?: boolean | InlineScriptOptions;
|
|
92
|
+
/** The arguments to append to the script command. `<workspaceName>` will be replaced with the workspace name */
|
|
93
|
+
args?: string;
|
|
94
|
+
/** Whether to run the scripts in parallel (default: `true`). Pass `false` to run in series. */
|
|
95
|
+
parallel?: ParallelOption;
|
|
96
|
+
/** When `true`, run scripts so that dependent workspaces run only after their dependencies */
|
|
97
|
+
dependencyOrder?: boolean;
|
|
98
|
+
/** When `true`, continue running scripts even if a dependency fails (Only relevant when `dependencyOrder` is `true`) */
|
|
99
|
+
ignoreDependencyFailure?: boolean;
|
|
100
|
+
/** Set to `true` to ignore all output from the scripts. This saves memory when you don't need script output. */
|
|
101
|
+
ignoreOutput?: boolean;
|
|
102
|
+
/** Callback to invoke when a script event occurs (start, skip, exit) */
|
|
103
|
+
onScriptEvent?: OnScriptEventCallback;
|
|
104
|
+
};
|
|
105
|
+
export type RunScriptAcrossWorkspacesSummary = Simplify<
|
|
106
|
+
RunScriptsSummary<RunWorkspaceScriptMetadata>
|
|
107
|
+
>;
|
|
108
|
+
export type RunScriptAcrossWorkspacesOutput = MultiProcessOutput<
|
|
109
|
+
RunWorkspaceScriptMetadata & {
|
|
110
|
+
streamName: OutputStreamName;
|
|
111
|
+
}
|
|
112
|
+
>;
|
|
113
|
+
/** Result of `FileSystemProject.runScriptAcrossWorkspaces` */
|
|
114
|
+
export type RunScriptAcrossWorkspacesResult = {
|
|
115
|
+
/** Use to get the output of the scripts */
|
|
116
|
+
output: RunScriptAcrossWorkspacesOutput;
|
|
117
|
+
/** The summary of the script run with exit details for each workspace */
|
|
118
|
+
summary: Promise<RunScriptAcrossWorkspacesSummary>;
|
|
119
|
+
/** The workspaces targeted */
|
|
120
|
+
workspaces: Workspace[];
|
|
121
|
+
};
|
|
122
|
+
declare class _FileSystemProject extends ProjectBase implements Project {
|
|
123
|
+
#private;
|
|
124
|
+
readonly rootDirectory: string;
|
|
125
|
+
readonly workspaces: Workspace[];
|
|
126
|
+
readonly name: string;
|
|
127
|
+
readonly sourceType = "fileSystem";
|
|
128
|
+
readonly config: ProjectConfig;
|
|
129
|
+
readonly rootWorkspace: Workspace;
|
|
130
|
+
constructor(options: CreateFileSystemProjectOptions);
|
|
131
|
+
runWorkspaceScript(
|
|
132
|
+
options: RunWorkspaceScriptOptions,
|
|
133
|
+
): RunWorkspaceScriptResult;
|
|
134
|
+
runScriptAcrossWorkspaces(
|
|
135
|
+
options: RunScriptAcrossWorkspacesOptions,
|
|
136
|
+
): RunScriptAcrossWorkspacesResult;
|
|
137
|
+
}
|
|
138
|
+
/** An implementation of {@link Project} that is created from a root directory in the file system. */
|
|
139
|
+
export type FileSystemProject = Simplify<_FileSystemProject>;
|
|
140
|
+
/**
|
|
141
|
+
* Create a {@link Project} based on a given root directory.
|
|
142
|
+
* Automatically finds workspaces based on the root package.json "workspaces" field
|
|
143
|
+
* and detects and utilizes any provided configuration.
|
|
144
|
+
*/
|
|
145
|
+
export declare const createFileSystemProject: (
|
|
146
|
+
options?: CreateFileSystemProjectOptions,
|
|
147
|
+
) => FileSystemProject;
|
|
148
|
+
export {};
|