create-krispya 0.3.0 → 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.
package/dist/cli.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
+ const module$1 = require('module');
4
5
  const process$1 = require('process');
5
6
  const index = require('./index.cjs');
6
7
  const path = require('path');
@@ -10,6 +11,7 @@ const p = require('@clack/prompts');
10
11
  const color = require('chalk');
11
12
  const undici = require('undici');
12
13
 
14
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
13
15
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
14
16
 
15
17
  function _interopNamespaceCompat(e) {
@@ -27,6 +29,8 @@ function _interopNamespaceCompat(e) {
27
29
  const p__namespace = /*#__PURE__*/_interopNamespaceCompat(p);
28
30
  const color__default = /*#__PURE__*/_interopDefaultCompat(color);
29
31
 
32
+ const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.cjs', document.baseURI).href)));
33
+ const pkg = require$1("../package.json");
30
34
  function getDefaultProjectName(template) {
31
35
  const base = index.getBaseTemplate(template);
32
36
  switch (base) {
@@ -408,7 +412,7 @@ async function main() {
408
412
  'set Node.js version for engines.node field (default: "latest")'
409
413
  ).option("-y, --yes", "Skip prompts and use default values").action(async (name, options) => {
410
414
  console.clear();
411
- p__namespace.intro(color__default.bgCyan(color__default.black(" create-krispya ")));
415
+ p__namespace.intro(color__default.bgCyan(color__default.black(` create-krispya v${pkg.version} `)));
412
416
  let generateOptions;
413
417
  if (Object.keys(options).length > 0) {
414
418
  const template = options.template ?? "vanilla";
package/dist/cli.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from 'module';
2
3
  import { cwd } from 'process';
3
4
  import { getBaseTemplate, getLatestPnpmVersion, getLatestNodeVersion, getLatestNpmVersion, generate, generateRandomName, getLanguageFromTemplate } from './index.mjs';
4
5
  import { join, dirname } from 'path';
@@ -8,6 +9,8 @@ import * as p from '@clack/prompts';
8
9
  import color from 'chalk';
9
10
  import { fetch } from 'undici';
10
11
 
12
+ const require$1 = createRequire(import.meta.url);
13
+ const pkg = require$1("../package.json");
11
14
  function getDefaultProjectName(template) {
12
15
  const base = getBaseTemplate(template);
13
16
  switch (base) {
@@ -389,7 +392,7 @@ async function main() {
389
392
  'set Node.js version for engines.node field (default: "latest")'
390
393
  ).option("-y, --yes", "Skip prompts and use default values").action(async (name, options) => {
391
394
  console.clear();
392
- p.intro(color.bgCyan(color.black(" create-krispya ")));
395
+ p.intro(color.bgCyan(color.black(` create-krispya v${pkg.version} `)));
393
396
  let generateOptions;
394
397
  if (Object.keys(options).length > 0) {
395
398
  const template = options.template ?? "vanilla";
package/dist/index.cjs CHANGED
@@ -437,17 +437,24 @@ function generateOxfmt(generator, options) {
437
437
  bracketSpacing: defaultFormatterConfig.bracketSpacing,
438
438
  arrowParens: defaultFormatterConfig.arrowParens
439
439
  };
440
- generator.addFile(".oxfmt.json", {
440
+ generator.addFile(".config/oxfmt.json", {
441
441
  type: "text",
442
442
  content: JSON.stringify(oxfmtConfig, null, 2)
443
443
  });
444
- generator.addScript("format", "oxfmt --write .");
444
+ generator.addScript("format", "oxfmt -c .config/oxfmt.json --write .");
445
445
  generator.inject(
446
446
  "readme-tools",
447
447
  "[Oxfmt](https://oxc.rs/docs/guide/usage/formatter) - Fast Prettier-compatible code formatter"
448
448
  );
449
449
  generator.inject("vscode-extension-suggestion", "oxc.oxc-vscode");
450
450
  generator.addVscodeSetting("editor.defaultFormatter", "oxc.oxc-vscode");
451
+ generator.addVscodeSetting("oxc.fmt.configPath", ".config/oxfmt.json");
452
+ generator.addVscodeSetting("[json]", {
453
+ "editor.defaultFormatter": "vscode.json-language-features"
454
+ });
455
+ generator.addVscodeSetting("[jsonc]", {
456
+ "editor.defaultFormatter": "vscode.json-language-features"
457
+ });
451
458
  }
452
459
 
453
460
  function toOxlintLevel(level) {
@@ -465,7 +472,7 @@ function generateOxlint(generator, options) {
465
472
  plugins.push("react");
466
473
  }
467
474
  const oxlintConfig = {
468
- $schema: "./node_modules/oxlint/configuration_schema.json",
475
+ $schema: "../node_modules/oxlint/configuration_schema.json",
469
476
  plugins,
470
477
  rules: {
471
478
  "no-unused-vars": [
@@ -484,17 +491,18 @@ function generateOxlint(generator, options) {
484
491
  },
485
492
  ignorePatterns: defaultLinterConfig.ignorePatterns
486
493
  };
487
- generator.addFile("oxlint.json", {
494
+ generator.addFile(".config/oxlint.json", {
488
495
  type: "text",
489
496
  content: JSON.stringify(oxlintConfig, null, 2)
490
497
  });
491
- generator.addScript("lint", "oxlint");
498
+ generator.addScript("lint", "oxlint -c .config/oxlint.json");
492
499
  generator.inject(
493
500
  "readme-tools",
494
501
  "[Oxlint](https://oxc.rs/docs/guide/usage/linter) - A fast linter for JavaScript and TypeScript"
495
502
  );
496
503
  generator.inject("vscode-extension-suggestion", "oxc.oxc-vscode");
497
504
  generator.addVscodeSetting("oxc.enable", true);
505
+ generator.addVscodeSetting("oxc.configPath", ".config/oxlint.json");
498
506
  }
499
507
 
500
508
  function generatePostprocessing(generator, options) {
@@ -857,11 +865,11 @@ function generateUnbuild(generator) {
857
865
  }
858
866
  buildConfigLines.push(` },`);
859
867
  buildConfigLines.push(`})`);
860
- generator.addFile(`build.config.${ext}`, {
868
+ generator.addFile(`.config/build.config.${ext}`, {
861
869
  type: "text",
862
870
  content: buildConfigLines.join("\n")
863
871
  });
864
- generator.addScript("build", "unbuild");
872
+ generator.addScript("build", `unbuild --config .config/build.config.${ext}`);
865
873
  generator.inject(
866
874
  "readme-libraries",
867
875
  "[unbuild](https://github.com/unjs/unbuild) - Unified JavaScript build system"
@@ -1327,6 +1335,7 @@ function generate(options) {
1327
1335
  const jsxExt = language === "typescript" ? "tsx" : "jsx";
1328
1336
  const packageJson = {
1329
1337
  name,
1338
+ description: "Built with \u{1F339} create-krispya",
1330
1339
  type: "module"
1331
1340
  };
1332
1341
  if (isLibrary) {
package/dist/index.mjs CHANGED
@@ -431,17 +431,24 @@ function generateOxfmt(generator, options) {
431
431
  bracketSpacing: defaultFormatterConfig.bracketSpacing,
432
432
  arrowParens: defaultFormatterConfig.arrowParens
433
433
  };
434
- generator.addFile(".oxfmt.json", {
434
+ generator.addFile(".config/oxfmt.json", {
435
435
  type: "text",
436
436
  content: JSON.stringify(oxfmtConfig, null, 2)
437
437
  });
438
- generator.addScript("format", "oxfmt --write .");
438
+ generator.addScript("format", "oxfmt -c .config/oxfmt.json --write .");
439
439
  generator.inject(
440
440
  "readme-tools",
441
441
  "[Oxfmt](https://oxc.rs/docs/guide/usage/formatter) - Fast Prettier-compatible code formatter"
442
442
  );
443
443
  generator.inject("vscode-extension-suggestion", "oxc.oxc-vscode");
444
444
  generator.addVscodeSetting("editor.defaultFormatter", "oxc.oxc-vscode");
445
+ generator.addVscodeSetting("oxc.fmt.configPath", ".config/oxfmt.json");
446
+ generator.addVscodeSetting("[json]", {
447
+ "editor.defaultFormatter": "vscode.json-language-features"
448
+ });
449
+ generator.addVscodeSetting("[jsonc]", {
450
+ "editor.defaultFormatter": "vscode.json-language-features"
451
+ });
445
452
  }
446
453
 
447
454
  function toOxlintLevel(level) {
@@ -459,7 +466,7 @@ function generateOxlint(generator, options) {
459
466
  plugins.push("react");
460
467
  }
461
468
  const oxlintConfig = {
462
- $schema: "./node_modules/oxlint/configuration_schema.json",
469
+ $schema: "../node_modules/oxlint/configuration_schema.json",
463
470
  plugins,
464
471
  rules: {
465
472
  "no-unused-vars": [
@@ -478,17 +485,18 @@ function generateOxlint(generator, options) {
478
485
  },
479
486
  ignorePatterns: defaultLinterConfig.ignorePatterns
480
487
  };
481
- generator.addFile("oxlint.json", {
488
+ generator.addFile(".config/oxlint.json", {
482
489
  type: "text",
483
490
  content: JSON.stringify(oxlintConfig, null, 2)
484
491
  });
485
- generator.addScript("lint", "oxlint");
492
+ generator.addScript("lint", "oxlint -c .config/oxlint.json");
486
493
  generator.inject(
487
494
  "readme-tools",
488
495
  "[Oxlint](https://oxc.rs/docs/guide/usage/linter) - A fast linter for JavaScript and TypeScript"
489
496
  );
490
497
  generator.inject("vscode-extension-suggestion", "oxc.oxc-vscode");
491
498
  generator.addVscodeSetting("oxc.enable", true);
499
+ generator.addVscodeSetting("oxc.configPath", ".config/oxlint.json");
492
500
  }
493
501
 
494
502
  function generatePostprocessing(generator, options) {
@@ -851,11 +859,11 @@ function generateUnbuild(generator) {
851
859
  }
852
860
  buildConfigLines.push(` },`);
853
861
  buildConfigLines.push(`})`);
854
- generator.addFile(`build.config.${ext}`, {
862
+ generator.addFile(`.config/build.config.${ext}`, {
855
863
  type: "text",
856
864
  content: buildConfigLines.join("\n")
857
865
  });
858
- generator.addScript("build", "unbuild");
866
+ generator.addScript("build", `unbuild --config .config/build.config.${ext}`);
859
867
  generator.inject(
860
868
  "readme-libraries",
861
869
  "[unbuild](https://github.com/unjs/unbuild) - Unified JavaScript build system"
@@ -1321,6 +1329,7 @@ function generate(options) {
1321
1329
  const jsxExt = language === "typescript" ? "tsx" : "jsx";
1322
1330
  const packageJson = {
1323
1331
  name,
1332
+ description: "Built with \u{1F339} create-krispya",
1324
1333
  type: "module"
1325
1334
  };
1326
1335
  if (isLibrary) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-krispya",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "🌹 CLI for creating web projects with (my) sensible defaults",
5
5
  "keywords": [
6
6
  "cli",