@vlandoss/vland 0.1.2-git-a483516.0 → 0.1.2-git-137024d.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/dist/cli.usage.kdl +1 -1
- package/dist/run.mjs +17 -2
- package/package.json +3 -3
- package/src/actions/init.ts +4 -3
- package/src/actions/template.ts +6 -0
package/dist/cli.usage.kdl
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @generated by @usage-spec/commander from Commander.js metadata
|
|
2
2
|
name vland
|
|
3
3
|
bin vland
|
|
4
|
-
version "0.1.2-git-
|
|
4
|
+
version "0.1.2-git-137024d.0"
|
|
5
5
|
usage "[options] [command]"
|
|
6
6
|
flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
|
|
7
7
|
cmd completion help="print shell completion script 🐚 (usage)" {
|
package/dist/run.mjs
CHANGED
|
@@ -180,6 +180,20 @@ const TEMPLATES = [
|
|
|
180
180
|
"backend",
|
|
181
181
|
"monorepo"
|
|
182
182
|
];
|
|
183
|
+
const TEMPLATE_META = {
|
|
184
|
+
library: {
|
|
185
|
+
placeholder: "my-lib",
|
|
186
|
+
runScript: "test"
|
|
187
|
+
},
|
|
188
|
+
backend: {
|
|
189
|
+
placeholder: "my-api",
|
|
190
|
+
runScript: "dev"
|
|
191
|
+
},
|
|
192
|
+
monorepo: {
|
|
193
|
+
placeholder: "my-mono",
|
|
194
|
+
runScript: "dev"
|
|
195
|
+
}
|
|
196
|
+
};
|
|
183
197
|
const GITHUB_SOURCE = "github:variableland/dx";
|
|
184
198
|
const GITHUB_REF = "main";
|
|
185
199
|
/**
|
|
@@ -274,7 +288,7 @@ async function runInit(ctx, options) {
|
|
|
274
288
|
if (!hasTTY) abort("Project name is required in non-interactive environments. Pass it as the first argument.");
|
|
275
289
|
const value = await text$1({
|
|
276
290
|
message: "Project name",
|
|
277
|
-
placeholder:
|
|
291
|
+
placeholder: TEMPLATE_META[template].placeholder,
|
|
278
292
|
validate: (input) => validateProjectName(input ?? "")
|
|
279
293
|
});
|
|
280
294
|
if (isCancel(value)) abort("Cancelled.");
|
|
@@ -365,12 +379,13 @@ async function runInit(ctx, options) {
|
|
|
365
379
|
}
|
|
366
380
|
} else log.info(`Skipping ${palette.highlight("git init")}.`);
|
|
367
381
|
const detectedPm = options.pm ?? (await detectPackageManager(dir, { ignorePackageJSON: false }))?.name ?? "pnpm";
|
|
382
|
+
const runScript = TEMPLATE_META[template].runScript;
|
|
368
383
|
outro([
|
|
369
384
|
palette.success("Done!"),
|
|
370
385
|
"",
|
|
371
386
|
palette.muted("Next steps:"),
|
|
372
387
|
` cd ${name}`,
|
|
373
|
-
shouldInstall ? ` ${detectedPm}
|
|
388
|
+
shouldInstall ? ` ${detectedPm} ${runScript}` : ` ${detectedPm} install && ${detectedPm} ${runScript}`
|
|
374
389
|
].join("\n"));
|
|
375
390
|
}
|
|
376
391
|
async function resolveYesNo(explicit, message) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vlandoss/vland",
|
|
3
|
-
"version": "0.1.2-git-
|
|
3
|
+
"version": "0.1.2-git-137024d.0",
|
|
4
4
|
"description": "The CLI to init a new project in Variable Land",
|
|
5
5
|
"homepage": "https://github.com/variableland/dx/tree/main/packages/vland#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"commander": "14.0.3",
|
|
36
36
|
"giget": "2.0.0",
|
|
37
37
|
"nypm": "0.6.0",
|
|
38
|
-
"@vlandoss/
|
|
39
|
-
"@vlandoss/
|
|
38
|
+
"@vlandoss/loggy": "0.2.0",
|
|
39
|
+
"@vlandoss/clibuddy": "0.5.1-git-137024d.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
package/src/actions/init.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { detectPackageManager, installDependencies } from "nypm";
|
|
|
6
6
|
import type { Context } from "#src/services/ctx.ts";
|
|
7
7
|
import { logger } from "#src/services/logger.ts";
|
|
8
8
|
import { replacePlaceholders, updateRootPackageName } from "./placeholders.ts";
|
|
9
|
-
import { fetchTemplate, TEMPLATES, type TemplateName } from "./template.ts";
|
|
9
|
+
import { fetchTemplate, TEMPLATE_META, TEMPLATES, type TemplateName } from "./template.ts";
|
|
10
10
|
|
|
11
11
|
export type InitOptions = {
|
|
12
12
|
name?: string;
|
|
@@ -92,7 +92,7 @@ export async function runInit(ctx: Context, options: InitOptions) {
|
|
|
92
92
|
if (!hasTTY) abort("Project name is required in non-interactive environments. Pass it as the first argument.");
|
|
93
93
|
const value = await text({
|
|
94
94
|
message: "Project name",
|
|
95
|
-
placeholder:
|
|
95
|
+
placeholder: TEMPLATE_META[template].placeholder,
|
|
96
96
|
validate: (input) => validateProjectName(input ?? ""),
|
|
97
97
|
});
|
|
98
98
|
if (isCancel(value)) abort("Cancelled.");
|
|
@@ -200,13 +200,14 @@ export async function runInit(ctx: Context, options: InitOptions) {
|
|
|
200
200
|
|
|
201
201
|
// 10. Outro with next steps
|
|
202
202
|
const detectedPm = options.pm ?? (await detectPackageManager(dir, { ignorePackageJSON: false }))?.name ?? "pnpm";
|
|
203
|
+
const runScript = TEMPLATE_META[template].runScript;
|
|
203
204
|
outro(
|
|
204
205
|
[
|
|
205
206
|
palette.success("Done!"),
|
|
206
207
|
"",
|
|
207
208
|
palette.muted("Next steps:"),
|
|
208
209
|
` cd ${name}`,
|
|
209
|
-
shouldInstall ? ` ${detectedPm}
|
|
210
|
+
shouldInstall ? ` ${detectedPm} ${runScript}` : ` ${detectedPm} install && ${detectedPm} ${runScript}`,
|
|
210
211
|
].join("\n"),
|
|
211
212
|
);
|
|
212
213
|
}
|
package/src/actions/template.ts
CHANGED
|
@@ -6,6 +6,12 @@ import { logger } from "#src/services/logger.ts";
|
|
|
6
6
|
export const TEMPLATES = ["library", "backend", "monorepo"] as const;
|
|
7
7
|
export type TemplateName = (typeof TEMPLATES)[number];
|
|
8
8
|
|
|
9
|
+
export const TEMPLATE_META: Record<TemplateName, { placeholder: string; runScript: string }> = {
|
|
10
|
+
library: { placeholder: "my-lib", runScript: "test" },
|
|
11
|
+
backend: { placeholder: "my-api", runScript: "dev" },
|
|
12
|
+
monorepo: { placeholder: "my-mono", runScript: "dev" },
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
const GITHUB_SOURCE = "github:variableland/dx";
|
|
10
16
|
const GITHUB_REF = "main";
|
|
11
17
|
|