Skip to content

Commit 67f1968

Browse files
committed
feat: create new handbook command + test setup for scripts
1 parent da0fc08 commit 67f1968

20 files changed

Lines changed: 2384 additions & 103 deletions

.github/workflows/test-scripts.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test Scripts
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 18.x
19+
cache: 'pnpm'
20+
21+
- name: Install pnpm
22+
run: npm install -g pnpm
23+
24+
- name: Install dependencies
25+
run: pnpm install
26+
27+
- name: Run tests
28+
run: cd scripts && pnpm test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
.docusaurus
1212
.cache-loader
1313

14+
# Test temporary files
15+
.tmp/
16+
1417
# Misc
1518
.DS_Store
1619
.env

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,30 @@ The static site will be generated in the `sites/[name]/build` directory.
5050

5151
## 🛠️ Creating a New Site
5252

53-
TBD (CHA-330)
53+
To create a new handbook site from the template:
54+
55+
```bash
56+
pnpm create-handbook <site-name>
57+
```
58+
59+
This will:
60+
1. Create a new site in `sites/<site-name>` based on the template
61+
2. Update the package.json with the correct site name
62+
3. Set up all necessary configurations
63+
64+
**Example:**
65+
```bash
66+
pnpm create-handbook my-new-handbook
67+
```
68+
69+
After creation, you can build and start the new site:
70+
```bash
71+
cd sites/my-new-handbook
72+
pnpm build:assets
73+
pnpm start
74+
```
75+
76+
**Note:** Site names can only contain letters, numbers, hyphens, and underscores.
5477

5578
## Contributing
5679

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
"private": true,
44
"workspaces": [
55
"packages/*",
6-
"sites/*"
6+
"sites/*",
7+
"scripts"
78
],
9+
"scripts": {
10+
"create-handbook": "ts-node scripts/src/create-handbook.ts"
11+
},
812
"devDependencies": {
913
"turbo": "1.11.0",
1014
"typescript": "5.6.2",
1115
"eslint": "9.28.0",
12-
"prettier": "3.2.5"
16+
"prettier": "3.2.5",
17+
"ts-node": "10.9.2"
1318
},
1419
"engines": {
1520
"node": ">=18.0"

packages/common-config/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
],
1111
"exports": {
1212
"./styles/global.css": "./static/common/styles/global.css",
13-
"./preset": "./dist/preset/index.js",
14-
"./copy-static": "./dist/scripts/copyStaticTo.js"
13+
"./preset": "./dist/preset/index.js"
1514
},
1615
"scripts": {
1716
"build": "tsc"

packages/common-config/scripts/copyStaticTo.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)