@verikit/cli 0.2.2 → 0.25.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/bin/verikit.js +4 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +97 -0
- package/dist/field-spec.d.ts +17 -0
- package/dist/field-spec.d.ts.map +1 -0
- package/dist/field-spec.js +64 -0
- package/dist/imports.d.ts +14 -0
- package/dist/imports.d.ts.map +1 -0
- package/dist/imports.js +12 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -52
- package/dist/load-resources.d.ts +38 -0
- package/dist/load-resources.d.ts.map +1 -0
- package/dist/load-resources.js +71 -0
- package/dist/names.d.ts +21 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +73 -0
- package/dist/project.d.ts +41 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +196 -0
- package/dist/render-registry.d.ts +20 -0
- package/dist/render-registry.d.ts.map +1 -0
- package/dist/render-registry.js +86 -0
- package/dist/render-resource.d.ts +26 -0
- package/dist/render-resource.d.ts.map +1 -0
- package/dist/render-resource.js +141 -0
- package/dist/render-schema.d.ts +13 -0
- package/dist/render-schema.d.ts.map +1 -0
- package/dist/render-schema.js +172 -0
- package/dist/wire-actions.d.ts +18 -0
- package/dist/wire-actions.d.ts.map +1 -0
- package/dist/wire-actions.js +32 -0
- package/package.json +30 -32
- package/README.md +0 -73
- package/dist/commands/init.js +0 -235
- package/dist/detect/database.js +0 -7
- package/dist/detect/framework.js +0 -25
- package/dist/detect/package-manager.js +0 -41
- package/dist/detect/project.js +0 -22
- package/dist/generators/route.js +0 -22
- package/dist/generators/server.js +0 -38
- package/dist/generators/theme.js +0 -25
- package/dist/install/capabilities.js +0 -45
- package/dist/install/dependencies.js +0 -21
- package/dist/utils/banner.js +0 -6
- package/dist/utils/fs.js +0 -29
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { hasDependency } from "../detect/project.js";
|
|
2
|
-
/**
|
|
3
|
-
* Top-level dependencies required by each capability. Kept explicit because
|
|
4
|
-
* generated integrations may import packages directly, which isolated
|
|
5
|
-
* node_modules setups don't expose transitively.
|
|
6
|
-
*
|
|
7
|
-
* Keep in sync with the framework's @verikit/* versions.
|
|
8
|
-
*/
|
|
9
|
-
const VERIKIT_VERSION = "latest";
|
|
10
|
-
function verikit(...names) {
|
|
11
|
-
return names.map((name) => `@verikit/${name}@${VERIKIT_VERSION}`);
|
|
12
|
-
}
|
|
13
|
-
/** Strips a trailing `@version` from an install spec, e.g. `"@verikit/react@latest"` -> `"@verikit/react"`. */
|
|
14
|
-
function bareName(spec) {
|
|
15
|
-
const at = spec.lastIndexOf("@");
|
|
16
|
-
return at > 0 ? spec.slice(0, at) : spec;
|
|
17
|
-
}
|
|
18
|
-
export function resolvePackages(selection) {
|
|
19
|
-
const packages = [];
|
|
20
|
-
const add = (...specs) => {
|
|
21
|
-
for (const spec of specs) {
|
|
22
|
-
if (!hasDependency(selection.pkg, bareName(spec)) &&
|
|
23
|
-
!packages.includes(spec)) {
|
|
24
|
-
packages.push(spec);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
if (selection.server)
|
|
29
|
-
add(...verikit("core", "runtime", "client", "server"));
|
|
30
|
-
if (selection.ui === "react" || selection.ui === "next") {
|
|
31
|
-
add(...verikit("core", "react"), "@tanstack/react-query", "@tanstack/react-form", "@tanstack/react-table", "@base-ui/react");
|
|
32
|
-
if (selection.theme)
|
|
33
|
-
add(...verikit("theme"));
|
|
34
|
-
}
|
|
35
|
-
else if (selection.ui === "vue") {
|
|
36
|
-
add(...verikit("core", "vue"), "@tanstack/vue-query", "@tanstack/vue-form", "@tanstack/vue-table", "reka-ui");
|
|
37
|
-
if (selection.theme)
|
|
38
|
-
add(...verikit("theme"));
|
|
39
|
-
}
|
|
40
|
-
if (selection.adapter === "prisma")
|
|
41
|
-
add(...verikit("prisma"));
|
|
42
|
-
if (selection.adapter === "drizzle")
|
|
43
|
-
add(...verikit("drizzle"));
|
|
44
|
-
return { packages };
|
|
45
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
import { installCommand, } from "../detect/package-manager.js";
|
|
3
|
-
/** Runs `command args` in `cwd`, capturing combined stdout/stderr. Never rejects. */
|
|
4
|
-
export function runCommand(command, args, cwd) {
|
|
5
|
-
return new Promise((resolve) => {
|
|
6
|
-
const child = spawn(command, args, {
|
|
7
|
-
cwd,
|
|
8
|
-
shell: process.platform === "win32",
|
|
9
|
-
});
|
|
10
|
-
let output = "";
|
|
11
|
-
child.stdout?.on("data", (chunk) => (output += chunk));
|
|
12
|
-
child.stderr?.on("data", (chunk) => (output += chunk));
|
|
13
|
-
child.on("error", (err) => resolve({ ok: false, output: String(err) }));
|
|
14
|
-
child.on("close", (code) => resolve({ ok: code === 0, output }));
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
/** Runs the package manager's add/install command for `packages` in `cwd`, capturing output. */
|
|
18
|
-
export function installPackages(manager, packages, cwd, run = runCommand) {
|
|
19
|
-
const { command, args } = installCommand(manager, packages);
|
|
20
|
-
return run(command, args, cwd);
|
|
21
|
-
}
|
package/dist/utils/banner.js
DELETED
package/dist/utils/fs.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
/**
|
|
4
|
-
* Writes `contents` to `file`, creating parent directories as needed. Never overwrites an
|
|
5
|
-
* existing file. With `dryRun`, reports what would happen without touching the filesystem.
|
|
6
|
-
*/
|
|
7
|
-
export function writeFileIfAbsent(file, contents, dryRun = false) {
|
|
8
|
-
if (existsSync(file))
|
|
9
|
-
return "exists";
|
|
10
|
-
if (!dryRun) {
|
|
11
|
-
mkdirSync(path.dirname(file), { recursive: true });
|
|
12
|
-
writeFileSync(file, contents, "utf8");
|
|
13
|
-
}
|
|
14
|
-
return "created";
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Inserts `line` at the top of `file` if it isn't already present anywhere in the file. With
|
|
18
|
-
* `dryRun`, reports what would happen without touching the filesystem.
|
|
19
|
-
*/
|
|
20
|
-
export function insertLineIfAbsent(file, line, dryRun = false) {
|
|
21
|
-
if (!existsSync(file))
|
|
22
|
-
return "not-found";
|
|
23
|
-
const contents = readFileSync(file, "utf8");
|
|
24
|
-
if (contents.includes(line))
|
|
25
|
-
return "already-present";
|
|
26
|
-
if (!dryRun)
|
|
27
|
-
writeFileSync(file, `${line}\n${contents}`, "utf8");
|
|
28
|
-
return "inserted";
|
|
29
|
-
}
|