hudson 1.0.0 → 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/dist/commands/build.d.ts +9 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +145 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/configure.d.ts +6 -0
- package/dist/commands/configure.d.ts.map +1 -0
- package/dist/commands/configure.js +67 -0
- package/dist/commands/configure.js.map +1 -0
- package/dist/commands/dev.d.ts +6 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +90 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/info.d.ts +2 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +66 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +72 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +8 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +94 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/workspaces.d.ts +2 -0
- package/dist/commands/workspaces.d.ts.map +1 -0
- package/dist/commands/workspaces.js +40 -0
- package/dist/commands/workspaces.js.map +1 -0
- package/dist/core/config.d.ts +56 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +158 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/runner.d.ts +20 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/runner.js +74 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/workspace.d.ts +12 -0
- package/dist/core/workspace.d.ts.map +1 -0
- package/dist/core/workspace.js +49 -0
- package/dist/core/workspace.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +127 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/display.d.ts +28 -0
- package/dist/utils/display.d.ts.map +1 -0
- package/dist/utils/display.js +62 -0
- package/dist/utils/display.js.map +1 -0
- package/package.json +1 -1
- package/.hudson/hudson.yml +0 -60
- package/example/.hudson/hudson.yml +0 -60
- package/example/src/index.ts +0 -1
- package/example/tsconfig.json +0 -21
- package/src/commands/build.ts +0 -187
- package/src/commands/configure.ts +0 -85
- package/src/commands/dev.ts +0 -114
- package/src/commands/info.ts +0 -78
- package/src/commands/init.ts +0 -80
- package/src/commands/run.ts +0 -114
- package/src/commands/workspaces.ts +0 -49
- package/src/core/config.ts +0 -214
- package/src/core/runner.ts +0 -108
- package/src/core/workspace.ts +0 -65
- package/src/index.ts +0 -138
- package/src/types/gradient-string.d.ts +0 -4
- package/src/utils/display.ts +0 -66
package/dist/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { program } from "commander";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { HUDSON_VERSION, BANNER, log } from "./utils/display.js";
|
|
5
|
+
import { initCommand } from "./commands/init.js";
|
|
6
|
+
import { buildCommand } from "./commands/build.js";
|
|
7
|
+
import { devCommand } from "./commands/dev.js";
|
|
8
|
+
import { runScriptCommand } from "./commands/run.js";
|
|
9
|
+
import { configureCommand } from "./commands/configure.js";
|
|
10
|
+
import { infoCommand } from "./commands/info.js";
|
|
11
|
+
import { workspacesCommand } from "./commands/workspaces.js";
|
|
12
|
+
program
|
|
13
|
+
.name("hudson")
|
|
14
|
+
.description("Hudson — The blazing-fast TypeScript build system")
|
|
15
|
+
.version(HUDSON_VERSION, "-v, --version", "Show Hudson version")
|
|
16
|
+
.addHelpText("beforeAll", BANNER());
|
|
17
|
+
program
|
|
18
|
+
.command("init")
|
|
19
|
+
.description("Initialize Hudson in the current project")
|
|
20
|
+
.option("-f, --force", "Reinitialize even if already set up")
|
|
21
|
+
.action(async (opts) => {
|
|
22
|
+
await initCommand({ force: opts.force });
|
|
23
|
+
});
|
|
24
|
+
program
|
|
25
|
+
.command("build")
|
|
26
|
+
.description("Build the project or workspace(s)")
|
|
27
|
+
.option("-w, --workspace <name>", "Build a specific workspace")
|
|
28
|
+
.option("--verbose", "Show detailed output")
|
|
29
|
+
.option("--no-clean", "Skip cleaning the output directory")
|
|
30
|
+
.option("--watch", "Watch for changes and rebuild")
|
|
31
|
+
.action(async (opts) => {
|
|
32
|
+
await buildCommand({
|
|
33
|
+
workspace: opts.workspace,
|
|
34
|
+
verbose: opts.verbose,
|
|
35
|
+
clean: opts.clean !== false,
|
|
36
|
+
watch: opts.watch,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
program
|
|
40
|
+
.command("dev")
|
|
41
|
+
.description("Start development mode with file watching")
|
|
42
|
+
.option("--verbose", "Show detailed output")
|
|
43
|
+
.action(async (opts) => {
|
|
44
|
+
await devCommand({ verbose: opts.verbose });
|
|
45
|
+
});
|
|
46
|
+
program
|
|
47
|
+
.command("run <script>")
|
|
48
|
+
.description("Run a script defined in .hudson/hudson.yml")
|
|
49
|
+
.option("-w, --workspace <name>", "Run in a specific workspace")
|
|
50
|
+
.option("--all", "Run in all workspaces")
|
|
51
|
+
.option("--verbose", "Show detailed output")
|
|
52
|
+
.action(async (script, opts) => {
|
|
53
|
+
await runScriptCommand(script, {
|
|
54
|
+
workspace: opts.workspace,
|
|
55
|
+
all: opts.all,
|
|
56
|
+
verbose: opts.verbose,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
program
|
|
60
|
+
.command("configure [key] [value]")
|
|
61
|
+
.description("Get or set a config value")
|
|
62
|
+
.option("-l, --list", "List all config values")
|
|
63
|
+
.option("-g, --get <key>", "Get a specific config value")
|
|
64
|
+
.option("--reset", "Reset config to defaults")
|
|
65
|
+
.action(async (key, value, opts) => {
|
|
66
|
+
await configureCommand(key, value, {
|
|
67
|
+
list: opts.list,
|
|
68
|
+
get: opts.get,
|
|
69
|
+
reset: opts.reset,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
program
|
|
73
|
+
.command("info")
|
|
74
|
+
.description("Show project information and configuration")
|
|
75
|
+
.action(async () => {
|
|
76
|
+
await infoCommand();
|
|
77
|
+
});
|
|
78
|
+
program
|
|
79
|
+
.command("workspaces [subcommand]")
|
|
80
|
+
.alias("ws")
|
|
81
|
+
.description("Manage workspaces (subcommands: list)")
|
|
82
|
+
.action(async (sub) => {
|
|
83
|
+
await workspacesCommand(sub);
|
|
84
|
+
});
|
|
85
|
+
// Custom help formatting
|
|
86
|
+
program.configureOutput({
|
|
87
|
+
writeErr: (str) => {
|
|
88
|
+
console.log(` ${chalk.red("✘")} ${str.trim()}`);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
// Handle unknown commands
|
|
92
|
+
program.on("command:*", (ops) => {
|
|
93
|
+
console.log(BANNER());
|
|
94
|
+
log.error(`Unknown command: ${chalk.cyan(ops[0])}`);
|
|
95
|
+
log.blank();
|
|
96
|
+
log.step("Available commands:");
|
|
97
|
+
console.log(` ${chalk.cyan("hudson init")} Initialize Hudson in a project`);
|
|
98
|
+
console.log(` ${chalk.cyan("hudson build")} Build the project`);
|
|
99
|
+
console.log(` ${chalk.cyan("hudson dev")} Start dev mode with file watching`);
|
|
100
|
+
console.log(` ${chalk.cyan("hudson run <script>")} Run a project script`);
|
|
101
|
+
console.log(` ${chalk.cyan("hudson configure")} Get/set configuration values`);
|
|
102
|
+
console.log(` ${chalk.cyan("hudson info")} Show project information`);
|
|
103
|
+
console.log(` ${chalk.cyan("hudson workspaces")} Manage workspaces`);
|
|
104
|
+
log.blank();
|
|
105
|
+
process.exit(1);
|
|
106
|
+
});
|
|
107
|
+
program.parse(process.argv);
|
|
108
|
+
// Show help if no command given
|
|
109
|
+
if (!process.argv.slice(2).length) {
|
|
110
|
+
console.log(BANNER());
|
|
111
|
+
console.log(` ${chalk.bold("Hudson")} — The blazing-fast TypeScript build system`);
|
|
112
|
+
log.blank();
|
|
113
|
+
console.log(` ${chalk.dim("Usage:")} ${chalk.cyan("hudson <command> [options]")}`);
|
|
114
|
+
log.blank();
|
|
115
|
+
console.log(` ${chalk.dim("Commands:")}`);
|
|
116
|
+
console.log(` ${chalk.cyan("init")} Initialize Hudson in a project`);
|
|
117
|
+
console.log(` ${chalk.cyan("build")} Build the project`);
|
|
118
|
+
console.log(` ${chalk.cyan("dev")} Start dev mode with file watching`);
|
|
119
|
+
console.log(` ${chalk.cyan("run <script>")} Run a project script`);
|
|
120
|
+
console.log(` ${chalk.cyan("configure")} Get/set configuration values`);
|
|
121
|
+
console.log(` ${chalk.cyan("info")} Show project information`);
|
|
122
|
+
console.log(` ${chalk.cyan("ws")} Manage workspaces`);
|
|
123
|
+
log.blank();
|
|
124
|
+
console.log(` ${chalk.dim("Run")} ${chalk.cyan("hudson <command> --help")} ${chalk.dim("for command details")}`);
|
|
125
|
+
log.blank();
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,EAAW,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC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,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IACjF,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IACtE,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;IAClH,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const HUDSON_VERSION = "1.0.0";
|
|
2
|
+
export declare const MASCOT: string;
|
|
3
|
+
export declare const MASCOT_FULL: string;
|
|
4
|
+
export declare const BANNER: () => string;
|
|
5
|
+
export declare const symbols: {
|
|
6
|
+
success: string;
|
|
7
|
+
error: string;
|
|
8
|
+
warning: string;
|
|
9
|
+
info: string;
|
|
10
|
+
arrow: string;
|
|
11
|
+
dot: string;
|
|
12
|
+
bullet: string;
|
|
13
|
+
fish: string;
|
|
14
|
+
hook: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const log: {
|
|
17
|
+
success: (msg: string) => void;
|
|
18
|
+
error: (msg: string) => void;
|
|
19
|
+
warn: (msg: string) => void;
|
|
20
|
+
info: (msg: string) => void;
|
|
21
|
+
step: (msg: string) => void;
|
|
22
|
+
dim: (msg: string) => void;
|
|
23
|
+
blank: () => void;
|
|
24
|
+
section: (title: string) => void;
|
|
25
|
+
};
|
|
26
|
+
export declare function formatDuration(ms: number): string;
|
|
27
|
+
export declare function formatSize(bytes: number): string;
|
|
28
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/utils/display.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,UAAU,CAAC;AAGtC,eAAO,MAAM,MAAM,QAIlB,CAAC;AAEF,eAAO,MAAM,WAAW,QAOvB,CAAC;AAEF,eAAO,MAAM,MAAM,cAMlB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;CAUnB,CAAC;AAEF,eAAO,MAAM,GAAG;mBACC,MAAM;iBACR,MAAM;gBACP,MAAM;gBACN,MAAM;gBACN,MAAM;eACP,MAAM;;qBAEA,MAAM;CAKxB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import gradient from "gradient-string";
|
|
3
|
+
export const HUDSON_VERSION = "1.0.0";
|
|
4
|
+
// Hudson mascot - fishing on a lake (ASCII art)
|
|
5
|
+
export const MASCOT = `
|
|
6
|
+
${chalk.hex("#4FC3F7")("~")} ${chalk.hex("#FFB74D")("Hudson")} ${chalk.hex("#4FC3F7")("~")}
|
|
7
|
+
${chalk.hex("#81C784")(" 🎣")}
|
|
8
|
+
${chalk.hex("#4FC3F7")(" ≋≋≋≋≋≋≋≋≋")}
|
|
9
|
+
`;
|
|
10
|
+
export const MASCOT_FULL = `
|
|
11
|
+
${chalk.hex("#FFD54F")("( •_•)")} ${chalk.dim("Hudson Build System")}
|
|
12
|
+
${chalk.hex("#FFD54F")("( >🎣")} ${chalk.dim("v" + HUDSON_VERSION)}
|
|
13
|
+
${chalk.hex("#FFD54F")("/ >")}
|
|
14
|
+
${chalk.hex("#4FC3F7")("━━━━━━━━━━━━━━━")}
|
|
15
|
+
${chalk.hex("#4FC3F7")("≋ ≋ ≋ ≋ ≋ ≋ ≋ ≋")}
|
|
16
|
+
${chalk.hex("#1565C0")("~ ~ ~ ~ ~ ~ ~ ~")}
|
|
17
|
+
`;
|
|
18
|
+
export const BANNER = () => {
|
|
19
|
+
const title = gradient(["#4FC3F7", "#81C784", "#FFD54F"])(" HUDSON");
|
|
20
|
+
return `
|
|
21
|
+
${title} ${chalk.dim(`v${HUDSON_VERSION}`)} ${chalk.hex("#4FC3F7")("⛵")}
|
|
22
|
+
${chalk.hex("#4FC3F7")(" ──────────────────────────────")}
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
export const symbols = {
|
|
26
|
+
success: chalk.green("✔"),
|
|
27
|
+
error: chalk.red("✘"),
|
|
28
|
+
warning: chalk.yellow("⚠"),
|
|
29
|
+
info: chalk.cyan("ℹ"),
|
|
30
|
+
arrow: chalk.dim("→"),
|
|
31
|
+
dot: chalk.dim("·"),
|
|
32
|
+
bullet: chalk.cyan("◆"),
|
|
33
|
+
fish: "🐟",
|
|
34
|
+
hook: "🎣",
|
|
35
|
+
};
|
|
36
|
+
export const log = {
|
|
37
|
+
success: (msg) => console.log(` ${symbols.success} ${chalk.green(msg)}`),
|
|
38
|
+
error: (msg) => console.log(` ${symbols.error} ${chalk.red(msg)}`),
|
|
39
|
+
warn: (msg) => console.log(` ${symbols.warning} ${chalk.yellow(msg)}`),
|
|
40
|
+
info: (msg) => console.log(` ${symbols.info} ${chalk.cyan(msg)}`),
|
|
41
|
+
step: (msg) => console.log(` ${symbols.arrow} ${chalk.white(msg)}`),
|
|
42
|
+
dim: (msg) => console.log(` ${chalk.dim(msg)}`),
|
|
43
|
+
blank: () => console.log(),
|
|
44
|
+
section: (title) => {
|
|
45
|
+
console.log();
|
|
46
|
+
console.log(` ${chalk.bold.hex("#FFD54F")(title)}`);
|
|
47
|
+
console.log(` ${chalk.dim("─".repeat(40))}`);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export function formatDuration(ms) {
|
|
51
|
+
if (ms < 1000)
|
|
52
|
+
return `${ms}ms`;
|
|
53
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
54
|
+
}
|
|
55
|
+
export function formatSize(bytes) {
|
|
56
|
+
if (bytes < 1024)
|
|
57
|
+
return `${bytes}B`;
|
|
58
|
+
if (bytes < 1024 * 1024)
|
|
59
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
60
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)}MB`;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/utils/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,gDAAgD;AAChD,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC;EAC5F,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;EAC5B,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC;CACpC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;MACrB,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,YAAY,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC;MAC1E,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,cAAc,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,cAAc,CAAC;MAC1E,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC;IAC7B,KAAK,C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CAAC;IAChC,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,IAAI,KAAK,GAAG,IAAI;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IACrC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;QAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IACjE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
package/.hudson/hudson.yml
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
#
|
|
3
|
-
# ██╗ ██╗██╗ ██╗██████╗ ███████╗ ██████╗ ███╗ ██╗
|
|
4
|
-
# ██║ ██║██║ ██║██╔══██╗██╔════╝██╔═══██╗████╗ ██║
|
|
5
|
-
# ███████║██║ ██║██║ ██║███████╗██║ ██║██╔██╗ ██║
|
|
6
|
-
# ██╔══██║██║ ██║██║ ██║╚════██║██║ ██║██║╚██╗██║
|
|
7
|
-
# ██║ ██║╚██████╔╝██████╔╝███████║╚██████╔╝██║ ╚████║
|
|
8
|
-
# ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝
|
|
9
|
-
#
|
|
10
|
-
# Hudson Build System — v1.0.0
|
|
11
|
-
# The blazing-fast TypeScript build system
|
|
12
|
-
#
|
|
13
|
-
# ─────────────────────────────────────────────────────
|
|
14
|
-
# Configure via CLI (without editing this file):
|
|
15
|
-
#
|
|
16
|
-
# hudson configure <key> <value>
|
|
17
|
-
#
|
|
18
|
-
# Examples:
|
|
19
|
-
# hudson configure build.outDir dist
|
|
20
|
-
# hudson configure output.verbose true
|
|
21
|
-
# hudson configure packageManager pnpm
|
|
22
|
-
#
|
|
23
|
-
# ─────────────────────────────────────────────────────
|
|
24
|
-
# Docs: https://github.com/hudson-build/hudson
|
|
25
|
-
#
|
|
26
|
-
#####################################################################
|
|
27
|
-
|
|
28
|
-
project:
|
|
29
|
-
name: hudson
|
|
30
|
-
version: 1.0.0
|
|
31
|
-
description: A Hudson-managed project
|
|
32
|
-
build:
|
|
33
|
-
outDir: dist
|
|
34
|
-
tsconfig: tsconfig.json
|
|
35
|
-
sourcemap: true
|
|
36
|
-
minify: false
|
|
37
|
-
target: ES2022
|
|
38
|
-
clean: true
|
|
39
|
-
workspaces:
|
|
40
|
-
enabled: false
|
|
41
|
-
packages:
|
|
42
|
-
- packages/*
|
|
43
|
-
parallel: true
|
|
44
|
-
maxConcurrency: 4
|
|
45
|
-
dev:
|
|
46
|
-
watch: true
|
|
47
|
-
open: false
|
|
48
|
-
scripts:
|
|
49
|
-
build: tsc
|
|
50
|
-
dev: tsc --watch
|
|
51
|
-
test: node --test
|
|
52
|
-
lint: eslint .
|
|
53
|
-
clean: rm -rf dist
|
|
54
|
-
hooks: {}
|
|
55
|
-
packageManager: pnpm
|
|
56
|
-
output:
|
|
57
|
-
verbose: false
|
|
58
|
-
timestamps: true
|
|
59
|
-
color: true
|
|
60
|
-
banner: true
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#####################################################################
|
|
2
|
-
#
|
|
3
|
-
# ██╗ ██╗██╗ ██╗██████╗ ███████╗ ██████╗ ███╗ ██╗
|
|
4
|
-
# ██║ ██║██║ ██║██╔══██╗██╔════╝██╔═══██╗████╗ ██║
|
|
5
|
-
# ███████║██║ ██║██║ ██║███████╗██║ ██║██╔██╗ ██║
|
|
6
|
-
# ██╔══██║██║ ██║██║ ██║╚════██║██║ ██║██║╚██╗██║
|
|
7
|
-
# ██║ ██║╚██████╔╝██████╔╝███████║╚██████╔╝██║ ╚████║
|
|
8
|
-
# ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝
|
|
9
|
-
#
|
|
10
|
-
# Hudson Build System — v1.0.0
|
|
11
|
-
# The blazing-fast TypeScript build system
|
|
12
|
-
#
|
|
13
|
-
# ─────────────────────────────────────────────────────
|
|
14
|
-
# Configure via CLI (without editing this file):
|
|
15
|
-
#
|
|
16
|
-
# hudson configure <key> <value>
|
|
17
|
-
#
|
|
18
|
-
# Examples:
|
|
19
|
-
# hudson configure build.outDir dist
|
|
20
|
-
# hudson configure output.verbose true
|
|
21
|
-
# hudson configure packageManager pnpm
|
|
22
|
-
#
|
|
23
|
-
# ─────────────────────────────────────────────────────
|
|
24
|
-
# Docs: https://github.com/hudson-build/hudson
|
|
25
|
-
#
|
|
26
|
-
#####################################################################
|
|
27
|
-
|
|
28
|
-
project:
|
|
29
|
-
name: example
|
|
30
|
-
version: 1.0.0
|
|
31
|
-
description: A Hudson-managed project
|
|
32
|
-
build:
|
|
33
|
-
outDir: dist
|
|
34
|
-
tsconfig: tsconfig.json
|
|
35
|
-
sourcemap: true
|
|
36
|
-
minify: false
|
|
37
|
-
target: ES2022
|
|
38
|
-
clean: true
|
|
39
|
-
workspaces:
|
|
40
|
-
enabled: false
|
|
41
|
-
packages:
|
|
42
|
-
"0": packages/*
|
|
43
|
-
parallel: true
|
|
44
|
-
maxConcurrency: 4
|
|
45
|
-
dev:
|
|
46
|
-
watch: true
|
|
47
|
-
open: false
|
|
48
|
-
scripts:
|
|
49
|
-
build: tsc
|
|
50
|
-
dev: tsc --watch
|
|
51
|
-
test: node --test
|
|
52
|
-
lint: eslint .
|
|
53
|
-
clean: rm -rf dist
|
|
54
|
-
hooks: {}
|
|
55
|
-
packageManager: pnpm
|
|
56
|
-
output:
|
|
57
|
-
verbose: false
|
|
58
|
-
timestamps: true
|
|
59
|
-
color: true
|
|
60
|
-
banner: true
|
package/example/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
console.log("hey!")
|
package/example/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"sourceMap": true,
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"allowImportingTsExtensions": false,
|
|
16
|
-
"noUnusedLocals": false,
|
|
17
|
-
"noUnusedParameters": false
|
|
18
|
-
},
|
|
19
|
-
"include": ["src/**/*"],
|
|
20
|
-
"exclude": ["node_modules", "dist"]
|
|
21
|
-
}
|
package/src/commands/build.ts
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import ora from "ora";
|
|
4
|
-
import chalk from "chalk";
|
|
5
|
-
import { loadConfig, HudsonConfig } from "../core/config.js";
|
|
6
|
-
import { runCommand, runHook } from "../core/runner.js";
|
|
7
|
-
import { discoverWorkspaces, topologicalSort, Workspace } from "../core/workspace.js";
|
|
8
|
-
import { log, formatDuration, symbols, BANNER } from "../utils/display.js";
|
|
9
|
-
|
|
10
|
-
interface BuildOptions {
|
|
11
|
-
workspace?: string;
|
|
12
|
-
verbose?: boolean;
|
|
13
|
-
clean?: boolean;
|
|
14
|
-
watch?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function buildCommand(options: BuildOptions = {}): Promise<void> {
|
|
18
|
-
const cwd = process.cwd();
|
|
19
|
-
const config = loadConfig(cwd);
|
|
20
|
-
const verbose = options.verbose ?? config.output.verbose;
|
|
21
|
-
|
|
22
|
-
if (config.output.banner) {
|
|
23
|
-
console.log(BANNER());
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
log.section("Build");
|
|
27
|
-
|
|
28
|
-
const start = Date.now();
|
|
29
|
-
|
|
30
|
-
// Pre-build hook
|
|
31
|
-
if (config.hooks.preBuild) {
|
|
32
|
-
const ok = await runHook("preBuild", config, cwd);
|
|
33
|
-
if (!ok) {
|
|
34
|
-
log.error("Pre-build hook failed");
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Clean output directory
|
|
40
|
-
const shouldClean = options.clean ?? config.build.clean;
|
|
41
|
-
if (shouldClean) {
|
|
42
|
-
const outDir = path.join(cwd, config.build.outDir);
|
|
43
|
-
if (fs.existsSync(outDir)) {
|
|
44
|
-
const spinner = ora({ text: chalk.dim("Cleaning output directory..."), prefixText: " " }).start();
|
|
45
|
-
fs.rmSync(outDir, { recursive: true, force: true });
|
|
46
|
-
spinner.succeed(chalk.dim("Cleaned " + chalk.cyan(config.build.outDir)));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (config.workspaces.enabled && !options.workspace) {
|
|
51
|
-
await buildWorkspaces(config, cwd, verbose);
|
|
52
|
-
} else if (options.workspace) {
|
|
53
|
-
const workspaces = await discoverWorkspaces(config, cwd);
|
|
54
|
-
const ws = workspaces.find((w) => w.name === options.workspace);
|
|
55
|
-
if (!ws) {
|
|
56
|
-
log.error(`Workspace '${options.workspace}' not found`);
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
await buildSingleWorkspace(ws, config, verbose);
|
|
60
|
-
} else {
|
|
61
|
-
await buildProject(config, cwd, verbose, options.watch);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Post-build hook
|
|
65
|
-
if (config.hooks.postBuild) {
|
|
66
|
-
await runHook("postBuild", config, cwd);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const duration = Date.now() - start;
|
|
70
|
-
log.blank();
|
|
71
|
-
log.success(
|
|
72
|
-
`Build complete ${chalk.dim("in")} ${chalk.cyan(formatDuration(duration))}`
|
|
73
|
-
);
|
|
74
|
-
log.blank();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async function buildProject(
|
|
78
|
-
config: HudsonConfig,
|
|
79
|
-
cwd: string,
|
|
80
|
-
verbose: boolean,
|
|
81
|
-
watch = false
|
|
82
|
-
): Promise<void> {
|
|
83
|
-
const tsconfig = path.join(cwd, config.build.tsconfig);
|
|
84
|
-
|
|
85
|
-
if (!fs.existsSync(tsconfig)) {
|
|
86
|
-
log.error(`tsconfig not found: ${config.build.tsconfig}`);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const args = ["-p", config.build.tsconfig];
|
|
91
|
-
if (watch) args.push("--watch");
|
|
92
|
-
if (config.build.sourcemap) args.push("--sourceMap");
|
|
93
|
-
|
|
94
|
-
const spinner = ora({
|
|
95
|
-
text: watch ? chalk.dim("Watching for changes...") : chalk.dim("Compiling TypeScript..."),
|
|
96
|
-
prefixText: " ",
|
|
97
|
-
}).start();
|
|
98
|
-
|
|
99
|
-
const result = await runCommand("tsc", args, { cwd, verbose });
|
|
100
|
-
|
|
101
|
-
if (result.exitCode === 0) {
|
|
102
|
-
spinner.succeed(chalk.white("TypeScript compiled") + chalk.dim(` ${formatDuration(result.duration)}`));
|
|
103
|
-
if (verbose && result.stdout) {
|
|
104
|
-
result.stdout.split("\n").filter(Boolean).forEach((l) => log.dim(l));
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
spinner.fail(chalk.red("TypeScript compilation failed"));
|
|
108
|
-
if (result.stderr) {
|
|
109
|
-
log.blank();
|
|
110
|
-
result.stderr.split("\n").filter(Boolean).forEach((l) => {
|
|
111
|
-
console.log(` ${chalk.red(l)}`);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
process.exit(1);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async function buildWorkspaces(
|
|
119
|
-
config: HudsonConfig,
|
|
120
|
-
cwd: string,
|
|
121
|
-
verbose: boolean
|
|
122
|
-
): Promise<void> {
|
|
123
|
-
const workspaces = await discoverWorkspaces(config, cwd);
|
|
124
|
-
|
|
125
|
-
if (workspaces.length === 0) {
|
|
126
|
-
log.warn("No workspaces found. Check your workspaces.packages config.");
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const sorted = topologicalSort(workspaces);
|
|
131
|
-
log.step(`Found ${chalk.cyan(sorted.length)} workspace${sorted.length !== 1 ? "s" : ""}`);
|
|
132
|
-
log.blank();
|
|
133
|
-
|
|
134
|
-
if (config.workspaces.parallel) {
|
|
135
|
-
const chunks: Workspace[][] = [];
|
|
136
|
-
const batchSize = config.workspaces.maxConcurrency;
|
|
137
|
-
|
|
138
|
-
for (let i = 0; i < sorted.length; i += batchSize) {
|
|
139
|
-
chunks.push(sorted.slice(i, i + batchSize));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
for (const chunk of chunks) {
|
|
143
|
-
await Promise.all(chunk.map((ws) => buildSingleWorkspace(ws, config, verbose)));
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
for (const ws of sorted) {
|
|
147
|
-
await buildSingleWorkspace(ws, config, verbose);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async function buildSingleWorkspace(
|
|
153
|
-
ws: Workspace,
|
|
154
|
-
config: HudsonConfig,
|
|
155
|
-
verbose: boolean
|
|
156
|
-
): Promise<void> {
|
|
157
|
-
const buildScript = ws.scripts["build"];
|
|
158
|
-
|
|
159
|
-
if (!buildScript) {
|
|
160
|
-
log.warn(` ${chalk.cyan(ws.name)} has no build script, skipping`);
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
const spinner = ora({
|
|
165
|
-
text: chalk.dim(`Building ${chalk.cyan(ws.name)}...`),
|
|
166
|
-
prefixText: " ",
|
|
167
|
-
}).start();
|
|
168
|
-
|
|
169
|
-
const parts = buildScript.split(" ");
|
|
170
|
-
const result = await runCommand(parts[0], parts.slice(1), {
|
|
171
|
-
cwd: ws.path,
|
|
172
|
-
verbose,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
if (result.exitCode === 0) {
|
|
176
|
-
spinner.succeed(
|
|
177
|
-
`${chalk.cyan(ws.name)} ${chalk.dim("built")} ${chalk.dim(formatDuration(result.duration))}`
|
|
178
|
-
);
|
|
179
|
-
} else {
|
|
180
|
-
spinner.fail(`${chalk.red(ws.name)} ${chalk.red("failed")}`);
|
|
181
|
-
if (result.stderr) {
|
|
182
|
-
result.stderr.split("\n").filter(Boolean).forEach((l) => {
|
|
183
|
-
console.log(` ${chalk.dim(l)}`);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { loadConfig, setConfigValue, getConfigValue, saveConfig } from "../core/config.js";
|
|
3
|
-
import { log } from "../utils/display.js";
|
|
4
|
-
|
|
5
|
-
export async function configureCommand(
|
|
6
|
-
key?: string,
|
|
7
|
-
value?: string,
|
|
8
|
-
options: { list?: boolean; reset?: boolean; get?: string } = {}
|
|
9
|
-
): Promise<void> {
|
|
10
|
-
const cwd = process.cwd();
|
|
11
|
-
|
|
12
|
-
if (options.list) {
|
|
13
|
-
await listConfig(cwd);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (options.reset) {
|
|
18
|
-
const { DEFAULT_CONFIG } = await import("../core/config.js");
|
|
19
|
-
saveConfig(DEFAULT_CONFIG, cwd);
|
|
20
|
-
log.success("Config reset to defaults");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (options.get) {
|
|
25
|
-
const val = getConfigValue(options.get, cwd);
|
|
26
|
-
if (val === undefined) {
|
|
27
|
-
log.error(`Config key '${options.get}' not found`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
console.log(` ${chalk.cyan(options.get)} ${chalk.dim("=")} ${chalk.white(String(val))}`);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (!key || value === undefined) {
|
|
35
|
-
log.error("Usage: hudson configure <key> <value>");
|
|
36
|
-
log.dim("Example: hudson configure build.outDir dist");
|
|
37
|
-
log.dim(" hudson configure output.verbose true");
|
|
38
|
-
log.dim(" hudson configure packageManager pnpm");
|
|
39
|
-
log.blank();
|
|
40
|
-
log.step(`List all keys: ${chalk.cyan("hudson configure --list")}`);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setConfigValue(key, value, cwd);
|
|
45
|
-
log.success(`Set ${chalk.cyan(key)} ${chalk.dim("→")} ${chalk.white(value)}`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function listConfig(cwd: string): Promise<void> {
|
|
49
|
-
const config = loadConfig(cwd);
|
|
50
|
-
|
|
51
|
-
log.section("Configuration");
|
|
52
|
-
printObject(config, "", 0);
|
|
53
|
-
log.blank();
|
|
54
|
-
log.dim(`Config file: ${chalk.cyan(".hudson/hudson.yml")}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function printObject(obj: unknown, prefix: string, depth: number): void {
|
|
58
|
-
if (typeof obj !== "object" || obj === null) return;
|
|
59
|
-
|
|
60
|
-
const indent = " ".repeat(depth + 1);
|
|
61
|
-
|
|
62
|
-
for (const [key, value] of Object.entries(obj as Record<string, unknown>)) {
|
|
63
|
-
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
64
|
-
|
|
65
|
-
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
66
|
-
console.log(`${indent}${chalk.dim(key + ":")}`);
|
|
67
|
-
printObject(value, fullKey, depth + 1);
|
|
68
|
-
} else if (Array.isArray(value)) {
|
|
69
|
-
console.log(
|
|
70
|
-
`${indent}${chalk.hex("#4FC3F7")(fullKey)} ${chalk.dim("=")} ${chalk.yellow(JSON.stringify(value))}`
|
|
71
|
-
);
|
|
72
|
-
} else {
|
|
73
|
-
const displayValue =
|
|
74
|
-
typeof value === "boolean"
|
|
75
|
-
? value
|
|
76
|
-
? chalk.green(String(value))
|
|
77
|
-
: chalk.red(String(value))
|
|
78
|
-
: chalk.white(String(value));
|
|
79
|
-
|
|
80
|
-
console.log(
|
|
81
|
-
`${indent}${chalk.hex("#4FC3F7")(fullKey)} ${chalk.dim("=")} ${displayValue}`
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|