@outfitter/tooling 0.2.4 → 0.3.3
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/README.md +69 -1
- package/biome.json +1 -1
- package/dist/cli/index.js +163 -24
- package/dist/index.d.ts +79 -4
- package/dist/index.js +17 -6
- package/dist/shared/chunk-cmde0fwx.js +421 -0
- package/package.json +14 -7
- package/registry/registry.json +6 -6
- package/dist/cli/check-boundary-invocations.d.ts +0 -34
- package/dist/cli/check-boundary-invocations.js +0 -14
- package/dist/cli/check-bunup-registry.d.ts +0 -36
- package/dist/cli/check-bunup-registry.js +0 -12
- package/dist/cli/check-changeset.d.ts +0 -64
- package/dist/cli/check-changeset.js +0 -14
- package/dist/cli/check-clean-tree.d.ts +0 -36
- package/dist/cli/check-clean-tree.js +0 -14
- package/dist/cli/check-exports.d.ts +0 -2
- package/dist/cli/check-exports.js +0 -14
- package/dist/cli/check-readme-imports.d.ts +0 -61
- package/dist/cli/check-readme-imports.js +0 -198
- package/dist/cli/check.d.ts +0 -19
- package/dist/cli/check.js +0 -10
- package/dist/cli/fix.d.ts +0 -19
- package/dist/cli/fix.js +0 -10
- package/dist/cli/init.d.ts +0 -31
- package/dist/cli/init.js +0 -12
- package/dist/cli/pre-push.d.ts +0 -41
- package/dist/cli/pre-push.js +0 -20
- package/dist/cli/upgrade-bun.d.ts +0 -8
- package/dist/cli/upgrade-bun.js +0 -8
- package/dist/registry/build.d.ts +0 -6
- package/dist/registry/build.js +0 -147
- package/dist/registry/index.d.ts +0 -3
- package/dist/registry/index.js +0 -13
- package/dist/registry/schema.d.ts +0 -2
- package/dist/registry/schema.js +0 -12
- package/dist/shared/@outfitter/tooling-0x5q15ec.js +0 -21
- package/dist/shared/@outfitter/tooling-1y8w5ahg.js +0 -70
- package/dist/shared/@outfitter/tooling-3w8vr2w3.js +0 -94
- package/dist/shared/@outfitter/tooling-8sd32ts6.js +0 -277
- package/dist/shared/@outfitter/tooling-9errkcvk.js +0 -21
- package/dist/shared/@outfitter/tooling-9vs606gq.d.ts +0 -3
- package/dist/shared/@outfitter/tooling-9yzd08v1.js +0 -146
- package/dist/shared/@outfitter/tooling-ctmgnap5.js +0 -19
- package/dist/shared/@outfitter/tooling-dvwh9qve.js +0 -4
- package/dist/shared/@outfitter/tooling-enjcenja.js +0 -229
- package/dist/shared/@outfitter/tooling-g83d0kjv.js +0 -23
- package/dist/shared/@outfitter/tooling-kcvs6mys.js +0 -1
- package/dist/shared/@outfitter/tooling-mxwc1n8w.js +0 -68
- package/dist/shared/@outfitter/tooling-r9976n43.js +0 -100
- package/dist/shared/@outfitter/tooling-sjm8nebx.d.ts +0 -109
- package/dist/shared/@outfitter/tooling-t17gnh9b.js +0 -78
- package/dist/shared/@outfitter/tooling-wesswf21.d.ts +0 -59
- package/dist/shared/chunk-8aenrm6f.js +0 -18
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -8
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { ZodType } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* File entry in a block.
|
|
4
|
-
*/
|
|
5
|
-
interface FileEntry {
|
|
6
|
-
/** Destination path relative to project root */
|
|
7
|
-
path: string;
|
|
8
|
-
/** File contents (embedded in registry) */
|
|
9
|
-
content: string;
|
|
10
|
-
/** Whether to chmod +x after copying */
|
|
11
|
-
executable?: boolean | undefined;
|
|
12
|
-
/** Whether to process as a template (future) */
|
|
13
|
-
template?: boolean | undefined;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Schema for a file entry in a block.
|
|
17
|
-
* Represents a file that will be copied to the user's project.
|
|
18
|
-
*/
|
|
19
|
-
declare const FileEntrySchema: ZodType<FileEntry>;
|
|
20
|
-
/**
|
|
21
|
-
* Block in the registry.
|
|
22
|
-
*/
|
|
23
|
-
interface Block {
|
|
24
|
-
/** Block name (matches the key in blocks record) */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Human-readable description */
|
|
27
|
-
description: string;
|
|
28
|
-
/** Files included in this block */
|
|
29
|
-
files?: FileEntry[] | undefined;
|
|
30
|
-
/** npm dependencies to add to package.json */
|
|
31
|
-
dependencies?: Record<string, string> | undefined;
|
|
32
|
-
/** npm devDependencies to add to package.json */
|
|
33
|
-
devDependencies?: Record<string, string> | undefined;
|
|
34
|
-
/** Other blocks this block extends (for composite blocks) */
|
|
35
|
-
extends?: string[] | undefined;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Schema for a block in the registry.
|
|
39
|
-
* A block is a collection of related files that can be added together.
|
|
40
|
-
*/
|
|
41
|
-
declare const BlockSchema: ZodType<Block>;
|
|
42
|
-
/**
|
|
43
|
-
* Complete registry structure.
|
|
44
|
-
*/
|
|
45
|
-
interface Registry {
|
|
46
|
-
/** Registry schema version */
|
|
47
|
-
version: string;
|
|
48
|
-
/** Map of block name to block definition */
|
|
49
|
-
blocks: Record<string, Block>;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Schema for the complete registry.
|
|
53
|
-
* Contains all available blocks with their files and metadata.
|
|
54
|
-
*/
|
|
55
|
-
declare const RegistrySchema: ZodType<Registry>;
|
|
56
|
-
/**
|
|
57
|
-
* Block definition used in the build script.
|
|
58
|
-
* Specifies how to collect source files into a block.
|
|
59
|
-
*/
|
|
60
|
-
interface BlockDefinition {
|
|
61
|
-
/** Human-readable description */
|
|
62
|
-
description: string;
|
|
63
|
-
/** Source file paths (relative to repo root) */
|
|
64
|
-
files?: string[];
|
|
65
|
-
/** Remap source paths to destination paths */
|
|
66
|
-
remap?: Record<string, string>;
|
|
67
|
-
/** npm dependencies */
|
|
68
|
-
dependencies?: Record<string, string>;
|
|
69
|
-
/** npm devDependencies */
|
|
70
|
-
devDependencies?: Record<string, string>;
|
|
71
|
-
/** Other blocks this block extends */
|
|
72
|
-
extends?: string[];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Configuration for the registry build.
|
|
76
|
-
*/
|
|
77
|
-
interface RegistryBuildConfig {
|
|
78
|
-
/** Registry schema version */
|
|
79
|
-
version: string;
|
|
80
|
-
/** Block definitions */
|
|
81
|
-
blocks: Record<string, BlockDefinition>;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Result of adding a block to a project.
|
|
85
|
-
*/
|
|
86
|
-
interface AddBlockResult {
|
|
87
|
-
/** Files that were created */
|
|
88
|
-
created: string[];
|
|
89
|
-
/** Files that were skipped (already exist) */
|
|
90
|
-
skipped: string[];
|
|
91
|
-
/** Files that were overwritten (with --force) */
|
|
92
|
-
overwritten: string[];
|
|
93
|
-
/** Dependencies added to package.json */
|
|
94
|
-
dependencies: Record<string, string>;
|
|
95
|
-
/** devDependencies added to package.json */
|
|
96
|
-
devDependencies: Record<string, string>;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Options for the add command.
|
|
100
|
-
*/
|
|
101
|
-
interface AddBlockOptions {
|
|
102
|
-
/** Overwrite existing files */
|
|
103
|
-
force?: boolean;
|
|
104
|
-
/** Show what would be added without making changes */
|
|
105
|
-
dryRun?: boolean;
|
|
106
|
-
/** Working directory (defaults to cwd) */
|
|
107
|
-
cwd?: string;
|
|
108
|
-
}
|
|
109
|
-
export { FileEntry, FileEntrySchema, Block, BlockSchema, Registry, RegistrySchema, BlockDefinition, RegistryBuildConfig, AddBlockResult, AddBlockOptions };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/tooling/src/cli/check-bunup-registry.ts
|
|
3
|
-
import { resolve } from "path";
|
|
4
|
-
function extractBunupFilterName(script) {
|
|
5
|
-
const match = script.match(/bunup\s+--filter\s+(\S+)/);
|
|
6
|
-
return match?.[1] ?? null;
|
|
7
|
-
}
|
|
8
|
-
function findUnregisteredPackages(packagesWithFilter, registeredNames) {
|
|
9
|
-
const registered = new Set(registeredNames);
|
|
10
|
-
const missing = packagesWithFilter.filter((name) => !registered.has(name)).sort();
|
|
11
|
-
return {
|
|
12
|
-
ok: missing.length === 0,
|
|
13
|
-
missing
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
var COLORS = {
|
|
17
|
-
reset: "\x1B[0m",
|
|
18
|
-
red: "\x1B[31m",
|
|
19
|
-
green: "\x1B[32m",
|
|
20
|
-
yellow: "\x1B[33m",
|
|
21
|
-
blue: "\x1B[34m",
|
|
22
|
-
dim: "\x1B[2m"
|
|
23
|
-
};
|
|
24
|
-
async function runCheckBunupRegistry() {
|
|
25
|
-
const cwd = process.cwd();
|
|
26
|
-
const configPath = resolve(cwd, "bunup.config.ts");
|
|
27
|
-
let registeredNames;
|
|
28
|
-
try {
|
|
29
|
-
const configModule = await import(configPath);
|
|
30
|
-
const rawConfig = configModule.default;
|
|
31
|
-
if (!Array.isArray(rawConfig)) {
|
|
32
|
-
process.stderr.write(`bunup.config.ts must export a workspace array
|
|
33
|
-
`);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
registeredNames = rawConfig.map((entry) => entry.name);
|
|
37
|
-
} catch {
|
|
38
|
-
process.stderr.write(`Could not load bunup.config.ts from ${cwd}
|
|
39
|
-
`);
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
const packagesWithFilter = [];
|
|
43
|
-
const glob = new Bun.Glob("{packages,apps}/*/package.json");
|
|
44
|
-
for (const match of glob.scanSync({ cwd })) {
|
|
45
|
-
const pkgPath = resolve(cwd, match);
|
|
46
|
-
try {
|
|
47
|
-
const pkg = await Bun.file(pkgPath).json();
|
|
48
|
-
const buildScript = pkg.scripts?.["build"];
|
|
49
|
-
if (!buildScript)
|
|
50
|
-
continue;
|
|
51
|
-
const filterName = extractBunupFilterName(buildScript);
|
|
52
|
-
if (filterName) {
|
|
53
|
-
packagesWithFilter.push(filterName);
|
|
54
|
-
}
|
|
55
|
-
} catch {}
|
|
56
|
-
}
|
|
57
|
-
const result = findUnregisteredPackages(packagesWithFilter, registeredNames);
|
|
58
|
-
if (result.ok) {
|
|
59
|
-
process.stdout.write(`${COLORS.green}All ${packagesWithFilter.length} packages with bunup --filter are registered in bunup.config.ts.${COLORS.reset}
|
|
60
|
-
`);
|
|
61
|
-
process.exit(0);
|
|
62
|
-
}
|
|
63
|
-
process.stderr.write(`${COLORS.red}${result.missing.length} package(s) have bunup --filter build scripts but are not registered in bunup.config.ts:${COLORS.reset}
|
|
64
|
-
|
|
65
|
-
`);
|
|
66
|
-
for (const name of result.missing) {
|
|
67
|
-
process.stderr.write(` ${COLORS.yellow}${name}${COLORS.reset} ${COLORS.dim}(missing from workspace array)${COLORS.reset}
|
|
68
|
-
`);
|
|
69
|
-
}
|
|
70
|
-
process.stderr.write(`
|
|
71
|
-
Add the missing entries to ${COLORS.blue}bunup.config.ts${COLORS.reset} defineWorkspace array.
|
|
72
|
-
`);
|
|
73
|
-
process.stderr.write(`Without registration, ${COLORS.dim}bunup --filter <name>${COLORS.reset} silently exits with no output.
|
|
74
|
-
`);
|
|
75
|
-
process.exit(1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export { extractBunupFilterName, findUnregisteredPackages, runCheckBunupRegistry };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/** A package.json map: keys are subpaths, values are conditions or strings */
|
|
2
|
-
type ExportMap = Record<string, unknown>;
|
|
3
|
-
/** Describes drift between expected and actual exports for a single package */
|
|
4
|
-
interface ExportDrift {
|
|
5
|
-
readonly package: string;
|
|
6
|
-
readonly path: string;
|
|
7
|
-
readonly added: string[];
|
|
8
|
-
readonly removed: string[];
|
|
9
|
-
readonly changed: Array<{
|
|
10
|
-
readonly key: string;
|
|
11
|
-
readonly expected: unknown;
|
|
12
|
-
readonly actual: unknown;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
15
|
-
/** Per-package comparison result */
|
|
16
|
-
interface PackageResult {
|
|
17
|
-
readonly name: string;
|
|
18
|
-
readonly status: "ok" | "drift";
|
|
19
|
-
readonly drift?: ExportDrift;
|
|
20
|
-
}
|
|
21
|
-
/** Aggregated result across all checked packages */
|
|
22
|
-
interface CheckResult {
|
|
23
|
-
readonly ok: boolean;
|
|
24
|
-
readonly packages: PackageResult[];
|
|
25
|
-
}
|
|
26
|
-
/** Input for comparing a single package's exports */
|
|
27
|
-
interface CompareInput {
|
|
28
|
-
readonly name: string;
|
|
29
|
-
readonly actual: ExportMap;
|
|
30
|
-
readonly expected: ExportMap;
|
|
31
|
-
readonly path?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Convert a source entry file path to its subpath.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* entryToSubpath("src/index.ts") // "."
|
|
38
|
-
* entryToSubpath("src/branded.ts") // "./branded"
|
|
39
|
-
* entryToSubpath("src/cli/index.ts") // "./cli"
|
|
40
|
-
* entryToSubpath("src/cli/check.ts") // "./cli/check"
|
|
41
|
-
*/
|
|
42
|
-
declare function entryToSubpath(entry: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Compare actual vs expected exports for a single package.
|
|
45
|
-
*
|
|
46
|
-
* Returns a PackageResult with status "ok" or "drift" and detailed diff.
|
|
47
|
-
*/
|
|
48
|
-
declare function compareExports(input: CompareInput): PackageResult;
|
|
49
|
-
interface CheckExportsOptions {
|
|
50
|
-
readonly json?: boolean;
|
|
51
|
-
}
|
|
52
|
-
declare function resolveJsonMode(options?: CheckExportsOptions): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Run check-exports across all workspace packages.
|
|
55
|
-
*
|
|
56
|
-
* Reads the bunup workspace config to discover packages and their * settings, then compares expected vs actual exports in each package.json.
|
|
57
|
-
*/
|
|
58
|
-
declare function runCheckExports(options?: CheckExportsOptions): Promise<void>;
|
|
59
|
-
export { ExportMap, ExportDrift, PackageResult, CheckResult, CompareInput, entryToSubpath, compareExports, CheckExportsOptions, resolveJsonMode, runCheckExports };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/version.ts
|
|
2
|
-
import { readFileSync } from "node:fs";
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
var DEFAULT_VERSION = "0.0.0";
|
|
5
|
-
function readPackageVersion() {
|
|
6
|
-
try {
|
|
7
|
-
const require2 = createRequire(import.meta.url);
|
|
8
|
-
const pkgPath = require2.resolve("@outfitter/tooling/package.json");
|
|
9
|
-
const packageJson = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
10
|
-
if (typeof packageJson.version === "string" && packageJson.version.length > 0) {
|
|
11
|
-
return packageJson.version;
|
|
12
|
-
}
|
|
13
|
-
} catch {}
|
|
14
|
-
return DEFAULT_VERSION;
|
|
15
|
-
}
|
|
16
|
-
var VERSION = readPackageVersion();
|
|
17
|
-
|
|
18
|
-
export { VERSION };
|
package/dist/version.d.ts
DELETED