create-rstack 1.0.6 → 1.0.8

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/index.d.ts CHANGED
@@ -1,19 +1,88 @@
1
- import { multiselect, select, text } from '@clack/prompts';
2
- export { select, multiselect, text };
3
- export declare function checkCancel<T>(value: unknown): T;
4
- export type Argv = {
5
- help?: boolean;
6
- dir?: string;
7
- template?: string;
8
- override?: boolean;
9
- tools?: string | string[];
10
- };
11
- export type ESLintTemplateName = 'vanilla-js' | 'vanilla-ts' | 'react-js' | 'react-ts' | 'vue-ts' | 'vue-js' | 'svelte-js' | 'svelte-ts';
12
- export declare function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, }: {
13
- name: string;
14
- root: string;
15
- skipFiles?: string[];
16
- templates: string[];
17
- getTemplateName: (argv: Argv) => Promise<string>;
18
- mapESLintTemplate: (templateName: string) => ESLintTemplateName | null;
19
- }): Promise<void>;
1
+ export declare type Argv = {
2
+ help?: boolean;
3
+ dir?: string;
4
+ template?: string;
5
+ override?: boolean;
6
+ tools?: string | string[];
7
+ };
8
+
9
+ export declare function checkCancel<T>(value: unknown): T;
10
+
11
+ /**
12
+ * Copy files from one folder to another.
13
+ * @param from Source folder
14
+ * @param to Destination folder
15
+ * @param version Version to update in package.json
16
+ * @param packageName Name to update in package.json
17
+ * @param isMergePackageJson Merge package.json files
18
+ * @param skipFiles Files to skip
19
+ */
20
+ export declare function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles, }: {
21
+ from: string;
22
+ to: string;
23
+ version: string;
24
+ packageName?: string;
25
+ isMergePackageJson?: boolean;
26
+ skipFiles?: string[];
27
+ }): void;
28
+
29
+ export declare function create({ name, root, templates, skipFiles, getTemplateName, mapESLintTemplate, }: {
30
+ name: string;
31
+ root: string;
32
+ skipFiles?: string[];
33
+ templates: string[];
34
+ getTemplateName: (argv: Argv) => Promise<string>;
35
+ mapESLintTemplate: (templateName: string) => ESLintTemplateName | null;
36
+ }): Promise<void>;
37
+
38
+ export declare type ESLintTemplateName = 'vanilla-js' | 'vanilla-ts' | 'react-js' | 'react-ts' | 'vue-ts' | 'vue-js' | 'svelte-js' | 'svelte-ts';
39
+
40
+ /**
41
+ * Merge two package.json files and keep the order of keys.
42
+ * @param targetPackage Path to the base package.json file
43
+ * @param extraPackage Path to the extra package.json file to merge
44
+ */
45
+ export declare function mergePackageJson(targetPackage: string, extraPackage: string): void;
46
+
47
+ export declare const multiselect: <Options extends Option_2<Value>[], Value>(opts: MultiSelectOptions<Options, Value>) => Promise<symbol | Value[]>;
48
+
49
+ declare interface MultiSelectOptions<Options extends Option_2<Value>[], Value> {
50
+ message: string;
51
+ options: Options;
52
+ initialValues?: Value[];
53
+ required?: boolean;
54
+ cursorAt?: Value;
55
+ }
56
+
57
+ declare type Option_2<Value> = Value extends Primitive ? {
58
+ value: Value;
59
+ label?: string;
60
+ hint?: string;
61
+ } : {
62
+ value: Value;
63
+ label: string;
64
+ hint?: string;
65
+ };
66
+
67
+ declare type Primitive = Readonly<string | boolean | number>;
68
+
69
+ export declare const select: <Options extends Option_2<Value>[], Value>(opts: SelectOptions<Options, Value>) => Promise<symbol | Value>;
70
+
71
+ declare interface SelectOptions<Options extends Option_2<Value>[], Value> {
72
+ message: string;
73
+ options: Options;
74
+ initialValue?: Value;
75
+ maxItems?: number;
76
+ }
77
+
78
+ export declare const text: (opts: TextOptions) => Promise<string | symbol>;
79
+
80
+ declare interface TextOptions {
81
+ message: string;
82
+ placeholder?: string;
83
+ defaultValue?: string;
84
+ initialValue?: string;
85
+ validate?: (value: string) => string | void;
86
+ }
87
+
88
+ export { }
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
- import { fileURLToPath as __webpack_fileURLToPath__ } from "url";
2
- import { dirname as __webpack_dirname__ } from "path";
1
+ // Rslib ESM shims
2
+ import __rslib_shim_module__ from 'module';
3
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
4
  import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
5
6
  import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
7
+ import * as __WEBPACK_EXTERNAL_MODULE_node_url__ from "node:url";
6
8
  import * as __WEBPACK_EXTERNAL_MODULE_node_process__ from "node:process";
7
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_readline__ from "node:readline";
8
10
  import * as __WEBPACK_EXTERNAL_MODULE_node_tty__ from "node:tty";
@@ -287,7 +289,7 @@ var __webpack_modules__ = {
287
289
  },
