Skip to content

Commit

Permalink
chore: Monorepo tooling updates (#75)
Browse files Browse the repository at this point in the history
* chore: Update update-sites script to work on Node 16+

* chore: Test on lts and current Node versions

* chore: Add docs workspace

* chore: Add engines, OS to root package.json
  • Loading branch information
tyhopp authored Oct 2, 2022
1 parent 6638173 commit 617a50b
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 21 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ defaults:

jobs:
test:
name: ${{ matrix.os }}
name: ${{ matrix.os }}-node-${{ matrix.node }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node: [16, 18]

steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodejs }}

- name: Install monorepo dependencies
run: npm i
run: npm install

- name: Build PRPL modules
run: npm run build
Expand Down
141 changes: 139 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
"workspaces": [
"packages/*",
"examples/*",
"tests"
"tests",
"docs"
],
"os": [
"darwin",
"linux",
"win32"
],
"engines": {
"node": ">=16.17.1"
},
"scripts": {
"dev": "bash scripts/dev.sh",
"clear": "rm -rf packages/*/dist",
"build": "npm run clear && rollup -c rollup.config.js",
"version": "bash scripts/version.sh",
"publish": "npm run build && bash scripts/publish.sh",
"update:sites": "bash scripts/update-sites.sh"
"update-sites": "bash scripts/update-sites.sh"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^19.0.0",
Expand Down
2 changes: 1 addition & 1 deletion process-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Update docs and example sites by checking out `main` and then running:

```
git checkout -b chore-update-sites
npm run update:sites
npm run update-sites
git push --set-upstream origin chore-update-sites
```

Expand Down
45 changes: 32 additions & 13 deletions scripts/update-sites.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@
# Docs site --------------------------------------------------
# Update package.json and package-lock.json files with latest PRPL deps.
# Some workspace commands (e.g. install, update) are borked, so we have to do this manually.

# Update docs site
cd docs
npm i @prpl/core@latest @prpl/plugin-code-highlight@latest @prpl/plugin-css-imports@latest @prpl/plugin-html-imports@latest @prpl/plugin-sitemap@latest && npm i --workspaces=false -D @prpl/server@latest
cd ..
git add .
git commit -m "chore(docs): Update PRPL deps"
core_latest=$(npm view "@prpl/core" version)
server_latest=$(npm view "@prpl/server" version)

# Update example site deps
npm pkg set "dependencies[@prpl/core]"="^${core_latest}" --workspace=examples
npm pkg set "devDependencies[@prpl/server]"="^${server_latest}" --workspace=examples

# Example sites --------------------------------------------------
# Update docs deps
npm pkg set "dependencies[@prpl/core]"="^${core_latest}" --workspace=docs
npm pkg set "devDependencies[@prpl/server]"="^${server_latest}" --workspace=docs

examples=("basic" "esm" "commonjs" "deno")
plugins=("core" "plugin-code-highlight" "plugin-css-imports" "plugin-html-imports" "plugin-sitemap")

for plugin in ${plugins[@]}; do
latest=$(npm view "@prpl/${plugin}" version)
npm pkg set "dependencies[@prpl/${plugin}]"="^${latest}" --workspace=docs
done

# Recreate lockfiles, workspaces + lockfiles are broken in npm
examples=("examples/basic" "examples/commonjs" "examples/deno" "examples/esm")

# Recreate example lockfiles
for example in ${examples[@]}; do
cd "examples/${example}"
npm i @prpl/core@latest @prpl/server@latest
cd $example
rm package-lock.json
npm install --workspaces=false
cd ../..
done

git add .
git commit -m "chore(examples): Update PRPL deps"
# Recreate docs lockfile
cd docs
rm package-lock.json
npm install --workspaces=false
cd ../

# Show if tree is borked or not
npm ls

0 comments on commit 617a50b

Please sign in to comment.