Skip to content

Commit

Permalink
Further refine Wireit integration (#809)
Browse files Browse the repository at this point in the history
- Bump to latest version of Wireit to bring in google/wireit#189, which makes it safe to have multiple concurrent Wireit processes handling overlapping build graphs.

- Added `output:[]` to some server commands, so that they can run concurrently given the above new restriction.

- Renamed `:not-site` scripts to `:assets`, and `:site` scripts to `:eleventy`. I think these are more intuitive names.

- Separated out `dev:build:assets` and `prod:build:assets` scripts. This means that watching dev no longer runs rollup, which was unnecessary because we serve tsc output directly in dev mode.

- Updated the top-level `dev` script:
  - Ensure that the server is built first
  - Simplified to take advantage of safe concurrent Wireit processes

I'll be working on google/wireit#33 next, which should simplify things even further.
  • Loading branch information
aomarks authored May 6, 2022
1 parent 681673a commit 7d34757
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 37 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You may also prefer to run each dev script in its own terminal:
cd packages/lit-dev-content

npm run build:ts:watch # TypeScript
npm run dev:build:site:watch # Eleventy
npm run dev:build:eleventy:watch # Eleventy
npm run dev:serve # @web/dev-server
```

Expand Down Expand Up @@ -100,7 +100,7 @@ npm start # production server
cd packages/lit-dev-content
npm run build:ts:watch # TypeScript
npm run build:rollup:watch # Rollup
npm run build:site:watch # Eleventy
npm run build:eleventy:watch # Eleventy
```

Serves at [`http://localhost:6415`](http://localhost:6415)
Expand Down
60 changes: 50 additions & 10 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start:main": "LITDEV_ENV=local MODE=main lerna run start --scope=lit-dev-server --stream",
"start:playground": "LITDEV_ENV=local MODE=playground lerna run start --scope=lit-dev-server --stream",
"start:fake-github": "wireit",
"dev": "cd packages/lit-dev-content && npm run build:not-site && (LITDEV_ENV=dev NODE_OPTIONS=--experimental-vm-modules npx eleventy --watch --incremental & npm run build:not-site watch & node ../lit-dev-tools-esm/lib/dev-server.js --open)",
"dev": "cd packages/lit-dev-server && npm run build && cd ../lit-dev-content && (npm run dev:build:assets watch & npm run dev:build:eleventy:watch & node ../lit-dev-tools-esm/lib/dev-server.js --open)",
"format": "prettier . --write",
"format:check": "prettier . --check",
"nuke": "rm -rf node_modules && npm ci && lerna exec 'rm -rf node_modules' && lerna bootstrap --ci",
Expand All @@ -37,14 +37,15 @@
"dependencies": [
"./packages/lit-dev-tools-esm:build"
],
"command": "LITDEV_ENV=local node packages/lit-dev-tools-esm/lib/fake-github-server.js"
"command": "LITDEV_ENV=local node packages/lit-dev-tools-esm/lib/fake-github-server.js",
"output": []
}
},
"devDependencies": {
"lerna": "^4.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"typescript": "^4.4.3",
"wireit": "^0.2.0"
"wireit": "^0.4.0"
}
}
46 changes: 26 additions & 20 deletions packages/lit-dev-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,36 @@
"scripts": {
"fonts:manrope": "wireit",
"build": "wireit",
"build:not-site": "wireit",
"build:site": "wireit",
"build:site:watch": "wireit",
"build:eleventy": "wireit",
"build:eleventy:watch": "wireit",
"build:ts": "wireit",
"build:ts:watch": "npm run build:ts -- watch",
"build:rollup": "wireit",
"build:rollup:watch": "npm run build:rollup -- watch",
"build:samples": "wireit",
"build:samples:watch": "npm run build:samples -- watch",
"dev:build": "wireit",
"dev:build:site": "wireit",
"dev:build:site:watch": "wireit",
"dev:build:assets": "wireit",
"dev:build:eleventy": "wireit",
"dev:build:eleventy:watch": "wireit",
"dev:serve": "wireit",
"prod:build": "wireit"
"prod:build": "wireit",
"prod:build:assets": "wireit"
},
"wireit": {
"build": {
"dependencies": [
"build:site"
"build:eleventy"
]
},
"dev:build": {
"dependencies": [
"dev:build:site"
"dev:build:eleventy"
]
},
"prod:build": {
"dependencies": [
"build:not-site"
"prod:build:assets"
],
"files": [
"site/**",
Expand All @@ -52,9 +53,9 @@
],
"command": "node ../lit-dev-tools-esm/lib/dev-server.js --open"
},
"build:site": {
"build:eleventy": {
"dependencies": [
"build:not-site"
"prod:build:assets"
],
"output": [
"_site"
Expand All @@ -65,23 +66,23 @@
],
"command": "LITDEV_ENV=local NODE_OPTIONS=--experimental-vm-modules eleventy"
},
"build:site:watch": {
"build:eleventy:watch": {
"dependencies": [
"build:not-site"
"prod:build:assets"
],
"output": [
"_site"
],
"#comment": "This is awkward. We want to do the watch part for build:not-site ourselves, but let eleventy do its own watch mode itself. Maybe --incremental will do a quick rebuild of just the changed parts, and we don't need --watch?",
"#comment": "This is awkward. We want to do the watch part for build:assets ourselves, but let eleventy do its own watch mode itself. Maybe --incremental will do a quick rebuild of just the changed parts, and we don't need --watch?",
"files": [
"site/**",
".eleventy.js"
],
"command": "LITDEV_ENV=local NODE_OPTIONS=--experimental-vm-modules eleventy --watch --incremental"
},
"dev:build:site": {
"dev:build:eleventy": {
"dependencies": [
"build:not-site"
"dev:build:assets"
],
"output": [
"_dev"
Expand All @@ -92,9 +93,9 @@
],
"command": "LITDEV_ENV=dev NODE_OPTIONS=--experimental-vm-modules eleventy"
},
"dev:build:site:watch": {
"dev:build:eleventy:watch": {
"dependencies": [
"build:not-site"
"dev:build:assets"
],
"output": [
"_dev"
Expand All @@ -105,14 +106,19 @@
],
"command": "LITDEV_ENV=dev NODE_OPTIONS=--experimental-vm-modules eleventy --watch --incremental"
},
"build:not-site": {
"dev:build:assets": {
"dependencies": [
"build:ts",
"build:rollup",
"build:samples",
"fonts:manrope"
]
},
"prod:build:assets": {
"dependencies": [
"dev:build:assets",
"build:rollup"
]
},
"fonts:manrope": {
"files": [],
"output": [
Expand Down
5 changes: 3 additions & 2 deletions packages/lit-dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
"start": {
"dependencies": [
"build",
"../lit-dev-content:build:site"
"../lit-dev-content:build:eleventy"
],
"command": "node lib/server.js"
"command": "node lib/server.js",
"output": []
}
},
"dependencies": {
Expand Down

0 comments on commit 7d34757

Please sign in to comment.