@quadratz/qz-scaff 2.0.1-beta.2 → 2.0.1-beta.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quadratz/qz-scaff",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A personal-use Bun CLI for scaffolding projects from templates.",
|
|
6
6
|
"author": "Quadratz",
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
"url": "git+https://github.com/Quadratz-Org/qz-scaff.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": "https://github.com/Quadratz-Org/qz-scaff/issues",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"./package.json": "./package.json"
|
|
14
|
+
"bin": {
|
|
15
|
+
"qz-scaff": "src/index.ts"
|
|
17
16
|
},
|
|
18
17
|
"files": [
|
|
19
18
|
"src",
|
package/src/index.ts
CHANGED
|
File without changes
|
package/src/scaffold-project.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Response } from "./types.ts";
|
|
2
|
-
import { join
|
|
2
|
+
import { join } from "node:path";
|
|
3
3
|
import { mkdir, readdir, cp } from "node:fs/promises";
|
|
4
4
|
import npmPkg from "../template/package.json" with { type: "json" };
|
|
5
5
|
|
|
@@ -19,6 +19,7 @@ async function scaffoldProject(resp: Response): Promise<void> {
|
|
|
19
19
|
await mkdir(destination, { recursive: true });
|
|
20
20
|
|
|
21
21
|
const promises: Promise<number>[] = [];
|
|
22
|
+
const templatePath = join(import.meta.dirname, "../template");
|
|
22
23
|
const repoUrl = `${GITHUB_BASE_URL}${name}`;
|
|
23
24
|
|
|
24
25
|
// 1. Prepare and write package.json
|
|
@@ -40,8 +41,8 @@ async function scaffoldProject(resp: Response): Promise<void> {
|
|
|
40
41
|
);
|
|
41
42
|
|
|
42
43
|
const [contributingTxt, readmeTxt] = await Promise.all([
|
|
43
|
-
Bun.file(
|
|
44
|
-
Bun.file(
|
|
44
|
+
Bun.file(join(templatePath, "CONTRIBUTING.md")).text(),
|
|
45
|
+
Bun.file(join(templatePath, "README.md")).text(),
|
|
45
46
|
]);
|
|
46
47
|
|
|
47
48
|
// 2. Write CONTRIBUTING.md
|
|
@@ -65,7 +66,6 @@ async function scaffoldProject(resp: Response): Promise<void> {
|
|
|
65
66
|
await Promise.all(promises);
|
|
66
67
|
|
|
67
68
|
// 4. Copy remaining template files
|
|
68
|
-
const templatePath = new URL("../template", import.meta.url);
|
|
69
69
|
const copyPromises: Promise<void>[] = [];
|
|
70
70
|
const excludedFiles = new Set([
|
|
71
71
|
"CONTRIBUTING.md",
|
|
@@ -74,12 +74,13 @@ async function scaffoldProject(resp: Response): Promise<void> {
|
|
|
74
74
|
]);
|
|
75
75
|
|
|
76
76
|
for (const source of await readdir(templatePath)) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (excludedFiles.has(fileName)) continue;
|
|
77
|
+
if (excludedFiles.has(source)) continue;
|
|
80
78
|
|
|
81
79
|
copyPromises.push(
|
|
82
|
-
cp(source, join(destination,
|
|
80
|
+
cp(join(templatePath, source), join(destination, source), {
|
|
81
|
+
force: true,
|
|
82
|
+
recursive: true,
|
|
83
|
+
}),
|
|
83
84
|
);
|
|
84
85
|
}
|
|
85
86
|
|
|
File without changes
|