@reliverse/dler 2.1.5 → 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/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1
- package/dist/cmds/{init → escape}/cmd.d.ts +0 -1
- package/dist/cmds/escape/cmd.js +81 -0
- package/dist/cmds/publish/cmd.d.ts +0 -1
- package/dist/cmds/publish/cmd.js +0 -1
- package/dist/cmds/shell/cmd.d.ts +0 -1
- package/dist/cmds/shell/cmd.js +0 -1
- package/package.json +12 -11
- package/dist/cmds/init/cmd.js +0 -51
- 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 -3
- package/dist/cmds/integrate/cmd.js +0 -67
- 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,140 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import { writeJsonFile } from "@reliverse/dler-helpers";
|
|
4
|
-
import { logger } from "@reliverse/dler-logger";
|
|
5
|
-
import { hasWorkspaces, readPackageJSON } from "@reliverse/dler-pkg-tsc";
|
|
6
|
-
export const findBiomeConfig = async (startDir) => {
|
|
7
|
-
let currentDir = resolve(startDir);
|
|
8
|
-
let depth = 0;
|
|
9
|
-
const maxDepth = 3;
|
|
10
|
-
while (depth <= maxDepth) {
|
|
11
|
-
const biomePath = join(currentDir, "biome.json");
|
|
12
|
-
if (existsSync(biomePath)) {
|
|
13
|
-
try {
|
|
14
|
-
const content = await Bun.file(biomePath).json();
|
|
15
|
-
return {
|
|
16
|
-
path: biomePath,
|
|
17
|
-
exists: true,
|
|
18
|
-
content
|
|
19
|
-
};
|
|
20
|
-
} catch {
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const parentDir = resolve(currentDir, "..");
|
|
24
|
-
if (parentDir === currentDir) break;
|
|
25
|
-
currentDir = parentDir;
|
|
26
|
-
depth++;
|
|
27
|
-
}
|
|
28
|
-
const monorepoRoot = await findMonorepoRoot(startDir);
|
|
29
|
-
const targetPath = monorepoRoot || startDir;
|
|
30
|
-
return {
|
|
31
|
-
path: join(targetPath, "biome.json"),
|
|
32
|
-
exists: false
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
const findMonorepoRoot = async (startDir) => {
|
|
36
|
-
let currentDir = resolve(startDir);
|
|
37
|
-
while (currentDir !== "/") {
|
|
38
|
-
const pkgPath = join(currentDir, "package.json");
|
|
39
|
-
if (existsSync(pkgPath)) {
|
|
40
|
-
const pkg = await readPackageJSON(currentDir);
|
|
41
|
-
if (pkg && hasWorkspaces(pkg)) {
|
|
42
|
-
return currentDir;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const parentDir = resolve(currentDir, "..");
|
|
46
|
-
if (parentDir === currentDir) break;
|
|
47
|
-
currentDir = parentDir;
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
};
|
|
51
|
-
export const createBiomeConfig = async (configPath, integrationType) => {
|
|
52
|
-
logger.info(`\u{1F4DD} Creating biome.json at ${configPath}`);
|
|
53
|
-
const baseConfig = {
|
|
54
|
-
$schema: "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
55
|
-
extends: ["ultracite"],
|
|
56
|
-
files: {
|
|
57
|
-
includes: [
|
|
58
|
-
"**",
|
|
59
|
-
"!**/.js",
|
|
60
|
-
"!**/.d.ts",
|
|
61
|
-
"!**/_generated",
|
|
62
|
-
"!**/.next",
|
|
63
|
-
"!**/.react-email",
|
|
64
|
-
"!**/.source",
|
|
65
|
-
"!**/.turbo",
|
|
66
|
-
"!**/.vercel",
|
|
67
|
-
"!**/.wrangler",
|
|
68
|
-
"!**/.zed",
|
|
69
|
-
"!**/dev-dist",
|
|
70
|
-
"!**/dist-*",
|
|
71
|
-
"!**/dist",
|
|
72
|
-
"!**/drizzle/migrations",
|
|
73
|
-
"!**/node_modules"
|
|
74
|
-
],
|
|
75
|
-
ignoreUnknown: false
|
|
76
|
-
},
|
|
77
|
-
linter: {
|
|
78
|
-
enabled: true,
|
|
79
|
-
rules: {
|
|
80
|
-
recommended: true,
|
|
81
|
-
// Add integration-specific rules if needed
|
|
82
|
-
...integrationType === "nextjs" && {
|
|
83
|
-
a11y: {
|
|
84
|
-
useHtmlLang: "warn",
|
|
85
|
-
noHeaderScope: "warn"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
formatter: {
|
|
91
|
-
enabled: true,
|
|
92
|
-
indentStyle: "space",
|
|
93
|
-
indentWidth: 2,
|
|
94
|
-
lineWidth: 80
|
|
95
|
-
},
|
|
96
|
-
javascript: {
|
|
97
|
-
globals: ["Bun"],
|
|
98
|
-
formatter: {
|
|
99
|
-
enabled: true,
|
|
100
|
-
lineEnding: "lf",
|
|
101
|
-
jsxQuoteStyle: "double",
|
|
102
|
-
quoteProperties: "asNeeded",
|
|
103
|
-
trailingCommas: "all",
|
|
104
|
-
lineWidth: 80,
|
|
105
|
-
indentWidth: 2,
|
|
106
|
-
indentStyle: "space",
|
|
107
|
-
semicolons: "always",
|
|
108
|
-
arrowParentheses: "always",
|
|
109
|
-
bracketSpacing: true,
|
|
110
|
-
bracketSameLine: false,
|
|
111
|
-
quoteStyle: "double",
|
|
112
|
-
attributePosition: "auto"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
assist: {
|
|
116
|
-
enabled: true,
|
|
117
|
-
actions: {
|
|
118
|
-
source: {
|
|
119
|
-
organizeImports: "on"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
vcs: {
|
|
124
|
-
enabled: false,
|
|
125
|
-
clientKind: "git",
|
|
126
|
-
useIgnoreFile: false
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
await writeJsonFile(configPath, baseConfig);
|
|
130
|
-
};
|
|
131
|
-
export const updateBiomeConfig = async (configPath, content) => {
|
|
132
|
-
logger.info(`\u{1F4DD} Updating biome.json at ${configPath}`);
|
|
133
|
-
if (!content.extends || !Array.isArray(content.extends)) {
|
|
134
|
-
content.extends = [];
|
|
135
|
-
}
|
|
136
|
-
if (!content.extends.includes("ultracite")) {
|
|
137
|
-
content.extends.unshift("ultracite");
|
|
138
|
-
}
|
|
139
|
-
await writeJsonFile(configPath, content);
|
|
140
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import { logger } from "@reliverse/dler-logger";
|
|
4
|
-
import {
|
|
5
|
-
getWorkspacePatterns,
|
|
6
|
-
hasWorkspaces,
|
|
7
|
-
readPackageJSON
|
|
8
|
-
} from "@reliverse/dler-pkg-tsc";
|
|
9
|
-
import { askQuestion } from "@reliverse/dler-prompt";
|
|
10
|
-
export const detectProjectContext = async (cwd) => {
|
|
11
|
-
const startDir = resolve(cwd ?? process.cwd());
|
|
12
|
-
const monorepoRoot = await findMonorepoRoot(startDir);
|
|
13
|
-
if (monorepoRoot) {
|
|
14
|
-
logger.info("\u{1F50D} Detected monorepo project");
|
|
15
|
-
const packages = await getWorkspacePackages(monorepoRoot);
|
|
16
|
-
return {
|
|
17
|
-
type: "monorepo",
|
|
18
|
-
rootPath: monorepoRoot,
|
|
19
|
-
targetPath: monorepoRoot,
|
|
20
|
-
// Will be updated when package is selected
|
|
21
|
-
packages
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
logger.info("\u{1F50D} Detected standalone project");
|
|
25
|
-
return {
|
|
26
|
-
type: "single-repo",
|
|
27
|
-
rootPath: startDir,
|
|
28
|
-
targetPath: startDir
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
const findMonorepoRoot = async (startDir) => {
|
|
32
|
-
let currentDir = resolve(startDir);
|
|
33
|
-
while (currentDir !== "/") {
|
|
34
|
-
const pkgPath = join(currentDir, "package.json");
|
|
35
|
-
if (existsSync(pkgPath)) {
|
|
36
|
-
const pkg = await readPackageJSON(currentDir);
|
|
37
|
-
if (pkg && hasWorkspaces(pkg)) {
|
|
38
|
-
return currentDir;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const parentDir = resolve(currentDir, "..");
|
|
42
|
-
if (parentDir === currentDir) break;
|
|
43
|
-
currentDir = parentDir;
|
|
44
|
-
}
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
const getWorkspacePackages = async (monorepoRoot) => {
|
|
48
|
-
const rootPkg = await readPackageJSON(monorepoRoot);
|
|
49
|
-
if (!rootPkg) {
|
|
50
|
-
throw new Error("\u274C Could not read root package.json");
|
|
51
|
-
}
|
|
52
|
-
const patterns = getWorkspacePatterns(rootPkg);
|
|
53
|
-
if (!patterns.length) {
|
|
54
|
-
throw new Error("\u274C No workspace patterns found in package.json");
|
|
55
|
-
}
|
|
56
|
-
const packages = [];
|
|
57
|
-
const seenPaths = /* @__PURE__ */ new Set();
|
|
58
|
-
for (const pattern of patterns) {
|
|
59
|
-
const glob = new Bun.Glob(pattern);
|
|
60
|
-
const matches = glob.scanSync({ cwd: monorepoRoot, onlyFiles: false });
|
|
61
|
-
for (const match of matches) {
|
|
62
|
-
const packagePath = resolve(monorepoRoot, match);
|
|
63
|
-
if (seenPaths.has(packagePath)) continue;
|
|
64
|
-
seenPaths.add(packagePath);
|
|
65
|
-
const pkgInfo = await resolvePackageInfo(packagePath);
|
|
66
|
-
if (pkgInfo) {
|
|
67
|
-
packages.push(pkgInfo);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const filteredPackages = packages.filter((pkg) => {
|
|
72
|
-
const normalizedPkgPath = resolve(pkg.path);
|
|
73
|
-
const normalizedRootPath = resolve(monorepoRoot);
|
|
74
|
-
return normalizedPkgPath !== normalizedRootPath;
|
|
75
|
-
});
|
|
76
|
-
return filteredPackages;
|
|
77
|
-
};
|
|
78
|
-
const resolvePackageInfo = async (packagePath) => {
|
|
79
|
-
try {
|
|
80
|
-
const packageJsonPath = join(packagePath, "package.json");
|
|
81
|
-
if (!existsSync(packageJsonPath)) return null;
|
|
82
|
-
const packageJson = await readPackageJSON(packagePath);
|
|
83
|
-
if (!packageJson || !packageJson.name) return null;
|
|
84
|
-
return {
|
|
85
|
-
name: packageJson.name,
|
|
86
|
-
path: packagePath,
|
|
87
|
-
packageJson
|
|
88
|
-
};
|
|
89
|
-
} catch {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export const selectTargetPackage = async (packages) => {
|
|
94
|
-
if (packages.length === 0) {
|
|
95
|
-
throw new Error("\u274C No packages found in workspace");
|
|
96
|
-
}
|
|
97
|
-
if (packages.length === 1) {
|
|
98
|
-
logger.info(`\u{1F4E6} Using package: ${packages[0]?.name}`);
|
|
99
|
-
return packages[0];
|
|
100
|
-
}
|
|
101
|
-
logger.info("\n\u{1F4E6} Available packages:");
|
|
102
|
-
packages.forEach((pkg, index) => {
|
|
103
|
-
logger.log(` ${index + 1}. ${pkg.name}`);
|
|
104
|
-
});
|
|
105
|
-
while (true) {
|
|
106
|
-
const answer = await askQuestion(
|
|
107
|
-
`Select target package (1-${packages.length})`,
|
|
108
|
-
"1"
|
|
109
|
-
);
|
|
110
|
-
const index = Number.parseInt(answer, 10) - 1;
|
|
111
|
-
if (index >= 0 && index < packages.length) {
|
|
112
|
-
return packages[index];
|
|
113
|
-
}
|
|
114
|
-
logger.error("\u274C Invalid selection. Please try again.");
|
|
115
|
-
}
|
|
116
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { existsSync, rmSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import { logger } from "@reliverse/dler-logger";
|
|
5
|
-
import { ensureDir } from "../../init/impl/utils.js";
|
|
6
|
-
export const createTempDirectory = async () => {
|
|
7
|
-
const timestamp = Date.now();
|
|
8
|
-
const tempPath = join(
|
|
9
|
-
homedir(),
|
|
10
|
-
".reliverse",
|
|
11
|
-
"dler",
|
|
12
|
-
"temp",
|
|
13
|
-
"integrate",
|
|
14
|
-
timestamp.toString()
|
|
15
|
-
);
|
|
16
|
-
await ensureDir(tempPath);
|
|
17
|
-
logger.debug(`\u{1F4C1} Created temp directory: ${tempPath}`);
|
|
18
|
-
return {
|
|
19
|
-
path: tempPath,
|
|
20
|
-
cleanup: async () => {
|
|
21
|
-
try {
|
|
22
|
-
if (existsSync(tempPath)) {
|
|
23
|
-
rmSync(tempPath, { recursive: true, force: true });
|
|
24
|
-
logger.debug(`\u{1F9F9} Cleaned up temp directory: ${tempPath}`);
|
|
25
|
-
}
|
|
26
|
-
} catch (error) {
|
|
27
|
-
logger.warn(`\u26A0\uFE0F Failed to clean up temp directory: ${error}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export const createIntegrationTempDir = async (tempDir, integrationName) => {
|
|
33
|
-
const integrationPath = join(tempDir.path, `${integrationName}-temp`);
|
|
34
|
-
await ensureDir(integrationPath);
|
|
35
|
-
return integrationPath;
|
|
36
|
-
};
|