@mongez/pkgist 1.0.0
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/.prettierignore +4 -0
- package/.prettierrc +8 -0
- package/README.md +320 -0
- package/builder.ts +183 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1125 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +202 -0
- package/dist/index.js +824 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +98 -0
- package/package.json +49 -0
- package/src/build/family-builder.ts +76 -0
- package/src/build/index.ts +4 -0
- package/src/build/package-builder.ts +155 -0
- package/src/build/parallel-builder.ts +36 -0
- package/src/cli.ts +51 -0
- package/src/commands/build-all.ts +88 -0
- package/src/commands/build-family.ts +55 -0
- package/src/commands/build.ts +84 -0
- package/src/commands/index.ts +5 -0
- package/src/commands/list.ts +74 -0
- package/src/commands/validate.ts +125 -0
- package/src/compile/index.ts +1 -0
- package/src/compile/tsdown-compiler.ts +344 -0
- package/src/config/define-config.ts +9 -0
- package/src/config/index.ts +3 -0
- package/src/config/load-config.ts +103 -0
- package/src/files/clone-files.ts +45 -0
- package/src/files/file-manager.ts +109 -0
- package/src/files/index.ts +3 -0
- package/src/files/package-json.ts +191 -0
- package/src/git/index.ts +1 -0
- package/src/git/operations.ts +87 -0
- package/src/index.ts +26 -0
- package/src/publish/index.ts +1 -0
- package/src/publish/npm-publisher.ts +36 -0
- package/src/types/config.ts +33 -0
- package/src/types/index.ts +2 -0
- package/src/types/package.ts +81 -0
- package/src/utils/errors.ts +40 -0
- package/src/utils/exec.ts +58 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/logger.ts +44 -0
- package/src/utils/paths.ts +48 -0
- package/src/version/increment.ts +51 -0
- package/src/version/index.ts +1 -0
- package/tsconfig.json +20 -0
- package/tsup.config.ts +34 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { loadConfig, findDefaultConfigPath } from "../config/index.js";
|
|
3
|
+
import { buildPackage } from "../build/package-builder.js";
|
|
4
|
+
import { buildFamily } from "../build/family-builder.js";
|
|
5
|
+
import { runParallel } from "../build/parallel-builder.js";
|
|
6
|
+
import { logger } from "../utils/logger.js";
|
|
7
|
+
import type { BuildOptions } from "../types/index.js";
|
|
8
|
+
import type { BuildResult } from "../build/package-builder.js";
|
|
9
|
+
|
|
10
|
+
interface BuildAllOptions {
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
noPublish?: boolean;
|
|
13
|
+
noGit?: boolean;
|
|
14
|
+
config?: string;
|
|
15
|
+
concurrency?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function registerBuildAllCommand(program: Command): void {
|
|
19
|
+
program
|
|
20
|
+
.command("build:all")
|
|
21
|
+
.description("Build all standalone packages and all families.")
|
|
22
|
+
.option("--dry-run", "Print what would happen without making any changes")
|
|
23
|
+
.option("--no-publish", "Skip npm publish")
|
|
24
|
+
.option("--no-git", "Skip git operations")
|
|
25
|
+
.option("--config <path>", "Path to config file")
|
|
26
|
+
.option("--concurrency <n>", "Override concurrency")
|
|
27
|
+
.action(async (opts: BuildAllOptions) => {
|
|
28
|
+
const configPath =
|
|
29
|
+
opts.config ?? findDefaultConfigPath(process.cwd());
|
|
30
|
+
|
|
31
|
+
const { config, configDir } = await loadConfig(configPath);
|
|
32
|
+
|
|
33
|
+
const rawOpts = opts as Record<string, unknown>;
|
|
34
|
+
const shouldPublish = rawOpts["publish"] !== false;
|
|
35
|
+
|
|
36
|
+
const buildOptions: BuildOptions = {
|
|
37
|
+
dryRun: opts.dryRun ?? false,
|
|
38
|
+
noPublish: !shouldPublish,
|
|
39
|
+
noGit: opts.noGit ?? false,
|
|
40
|
+
concurrency: opts.concurrency ? parseInt(opts.concurrency, 10) : undefined,
|
|
41
|
+
configPath,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const concurrency = buildOptions.concurrency ?? config.settings.concurrency ?? 4;
|
|
45
|
+
|
|
46
|
+
const allResults: BuildResult[] = [];
|
|
47
|
+
|
|
48
|
+
// Build all standalone packages in parallel
|
|
49
|
+
const standalone = config.standalone ?? [];
|
|
50
|
+
if (standalone.length > 0) {
|
|
51
|
+
logger.info(`Building ${standalone.length} standalone package(s)…`);
|
|
52
|
+
const standaloneTasks = standalone.map(
|
|
53
|
+
(pkg) => () =>
|
|
54
|
+
buildPackage(
|
|
55
|
+
pkg,
|
|
56
|
+
pkg.version ?? "auto",
|
|
57
|
+
config.settings,
|
|
58
|
+
buildOptions,
|
|
59
|
+
configDir,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
const standaloneResults = await runParallel(standaloneTasks, concurrency);
|
|
63
|
+
allResults.push(...standaloneResults);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Build all families sequentially (families share a version; running
|
|
67
|
+
// multiple families in parallel is fine since they're independent)
|
|
68
|
+
const families = config.families ?? [];
|
|
69
|
+
if (families.length > 0) {
|
|
70
|
+
logger.info(`Building ${families.length} famil${families.length === 1 ? "y" : "ies"}…`);
|
|
71
|
+
for (const family of families) {
|
|
72
|
+
const familyResults = await buildFamily(
|
|
73
|
+
family,
|
|
74
|
+
config.settings,
|
|
75
|
+
buildOptions,
|
|
76
|
+
configDir,
|
|
77
|
+
);
|
|
78
|
+
allResults.push(...familyResults);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const succeeded = allResults.filter((r) => r.success).length;
|
|
83
|
+
const failed = allResults.filter((r) => !r.success).length;
|
|
84
|
+
|
|
85
|
+
logger.info(`\nSummary: ${succeeded} succeeded, ${failed} failed out of ${allResults.length} total`);
|
|
86
|
+
process.exit(failed > 0 ? 1 : 0);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { loadConfig, findDefaultConfigPath } from "../config/index.js";
|
|
3
|
+
import { buildFamily } from "../build/family-builder.js";
|
|
4
|
+
import { logger } from "../utils/logger.js";
|
|
5
|
+
import type { BuildOptions } from "../types/index.js";
|
|
6
|
+
|
|
7
|
+
interface BuildFamilyOptions {
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
noPublish?: boolean;
|
|
10
|
+
noGit?: boolean;
|
|
11
|
+
config?: string;
|
|
12
|
+
concurrency?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function registerBuildFamilyCommand(program: Command): void {
|
|
16
|
+
program
|
|
17
|
+
.command("build:family <name>")
|
|
18
|
+
.description("Build all packages in a named family with a single shared version.")
|
|
19
|
+
.option("--dry-run", "Print what would happen without making any changes")
|
|
20
|
+
.option("--no-publish", "Skip npm publish")
|
|
21
|
+
.option("--no-git", "Skip git operations")
|
|
22
|
+
.option("--config <path>", "Path to config file")
|
|
23
|
+
.option("--concurrency <n>", "Override concurrency")
|
|
24
|
+
.action(async (familyName: string, opts: BuildFamilyOptions) => {
|
|
25
|
+
const configPath =
|
|
26
|
+
opts.config ?? findDefaultConfigPath(process.cwd());
|
|
27
|
+
|
|
28
|
+
const { config, configDir } = await loadConfig(configPath);
|
|
29
|
+
|
|
30
|
+
const rawOpts = opts as Record<string, unknown>;
|
|
31
|
+
const shouldPublish = rawOpts["publish"] !== false;
|
|
32
|
+
|
|
33
|
+
const buildOptions: BuildOptions = {
|
|
34
|
+
dryRun: opts.dryRun ?? false,
|
|
35
|
+
noPublish: !shouldPublish,
|
|
36
|
+
noGit: opts.noGit ?? false,
|
|
37
|
+
concurrency: opts.concurrency ? parseInt(opts.concurrency, 10) : undefined,
|
|
38
|
+
configPath,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const family = (config.families ?? []).find((f) => f.name === familyName);
|
|
42
|
+
|
|
43
|
+
if (!family) {
|
|
44
|
+
const available = (config.families ?? []).map((f) => f.name).join(", ");
|
|
45
|
+
logger.error(
|
|
46
|
+
`Family "${familyName}" not found. Available families: ${available || "(none)"}`,
|
|
47
|
+
);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const results = await buildFamily(family, config.settings, buildOptions, configDir);
|
|
52
|
+
const anyFailed = results.some((r) => !r.success);
|
|
53
|
+
process.exit(anyFailed ? 1 : 0);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { loadConfig, findDefaultConfigPath } from "../config/index.js";
|
|
3
|
+
import { buildPackage } from "../build/package-builder.js";
|
|
4
|
+
import { runParallel } from "../build/parallel-builder.js";
|
|
5
|
+
import { logger } from "../utils/logger.js";
|
|
6
|
+
import type { BuildOptions } from "../types/index.js";
|
|
7
|
+
|
|
8
|
+
interface BuildCommandOptions {
|
|
9
|
+
all?: boolean;
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
noPublish?: boolean;
|
|
12
|
+
noGit?: boolean;
|
|
13
|
+
config?: string;
|
|
14
|
+
concurrency?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function registerBuildCommand(program: Command): void {
|
|
18
|
+
program
|
|
19
|
+
.command("build [packages...]")
|
|
20
|
+
.description("Build standalone packages by name. Use --all to build all standalone packages.")
|
|
21
|
+
.option("--all", "Build all standalone packages")
|
|
22
|
+
.option("--dry-run", "Print what would happen without making any changes")
|
|
23
|
+
.option("--no-publish", "Skip npm publish")
|
|
24
|
+
.option("--no-git", "Skip git operations")
|
|
25
|
+
.option("--config <path>", "Path to config file")
|
|
26
|
+
.option("--concurrency <n>", "Override concurrency")
|
|
27
|
+
.action(async (packageNames: string[], opts: BuildCommandOptions) => {
|
|
28
|
+
const configPath =
|
|
29
|
+
opts.config ?? findDefaultConfigPath(process.cwd());
|
|
30
|
+
|
|
31
|
+
const { config, configDir } = await loadConfig(configPath);
|
|
32
|
+
|
|
33
|
+
const buildOptions: BuildOptions = {
|
|
34
|
+
dryRun: opts.dryRun ?? false,
|
|
35
|
+
noPublish: !opts.noPublish, // commander flips --no-publish to noPublish=false
|
|
36
|
+
noGit: opts.noGit ?? false,
|
|
37
|
+
concurrency: opts.concurrency ? parseInt(opts.concurrency, 10) : undefined,
|
|
38
|
+
configPath,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Fix: commander's --no-publish sets opts.publish = false (not opts.noPublish)
|
|
42
|
+
// We need to check for the raw value
|
|
43
|
+
const rawOpts = opts as Record<string, unknown>;
|
|
44
|
+
const shouldPublish = rawOpts["publish"] !== false;
|
|
45
|
+
buildOptions.noPublish = !shouldPublish;
|
|
46
|
+
|
|
47
|
+
const standalone = config.standalone ?? [];
|
|
48
|
+
|
|
49
|
+
let targets = standalone;
|
|
50
|
+
|
|
51
|
+
if (!opts.all && packageNames.length > 0) {
|
|
52
|
+
targets = standalone.filter((p) => packageNames.includes(p.name));
|
|
53
|
+
const missing = packageNames.filter(
|
|
54
|
+
(n) => !standalone.some((p) => p.name === n),
|
|
55
|
+
);
|
|
56
|
+
if (missing.length > 0) {
|
|
57
|
+
logger.warn(`Unknown package names: ${missing.join(", ")}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (targets.length === 0) {
|
|
62
|
+
logger.warn("No standalone packages matched. Use --all or specify package names.");
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const concurrency =
|
|
67
|
+
buildOptions.concurrency ?? config.settings.concurrency ?? 4;
|
|
68
|
+
|
|
69
|
+
const tasks = targets.map(
|
|
70
|
+
(pkg) => () =>
|
|
71
|
+
buildPackage(
|
|
72
|
+
pkg,
|
|
73
|
+
pkg.version ?? "auto",
|
|
74
|
+
config.settings,
|
|
75
|
+
buildOptions,
|
|
76
|
+
configDir,
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const results = await runParallel(tasks, concurrency);
|
|
81
|
+
const anyFailed = results.some((r) => !r.success);
|
|
82
|
+
process.exit(anyFailed ? 1 : 0);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { registerBuildCommand } from "./build.js";
|
|
2
|
+
export { registerBuildFamilyCommand } from "./build-family.js";
|
|
3
|
+
export { registerBuildAllCommand } from "./build-all.js";
|
|
4
|
+
export { registerListCommand } from "./list.js";
|
|
5
|
+
export { registerValidateCommand } from "./validate.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { loadConfig, findDefaultConfigPath } from "../config/index.js";
|
|
4
|
+
import { readSourcePackageJson } from "../files/package-json.js";
|
|
5
|
+
import { resolvePath } from "../utils/paths.js";
|
|
6
|
+
|
|
7
|
+
interface ListOptions {
|
|
8
|
+
config?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function registerListCommand(program: Command): void {
|
|
12
|
+
program
|
|
13
|
+
.command("list")
|
|
14
|
+
.description("List all registered standalone packages and families.")
|
|
15
|
+
.option("--config <path>", "Path to config file")
|
|
16
|
+
.action(async (opts: ListOptions) => {
|
|
17
|
+
const configPath = opts.config ?? findDefaultConfigPath(process.cwd());
|
|
18
|
+
const { config, configDir } = await loadConfig(configPath);
|
|
19
|
+
|
|
20
|
+
const standalone = config.standalone ?? [];
|
|
21
|
+
const families = config.families ?? [];
|
|
22
|
+
|
|
23
|
+
console.log(chalk.bold("\n=== Standalone Packages ==="));
|
|
24
|
+
if (standalone.length === 0) {
|
|
25
|
+
console.log(chalk.gray(" (none)"));
|
|
26
|
+
} else {
|
|
27
|
+
for (const pkg of standalone) {
|
|
28
|
+
const root = resolvePath(configDir, pkg.root);
|
|
29
|
+
let version = "?";
|
|
30
|
+
try {
|
|
31
|
+
const json = readSourcePackageJson(root, pkg.name);
|
|
32
|
+
version = json.version;
|
|
33
|
+
} catch {
|
|
34
|
+
version = chalk.red("(package.json missing)");
|
|
35
|
+
}
|
|
36
|
+
const type = pkg.type ?? "typescript";
|
|
37
|
+
const formats = (pkg.formats ?? ["esm", "cjs"]).join(", ");
|
|
38
|
+
console.log(
|
|
39
|
+
` ${chalk.cyan(pkg.name)} ${chalk.yellow(`v${version}`)}` +
|
|
40
|
+
chalk.gray(` [${type}] [${formats}]`),
|
|
41
|
+
);
|
|
42
|
+
console.log(chalk.gray(` root: ${root}`));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(chalk.bold("\n=== Families ==="));
|
|
47
|
+
if (families.length === 0) {
|
|
48
|
+
console.log(chalk.gray(" (none)"));
|
|
49
|
+
} else {
|
|
50
|
+
for (const family of families) {
|
|
51
|
+
console.log(chalk.bold(`\n Family: ${chalk.magenta(family.name)}`));
|
|
52
|
+
for (const pkg of family.packages) {
|
|
53
|
+
const root = resolvePath(configDir, pkg.root);
|
|
54
|
+
let version = "?";
|
|
55
|
+
try {
|
|
56
|
+
const json = readSourcePackageJson(root, pkg.name);
|
|
57
|
+
version = json.version;
|
|
58
|
+
} catch {
|
|
59
|
+
version = chalk.red("(package.json missing)");
|
|
60
|
+
}
|
|
61
|
+
const type = pkg.type ?? "typescript";
|
|
62
|
+
const formats = (pkg.formats ?? ["esm", "cjs"]).join(", ");
|
|
63
|
+
console.log(
|
|
64
|
+
` ${chalk.cyan(pkg.name)} ${chalk.yellow(`v${version}`)}` +
|
|
65
|
+
chalk.gray(` [${type}] [${formats}]`),
|
|
66
|
+
);
|
|
67
|
+
console.log(chalk.gray(` root: ${root}`));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
console.log("");
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { loadConfig, findDefaultConfigPath } from "../config/index.js";
|
|
5
|
+
import { resolvePath } from "../utils/paths.js";
|
|
6
|
+
import { logger } from "../utils/logger.js";
|
|
7
|
+
|
|
8
|
+
interface ValidateOptions {
|
|
9
|
+
config?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface ValidationIssue {
|
|
13
|
+
level: "error" | "warn";
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function registerValidateCommand(program: Command): void {
|
|
18
|
+
program
|
|
19
|
+
.command("validate")
|
|
20
|
+
.description("Validate the config file and check that all package roots exist.")
|
|
21
|
+
.option("--config <path>", "Path to config file")
|
|
22
|
+
.action(async (opts: ValidateOptions) => {
|
|
23
|
+
const configPath = opts.config ?? findDefaultConfigPath(process.cwd());
|
|
24
|
+
|
|
25
|
+
let config: Awaited<ReturnType<typeof loadConfig>>["config"];
|
|
26
|
+
let configDir: string;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const loaded = await loadConfig(configPath);
|
|
30
|
+
config = loaded.config;
|
|
31
|
+
configDir = loaded.configDir;
|
|
32
|
+
} catch (err) {
|
|
33
|
+
logger.error(
|
|
34
|
+
`Config load failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
35
|
+
);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const issues: ValidationIssue[] = [];
|
|
40
|
+
|
|
41
|
+
// Check all package roots exist
|
|
42
|
+
const allPackages = [
|
|
43
|
+
...(config.standalone ?? []).map((p) => ({
|
|
44
|
+
name: p.name,
|
|
45
|
+
root: p.root,
|
|
46
|
+
context: "standalone",
|
|
47
|
+
})),
|
|
48
|
+
...(config.families ?? []).flatMap((f) =>
|
|
49
|
+
f.packages.map((p) => ({
|
|
50
|
+
name: p.name,
|
|
51
|
+
root: p.root,
|
|
52
|
+
context: `family:${f.name}`,
|
|
53
|
+
})),
|
|
54
|
+
),
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
for (const { name, root, context } of allPackages) {
|
|
58
|
+
const abs = resolvePath(configDir, root);
|
|
59
|
+
if (!fs.existsSync(abs)) {
|
|
60
|
+
issues.push({
|
|
61
|
+
level: "error",
|
|
62
|
+
message: `[${context}] "${name}": root does not exist — ${abs}`,
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const pkgJsonPath = resolvePath(abs, "package.json");
|
|
68
|
+
if (!fs.existsSync(pkgJsonPath)) {
|
|
69
|
+
issues.push({
|
|
70
|
+
level: "error",
|
|
71
|
+
message: `[${context}] "${name}": package.json not found at ${pkgJsonPath}`,
|
|
72
|
+
});
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const raw = fs.readFileSync(pkgJsonPath, "utf-8");
|
|
78
|
+
const parsed = JSON.parse(raw) as Record<string, unknown>;
|
|
79
|
+
if (!parsed["version"]) {
|
|
80
|
+
issues.push({
|
|
81
|
+
level: "error",
|
|
82
|
+
message: `[${context}] "${name}": package.json is missing "version" field`,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
issues.push({
|
|
87
|
+
level: "error",
|
|
88
|
+
message: `[${context}] "${name}": failed to parse package.json — ${
|
|
89
|
+
err instanceof Error ? err.message : String(err)
|
|
90
|
+
}`,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Check buildDir
|
|
96
|
+
const buildDir = resolvePath(configDir, config.settings.buildDir);
|
|
97
|
+
if (!fs.existsSync(buildDir)) {
|
|
98
|
+
issues.push({
|
|
99
|
+
level: "warn",
|
|
100
|
+
message: `settings.buildDir does not exist yet and will be created on first build: ${buildDir}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Print results
|
|
105
|
+
if (issues.length === 0) {
|
|
106
|
+
console.log(chalk.green(`Config is valid. ${allPackages.length} package(s) found.`));
|
|
107
|
+
process.exit(0);
|
|
108
|
+
} else {
|
|
109
|
+
const errors = issues.filter((i) => i.level === "error");
|
|
110
|
+
const warnings = issues.filter((i) => i.level === "warn");
|
|
111
|
+
|
|
112
|
+
for (const issue of warnings) {
|
|
113
|
+
console.log(chalk.yellow(`WARN ${issue.message}`));
|
|
114
|
+
}
|
|
115
|
+
for (const issue of errors) {
|
|
116
|
+
console.log(chalk.red(`ERROR ${issue.message}`));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
console.log(
|
|
120
|
+
`\n${errors.length} error(s), ${warnings.length} warning(s) found.`,
|
|
121
|
+
);
|
|
122
|
+
process.exit(errors.length > 0 ? 1 : 0);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { compilePackage } from "./tsdown-compiler.js";
|