create-innovator 0.3.3 → 0.4.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +58 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
  import { readFileSync } from "fs";
5
5
  import { defineCommand, runMain } from "citty";
6
6
  import logo from "cli-ascii-logo";
7
- import { intro, text, isCancel as isCancel3, outro, log } from "@clack/prompts";
7
+ import { intro, text, isCancel as isCancel3, outro, log as log2 } from "@clack/prompts";
8
8
 
9
9
  // src/auth/github.ts
10
10
  import { Octokit } from "@octokit/rest";
@@ -252,7 +252,7 @@ async function cloneTemplate(name, tag) {
252
252
  }
253
253
 
254
254
  // src/scaffold/template.ts
255
- import { readFile as readFile2, writeFile as writeFile2, readdir } from "fs/promises";
255
+ import { readFile as readFile2, writeFile as writeFile2, readdir, rm } from "fs/promises";
256
256
  import { join as join2, relative } from "path";
257
257
  import * as p4 from "@clack/prompts";
258
258
  import { toCamelCase as toCamelCase2, toTitleCase } from "remeda";
@@ -301,6 +301,59 @@ async function replaceTemplateNames(dir, projectName) {
301
301
  }
302
302
  s.stop(`Replaced template names in ${replacedCount} file(s)`);
303
303
  }
304
+ var TEMPLATE_FILES_TO_REMOVE = ["changelog.md", "claude.md", "readme.md"];
305
+ async function removeTemplateFiles(dir) {
306
+ const s = p4.spinner();
307
+ s.start("Removing template files");
308
+ const allFiles = await readdir(dir);
309
+ const filesToRemove = allFiles.filter((f) => TEMPLATE_FILES_TO_REMOVE.includes(f.toLowerCase()));
310
+ for (const file of filesToRemove) {
311
+ await rm(join2(dir, file));
312
+ }
313
+ s.stop(`Removed ${filesToRemove.length} template file(s)`);
314
+ }
315
+
316
+ // src/scaffold/setup.ts
317
+ import { execFile as execFileCb2 } from "child_process";
318
+ import { promisify as promisify2 } from "util";
319
+ import * as p5 from "@clack/prompts";
320
+ var execFile2 = promisify2(execFileCb2);
321
+ async function setupProject(projectName) {
322
+ const s = p5.spinner();
323
+ try {
324
+ s.start("Checking pnpm availability");
325
+ try {
326
+ await execFile2("pnpm", ["--version"]);
327
+ } catch {
328
+ s.message("Enabling corepack");
329
+ await execFile2("corepack", ["enable"]);
330
+ }
331
+ s.stop("pnpm is available");
332
+ s.start("Installing dependencies");
333
+ await execFile2("pnpm", ["install"], { cwd: projectName });
334
+ s.stop("Dependencies installed");
335
+ s.start("Updating test snapshots");
336
+ await execFile2("pnpm", ["test", "-u"], { cwd: projectName });
337
+ s.stop("Test snapshots updated");
338
+ s.start("Creating initial commit");
339
+ await execFile2("git", ["add", "."], { cwd: projectName });
340
+ await execFile2("git", ["commit", "-m", `feat(${projectName}): initial commit`], {
341
+ cwd: projectName,
342
+ env: { ...process.env, HUSKY: "0" }
343
+ });
344
+ s.stop("Initial commit created");
345
+ } catch {
346
+ s.stop("Setup incomplete");
347
+ p5.log.warn("Automatic setup failed. Run these commands manually:");
348
+ p5.log.info(
349
+ ` cd ${projectName}
350
+ corepack enable
351
+ pnpm install
352
+ pnpm test -u
353
+ git add . && HUSKY=0 git commit -m "feat(${projectName}): initial commit"`
354
+ );
355
+ }
356
+ }
304
357
 
305
358
  // src/cli.ts
306
359
  var pkgUrl = new URL("../package.json", import.meta.url);
@@ -344,10 +397,12 @@ var main = defineCommand({
344
397
  const tag = await selectVersion(token, args.experimental);
345
398
  await cloneTemplate(projectName, tag);
346
399
  await replaceTemplateNames(projectName, projectName);
400
+ await removeTemplateFiles(projectName);
347
401
  } catch (error) {
348
- log.error(error instanceof Error ? error.message : "Scaffolding failed.");
402
+ log2.error(error instanceof Error ? error.message : "Scaffolding failed.");
349
403
  process.exit(1);
350
404
  }
405
+ await setupProject(projectName);
351
406
  outro(`Project ${projectName} is ready!`);
352
407
  }
353
408
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-innovator",
3
- "version": "0.3.3",
3
+ "version": "0.4.1",
4
4
  "description": "Create Innovator App",
5
5
  "author": {
6
6
  "email": "storm@reply.de",