@vlandoss/vland 0.1.2-git-87ebfca.0 → 0.1.2-git-f368be9.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.
@@ -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-87ebfca.0"
4
+ version "0.1.2-git-f368be9.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: "my-app",
291
+ placeholder: TEMPLATE_META[template].placeholder,
278
292
  validate: (input) => validateProjectName(input ?? "")
279
293
  });
280
294
  if (isCancel(value)) abort("Cancelled.");
@@ -331,7 +345,8 @@ async function runInit(ctx, options) {
331
345
  packageManager: {
332
346
  name: detected,
333
347
  command: detected
334
- }
348
+ },
349
+ silent: true
335
350
  });
336
351
  installSpin.stop(`Installed with ${palette.highlight(detected)}`);
337
352
  } catch (error) {
@@ -364,12 +379,13 @@ async function runInit(ctx, options) {
364
379
  }
365
380
  } else log.info(`Skipping ${palette.highlight("git init")}.`);
366
381
  const detectedPm = options.pm ?? (await detectPackageManager(dir, { ignorePackageJSON: false }))?.name ?? "pnpm";
382
+ const runScript = TEMPLATE_META[template].runScript;
367
383
  outro([
368
384
  palette.success("Done!"),
369
385
  "",
370
386
  palette.muted("Next steps:"),
371
387
  ` cd ${name}`,
372
- shouldInstall ? ` ${detectedPm} dev` : ` ${detectedPm} install && ${detectedPm} dev`
388
+ shouldInstall ? ` ${detectedPm} ${runScript}` : ` ${detectedPm} install && ${detectedPm} ${runScript}`
373
389
  ].join("\n"));
374
390
  }
375
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-87ebfca.0",
3
+ "version": "0.1.2-git-f368be9.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/loggy": "0.2.0",
39
- "@vlandoss/clibuddy": "0.5.1-git-87ebfca.0"
38
+ "@vlandoss/clibuddy": "0.5.1-git-f368be9.0",
39
+ "@vlandoss/loggy": "0.2.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -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: "my-app",
95
+ placeholder: TEMPLATE_META[template].placeholder,
96
96
  validate: (input) => validateProjectName(input ?? ""),
97
97
  });
98
98
  if (isCancel(value)) abort("Cancelled.");
@@ -162,7 +162,7 @@ export async function runInit(ctx: Context, options: InitOptions) {
162
162
  const installSpin = spinner();
163
163
  installSpin.start(`Installing dependencies with ${palette.highlight(detected)}`);
164
164
  try {
165
- await installDependencies({ cwd: dir, packageManager: { name: detected, command: detected } });
165
+ await installDependencies({ cwd: dir, packageManager: { name: detected, command: detected }, silent: true });
166
166
  installSpin.stop(`Installed with ${palette.highlight(detected)}`);
167
167
  } catch (error) {
168
168
  installSpin.stop("Failed to install dependencies", 1);
@@ -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} dev` : ` ${detectedPm} install && ${detectedPm} dev`,
210
+ shouldInstall ? ` ${detectedPm} ${runScript}` : ` ${detectedPm} install && ${detectedPm} ${runScript}`,
210
211
  ].join("\n"),
211
212
  );
212
213
  }
@@ -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