@justinli/create-vite-template 0.1.1 → 0.1.2
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/README.md +15 -14
- package/index.js +24 -13
- package/package.json +21 -16
- package/template/_gitignore +3 -0
- package/template/pnpm-lock.yaml +0 -1380
package/README.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
# Create Vite Template
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup for a static site using:
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
# Create Vite Template
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup for a static site using:
|
|
4
|
+
|
|
5
|
+
- React
|
|
6
|
+
- TypeScript
|
|
7
|
+
- Vite
|
|
8
|
+
- Oxlint
|
|
9
|
+
- Oxfmt
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pnpm create @justinli/vite-template my-app
|
|
15
|
+
```
|
package/index.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cp, readFile, writeFile, rename, access } from "node:fs/promises";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
6
|
const target = process.argv[2] ?? "my-app";
|
|
7
7
|
const from = fileURLToPath(new URL("./template", import.meta.url));
|
|
8
8
|
const to = resolve(process.cwd(), target);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
await access(to);
|
|
12
|
+
console.error(`Target already exists: ${to}`);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
if (e.code !== "ENOENT") throw e;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await cp(from, to, { recursive: true });
|
|
19
|
+
|
|
20
|
+
const pkgPath = resolve(to, "package.json");
|
|
21
|
+
const pkg = await readFile(pkgPath, "utf8");
|
|
22
|
+
await writeFile(pkgPath, pkg.replace(/vite-template/, target));
|
|
23
|
+
|
|
24
|
+
const gitignore = resolve(to, "_gitignore");
|
|
25
|
+
await rename(gitignore, resolve(to, ".gitignore"));
|
|
26
|
+
|
|
27
|
+
console.log(`Created ${target}`);
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@justinli/create-vite-template",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@justinli/create-vite-template",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/justinli34/create-vite-template.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"create-vite-template": "index.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"template"
|
|
16
|
+
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
}
|
|
21
|
+
}
|