create-pnpm-cli 0.0.3 → 0.0.5

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/bin/bin.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import('../lib/cli.js')
3
+ import('../lib/cli.cjs')
package/lib/cli.cjs ADDED
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/cli.ts
31
+ var cli_exports = {};
32
+ __export(cli_exports, {
33
+ cli: () => cli
34
+ });
35
+ module.exports = __toCommonJS(cli_exports);
36
+
37
+ // package.json
38
+ var version = "0.0.4";
39
+
40
+ // src/constants.ts
41
+ var import_path = __toESM(require("path"), 1);
42
+ var ROOT_PATH = import_path.default.join(__dirname, "..");
43
+ var TEMPLATE_PATH = import_path.default.join(ROOT_PATH, "template");
44
+ var PACKAGE_CHOICES = [
45
+ "prettier" /* prettier */
46
+ ].map((item) => ({ name: item, value: item }));
47
+ var PACKAGE_MAP = {
48
+ ["prettier" /* prettier */]: {
49
+ packages: ["prettier", "@trivago/prettier-plugin-sort-imports"],
50
+ options: ["--save-dev"]
51
+ }
52
+ };
53
+
54
+ // src/utils.ts
55
+ var import_process = require("process");
56
+ function handleError(err, message) {
57
+ console.log(message + "\uFF1A", err);
58
+ (0, import_process.exit)(1);
59
+ }
60
+
61
+ // src/cli.ts
62
+ var import_prompts = require("@inquirer/prompts");
63
+ var import_commander = require("commander");
64
+ var import_fast_glob = __toESM(require("fast-glob"), 1);
65
+ var import_fs_extra = __toESM(require("fs-extra"), 1);
66
+ var import_package_manager_install = __toESM(require("package-manager-install"), 1);
67
+ var import_path2 = __toESM(require("path"), 1);
68
+ var cli = import_commander.program;
69
+ cli.name("create-pnpm-cli").version(version);
70
+ cli.command("create", { isDefault: true }).description("create pnpm cli").argument("[path]", "path to mkdir", "./").action(async (targetPath) => {
71
+ const names = await (0, import_fast_glob.default)(`**`, {
72
+ deep: 1,
73
+ cwd: TEMPLATE_PATH,
74
+ onlyFiles: false
75
+ });
76
+ const template = await (0, import_prompts.select)({
77
+ message: "\u8BF7\u9009\u62E9\u6A21\u677F",
78
+ choices: names.map((item) => ({ name: item, value: item }))
79
+ });
80
+ const name = await (0, import_prompts.input)({
81
+ message: "\u8BF7\u8F93\u5165\u5305\u540D",
82
+ default: template
83
+ });
84
+ const target = import_path2.default.join(targetPath, name);
85
+ await import_fs_extra.default.ensureDir(target).catch((err) => handleError(err, "\u6587\u4EF6\u5939\u4E0D\u5B58\u5728"));
86
+ await import_fs_extra.default.copy(import_path2.default.join(TEMPLATE_PATH, template), target).catch((err) => handleError(err, "\u62F7\u8D1D\u6587\u4EF6\u9519\u8BEF"));
87
+ await (0, import_package_manager_install.default)({ cwd: target });
88
+ });
89
+ cli.parse();
90
+ // Annotate the CommonJS export names for ESM import in node:
91
+ 0 && (module.exports = {
92
+ cli
93
+ });
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "create-pnpm-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "create pnpm cli",
5
5
  "type": "module",
6
- "main": "./lib/cli.js",
7
- "module": "./lib/cli.js",
8
- "types": "./lib/cli.d.ts",
6
+ "main": "./lib/cli.cjs",
7
+ "types": "./lib/cli.d.cts",
9
8
  "bin": "./bin/bin.js",
10
9
  "files": [
11
10
  "./lib",
@@ -23,7 +22,10 @@
23
22
  "@types/fs-extra": "^11.0.4",
24
23
  "tsup": "^8.2.3"
25
24
  },
