···11-MIT License Copyright (c) 2024 [Bombshell contributors](https://bomb.sh/team)
11+MIT License Copyright (c) 2025-Present [Bombshell contributors](https://bomb.sh/team)
2233Permission is hereby granted, free of
44charge, to any person obtaining a copy of this software and associated
+8-21
README.md
···11-# `@bomb.sh/stub`
11+# `@bomb.sh/nucleus`
2233-## Install
44-55-You can install `@bomb.sh/stub` manually by running this command:
66-77-```sh
88-npm install @bomb.sh/stub
99-```
1010-1111-Looking for help? Start with our [Getting Started][docs] guide.
1212-1313-## Documentation
1414-1515-Visit our [official documentation][docs].
1616-1717-## Support
1818-1919-Having trouble? Get help in the official [Bombshell Discord][discord].
2020-2121-[docs]: https://bomb.sh/docs
2222-[discord]: https://bomb.sh/chat
33+This package is the internal CLI for our org. It provides:
44+- standardized `dev` command (`node --strip-types`)
55+- standardized `build` command with `esbuild`
66+- standardized `test` command
77+- standardized `lint` and `format` commands
88+- standardized `tsconfig` settings
99+- an opportunity to dogfood our packages
···11+// standardized `dev` command, shells out to `node --strip-types`
22+import { argv } from "node:process";
33+44+import { x } from "tinyexec";
55+import type { CommandContext } from "../context.ts";
66+77+export async function dev(ctx: CommandContext) {
88+ const { args } = ctx;
99+ const [file = "./src/index.ts", ...rest] = args;
1010+ // console.clear();
1111+ console.log(
1212+ `node --experimental-strip-types --no-warnings ${args.join(" ")}`,
1313+ );
1414+ const stdio = x("node", [
1515+ "--experimental-strip-types",
1616+ "--no-warnings",
1717+ "--watch-path=./src/",
1818+ file,
1919+ ...rest,
2020+ ]);
2121+ console.log("Starting dev server...");
2222+ console.log("Press Ctrl+C to stop the server.");
2323+2424+ for await (const line of stdio) {
2525+ if (line.startsWith("Restarting")) {
2626+ console.log(line);
2727+ continue;
2828+ }
2929+ if (line.startsWith("Completed")) {
3030+ console.log();
3131+ continue;
3232+ }
3333+ console.log(line);
3434+ }
3535+}
+13
src/commands/format.ts
···11+import { x } from "tinyexec";
22+import type { CommandContext } from "../context.ts";
33+44+// standardized `format` command, runs `@biomejs/biome` and fixes formatting
55+export async function format(ctx: CommandContext) {
66+ console.clear();
77+ console.log("Running format command...");
88+ const stdio = x("biome", ["check", "--write", "./src"]);
99+1010+ for await (const line of stdio) {
1111+ console.log(line);
1212+ }
1313+}
+41
src/commands/init.ts
···11+import { readFile, writeFile } from "node:fs/promises";
22+import { dirname, sep } from "node:path";
33+import { cwd } from "node:process";
44+import { pathToFileURL } from "node:url";
55+import { parse } from "@bomb.sh/args";
66+import { x } from "tinyexec";
77+import type { CommandContext } from "../context.ts";
88+99+export async function init(ctx: CommandContext) {
1010+ const [_name = '.', ...args] = ctx.args;
1111+ const name = _name === '.' ? dirname(cwd()) : _name;
1212+ const dest = new URL("./.temp/", pathToFileURL([cwd(), sep].join("")));
1313+ for await (const line of x("pnpx", ["giget@latest", "gh:bombshell-dev/template", name])) {
1414+ console.log(line);
1515+ }
1616+ const {
1717+ default: { version },
1818+ } = await import("@bomb.sh/nucleus/package.json", { with: { type: "json" } });
1919+2020+ const promises: Promise<void>[] = [];
2121+ for (const file of ["package.json", "README.md"]) {
2222+ promises.push(postprocess(new URL(file, dest), (contents) => {
2323+ return contents
2424+ .replaceAll("$name", name)
2525+ .replaceAll("$nucleus_version", version);
2626+ }));
2727+ }
2828+ await Promise.all(promises);
2929+}
3030+3131+async function postprocess(
3232+ file: URL,
3333+ transform: (
3434+ contents: string,
3535+ ) => string | undefined | Promise<string | undefined>,
3636+) {
3737+ const contents = await readFile(file, { encoding: "utf8" });
3838+ const result = await transform(contents);
3939+ if (!result) return;
4040+ await writeFile(file, result, { encoding: "utf8" });
4141+}
+4
src/commands/lint.ts
···11+import type { CommandContext } from "../context.ts";
22+33+// standardized `lint` command, runs `@biomejs/biome` and generates a lint report
44+export async function lint(ctx: CommandContext) {}
+4
src/commands/test.ts
···11+import type { CommandContext } from "../context.ts";
22+33+// standardized `test` command, shells out to `node test --strip-types`
44+export async function test(ctx: CommandContext) {}