forked from iflastandards/standards-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·89 lines (80 loc) · 2.94 KB
/
setup
File metadata and controls
executable file
·89 lines (80 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
# ------------------------------------------------------------------
# scaffold-standards-dev.sh
#
# Usage:
# mkdir standards-dev && cd standards-dev
# bash /path/to/scaffold-standards-dev.sh
#
# Prereqs:
# • git • corepack (bundled with Node ≥ 16) • pnpm (via corepack)
# • jq • docker (optional, for local vocab stack)
# ------------------------------------------------------------------
set -euo pipefail
ROOT=$(pwd)
echo "Scaffolding monorepo in $ROOT …"
cat >pnpm-workspace.yaml <<'EOF'
packages:
- "packages/*"
- "standards/*"
EOF
cat >.npmrc <<'EOF'
auto-install-peers = true
shamefully-hoist = true
shared-workspace-lockfile = true
EOF
# --- 4. Devcontainer (Codespaces / VS Code) -----------------------------------
mkdir .devcontainer
cat >.devcontainer/devcontainer.json <<'EOF'
{
"name": "IFLA Standards Dev",
"image": "mcr.microsoft.com/devcontainers/javascript-node:22-bookworm",
"postCreateCommand": "corepack enable && pnpm install --frozen-lockfile",
"customizations": {
"vscode": { "settings": { "files.eol": "\n" } }
}
}
EOF
# --- 5. GitHub workflows skeleton ---------------------------------------------
mkdir -p .github/workflows
cat >.github/workflows/ci-preview.yml <<'EOF'
name: build-preview
on: [push, pull_request]
permissions: {contents: write}
jobs:
site:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- run: pnpm install --frozen-lockfile
- name: Build all docs
run: BASE_URL="/standards-dev/" pnpm -r build
- name: Deploy to gh-pages
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
EOF
# --- 6. Basic package skeletons ------------------------------------------------
mkdir -p packages/theme/src
echo "export const placeholder = true;" >packages/theme/src/index.ts
printf '{\n "name":"@ifla/theme","version":"0.0.0","private":true,"main":"src/index.ts"}\n' >packages/theme/package.json
# --- 7. Tool placeholders ------------------------------------------------------
mkdir -p tools/sheet-sync
echo "// TODO: sheet-sync CLI" >tools/sheet-sync/index.ts
printf '{\n "name":"sheet-sync","private":true,"bin":"index.ts"}\n' >tools/sheet-sync/package.json
# --- 8. Standards folder -------------------------------------------------------
mkdir -p standards
# (Optionally scaffold first standard with the create script if present)
if command -v pnpm &>/dev/null && [ -f scripts/create-ifla-standard.ts ]; then
pnpm dlx ts-node scripts/create-ifla-standard.ts isbdm --name "ISBDM" --skip-github
fi
# --- 9. Initial commit ---------------------------------------------------------
git add -A
git commit -m "chore: bootstrap standards-dev monorepo" -q
echo "✅ Scaffold complete – initial commit made."
echo "Next:"
echo " • pnpm install"
echo " • pnpm -r build # to test Docusaurus builds"