create-krispya 0.4.1 → 0.4.3

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.cjs CHANGED
@@ -10,6 +10,7 @@ const commander = require('commander');
10
10
  const p = require('@clack/prompts');
11
11
  const color = require('chalk');
12
12
  const undici = require('undici');
13
+ const child_process = require('child_process');
13
14
 
14
15
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
15
16
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -380,6 +381,18 @@ async function promptForOptions(name) {
380
381
  projectType
381
382
  );
382
383
  }
384
+ function openInEditor(editor, path) {
385
+ return new Promise((resolve, reject) => {
386
+ const child = child_process.spawn(editor, [path], {
387
+ detached: true,
388
+ stdio: "ignore",
389
+ shell: process.platform === "win32"
390
+ });
391
+ child.on("error", reject);
392
+ child.unref();
393
+ setTimeout(resolve, 100);
394
+ });
395
+ }
383
396
  async function main() {
384
397
  const program = new commander.Command().name("create-krispya").description(
385
398
  "CLI for creating Vanilla, React, and React Three Fiber projects"
@@ -542,6 +555,36 @@ async function main() {
542
555
  `${packageManager} run dev`
543
556
  ].join("\n");
544
557
  p__namespace.note(nextSteps, "Next steps");
558
+ const openEditor = await p__namespace.select({
559
+ message: "Open project in editor?",
560
+ options: [
561
+ { value: "skip", label: "Skip" },
562
+ { value: "cursor", label: "Cursor" },
563
+ { value: "code", label: "VS Code" },
564
+ { value: "webstorm", label: "WebStorm" }
565
+ ],
566
+ initialValue: "skip"
567
+ });
568
+ if (!p__namespace.isCancel(openEditor) && openEditor !== "skip") {
569
+ const editorNames = {
570
+ cursor: "Cursor",
571
+ code: "VS Code",
572
+ webstorm: "WebStorm"
573
+ };
574
+ try {
575
+ await openInEditor(
576
+ openEditor,
577
+ basePath
578
+ );
579
+ p__namespace.log.success(
580
+ `Opening in ${editorNames[openEditor]}...`
581
+ );
582
+ } catch {
583
+ p__namespace.log.warn(
584
+ `Could not open ${editorNames[openEditor]}. Make sure the CLI command is in your PATH.`
585
+ );
586
+ }
587
+ }
545
588
  p__namespace.outro(color__default.green("Happy coding! \u2728"));
546
589
  } catch (error) {
547
590
  s.stop("Failed to create project");
package/dist/cli.mjs CHANGED
@@ -8,6 +8,7 @@ import { Command } from 'commander';
8
8
  import * as p from '@clack/prompts';
9
9
  import color from 'chalk';
10
10
  import { fetch } from 'undici';
11
+ import { spawn } from 'child_process';
11
12
 
12
13
  const require$1 = createRequire(import.meta.url);
13
14
  const pkg = require$1("../package.json");
@@ -360,6 +361,18 @@ async function promptForOptions(name) {
360
361
  projectType
361
362
  );
362
363
  }
364
+ function openInEditor(editor, path) {
365
+ return new Promise((resolve, reject) => {
366
+ const child = spawn(editor, [path], {
367
+ detached: true,
368
+ stdio: "ignore",
369
+ shell: process.platform === "win32"
370
+ });
371
+ child.on("error", reject);
372
+ child.unref();
373
+ setTimeout(resolve, 100);
374
+ });
375
+ }
363
376
  async function main() {
364
377
  const program = new Command().name("create-krispya").description(
365
378
  "CLI for creating Vanilla, React, and React Three Fiber projects"
@@ -522,6 +535,36 @@ async function main() {
522
535
  `${packageManager} run dev`
523
536
  ].join("\n");
524
537
  p.note(nextSteps, "Next steps");
538
+ const openEditor = await p.select({
539
+ message: "Open project in editor?",
540
+ options: [
541
+ { value: "skip", label: "Skip" },
542
+ { value: "cursor", label: "Cursor" },
543
+ { value: "code", label: "VS Code" },
544
+ { value: "webstorm", label: "WebStorm" }
545
+ ],
546
+ initialValue: "skip"
547
+ });
548
+ if (!p.isCancel(openEditor) && openEditor !== "skip") {
549
+ const editorNames = {
550
+ cursor: "Cursor",
551
+ code: "VS Code",
552
+ webstorm: "WebStorm"
553
+ };
554
+ try {
555
+ await openInEditor(
556
+ openEditor,
557
+ basePath
558
+ );
559
+ p.log.success(
560
+ `Opening in ${editorNames[openEditor]}...`
561
+ );
562
+ } catch {
563
+ p.log.warn(
564
+ `Could not open ${editorNames[openEditor]}. Make sure the CLI command is in your PATH.`
565
+ );
566
+ }
567
+ }
525
568
  p.outro(color.green("Happy coding! \u2728"));
526
569
  } catch (error) {
527
570
  s.stop("Failed to create project");
package/dist/index.cjs CHANGED
@@ -1157,13 +1157,25 @@ function generate(options) {
1157
1157
  }
1158
1158
  }
1159
1159
  if (language === "typescript") {
1160
- const tsConfigNode = {
1160
+ const tsConfig = {
1161
+ $schema: "https://json.schemastore.org/tsconfig",
1162
+ files: [],
1163
+ references: [
1164
+ { path: "./.config/tsconfig.app.json" },
1165
+ { path: "./.config/tsconfig.node.json" }
1166
+ ]
1167
+ };
1168
+ files["tsconfig.json"] = {
1169
+ type: "text",
1170
+ content: JSON.stringify(tsConfig, null, 2)
1171
+ };
1172
+ const tsConfigApp = {
1161
1173
  $schema: "https://json.schemastore.org/tsconfig",
1162
1174
  compilerOptions: {
1163
1175
  target: "ESNext",
1164
1176
  module: "ESNext",
1165
1177
  moduleResolution: "bundler",
1166
- lib: ["ESNext"],
1178
+ lib: ["DOM", "DOM.Iterable", "ESNext"],
1167
1179
  esModuleInterop: true,
1168
1180
  allowSyntheticDefaultImports: true,
1169
1181
  strict: true,
@@ -1172,30 +1184,40 @@ function generate(options) {
1172
1184
  rewriteRelativeImportExtensions: true,
1173
1185
  erasableSyntaxOnly: true
1174
1186
  },
1175
- include: ["src", "tests"]
1176
- };
1177
- files["tsconfig.node.json"] = {
1178
- type: "text",
1179
- content: JSON.stringify(tsConfigNode, null, 2)
1180
- };
1181
- const tsConfig = {
1182
- $schema: "https://json.schemastore.org/tsconfig",
1183
- extends: "./tsconfig.node.json",
1184
- compilerOptions: {},
1185
- include: ["*.config.ts"],
1186
- references: [{ path: "./tsconfig.node.json" }]
1187
+ include: ["../src", "../tests"]
1187
1188
  };
1188
1189
  if (isReact || isR3f) {
1189
- tsConfig.compilerOptions.jsx = "react-jsx";
1190
+ tsConfigApp.compilerOptions.jsx = "react-jsx";
1190
1191
  devDependencies["@types/react"] = "^19.0.0";
1191
1192
  devDependencies["@types/react-dom"] = "^19.0.0";
1192
1193
  }
1193
1194
  if (isR3f) {
1194
1195
  devDependencies["@types/three"] = "~0.175.0";
1195
1196
  }
1196
- files["tsconfig.json"] = {
1197
+ files[".config/tsconfig.app.json"] = {
1197
1198
  type: "text",
1198
- content: JSON.stringify(tsConfig, null, 2)
1199
+ content: JSON.stringify(tsConfigApp, null, 2)
1200
+ };
1201
+ const tsConfigNode = {
1202
+ $schema: "https://json.schemastore.org/tsconfig",
1203
+ compilerOptions: {
1204
+ target: "ESNext",
1205
+ module: "ESNext",
1206
+ moduleResolution: "bundler",
1207
+ lib: ["ESNext"],
1208
+ esModuleInterop: true,
1209
+ allowSyntheticDefaultImports: true,
1210
+ strict: true,
1211
+ skipLibCheck: true,
1212
+ composite: true,
1213
+ rewriteRelativeImportExtensions: true,
1214
+ erasableSyntaxOnly: true
1215
+ },
1216
+ include: ["../*.config.ts", "./*.ts"]
1217
+ };
1218
+ files[".config/tsconfig.node.json"] = {
1219
+ type: "text",
1220
+ content: JSON.stringify(tsConfigNode, null, 2)
1199
1221
  };
1200
1222
  }
1201
1223
  const codeSnippets = {};
package/dist/index.mjs CHANGED
@@ -1151,13 +1151,25 @@ function generate(options) {
1151
1151
  }
1152
1152
  }
1153
1153
  if (language === "typescript") {
1154
- const tsConfigNode = {
1154
+ const tsConfig = {
1155
+ $schema: "https://json.schemastore.org/tsconfig",
1156
+ files: [],
1157
+ references: [
1158
+ { path: "./.config/tsconfig.app.json" },
1159
+ { path: "./.config/tsconfig.node.json" }
1160
+ ]
1161
+ };
1162
+ files["tsconfig.json"] = {
1163
+ type: "text",
1164
+ content: JSON.stringify(tsConfig, null, 2)
1165
+ };
1166
+ const tsConfigApp = {
1155
1167
  $schema: "https://json.schemastore.org/tsconfig",
1156
1168
  compilerOptions: {
1157
1169
  target: "ESNext",
1158
1170
  module: "ESNext",
1159
1171
  moduleResolution: "bundler",
1160
- lib: ["ESNext"],
1172
+ lib: ["DOM", "DOM.Iterable", "ESNext"],
1161
1173
  esModuleInterop: true,
1162
1174
  allowSyntheticDefaultImports: true,
1163
1175
  strict: true,
@@ -1166,30 +1178,40 @@ function generate(options) {
1166
1178
  rewriteRelativeImportExtensions: true,
1167
1179
  erasableSyntaxOnly: true
1168
1180
  },
1169
- include: ["src", "tests"]
1170
- };
1171
- files["tsconfig.node.json"] = {
1172
- type: "text",
1173
- content: JSON.stringify(tsConfigNode, null, 2)
1174
- };
1175
- const tsConfig = {
1176
- $schema: "https://json.schemastore.org/tsconfig",
1177
- extends: "./tsconfig.node.json",
1178
- compilerOptions: {},
1179
- include: ["*.config.ts"],
1180
- references: [{ path: "./tsconfig.node.json" }]
1181
+ include: ["../src", "../tests"]
1181
1182
  };
1182
1183
  if (isReact || isR3f) {
1183
- tsConfig.compilerOptions.jsx = "react-jsx";
1184
+ tsConfigApp.compilerOptions.jsx = "react-jsx";
1184
1185
  devDependencies["@types/react"] = "^19.0.0";
1185
1186
  devDependencies["@types/react-dom"] = "^19.0.0";
1186
1187
  }
1187
1188
  if (isR3f) {
1188
1189
  devDependencies["@types/three"] = "~0.175.0";
1189
1190
  }
1190
- files["tsconfig.json"] = {
1191
+ files[".config/tsconfig.app.json"] = {
1191
1192
  type: "text",
1192
- content: JSON.stringify(tsConfig, null, 2)
1193
+ content: JSON.stringify(tsConfigApp, null, 2)
1194
+ };
1195
+ const tsConfigNode = {
1196
+ $schema: "https://json.schemastore.org/tsconfig",
1197
+ compilerOptions: {
1198
+ target: "ESNext",
1199
+ module: "ESNext",
1200
+ moduleResolution: "bundler",
1201
+ lib: ["ESNext"],
1202
+ esModuleInterop: true,
1203
+ allowSyntheticDefaultImports: true,
1204
+ strict: true,
1205
+ skipLibCheck: true,
1206
+ composite: true,
1207
+ rewriteRelativeImportExtensions: true,
1208
+ erasableSyntaxOnly: true
1209
+ },
1210
+ include: ["../*.config.ts", "./*.ts"]
1211
+ };
1212
+ files[".config/tsconfig.node.json"] = {
1213
+ type: "text",
1214
+ content: JSON.stringify(tsConfigNode, null, 2)
1193
1215
  };
1194
1216
  }
1195
1217
  const codeSnippets = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-krispya",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "🌹 CLI for creating web projects with (my) sensible defaults",
5
5
  "keywords": [
6
6
  "cli",