25
+ "engines": {
26
+ "node": ">=18"
27
+ },
26
28
  "scripts": {
27
- "dev": "tsup ./src/cli.ts --dts --clean --shims --format=esm --platform=node --outDir=./lib --watch"
29
+ "dev": "tsup ./src/cli.ts --dts --clean --shims --format=cjs --platform=node --outDir=./lib --watch"
28
30
  }
29
31
  }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "skipLibCheck": true,
5
+ "noEmit": true,
6
+ "module": "ESNext",
7
+ "target": "ESNext",
8
+ "resolveJsonModule": true,
9
+ "moduleResolution": "node",
10
+ "esModuleInterop": true
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "skipLibCheck": true,
5
+ "noEmit": true,
6
+ "module": "ESNext",
7
+ "target": "ESNext",
8
+ "resolveJsonModule": true,
9
+ "moduleResolution": "node",
10
+ "esModuleInterop": true
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "skipLibCheck": true,
5
+ "noEmit": true,
6
+ "module": "ESNext",
7
+ "target": "ESNext",
8
+ "resolveJsonModule": true,
9
+ "moduleResolution": "node",
10
+ "esModuleInterop": true
11
+ }
12
+ }
package/lib/cli.js DELETED
@@ -1,63 +0,0 @@
1
- // ../../node_modules/.pnpm/tsup@8.2.3_typescript@5.5.4/node_modules/tsup/assets/esm_shims.js
2
- import { fileURLToPath } from "url";
3
- import path from "path";
4
- var getFilename = () => fileURLToPath(import.meta.url);
5
- var getDirname = () => path.dirname(getFilename());
6
- var __dirname = /* @__PURE__ */ getDirname();
7
-
8
- // package.json
9
- var version = "0.0.2";
10
-
11
- // src/constants.ts
12
- import path2 from "path";
13
- var ROOT_PATH = path2.join(__dirname, "..");
14
- var TEMPLATE_PATH = path2.join(ROOT_PATH, "template");
15
- var PACKAGE_CHOICES = [
16
- "prettier" /* prettier */
17
- ].map((item) => ({ name: item, value: item }));
18
- var PACKAGE_MAP = {
19
- ["prettier" /* prettier */]: {
20
- packages: ["prettier", "@trivago/prettier-plugin-sort-imports"],
21
- options: ["--save-dev"]
22
- }
23
- };
24
-
25
- // src/utils.ts
26
- import { exit } from "process";
27
- function handleError(err, message) {
28
- console.log(message + "\uFF1A", err);
29
- exit(1);
30
- }
31
-
32
- // src/cli.ts
33
- import { input, select } from "@inquirer/prompts";
34
- import { program } from "commander";
35
- import glob from "fast-glob";
36
- import fse from "fs-extra";
37
- import packageManagerInstall from "package-manager-install";
38
- import path3 from "path";
39
- var cli = program;
40
- cli.name("create-pnpm-cli").version(version);
41
- cli.command("create", { isDefault: true }).description("create pnpm cli").argument("[path]", "path to mkdir", "./").action(async (targetPath) => {
42
- const names = await glob(`**`, {
43
- deep: 1,
44
- cwd: TEMPLATE_PATH,
45
- onlyFiles: false
46
- });
47
- const template = await select({
48
- message: "\u8BF7\u9009\u62E9\u6A21\u677F",
49
- choices: names.map((item) => ({ name: item, value: item }))
50
- });
51
- const name = await input({
52
- message: "\u8BF7\u8F93\u5165\u5305\u540D",
53
- default: template
54
- });
55
- const target = path3.join(targetPath, name);
56
- await fse.ensureDir(target).catch((err) => handleError(err, "\u6587\u4EF6\u5939\u4E0D\u5B58\u5728"));
57
- await fse.copy(path3.join(TEMPLATE_PATH, template), target).catch((err) => handleError(err, "\u62F7\u8D1D\u6587\u4EF6\u9519\u8BEF"));
58
- await packageManagerInstall({ cwd: target });
59
- });
60
- cli.parse();
61
- export {
62
- cli
63
- };
File without changes