288
290
  "./node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors/picocolors.js": function(module, __unused_webpack_exports, __webpack_require__) {
289
291
  let argv = process.argv || [], env = process.env;
290
- let isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || "win32" === process.platform || null != __webpack_require__("./node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors sync recursive") && __webpack_require__("tty")/* .isatty */ .isatty(1) && "dumb" !== env.TERM || "CI" in env);
292
+ let isColorSupported = !("NO_COLOR" in env || argv.includes("--no-color")) && ("FORCE_COLOR" in env || argv.includes("--color") || "win32" === process.platform || null != require && __webpack_require__("tty")/* .isatty */ .isatty(1) && "dumb" !== env.TERM || "CI" in env);
291
293
  let formatter = (open, close, replace = open)=>(input)=>{
292
294
  let string = "" + input;
293
295
  let index = string.indexOf(close, open.length);
@@ -337,17 +339,6 @@ var __webpack_modules__ = {
337
339
  module.exports = createColors();
338
340
  module.exports.createColors = createColors;
339
341
  },
340
- "./node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors sync recursive": function(module) {
341
- function webpackEmptyContext(req) {
342
- var e = new Error("Cannot find module '" + req + "'");
343
- e.code = 'MODULE_NOT_FOUND';
344
- throw e;
345
- }
346
- webpackEmptyContext.keys = ()=>[];
347
- webpackEmptyContext.resolve = webpackEmptyContext;
348
- webpackEmptyContext.id = "./node_modules/.pnpm/picocolors@1.0.1/node_modules/picocolors sync recursive";
349
- module.exports = webpackEmptyContext;
350
- },
351
342
  "./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js": function(module) {
352
343
  const ESC = '\x1B';
353
344
  const CSI = `${ESC}[`;
@@ -1513,7 +1504,8 @@ ${gray(rest.join("\n"))}`;
1513
1504
  };
1514
1505
  // src/index.ts
1515
1506
  var logger = createLogger();
1516
- var src_dirname = __webpack_dirname__(__webpack_fileURLToPath__(import.meta.url));
1507
+ const src_filename = (0, __WEBPACK_EXTERNAL_MODULE_node_url__.fileURLToPath)(import.meta.url);
1508
+ const src_dirname = (0, __WEBPACK_EXTERNAL_MODULE_node_path__.dirname)(src_filename);
1517
1509
  function cancelAndExit() {
1518
1510
  ue('Operation cancelled.');
1519
1511
  process.exit(0);
@@ -1701,7 +1693,11 @@ function sortObjectKeys(obj) {
1701
1693
  for (const key of sortedKeys)sortedObj[key] = obj[key];
1702
1694
  return sortedObj;
1703
1695
  }
1704
- function mergePackageJson(targetPackage, extraPackage) {
1696
+ /**
1697
+ * Merge two package.json files and keep the order of keys.
1698
+ * @param targetPackage Path to the base package.json file
1699
+ * @param extraPackage Path to the extra package.json file to merge
1700
+ */ function mergePackageJson(targetPackage, extraPackage) {
1705
1701
  if (!__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].existsSync(targetPackage)) return;
1706
1702
  const targetJson = JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].readFileSync(targetPackage, 'utf-8'));
1707
1703
  const extraJson = JSON.parse(__WEBPACK_EXTERNAL_MODULE_node_fs__["default"].readFileSync(extraPackage, 'utf-8'));
@@ -1716,7 +1712,15 @@ function mergePackageJson(targetPackage, extraPackage) {
1716
1712
  }
1717
1713
  __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].writeFileSync(targetPackage, `${JSON.stringify(mergedJson, null, 2)}\n`);
1718
1714
  }
1719
- function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles = [] }) {
1715
+ /**
1716
+ * Copy files from one folder to another.
1717
+ * @param from Source folder
1718
+ * @param to Destination folder
1719
+ * @param version Version to update in package.json
1720
+ * @param packageName Name to update in package.json
1721
+ * @param isMergePackageJson Merge package.json files
1722
+ * @param skipFiles Files to skip
1723
+ */ function copyFolder({ from, to, version, packageName, isMergePackageJson, skipFiles = [] }) {
1720
1724
  const renameFiles = {
1721
1725
  gitignore: '.gitignore'
1722
1726
  };
@@ -1766,4 +1770,4 @@ const updatePackageJson = (pkgJsonPath, version, name)=>{
1766
1770
  if (name && '.' !== name) pkg.name = name;
1767
1771
  __WEBPACK_EXTERNAL_MODULE_node_fs__["default"].writeFileSync(pkgJsonPath, JSON.stringify(pkg, null, 2));
1768
1772
  };
1769
- export { checkCancel, create, ae as multiselect, ie as select, te as text };
1773
+ export { checkCancel, copyFolder, create, mergePackageJson, ae as multiselect, ie as select, te as text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rstack",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Create a new Rstack project",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,12 @@
16
16
  },
17
17
  "main": "./dist/index.js",
18
18
  "types": "./dist/index.d.ts",
19
- "files": ["template-biome", "template-eslint", "template-prettier", "dist"],
19
+ "files": [
20
+ "template-biome",
21
+ "template-eslint",
22
+ "template-prettier",
23
+ "dist"
24
+ ],
20
25
  "scripts": {
21
26
  "build": "rslib build",
22
27
  "dev": "rslib build --watch",
@@ -37,7 +42,8 @@
37
42
  "devDependencies": {
38
43
  "@biomejs/biome": "^1.9.3",
39
44
  "@clack/prompts": "^0.7.0",
40
- "@rslib/core": "0.0.5",
45
+ "@microsoft/api-extractor": "^7.47.10",
46
+ "@rslib/core": "0.0.12",
41
47
  "@types/minimist": "^1.2.5",
42
48
  "@types/node": "18.19.55",
43
49
  "deepmerge": "^4.3.1",