create-vixt 0.12.2 → 0.13.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/bin/create-vixt.mjs +3 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +28 -38
- package/package.json +10 -7
- package/template/monorepo/package.json +19 -0
- package/template/{react-ts → monorepo/packages/react}/README.md +1 -1
- package/template/{vue-ts → monorepo/packages/react}/package.json +3 -3
- package/template/{react-ts → monorepo/packages/react}/src/App.tsx +3 -13
- package/template/{uni-ts → monorepo/packages/uni}/package.json +3 -5
- package/template/{react-ts → monorepo/packages/vue}/package.json +3 -3
- package/template/{vue-ts → monorepo/packages/vue}/src/App.vue +2 -2
- package/template/{vue-ts → monorepo/packages/vue}/src/components/HelloWorld.vue +7 -11
- package/index.js +0 -4
- package/template/monorepo-ts/package.json +0 -15
- /package/template/{react-ts/tsconfig.json → monorepo/packages/react/_tsconfig.json} +0 -0
- /package/template/{react-ts → monorepo/packages/react}/index.html +0 -0
- /package/template/{react-ts → monorepo/packages/react}/public/react.svg +0 -0
- /package/template/{react-ts → monorepo/packages/react}/public/vite.svg +0 -0
- /package/template/{react-ts → monorepo/packages/react}/src/App.css +0 -0
- /package/template/{react-ts → monorepo/packages/react}/src/index.css +0 -0
- /package/template/{react-ts → monorepo/packages/react}/src/main.tsx +0 -0
- /package/template/{react-ts → monorepo/packages/react}/vite.config.ts +0 -0
- /package/template/{react-ts → monorepo/packages/react}/vixt.config.ts +0 -0
- /package/template/{uni-ts/tsconfig.json → monorepo/packages/uni/_tsconfig.json} +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/index.html +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/pages.config.ts +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/App.vue +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/main.ts +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/manifest.json +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/pages/index/index.vue +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/static/logo.png +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/src/uni.scss +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/vite.config.ts +0 -0
- /package/template/{uni-ts → monorepo/packages/uni}/vixt.config.ts +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/README.md +0 -0
- /package/template/{vue-ts/tsconfig.json → monorepo/packages/vue/_tsconfig.json} +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/index.html +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/public/vite.svg +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/public/vue.svg +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/src/main.ts +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/src/style.css +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/vite.config.ts +0 -0
- /package/template/{vue-ts → monorepo/packages/vue}/vixt.config.ts +0 -0
- /package/template/{monorepo-ts → monorepo}/pnpm-workspace.yaml +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
3
|
import { cac } from "cac";
|
|
5
4
|
import fs from "fs-extra";
|
|
6
5
|
//#region package.json
|
|
7
|
-
var version = "0.
|
|
6
|
+
var version = "0.13.1";
|
|
8
7
|
//#endregion
|
|
9
8
|
//#region src/index.ts
|
|
10
|
-
const __dirname =
|
|
9
|
+
const __dirname = import.meta.dirname;
|
|
11
10
|
const argv = cac().parse();
|
|
12
|
-
const projectName = argv.args[0] || "
|
|
13
|
-
const templateName = argv.options.template || "monorepo
|
|
11
|
+
const projectName = argv.args[0] || "my-project";
|
|
12
|
+
const templateName = argv.options.template || "monorepo";
|
|
14
13
|
const cwd = process.cwd();
|
|
15
14
|
const projectPath = path.join(cwd, projectName);
|
|
16
15
|
const templatePath = path.join(__dirname, `../template/${templateName}`);
|
|
@@ -18,49 +17,40 @@ if (!fs.existsSync(templatePath)) {
|
|
|
18
17
|
console.error(`"${templateName}" isn't a valid template. Please confirm the template name.`);
|
|
19
18
|
process.exit(1);
|
|
20
19
|
}
|
|
21
|
-
if (
|
|
22
|
-
fs.mkdirSync(projectPath);
|
|
23
|
-
console.log(`Project directory ${projectName} created.`);
|
|
24
|
-
} else {
|
|
20
|
+
if (fs.existsSync(projectPath)) {
|
|
25
21
|
console.error(`Directory ${projectName} already exists.`);
|
|
26
22
|
process.exit(1);
|
|
27
23
|
}
|
|
24
|
+
main();
|
|
25
|
+
function main() {
|
|
26
|
+
fs.mkdirSync(projectPath);
|
|
27
|
+
fs.copySync(templatePath, projectPath);
|
|
28
|
+
editPackageJson(projectPath, (json) => {
|
|
29
|
+
json.name = projectName;
|
|
30
|
+
replaceDependenciesVersion(json);
|
|
31
|
+
});
|
|
32
|
+
const packagesPath = path.join(projectPath, "packages");
|
|
33
|
+
const packages = fs.readdirSync(packagesPath);
|
|
34
|
+
for (const name of packages) {
|
|
35
|
+
const pkgPath = path.join(packagesPath, name);
|
|
36
|
+
editPackageJson(pkgPath, (json) => {
|
|
37
|
+
json.name = `@${projectName}/${name}`;
|
|
38
|
+
replaceDependenciesVersion(json);
|
|
39
|
+
});
|
|
40
|
+
fs.renameSync(path.join(pkgPath, "_tsconfig.json"), path.join(pkgPath, "tsconfig.json"));
|
|
41
|
+
}
|
|
42
|
+
console.log(`Project ${projectName} created.`);
|
|
43
|
+
}
|
|
28
44
|
function editPackageJson(destDir, fn) {
|
|
29
45
|
const packageJsonPath = path.join(destDir, "package.json");
|
|
30
46
|
const packageJson = fs.readJsonSync(packageJsonPath);
|
|
31
47
|
const result = fn(packageJson) || packageJson;
|
|
32
48
|
fs.writeJSONSync(packageJsonPath, result, { spaces: 2 });
|
|
33
49
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
json.name = projectName;
|
|
38
|
-
Object.entries(json.dependencies).forEach(([key, value]) => {
|
|
39
|
-
if (value === "workspace:*") json.dependencies[key] = `^${version}`;
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
copyTemplateFiles(templatePath, projectPath);
|
|
44
|
-
if (templateName === "monorepo-ts") {
|
|
45
|
-
const vueTemplatePath = path.join(__dirname, `../template/vue-ts`);
|
|
46
|
-
const vueProjectPath = path.join(projectPath, "packages/vue");
|
|
47
|
-
fs.copySync(vueTemplatePath, vueProjectPath);
|
|
48
|
-
editPackageJson(vueProjectPath, (json) => {
|
|
49
|
-
delete json.dependencies.vixt;
|
|
50
|
-
});
|
|
51
|
-
const uniTemplatePath = path.join(__dirname, `../template/uni-ts`);
|
|
52
|
-
const uniProjectPath = path.join(projectPath, "packages/uni");
|
|
53
|
-
fs.copySync(uniTemplatePath, uniProjectPath);
|
|
54
|
-
editPackageJson(uniProjectPath, (json) => {
|
|
55
|
-
delete json.dependencies.vixt;
|
|
56
|
-
});
|
|
57
|
-
const reactTemplatePath = path.join(__dirname, `../template/react-ts`);
|
|
58
|
-
const reactProjectPath = path.join(projectPath, "packages/react");
|
|
59
|
-
fs.copySync(reactTemplatePath, reactProjectPath);
|
|
60
|
-
editPackageJson(reactProjectPath, (json) => {
|
|
61
|
-
delete json.dependencies.vixt;
|
|
50
|
+
function replaceDependenciesVersion(json) {
|
|
51
|
+
Object.entries(json.dependencies).forEach(([key, value]) => {
|
|
52
|
+
if (value === "workspace:*") json.dependencies[key] = `^${version}`;
|
|
62
53
|
});
|
|
63
54
|
}
|
|
64
|
-
console.log("Template project initialized.");
|
|
65
55
|
//#endregion
|
|
66
56
|
export {};
|
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vixt",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.12.2",
|
|
5
|
-
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
6
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.13.1",
|
|
7
4
|
"homepage": "https://soullyoko.github.io/vixt/",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "SoulLyoko<https://github.com/SoulLyoko>",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "https://github.com/SoulLyoko/vixt.git"
|
|
11
10
|
},
|
|
12
11
|
"bin": {
|
|
13
|
-
"create-vixt": "
|
|
12
|
+
"create-vixt": "bin/create-vixt.mjs"
|
|
14
13
|
},
|
|
15
14
|
"files": [
|
|
15
|
+
"bin",
|
|
16
16
|
"dist",
|
|
17
|
-
"index.js",
|
|
18
17
|
"template"
|
|
19
18
|
],
|
|
19
|
+
"type": "module",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"cac": "^7.0.0",
|
|
22
|
-
"fs-extra": "^11.
|
|
22
|
+
"fs-extra": "^11.4.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"jiti": "^2.7.0"
|
|
23
26
|
}
|
|
24
27
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vixt-monorepo-template",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build:h5": "pnpm -F uni build:h5",
|
|
8
|
+
"build:mp": "pnpm -F uni build:mp",
|
|
9
|
+
"build:react": "pnpm -F react build",
|
|
10
|
+
"build:vue": "pnpm -F vue build",
|
|
11
|
+
"dev:h5": "pnpm -F uni dev:h5",
|
|
12
|
+
"dev:mp": "pnpm -F uni dev:mp",
|
|
13
|
+
"dev:react": "pnpm -F react dev",
|
|
14
|
+
"dev:vue": "pnpm -F vue dev"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"vixt": "workspace:*"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "vixt-
|
|
3
|
-
"type": "module",
|
|
2
|
+
"name": "vixt-react-template",
|
|
4
3
|
"version": "0.0.0",
|
|
5
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"vixt": "workspace:*"
|
|
12
|
+
"@vixt/react": "workspace:*"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -17,22 +17,12 @@ function App() {
|
|
|
17
17
|
</div>
|
|
18
18
|
<h1>Vite + React</h1>
|
|
19
19
|
<div className="card">
|
|
20
|
-
<button onClick={() => setCount(count => count + 1)}>
|
|
21
|
-
count is
|
|
22
|
-
{' '}
|
|
23
|
-
{count}
|
|
24
|
-
</button>
|
|
20
|
+
<button onClick={() => setCount(count => count + 1)}>count is {count}</button>
|
|
25
21
|
<p>
|
|
26
|
-
Edit
|
|
27
|
-
{' '}
|
|
28
|
-
<code>src/App.tsx</code>
|
|
29
|
-
{' '}
|
|
30
|
-
and save to test HMR
|
|
22
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
31
23
|
</p>
|
|
32
24
|
</div>
|
|
33
|
-
<p className="read-the-docs">
|
|
34
|
-
Click on the Vite and React logos to learn more
|
|
35
|
-
</p>
|
|
25
|
+
<p className="read-the-docs">Click on the Vite and React logos to learn more</p>
|
|
36
26
|
</>
|
|
37
27
|
)
|
|
38
28
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "vixt-uni-
|
|
3
|
-
"type": "module",
|
|
2
|
+
"name": "vixt-uni-template",
|
|
4
3
|
"version": "0.0.0",
|
|
5
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev:h5": "uni",
|
|
8
|
-
"dev:h5:ssr": "uni --ssr",
|
|
9
8
|
"dev:mp": "uni -p mp-weixin",
|
|
10
9
|
"build:h5": "uni build",
|
|
11
|
-
"build:h5:ssr": "uni build --ssr",
|
|
12
10
|
"build:mp": "uni build -p mp-weixin"
|
|
13
11
|
},
|
|
14
12
|
"dependencies": {
|
|
@@ -17,7 +15,7 @@
|
|
|
17
15
|
"@dcloudio/uni-h5": "3.0.0-5000720260410001",
|
|
18
16
|
"@dcloudio/uni-mp-weixin": "3.0.0-5000720260410001",
|
|
19
17
|
"@dcloudio/uni-uts-v1": "3.0.0-5000720260410001",
|
|
20
|
-
"vixt": "workspace:*"
|
|
18
|
+
"@vixt/uni": "workspace:*"
|
|
21
19
|
},
|
|
22
20
|
"devDependencies": {
|
|
23
21
|
"@dcloudio/vite-plugin-uni": "3.0.0-5000720260410001"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "vixt-
|
|
3
|
-
"type": "module",
|
|
2
|
+
"name": "vixt-vue-template",
|
|
4
3
|
"version": "0.0.0",
|
|
5
4
|
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"vixt": "workspace:*"
|
|
12
|
+
"@vixt/vue": "workspace:*"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -5,10 +5,10 @@ import HelloWorld from '@/components/HelloWorld.vue'
|
|
|
5
5
|
<template>
|
|
6
6
|
<div>
|
|
7
7
|
<a href="https://vite.dev" target="_blank">
|
|
8
|
-
<img src="/vite.svg" class="logo" alt="Vite logo"
|
|
8
|
+
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
|
9
9
|
</a>
|
|
10
10
|
<a href="https://vuejs.org/" target="_blank">
|
|
11
|
-
<img src="/vue.svg" class="logo vue" alt="Vue logo"
|
|
11
|
+
<img src="/vue.svg" class="logo vue" alt="Vue logo" />
|
|
12
12
|
</a>
|
|
13
13
|
</div>
|
|
14
14
|
<HelloWorld msg="Vite + Vue" />
|
|
@@ -10,9 +10,7 @@ const count = ref(0)
|
|
|
10
10
|
<h1>{{ msg }}</h1>
|
|
11
11
|
|
|
12
12
|
<div class="card">
|
|
13
|
-
<button type="button" @click="count++">
|
|
14
|
-
count is {{ count }}
|
|
15
|
-
</button>
|
|
13
|
+
<button type="button" @click="count++">count is {{ count }}</button>
|
|
16
14
|
<p>
|
|
17
15
|
Edit
|
|
18
16
|
<code>components/HelloWorld.vue</code> to test HMR
|
|
@@ -21,18 +19,16 @@ const count = ref(0)
|
|
|
21
19
|
|
|
22
20
|
<p>
|
|
23
21
|
Check out
|
|
24
|
-
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the
|
|
22
|
+
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the
|
|
23
|
+
official Vue + Vite starter
|
|
25
24
|
</p>
|
|
26
25
|
<p>
|
|
27
26
|
Learn more about IDE Support for Vue in the
|
|
28
|
-
<a
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
>Vue Docs Scaling up Guide</a>.
|
|
32
|
-
</p>
|
|
33
|
-
<p class="read-the-docs">
|
|
34
|
-
Click on the Vite and Vue logos to learn more
|
|
27
|
+
<a href="https://vuejs.org/guide/scaling-up/tooling.html#ide-support" target="_blank"
|
|
28
|
+
>Vue Docs Scaling up Guide</a
|
|
29
|
+
>.
|
|
35
30
|
</p>
|
|
31
|
+
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
|
36
32
|
</template>
|
|
37
33
|
|
|
38
34
|
<style scoped>
|
package/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vixt-monorepo-ts",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "pnpm -F vue build",
|
|
8
|
-
"build:h5": "pnpm -F uni build:h5",
|
|
9
|
-
"dev": "pnpm -F vue dev",
|
|
10
|
-
"dev:h5": "pnpm -F uni dev"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"vixt": "workspace:*"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|