create-contractor-site 2.1.1 → 2.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 +98 -0
- package/bin/create-contractor-site.mjs +1 -1
- package/package.json +1 -1
- package/src/copy-template.mjs +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# create-contractor-site
|
|
2
|
+
|
|
3
|
+
Scaffold a client contractor website from the [website-multipages](https://github.com/glacayo/website-multipages) Astro template.
|
|
4
|
+
|
|
5
|
+
The CLI validates the target, copies the template, replaces placeholder values in `src/data/*.json`, installs with **pnpm**, validates data, builds, and initializes git **only after** success.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- **Node.js** 22+
|
|
10
|
+
- **pnpm** 11.1.2+
|
|
11
|
+
- **git**
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm create contractor-site my-client-site
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This downloads and runs `create-contractor-site` from npm. It is equivalent to the explicit `pnpm dlx` form below.
|
|
20
|
+
|
|
21
|
+
### Explicit command
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm dlx create-contractor-site my-client-site
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Local / monorepo development
|
|
28
|
+
|
|
29
|
+
From a checkout of this repository:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
node ./packages/create-contractor-site/bin/create-contractor-site.mjs ../my-client-site
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
By default, the CLI prompts for client details. For a non-interactive smoke run, add `--yes`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
node ./packages/create-contractor-site/bin/create-contractor-site.mjs --yes ../my-client-site
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or use the published CLI while pointing it at a local template checkout:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
CREATE_CONTRACTOR_TEMPLATE_ROOT=/path/to/website-multipages \
|
|
45
|
+
pnpm dlx create-contractor-site my-client-site
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## What the CLI does
|
|
49
|
+
|
|
50
|
+
1. Checks that **pnpm** and **git** are available
|
|
51
|
+
2. Resolves the template source (see env vars below)
|
|
52
|
+
3. Validates the target directory and refuses targets equal to or inside the template root
|
|
53
|
+
4. Copies the template into the target directory (denylist excludes `node_modules`, `dist`, `.astro`, `.git`, `.codegraph`, `docs_trash`, `openspec`, `.atl`, logs, `.env*`, `package-lock.json`, and `packages/`)
|
|
54
|
+
5. Replaces **values only** in target `src/data/*.json` (schema/shape preserved)
|
|
55
|
+
6. Runs `pnpm install`
|
|
56
|
+
7. Runs `pnpm run validate:data`
|
|
57
|
+
8. Runs `pnpm run build`
|
|
58
|
+
9. Runs `git init` + initial commit **only after** validate and build succeed
|
|
59
|
+
|
|
60
|
+
If install, validate, or build fails, git init is skipped so a broken scaffold is never committed.
|
|
61
|
+
|
|
62
|
+
## Environment variables
|
|
63
|
+
|
|
64
|
+
| Variable | Purpose |
|
|
65
|
+
|----------|---------|
|
|
66
|
+
| `CREATE_CONTRACTOR_SITE_ANSWERS_JSON` | JSON object with client answers for scripted/non-interactive scaffolds |
|
|
67
|
+
| `CREATE_CONTRACTOR_TEMPLATE_ROOT` | Path to a local template checkout (preferred for monorepo/dev) |
|
|
68
|
+
| `CREATE_CONTRACTOR_TEMPLATE_REPO` | Git URL for the published fallback clone (default: this template repo) |
|
|
69
|
+
| `CREATE_CONTRACTOR_TEMPLATE_REF` | Git branch/tag/ref to clone (default: `v2.1.2`) |
|
|
70
|
+
|
|
71
|
+
Template source precedence: `CREATE_CONTRACTOR_TEMPLATE_ROOT` → local monorepo discovery → temporary clone of repo @ ref.
|
|
72
|
+
|
|
73
|
+
### Scripted answers example
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
CREATE_CONTRACTOR_SITE_ANSWERS_JSON='{"businessName":"Acme Masonry","phone":"(757) 555-0199","email":"info@example.com","address":"123 Main St","city":"Virginia Beach","state":"VA","zip":"23451","serviceArea":"Virginia Beach, Norfolk, Chesapeake","primaryServices":["Masonry","Patios"]}' \
|
|
77
|
+
pnpm dlx create-contractor-site my-client-site
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## pnpm only
|
|
81
|
+
|
|
82
|
+
This project and the scaffolded client sites use **pnpm only**.
|
|
83
|
+
|
|
84
|
+
- Do **not** use `npm install` or `npx` for project setup
|
|
85
|
+
- Package runners (`pnpm create`, `pnpm dlx`) may start the binary; install/build inside the scaffold always use pnpm
|
|
86
|
+
|
|
87
|
+
## Options
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
create-contractor-site [options] <target-dir>
|
|
91
|
+
|
|
92
|
+
-y, --yes Non-interactive mode with built-in sample answers
|
|
93
|
+
-h, --help Show help
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
ISC. See the [repository](https://github.com/glacayo/website-multipages) for full template documentation.
|
|
@@ -45,7 +45,7 @@ Environment:
|
|
|
45
45
|
Default: https://github.com/glacayo/website-multipages.git
|
|
46
46
|
|
|
47
47
|
CREATE_CONTRACTOR_TEMPLATE_REF
|
|
48
|
-
Git branch/tag/ref to clone for the published fallback. Default: v2.1.
|
|
48
|
+
Git branch/tag/ref to clone for the published fallback. Default: v2.1.2
|
|
49
49
|
|
|
50
50
|
Answer precedence (highest first):
|
|
51
51
|
1. CREATE_CONTRACTOR_SITE_ANSWERS_JSON
|
package/package.json
CHANGED
package/src/copy-template.mjs
CHANGED
|
@@ -27,7 +27,7 @@ export const DEFAULT_TEMPLATE_REPO =
|
|
|
27
27
|
'https://github.com/glacayo/website-multipages.git';
|
|
28
28
|
|
|
29
29
|
export const DEFAULT_TEMPLATE_REF =
|
|
30
|
-
process.env.CREATE_CONTRACTOR_TEMPLATE_REF || 'v2.1.
|
|
30
|
+
process.env.CREATE_CONTRACTOR_TEMPLATE_REF || 'v2.1.2';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @param {string} name basename
|