create-vixt 0.5.16 → 0.6.0

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.mjs CHANGED
@@ -1,11 +1,14 @@
1
- import path from 'node:path';
2
- import process from 'node:process';
3
- import { fileURLToPath } from 'node:url';
4
- import { cac } from 'cac';
5
- import fs from 'fs-extra';
1
+ import path from "node:path";
2
+ import process from "node:process";
3
+ import { fileURLToPath } from "node:url";
4
+ import { cac } from "cac";
5
+ import fs from "fs-extra";
6
6
 
7
- const version = "0.5.16";
7
+ //#region package.json
8
+ var version = "0.6.0";
8
9
 
10
+ //#endregion
11
+ //#region src/index.ts
9
12
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
10
13
  const argv = cac().parse();
11
14
  const projectName = argv.args[0] || "vixt-project";
@@ -14,52 +17,53 @@ const cwd = process.cwd();
14
17
  const projectPath = path.join(cwd, projectName);
15
18
  const templatePath = path.join(__dirname, `../template-${templateName}`);
16
19
  if (!fs.existsSync(templatePath)) {
17
- console.error(`"${templateName}" isn't a valid template. Please confirm the template name.`);
18
- process.exit(1);
20
+ console.error(`"${templateName}" isn't a valid template. Please confirm the template name.`);
21
+ process.exit(1);
19
22
  }
20
23
  if (!fs.existsSync(projectPath)) {
21
- fs.mkdirSync(projectPath);
22
- console.log(`Project directory ${projectName} created.`);
24
+ fs.mkdirSync(projectPath);
25
+ console.log(`Project directory ${projectName} created.`);
23
26
  } else {
24
- console.error(`Directory ${projectName} already exists.`);
25
- process.exit(1);
27
+ console.error(`Directory ${projectName} already exists.`);
28
+ process.exit(1);
26
29
  }
27
30
  function editPackageJson(destDir, fn) {
28
- const packageJsonPath = path.join(destDir, "package.json");
29
- const packageJson = fs.readJsonSync(packageJsonPath);
30
- const result = fn(packageJson) || packageJson;
31
- fs.writeJSONSync(packageJsonPath, result, { spaces: 2 });
31
+ const packageJsonPath = path.join(destDir, "package.json");
32
+ const packageJson = fs.readJsonSync(packageJsonPath);
33
+ const result = fn(packageJson) || packageJson;
34
+ fs.writeJSONSync(packageJsonPath, result, { spaces: 2 });
32
35
  }
33
36
  function copyTemplateFiles(srcDir, destDir) {
34
- fs.copySync(srcDir, destDir);
35
- editPackageJson(destDir, (json) => {
36
- json.name = projectName;
37
- Object.entries(json.dependencies).forEach(([key, value]) => {
38
- if (value === "workspace:*") {
39
- json.dependencies[key] = `^${version}`;
40
- }
41
- });
42
- });
37
+ fs.copySync(srcDir, destDir);
38
+ editPackageJson(destDir, (json) => {
39
+ json.name = projectName;
40
+ Object.entries(json.dependencies).forEach(([key, value]) => {
41
+ if (value === "workspace:*") json.dependencies[key] = `^${version}`;
42
+ });
43
+ });
43
44
  }
44
45
  copyTemplateFiles(templatePath, projectPath);
