create-widget 24.1.1-beta.51 → 24.1.1-beta.53

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/bin/index.js +17 -10
  2. package/package.json +12 -12
package/bin/index.js CHANGED
@@ -1,8 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // node_modules/.pnpm/tsup@8.5.1_postcss@8.4.47_tsx@4.19.2_typescript@5.6.3_yaml@2.6.0/node_modules/tsup/assets/esm_shims.js
4
+ import path from "path";
5
+ import { fileURLToPath } from "url";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+
3
10
  // src/index.ts
4
11
  import fs3 from "fs";
5
- import path2 from "path";
12
+ import path3 from "path";
6
13
  import * as process from "process";
7
14
  import chalk from "chalk";
8
15
  import gradient from "gradient-string";
@@ -11,13 +18,13 @@ import prompts from "prompts";
11
18
 
12
19
  // src/utils/directoryTraverse.ts
13
20
  import fs from "fs";
14
- import path from "path";
21
+ import path2 from "path";
15
22
  function postOrderDirectoryTraverse(dir, dirCallback, fileCallback) {
16
23
  for (const filename of fs.readdirSync(dir)) {
17
24
  if (filename === ".git") {
18
25
  continue;
19
26
  }
20
- const fullpath = path.resolve(dir, filename);
27
+ const fullpath = path2.resolve(dir, filename);
21
28
  if (fs.lstatSync(fullpath).isDirectory()) {
22
29
  postOrderDirectoryTraverse(fullpath, dirCallback, fileCallback);
23
30
  dirCallback(fullpath);
@@ -187,7 +194,7 @@ async function init() {
187
194
  useGithubPage = argv2.githubPage,
188
195
  useEslintConfig = argv2.eslintConfig
189
196
  } = result;
190
- const root = path2.join(cwd2, targetDir);
197
+ const root = path3.join(cwd2, targetDir);
191
198
  if (fs3.existsSync(root) && shouldOverwrite) {
192
199
  emptyDir(root);
193
200
  } else if (!fs3.existsSync(root)) {
@@ -195,16 +202,16 @@ async function init() {
195
202
  }
196
203
  console.log(`
197
204
  Scaffolding project in ${root}...`);
198
- const templateRoot = path2.join(__dirname, "./template");
205
+ const templateRoot = path3.join(__dirname, "../template");
199
206
  await FileUtils.copyFolderRecursive(templateRoot, root);
200
- const packageJsonPath = path2.resolve(`${root}/package.json`);
207
+ const packageJsonPath = path3.resolve(`${root}/package.json`);
201
208
  const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath).toString());
202
209
  if (useVueUse) {
203
210
  packageJson.dependencies["@vueuse/core"] = "latest";
204
211
  }
205
212
  if (useUnoCss) {
206
213
  packageJson.devDependencies.unocss = "latest";
207
- const unocssTemplateRoot = path2.join(__dirname, "./unocss");
214
+ const unocssTemplateRoot = path3.join(__dirname, "../unocss");
208
215
  await FileUtils.copyFolderRecursive(unocssTemplateRoot, root);
209
216
  }
210
217
  if (useIconPark) {
@@ -218,12 +225,12 @@ Scaffolding project in ${root}...`);
218
225
  "lint": "eslint .",
219
226
  "lint:fix": "eslint . --fix"
220
227
  };
221
- const eslintTemplateRoot = path2.join(__dirname, "./eslint");
228
+ const eslintTemplateRoot = path3.join(__dirname, "../eslint");
222
229
  await FileUtils.copyFolderRecursive(eslintTemplateRoot, root);
223
230
  }
224
231
  fs3.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
225
232
  if (useGithubPage) {
226
- const githubPageTemplateRoot = path2.join(__dirname, "./github-page");
233
+ const githubPageTemplateRoot = path3.join(__dirname, "../github-page");
227
234
  await FileUtils.copyFolderRecursive(githubPageTemplateRoot, root);
228
235
  }
229
236
  const userAgent = process.env.npm_config_user_agent ?? "";
@@ -232,7 +239,7 @@ Scaffolding project in ${root}...`);
232
239
  Done. Now run:
233
240
  `);
234
241
  if (root !== cwd2) {
235
- const cdProjectName = path2.relative(cwd2, root);
242
+ const cdProjectName = path3.relative(cwd2, root);
236
243
  console.log(
237
244
  ` ${chalk.bold(
238
245
  chalk.green(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-widget",
3
- "version": "24.1.1-beta.51",
3
+ "version": "24.1.1-beta.53",
4
4
  "private": false,
5
5
  "description": "An easy way to start a Widget project",
6
6
  "author": "Neo Fu <rtugeek@gmail.com>",
@@ -20,16 +20,6 @@
20
20
  "engines": {
21
21
  "node": ">=v16.20.0"
22
22
  },
23
- "scripts": {
24
- "build": "tsup-node build src/index.ts",
25
- "watch": "tsup-node src/index.ts --format cjs --watch",
26
- "build:run": "npm run build && npm exec create-widget",
27
- "test": "node index.cjs",
28
- "update:version": "esno scripts/updateVersion.ts",
29
- "pnpm:publish": "npm run build && pnpm publish --no-git-checks",
30
- "link": "pnpm link --global",
31
- "lint:fix": "eslint"
32
- },
33
23
  "publishConfig": {
34
24
  "access": "public"
35
25
  },
@@ -57,5 +47,15 @@
57
47
  "tsup": "^8.3.5",
58
48
  "typescript": "^5.2.2",
59
49
  "vitest": "^0.34.6"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup-node build src/index.ts",
53
+ "watch": "tsup-node src/index.ts --format cjs --watch",
54
+ "build:run": "npm run build && npm exec create-widget",
55
+ "test": "node index.cjs",
56
+ "update:version": "esno scripts/updateVersion.ts",
57
+ "pnpm:publish": "npm run build && pnpm publish --no-git-checks",
58
+ "link": "pnpm link --global",
59
+ "lint:fix": "eslint"
60
60
  }
61
- }
61
+ }