@reliverse/dler 2.1.6 → 2.1.7
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/package.json +12 -12
- package/dist/cmds/init/cmd.d.ts +0 -2
- package/dist/cmds/init/cmd.js +0 -50
- package/dist/cmds/init/impl/config.d.ts +0 -45
- package/dist/cmds/init/impl/config.js +0 -99
- package/dist/cmds/init/impl/generators.d.ts +0 -6
- package/dist/cmds/init/impl/generators.js +0 -178
- package/dist/cmds/init/impl/prompts.d.ts +0 -2
- package/dist/cmds/init/impl/prompts.js +0 -98
- package/dist/cmds/init/impl/types.d.ts +0 -22
- package/dist/cmds/init/impl/types.js +0 -0
- package/dist/cmds/init/impl/utils.d.ts +0 -4
- package/dist/cmds/init/impl/utils.js +0 -11
- package/dist/cmds/init/impl/validators.d.ts +0 -4
- package/dist/cmds/init/impl/validators.js +0 -42
- package/dist/cmds/integrate/cmd.d.ts +0 -2
- package/dist/cmds/integrate/cmd.js +0 -66
- package/dist/cmds/integrate/impl.d.ts +0 -7
- package/dist/cmds/integrate/impl.js +0 -127
- package/dist/cmds/integrate/integrations/base.d.ts +0 -13
- package/dist/cmds/integrate/integrations/base.js +0 -41
- package/dist/cmds/integrate/integrations/nextjs.d.ts +0 -16
- package/dist/cmds/integrate/integrations/nextjs.js +0 -166
- package/dist/cmds/integrate/integrations/registry.d.ts +0 -7
- package/dist/cmds/integrate/integrations/registry.js +0 -31
- package/dist/cmds/integrate/integrations/ultracite.d.ts +0 -11
- package/dist/cmds/integrate/integrations/ultracite.js +0 -40
- package/dist/cmds/integrate/types.d.ts +0 -39
- package/dist/cmds/integrate/types.js +0 -0
- package/dist/cmds/integrate/utils/biome.d.ts +0 -4
- package/dist/cmds/integrate/utils/biome.js +0 -140
- package/dist/cmds/integrate/utils/context.d.ts +0 -3
- package/dist/cmds/integrate/utils/context.js +0 -116
- package/dist/cmds/integrate/utils/temp.d.ts +0 -3
- package/dist/cmds/integrate/utils/temp.js +0 -36
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { defineArgs, defineCommand } from "@reliverse/dler-launcher";
|
|
2
|
-
import { logger } from "@reliverse/dler-logger";
|
|
3
|
-
import { runIntegrate } from "./impl.js";
|
|
4
|
-
export default defineCommand({
|
|
5
|
-
meta: {
|
|
6
|
-
name: "integrate",
|
|
7
|
-
description: "Automatically install and configure integrations like Next.js and Ultracite/Biome. Supports both monorepo and single-repo contexts.",
|
|
8
|
-
examples: [
|
|
9
|
-
"dler integrate --x nextjs",
|
|
10
|
-
"dler integrate --x ultracite",
|
|
11
|
-
"dler integrate --x nextjs,ultracite",
|
|
12
|
-
"dler integrate --x nextjs --target my-app",
|
|
13
|
-
"dler integrate --x ultracite --verbose",
|
|
14
|
-
"dler integrate --x nextjs --cwd /path/to/project",
|
|
15
|
-
"",
|
|
16
|
-
"# Available integrations:",
|
|
17
|
-
"# - nextjs: Next.js React framework with App Router, TypeScript, and Tailwind CSS",
|
|
18
|
-
"# - ultracite: Ultracite preset for Biome (highly opinionated linter and formatter)",
|
|
19
|
-
"",
|
|
20
|
-
"# Monorepo usage:",
|
|
21
|
-
"# The command will automatically detect if you're in a monorepo and prompt you to",
|
|
22
|
-
"# select a target package, or you can specify one with --target",
|
|
23
|
-
"",
|
|
24
|
-
"# Single-repo usage:",
|
|
25
|
-
"# The command will install integrations directly into the current directory"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
args: defineArgs({
|
|
29
|
-
x: {
|
|
30
|
-
type: "string",
|
|
31
|
-
description: "Integration(s) to install (comma-separated, e.g., 'nextjs,ultracite')",
|
|
32
|
-
required: true
|
|
33
|
-
},
|
|
34
|
-
target: {
|
|
35
|
-
type: "string",
|
|
36
|
-
description: "Target package in monorepo (optional, will prompt if not specified)"
|
|
37
|
-
},
|
|
38
|
-
verbose: {
|
|
39
|
-
type: "boolean",
|
|
40
|
-
description: "Verbose mode for detailed logging (default: false)"
|
|
41
|
-
},
|
|
42
|
-
cwd: {
|
|
43
|
-
type: "string",
|
|
44
|
-
description: "Working directory (default: current directory)"
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
run: async ({ args }) => {
|
|
48
|
-
try {
|
|
49
|
-
const options = {
|
|
50
|
-
x: args.x,
|
|
51
|
-
target: args.target,
|
|
52
|
-
verbose: args.verbose || false,
|
|
53
|
-
cwd: args.cwd
|
|
54
|
-
};
|
|
55
|
-
await runIntegrate(options);
|
|
56
|
-
} catch (error) {
|
|
57
|
-
logger.error("\n\u274C Integration failed:");
|
|
58
|
-
if (error instanceof Error) {
|
|
59
|
-
logger.error(error.message);
|
|
60
|
-
} else {
|
|
61
|
-
logger.error(String(error));
|
|
62
|
-
}
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { logger } from "@reliverse/dler-logger";
|
|
2
|
-
import {
|
|
3
|
-
getIntegration,
|
|
4
|
-
validateIntegrationNames
|
|
5
|
-
} from "./integrations/registry.js";
|
|
6
|
-
import { detectProjectContext, selectTargetPackage } from "./utils/context.js";
|
|
7
|
-
import { createTempDirectory } from "./utils/temp.js";
|
|
8
|
-
export const runIntegrate = async (options) => {
|
|
9
|
-
try {
|
|
10
|
-
if (typeof process.versions.bun === "undefined") {
|
|
11
|
-
logger.error("\u274C This command requires Bun runtime. Sorry.");
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
const integrationNames = options.x.split(",").map((name) => name.trim()).filter(Boolean);
|
|
15
|
-
if (integrationNames.length === 0) {
|
|
16
|
-
logger.error(
|
|
17
|
-
"\u274C No integrations specified. Use --x to specify integrations (e.g., --x nextjs,ultracite)"
|
|
18
|
-
);
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
const { valid, invalid } = validateIntegrationNames(integrationNames);
|
|
22
|
-
if (invalid.length > 0) {
|
|
23
|
-
logger.error(`\u274C Invalid integrations: ${invalid.join(", ")}`);
|
|
24
|
-
logger.info(`Available integrations: ${valid.join(", ")}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
logger.info("\u{1F50D} Detecting project context...");
|
|
28
|
-
const projectContext = await detectProjectContext(options.cwd);
|
|
29
|
-
let targetPath = projectContext.targetPath;
|
|
30
|
-
let selectedPackage = projectContext.selectedPackage;
|
|
31
|
-
if (projectContext.type === "monorepo") {
|
|
32
|
-
if (options.target) {
|
|
33
|
-
const targetPkg = projectContext.packages?.find(
|
|
34
|
-
(pkg) => pkg.name === options.target || pkg.name.endsWith(options.target)
|
|
35
|
-
);
|
|
36
|
-
if (!targetPkg) {
|
|
37
|
-
logger.error(`\u274C Target package '${options.target}' not found`);
|
|
38
|
-
logger.info(
|
|
39
|
-
`Available packages: ${projectContext.packages?.map((p) => p.name).join(", ")}`
|
|
40
|
-
);
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
selectedPackage = targetPkg;
|
|
44
|
-
targetPath = targetPkg.path;
|
|
45
|
-
} else {
|
|
46
|
-
if (projectContext.packages && projectContext.packages.length > 1) {
|
|
47
|
-
selectedPackage = await selectTargetPackage(projectContext.packages);
|
|
48
|
-
targetPath = selectedPackage.path;
|
|
49
|
-
} else if (projectContext.packages && projectContext.packages.length === 1) {
|
|
50
|
-
selectedPackage = projectContext.packages[0];
|
|
51
|
-
targetPath = selectedPackage.path;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
logger.info(`\u{1F4E6} Target package: ${selectedPackage?.name ?? "root"}`);
|
|
55
|
-
}
|
|
56
|
-
const tempDir = await createTempDirectory();
|
|
57
|
-
const integrationContext = {
|
|
58
|
-
targetPath,
|
|
59
|
-
isMonorepo: projectContext.type === "monorepo",
|
|
60
|
-
monorepoRoot: projectContext.type === "monorepo" ? projectContext.rootPath : void 0,
|
|
61
|
-
packageName: selectedPackage?.name,
|
|
62
|
-
verbose: options.verbose,
|
|
63
|
-
tempDir
|
|
64
|
-
};
|
|
65
|
-
const results = await runIntegrations(integrationNames, integrationContext);
|
|
66
|
-
logger.info("\u{1F4E6} Installing dependencies...");
|
|
67
|
-
await Bun.$`bun install`.cwd(targetPath).quiet();
|
|
68
|
-
await tempDir.cleanup();
|
|
69
|
-
const successful = results.filter((r) => r.success);
|
|
70
|
-
const failed = results.filter((r) => !r.success);
|
|
71
|
-
if (successful.length > 0) {
|
|
72
|
-
logger.success(
|
|
73
|
-
`
|
|
74
|
-
\u2705 Successfully integrated: ${successful.map((r) => r.name).join(", ")}`
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
if (failed.length > 0) {
|
|
78
|
-
logger.error(
|
|
79
|
-
`
|
|
80
|
-
\u274C Failed integrations: ${failed.map((r) => r.name).join(", ")}`
|
|
81
|
-
);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
logger.success("\n\u{1F389} All integrations completed successfully!");
|
|
85
|
-
} catch (error) {
|
|
86
|
-
logger.error("\n\u274C Integration failed:");
|
|
87
|
-
if (error instanceof Error) {
|
|
88
|
-
logger.error(error.message);
|
|
89
|
-
} else {
|
|
90
|
-
logger.error(String(error));
|
|
91
|
-
}
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const runIntegrations = async (integrationNames, context) => {
|
|
96
|
-
const results = [];
|
|
97
|
-
for (const name of integrationNames) {
|
|
98
|
-
logger.info(`
|
|
99
|
-
\u{1F527} Processing ${name} integration...`);
|
|
100
|
-
try {
|
|
101
|
-
const integration = getIntegration(name);
|
|
102
|
-
if (!integration) {
|
|
103
|
-
results.push({ name, success: false, error: "Integration not found" });
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
const isValid = await integration.validate(context);
|
|
107
|
-
if (!isValid) {
|
|
108
|
-
results.push({
|
|
109
|
-
name,
|
|
110
|
-
success: true,
|
|
111
|
-
error: "Already installed, skipped"
|
|
112
|
-
});
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
await integration.install(context);
|
|
116
|
-
await integration.configure(context);
|
|
117
|
-
await integration.postInstall(context);
|
|
118
|
-
results.push({ name, success: true });
|
|
119
|
-
logger.success(`\u2705 ${name} integration completed`);
|
|
120
|
-
} catch (error) {
|
|
121
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
122
|
-
logger.error(`\u274C ${name} integration failed: ${errorMessage}`);
|
|
123
|
-
results.push({ name, success: false, error: errorMessage });
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return results;
|
|
127
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Integration, IntegrationContext } from "../types.js";
|
|
2
|
-
export declare abstract class BaseIntegration implements Integration {
|
|
3
|
-
abstract name: string;
|
|
4
|
-
abstract description: string;
|
|
5
|
-
abstract dependencies: string[];
|
|
6
|
-
abstract devDependencies: string[];
|
|
7
|
-
validate(_context: IntegrationContext): Promise<boolean>;
|
|
8
|
-
abstract install(context: IntegrationContext): Promise<void>;
|
|
9
|
-
abstract configure(context: IntegrationContext): Promise<void>;
|
|
10
|
-
postInstall(_context: IntegrationContext): Promise<void>;
|
|
11
|
-
protected isAlreadyInstalled(context: IntegrationContext): Promise<boolean>;
|
|
12
|
-
protected installDependencies(context: IntegrationContext): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { logger } from "@reliverse/dler-logger";
|
|
2
|
-
export class BaseIntegration {
|
|
3
|
-
async validate(_context) {
|
|
4
|
-
logger.debug(`\u{1F50D} Validating ${this.name} integration...`);
|
|
5
|
-
if (await this.isAlreadyInstalled(_context)) {
|
|
6
|
-
logger.warn(
|
|
7
|
-
`\u26A0\uFE0F ${this.name} appears to be already installed. Skipping...`
|
|
8
|
-
);
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
async postInstall(_context) {
|
|
14
|
-
logger.debug(`\u{1F527} Running post-install for ${this.name}...`);
|
|
15
|
-
}
|
|
16
|
-
async isAlreadyInstalled(context) {
|
|
17
|
-
try {
|
|
18
|
-
const packageJsonPath = `${context.targetPath}/package.json`;
|
|
19
|
-
const packageJson = await Bun.file(packageJsonPath).json();
|
|
20
|
-
const allDeps = [...this.dependencies, ...this.devDependencies];
|
|
21
|
-
return allDeps.some(
|
|
22
|
-
(dep) => packageJson.dependencies?.[dep] || packageJson.devDependencies?.[dep]
|
|
23
|
-
);
|
|
24
|
-
} catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async installDependencies(context) {
|
|
29
|
-
const { targetPath } = context;
|
|
30
|
-
if (this.dependencies.length > 0) {
|
|
31
|
-
logger.info(`\u{1F4E6} Installing ${this.name} dependencies...`);
|
|
32
|
-
const deps = this.dependencies.join(" ");
|
|
33
|
-
await Bun.$`bun add ${deps}`.cwd(targetPath).quiet();
|
|
34
|
-
}
|
|
35
|
-
if (this.devDependencies.length > 0) {
|
|
36
|
-
logger.info(`\u{1F4E6} Installing ${this.name} dev dependencies...`);
|
|
37
|
-
const devDeps = this.devDependencies.join(" ");
|
|
38
|
-
await Bun.$`bun add -D ${devDeps}`.cwd(targetPath).quiet();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { IntegrationContext } from "../types.js";
|
|
2
|
-
import { BaseIntegration } from "./base.js";
|
|
3
|
-
export declare class NextJsIntegration extends BaseIntegration {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
dependencies: string[];
|
|
7
|
-
devDependencies: string[];
|
|
8
|
-
private tempDir?;
|
|
9
|
-
install(context: IntegrationContext): Promise<void>;
|
|
10
|
-
configure(context: IntegrationContext): Promise<void>;
|
|
11
|
-
postInstall(context: IntegrationContext): Promise<void>;
|
|
12
|
-
private updateTsConfig;
|
|
13
|
-
private copyFilesToTarget;
|
|
14
|
-
private copyFileOrDir;
|
|
15
|
-
private updatePackageJsonScripts;
|
|
16
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { writeJsonFile, writeTextFile } from "@reliverse/dler-helpers";
|
|
4
|
-
import { logger } from "@reliverse/dler-logger";
|
|
5
|
-
import { createIntegrationTempDir } from "../utils/temp.js";
|
|
6
|
-
import { BaseIntegration } from "./base.js";
|
|
7
|
-
export class NextJsIntegration extends BaseIntegration {
|
|
8
|
-
name = "nextjs";
|
|
9
|
-
description = "Next.js React framework with App Router, TypeScript, and Tailwind CSS";
|
|
10
|
-
dependencies = ["next", "react", "react-dom"];
|
|
11
|
-
devDependencies = ["@types/react", "@types/react-dom", "typescript"];
|
|
12
|
-
tempDir;
|
|
13
|
-
async install(context) {
|
|
14
|
-
logger.info("\u{1F527} Installing Next.js integration...");
|
|
15
|
-
this.tempDir = context.tempDir;
|
|
16
|
-
if (!this.tempDir) {
|
|
17
|
-
throw new Error("Temp directory not provided for Next.js integration");
|
|
18
|
-
}
|
|
19
|
-
const nextjsTempPath = await createIntegrationTempDir(
|
|
20
|
-
this.tempDir,
|
|
21
|
-
"nextjs"
|
|
22
|
-
);
|
|
23
|
-
logger.info("\u{1F4E6} Creating Next.js app in temp directory...");
|
|
24
|
-
await Bun.$`bunx create-next-app@latest . --yes`.cwd(nextjsTempPath).quiet();
|
|
25
|
-
await this.updateTsConfig(nextjsTempPath);
|
|
26
|
-
await this.copyFilesToTarget(nextjsTempPath, context);
|
|
27
|
-
await this.installDependencies(context);
|
|
28
|
-
await this.updatePackageJsonScripts(context);
|
|
29
|
-
}
|
|
30
|
-
async configure(context) {
|
|
31
|
-
logger.info("\u2699\uFE0F Configuring Next.js...");
|
|
32
|
-
const nextConfigPath = join(context.targetPath, "next.config.js");
|
|
33
|
-
if (!existsSync(nextConfigPath)) {
|
|
34
|
-
const nextConfig = `/** @type {import('next').NextConfig} */
|
|
35
|
-
const nextConfig = {
|
|
36
|
-
experimental: {
|
|
37
|
-
turbo: {
|
|
38
|
-
rules: {
|
|
39
|
-
'*.svg': {
|
|
40
|
-
loaders: ['@svgr/webpack'],
|
|
41
|
-
as: '*.js',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
module.exports = nextConfig;`;
|
|
49
|
-
await writeTextFile(nextConfigPath, nextConfig);
|
|
50
|
-
}
|
|
51
|
-
const tailwindConfigPath = join(context.targetPath, "tailwind.config.ts");
|
|
52
|
-
if (!existsSync(tailwindConfigPath)) {
|
|
53
|
-
const tailwindConfig = `import type { Config } from "tailwindcss";
|
|
54
|
-
|
|
55
|
-
const config: Config = {
|
|
56
|
-
content: [
|
|
57
|
-
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
|
58
|
-
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
|
59
|
-
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
|
60
|
-
],
|
|
61
|
-
theme: {
|
|
62
|
-
extend: {
|
|
63
|
-
backgroundImage: {
|
|
64
|
-
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
|
|
65
|
-
"gradient-conic":
|
|
66
|
-
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
plugins: [],
|
|
71
|
-
};
|
|
72
|
-
export default config;`;
|
|
73
|
-
await writeTextFile(tailwindConfigPath, tailwindConfig);
|
|
74
|
-
}
|
|
75
|
-
logger.success("\u2705 Next.js configuration complete");
|
|
76
|
-
}
|
|
77
|
-
async postInstall(context) {
|
|
78
|
-
logger.info("\u{1F527} Verifying Next.js installation...");
|
|
79
|
-
try {
|
|
80
|
-
await Bun.$`bun next --version`.cwd(context.targetPath).quiet();
|
|
81
|
-
logger.success("\u2705 Next.js is ready to use");
|
|
82
|
-
logger.info("\u{1F680} Run 'bun dev' to start the development server");
|
|
83
|
-
} catch (error) {
|
|
84
|
-
logger.warn("\u26A0\uFE0F Next.js verification failed, but installation completed");
|
|
85
|
-
if (context.verbose) {
|
|
86
|
-
logger.debug(`Error: ${error}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async updateTsConfig(tempPath) {
|
|
91
|
-
const tsconfigPath = join(tempPath, "tsconfig.json");
|
|
92
|
-
if (existsSync(tsconfigPath)) {
|
|
93
|
-
const tsconfig = await Bun.file(tsconfigPath).json();
|
|
94
|
-
if (tsconfig.compilerOptions?.paths) {
|
|
95
|
-
const newPaths = {};
|
|
96
|
-
for (const [key, value] of Object.entries(
|
|
97
|
-
tsconfig.compilerOptions.paths
|
|
98
|
-
)) {
|
|
99
|
-
const newKey = key.replace("@/*", "~/*");
|
|
100
|
-
newPaths[newKey] = Array.isArray(value) ? value : [value];
|
|
101
|
-
}
|
|
102
|
-
tsconfig.compilerOptions.paths = newPaths;
|
|
103
|
-
}
|
|
104
|
-
await writeJsonFile(tsconfigPath, tsconfig);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async copyFilesToTarget(tempPath, context) {
|
|
108
|
-
const filesToCopy = [
|
|
109
|
-
"app",
|
|
110
|
-
"public",
|
|
111
|
-
"next.config.js",
|
|
112
|
-
"next.config.ts",
|
|
113
|
-
"tailwind.config.ts",
|
|
114
|
-
"tsconfig.json"
|
|
115
|
-
];
|
|
116
|
-
for (const file of filesToCopy) {
|
|
117
|
-
const srcPath = join(tempPath, file);
|
|
118
|
-
const destPath = join(context.targetPath, file);
|
|
119
|
-
if (existsSync(srcPath)) {
|
|
120
|
-
await this.copyFileOrDir(srcPath, destPath);
|
|
121
|
-
logger.debug(`\u{1F4C4} Copied ${file}`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async copyFileOrDir(src, dest) {
|
|
126
|
-
const stat = await Bun.file(src).stat();
|
|
127
|
-
if (stat.isDirectory()) {
|
|
128
|
-
const glob = new Bun.Glob("**/*");
|
|
129
|
-
const files = Array.from(glob.scanSync({ cwd: src, onlyFiles: true }));
|
|
130
|
-
for (const file of files) {
|
|
131
|
-
const srcFile = join(src, file);
|
|
132
|
-
const destFile = join(dest, file);
|
|
133
|
-
mkdirSync(dirname(destFile), { recursive: true });
|
|
134
|
-
const content = await Bun.file(srcFile).arrayBuffer();
|
|
135
|
-
await Bun.write(destFile, content);
|
|
136
|
-
}
|
|
137
|
-
} else {
|
|
138
|
-
mkdirSync(dirname(dest), { recursive: true });
|
|
139
|
-
const content = await Bun.file(src).arrayBuffer();
|
|
140
|
-
await Bun.write(dest, content);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async updatePackageJsonScripts(context) {
|
|
144
|
-
const packageJsonPath = join(context.targetPath, "package.json");
|
|
145
|
-
try {
|
|
146
|
-
const packageJson = await Bun.file(packageJsonPath).json();
|
|
147
|
-
const nextjsScripts = {
|
|
148
|
-
dev: "next dev",
|
|
149
|
-
build: "next build",
|
|
150
|
-
start: "next start",
|
|
151
|
-
lint: "next lint"
|
|
152
|
-
};
|
|
153
|
-
packageJson.scripts = {
|
|
154
|
-
...packageJson.scripts,
|
|
155
|
-
...nextjsScripts
|
|
156
|
-
};
|
|
157
|
-
await writeJsonFile(packageJsonPath, packageJson);
|
|
158
|
-
logger.debug("\u{1F4DD} Updated package.json scripts");
|
|
159
|
-
} catch (error) {
|
|
160
|
-
logger.warn("\u26A0\uFE0F Failed to update package.json scripts");
|
|
161
|
-
if (context.verbose) {
|
|
162
|
-
logger.debug(`Error: ${error}`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Integration } from "../types.js";
|
|
2
|
-
export declare function getIntegration(name: string): Integration | null;
|
|
3
|
-
export declare function listIntegrations(): string[];
|
|
4
|
-
export declare function validateIntegrationNames(names: string[]): {
|
|
5
|
-
valid: string[];
|
|
6
|
-
invalid: string[];
|
|
7
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { logger } from "@reliverse/dler-logger";
|
|
2
|
-
import { NextJsIntegration } from "./nextjs.js";
|
|
3
|
-
import { UltraciteIntegration } from "./ultracite.js";
|
|
4
|
-
const INTEGRATIONS = {
|
|
5
|
-
ultracite: () => new UltraciteIntegration(),
|
|
6
|
-
nextjs: () => new NextJsIntegration()
|
|
7
|
-
};
|
|
8
|
-
export function getIntegration(name) {
|
|
9
|
-
const integrationFactory = INTEGRATIONS[name.toLowerCase()];
|
|
10
|
-
if (!integrationFactory) {
|
|
11
|
-
logger.error(`\u274C Unknown integration: ${name}`);
|
|
12
|
-
logger.info(`Available integrations: ${listIntegrations().join(", ")}`);
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return integrationFactory();
|
|
16
|
-
}
|
|
17
|
-
export function listIntegrations() {
|
|
18
|
-
return Object.keys(INTEGRATIONS);
|
|
19
|
-
}
|
|
20
|
-
export function validateIntegrationNames(names) {
|
|
21
|
-
const valid = [];
|
|
22
|
-
const invalid = [];
|
|
23
|
-
for (const name of names) {
|
|
24
|
-
if (INTEGRATIONS[name.toLowerCase()]) {
|
|
25
|
-
valid.push(name);
|
|
26
|
-
} else {
|
|
27
|
-
invalid.push(name);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return { valid, invalid };
|
|
31
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IntegrationContext } from "../types.js";
|
|
2
|
-
import { BaseIntegration } from "./base.js";
|
|
3
|
-
export declare class UltraciteIntegration extends BaseIntegration {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
dependencies: string[];
|
|
7
|
-
devDependencies: string[];
|
|
8
|
-
install(context: IntegrationContext): Promise<void>;
|
|
9
|
-
configure(context: IntegrationContext): Promise<void>;
|
|
10
|
-
postInstall(context: IntegrationContext): Promise<void>;
|
|
11
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { logger } from "@reliverse/dler-logger";
|
|
2
|
-
import {
|
|
3
|
-
createBiomeConfig,
|
|
4
|
-
findBiomeConfig,
|
|
5
|
-
updateBiomeConfig
|
|
6
|
-
} from "../utils/biome.js";
|
|
7
|
-
import { BaseIntegration } from "./base.js";
|
|
8
|
-
export class UltraciteIntegration extends BaseIntegration {
|
|
9
|
-
name = "ultracite";
|
|
10
|
-
description = "Ultracite preset for Biome (highly opinionated linter and formatter)";
|
|
11
|
-
dependencies = [];
|
|
12
|
-
devDependencies = ["@biomejs/biome", "ultracite"];
|
|
13
|
-
async install(context) {
|
|
14
|
-
logger.info("\u{1F527} Installing Ultracite integration...");
|
|
15
|
-
await this.installDependencies(context);
|
|
16
|
-
}
|
|
17
|
-
async configure(context) {
|
|
18
|
-
logger.info("\u2699\uFE0F Configuring Biome with Ultracite preset...");
|
|
19
|
-
const biomeConfig = await findBiomeConfig(context.targetPath);
|
|
20
|
-
if (biomeConfig.exists && biomeConfig.content) {
|
|
21
|
-
await updateBiomeConfig(biomeConfig.path, biomeConfig.content);
|
|
22
|
-
logger.success("\u2705 Updated existing biome.json with Ultracite preset");
|
|
23
|
-
} else {
|
|
24
|
-
await createBiomeConfig(biomeConfig.path);
|
|
25
|
-
logger.success("\u2705 Created new biome.json with Ultracite preset");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async postInstall(context) {
|
|
29
|
-
logger.info("\u{1F527} Running Biome check to verify configuration...");
|
|
30
|
-
try {
|
|
31
|
-
await Bun.$`bun biome check --version`.cwd(context.targetPath).quiet();
|
|
32
|
-
logger.success("\u2705 Biome is properly configured and ready to use");
|
|
33
|
-
} catch (error) {
|
|
34
|
-
logger.warn("\u26A0\uFE0F Biome check failed, but configuration was created");
|
|
35
|
-
if (context.verbose) {
|
|
36
|
-
logger.debug(`Error: ${error}`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export interface IntegrationContext {
|
|
2
|
-
targetPath: string;
|
|
3
|
-
isMonorepo: boolean;
|
|
4
|
-
monorepoRoot?: string;
|
|
5
|
-
packageName?: string;
|
|
6
|
-
verbose: boolean;
|
|
7
|
-
tempDir: TempDirectory;
|
|
8
|
-
}
|
|
9
|
-
export interface Integration {
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
dependencies: string[];
|
|
13
|
-
devDependencies: string[];
|
|
14
|
-
validate(context: IntegrationContext): Promise<boolean>;
|
|
15
|
-
install(context: IntegrationContext): Promise<void>;
|
|
16
|
-
configure(context: IntegrationContext): Promise<void>;
|
|
17
|
-
postInstall(context: IntegrationContext): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export interface ProjectContext {
|
|
20
|
-
type: "monorepo" | "single-repo";
|
|
21
|
-
rootPath: string;
|
|
22
|
-
targetPath: string;
|
|
23
|
-
packages?: PackageInfo[];
|
|
24
|
-
selectedPackage?: PackageInfo;
|
|
25
|
-
}
|
|
26
|
-
export interface PackageInfo {
|
|
27
|
-
name: string;
|
|
28
|
-
path: string;
|
|
29
|
-
packageJson: any;
|
|
30
|
-
}
|
|
31
|
-
export interface BiomeConfig {
|
|
32
|
-
path: string;
|
|
33
|
-
exists: boolean;
|
|
34
|
-
content?: any;
|
|
35
|
-
}
|
|
36
|
-
export interface TempDirectory {
|
|
37
|
-
path: string;
|
|
38
|
-
cleanup: () => Promise<void>;
|
|
39
|
-
}
|
|
File without changes
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { BiomeConfig } from "../types.js";
|
|
2
|
-
export declare const findBiomeConfig: (startDir: string) => Promise<BiomeConfig>;
|
|
3
|
-
export declare const createBiomeConfig: (configPath: string, integrationType?: string) => Promise<void>;
|
|
4
|
-
export declare const updateBiomeConfig: (configPath: string, content: any) => Promise<void>;
|