45
46
  if (templateName === "monorepo-ts") {
46
- const vueTemplatePath = path.join(__dirname, `../template-vue-ts`);
47
- const vueProjectPath = path.join(projectPath, "packages/vue");
48
- fs.copySync(vueTemplatePath, vueProjectPath);
49
- editPackageJson(vueProjectPath, (json) => {
50
- delete json.dependencies.vixt;
51
- });
52
- const uniTemplatePath = path.join(__dirname, `../template-uni-ts`);
53
- const uniProjectPath = path.join(projectPath, "packages/uni");
54
- fs.copySync(uniTemplatePath, uniProjectPath);
55
- editPackageJson(uniProjectPath, (json) => {
56
- delete json.dependencies.vixt;
57
- });
58
- const reactTemplatePath = path.join(__dirname, `../template-react-ts`);
59
- const reactProjectPath = path.join(projectPath, "packages/react");
60
- fs.copySync(reactTemplatePath, reactProjectPath);
61
- editPackageJson(reactProjectPath, (json) => {
62
- delete json.dependencies.vixt;
63
- });
47
+ const vueTemplatePath = path.join(__dirname, `../template-vue-ts`);
48
+ const vueProjectPath = path.join(projectPath, "packages/vue");
49
+ fs.copySync(vueTemplatePath, vueProjectPath);
50
+ editPackageJson(vueProjectPath, (json) => {
51
+ delete json.dependencies.vixt;
52
+ });
53
+ const uniTemplatePath = path.join(__dirname, `../template-uni-ts`);
54
+ const uniProjectPath = path.join(projectPath, "packages/uni");
55
+ fs.copySync(uniTemplatePath, uniProjectPath);
56
+ editPackageJson(uniProjectPath, (json) => {
57
+ delete json.dependencies.vixt;
58
+ });
59
+ const reactTemplatePath = path.join(__dirname, `../template-react-ts`);
60
+ const reactProjectPath = path.join(projectPath, "packages/react");
61
+ fs.copySync(reactTemplatePath, reactProjectPath);
62
+ editPackageJson(reactProjectPath, (json) => {
63
+ delete json.dependencies.vixt;
64
+ });
64
65
  }
65
66
  console.log("Template project initialized.");
67
+
68
+ //#endregion
69
+ export { };
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "create-vixt",
3
3
  "type": "module",
4
- "version": "0.5.16",
4
+ "version": "0.6.0",
5
+ "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
+ "license": "MIT",
7
+ "homepage": "https://soullyoko.github.io/vixt/",
8
+ "repository": "https://github.com/SoulLyoko/vixt.git",
5
9
  "bin": {
6
10
  "create-vixt": "index.js"
7
11
  },
@@ -12,7 +16,7 @@
12
16
  ],
13
17
  "dependencies": {
14
18
  "cac": "^6.7.14",
15
- "fs-extra": "^11.3.2"
19
+ "fs-extra": "^11.3.3"
16
20
  },
17
21
  "scripts": {
18
22
  "build": "unbuild"
@@ -12,14 +12,14 @@
12
12
  "build:mp": "uni build -p mp-weixin"
13
13
  },
14
14
  "dependencies": {
15
- "@dcloudio/uni-app": "3.0.0-4080520251106001",
16
- "@dcloudio/uni-app-plus": "3.0.0-4080520251106001",
17
- "@dcloudio/uni-h5": "3.0.0-4080520251106001",
18
- "@dcloudio/uni-mp-weixin": "3.0.0-4080520251106001",
19
- "@dcloudio/uni-uts-v1": "3.0.0-4080520251106001",
15
+ "@dcloudio/uni-app": "3.0.0-4080720251210001",
16
+ "@dcloudio/uni-app-plus": "3.0.0-4080720251210001",
17
+ "@dcloudio/uni-h5": "3.0.0-4080720251210001",
18
+ "@dcloudio/uni-mp-weixin": "3.0.0-4080720251210001",
19
+ "@dcloudio/uni-uts-v1": "3.0.0-4080720251210001",
20
20
  "vixt": "workspace:*"
21
21
  },
22
22
  "devDependencies": {
23
- "@dcloudio/vite-plugin-uni": "3.0.0-4080520251106001"
23
+ "@dcloudio/vite-plugin-uni": "3.0.0-4080720251210001"
24
24
  }
25
25
  }
@@ -1,2 +0,0 @@
1
- // Generated by Vixt
2
- // This file transform from '.vixt/main.ts'
File without changes
File without changes