Skip to content

Commit b566dfb

Browse files
authored
Convert lit.dev to npm workspaces (#862)
Replaces Lerna with npm workspaces. ### Issues encountered - npm workspaces hoists shared dependencies, so there were a few spots where we were assuming that `playground-elements` would get installed to `<root>/packages/lit-dev-content/node_modules/playground-elements`, but it now gets installed to `<root>/node_modules/playground-elements` Updated these spots. - Constrained our typescript version with a `~`, because there is a new breaking change I didn't want to address in this PR, and `~` is a good idea anyway because TypeScript doesn't follow semver. - There seems a problem in the integration tests where running it a second time causes an error because the server is already running. This seems to be because playwright sends a `SIGKILL` instead of a `SIGTERM` or `SIGINT` to shut down the server, which I think causes the server to not shut down correctly (perhaps because it is a child of `npm` and `run-p`), so it keeps running after an integration test (see microsoft/playwright#12299). This means that we can't get updated goldens after a screenshot failure, because that works by running the integration tests again with a special option enabled. For now I have enabled the `reuseExistingServer` option as a workaround. Wireit services will also solve this: google/wireit#33. ### Also - Upgraded to the latest playground-elements - Upgraded to the latest MWC. - Upgraded to the latest Wireit. - Moved the playground-elements dependency to the top-level, since it gets installed there anyway, and now there will only be one place to change the version constraint, instead of 3. - Added some logging to the static playground renderer, so that we get more information when it times out (e.g. in this case there was a 404 that wasn't getting displayed in the build logs). - Split apart check links workflow from integration tests workflow. Just seems nicer to view them separately.
1 parent 650e896 commit b566dfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+14615
-43707
lines changed

.github/workflows/check-api-data-in-sync.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
- uses: google/wireit@setup-github-actions-caching/v1
1919
with:
2020
node-version: 18
21-
# Don't cache because we don't fully bootstrap
21+
cache: npm
22+
cache-dependency-path: '**/package-lock.json'
2223

2324
- run: npm ci
24-
- run: npx lerna bootstrap --scope lit-dev-api --include-dependencies
25-
- run: npx lerna run build --scope lit-dev-api --include-dependencies
25+
- run: npm run build --workspace=lit-dev-api
2626
- run: command test -z "$(git status --porcelain)"

.github/workflows/check-format.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ jobs:
1111
- uses: actions/setup-node@v2
1212
with:
1313
node-version: 18
14-
# Don't cache because we don't bootstrap
14+
cache: npm
15+
cache-dependency-path: '**/package-lock.json'
1516

1617
- run: npm ci
1718
- run: npm run format:check

.github/workflows/check-links.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Check links
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
check-links:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 10
9+
steps:
10+
- uses: google/wireit@setup-github-actions-caching/v1
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 18
15+
cache: npm
16+
cache-dependency-path: '**/package-lock.json'
17+
18+
- run: npm ci
19+
- run: npm run test:links

.github/workflows/integration-tests.yml

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717

1818
- run: npm ci
1919
- run: npx playwright install-deps
20-
- run: npm run bootstrap
21-
- run: npm run test:links
2220
- id: test
2321
run: npm run test:integration
2422

.github/workflows/unit-tests.yml

-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ jobs:
1616
cache-dependency-path: '**/package-lock.json'
1717

1818
- run: npm ci
19-
- run: npm run bootstrap
2019
- run: npm run test:unit

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ packages/lit-dev-tests/src/playwright/**/*.png
2020
test-results
2121

2222
*.tsbuildinfo
23-
lerna-debug.log
2423

2524
.wireit

Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ WORKDIR /usr/src/app
2323
# to execute the final Eleventy build step.
2424

2525
# External dependencies
26-
COPY package*.json lerna.json tsconfig.base.json ./
26+
COPY package*.json tsconfig.base.json ./
2727
COPY packages/lit-dev-tools-cjs/package*.json ./packages/lit-dev-tools-cjs/
2828
COPY packages/lit-dev-tools-esm/package*.json ./packages/lit-dev-tools-esm/
2929
COPY packages/lit-dev-server/package*.json ./packages/lit-dev-server/
3030
COPY packages/lit-dev-api/package*.json ./packages/lit-dev-api/
3131
COPY packages/lit-dev-content/package*.json ./packages/lit-dev-content/
32-
RUN npm ci && npm run bootstrap
32+
RUN npm ci
3333

3434
# Tooling code
3535
COPY packages/lit-dev-tools-cjs/ ./packages/lit-dev-tools-cjs/
3636
COPY packages/lit-dev-tools-esm/ ./packages/lit-dev-tools-esm/
3737
COPY packages/lit-dev-server/ ./packages/lit-dev-server/
38-
RUN npx lerna run build:ts --scope lit-dev-tools-cjs --scope lit-dev-tools-esm --scope lit-dev-server --stream
38+
RUN npm run build:ts -w packages/lit-dev-tools-cjs -w packages/lit-dev-tools-esm -w packages/lit-dev-server
3939

4040
# Pre-generated API docs data
4141
COPY packages/lit-dev-api/ ./packages/lit-dev-api/
@@ -59,7 +59,7 @@ RUN echo "LITDEV_ENV=$LITDEV_ENV" >> env \
5959
&& echo "SHORT_SHA=$SHORT_SHA" >> env
6060

6161
# Eleventy build
62-
RUN npx lerna run prod:build --scope lit-dev-content --stream
62+
RUN npm run prod:build -w packages/lit-dev-content
6363

6464
# Run the web service on container startup.
6565
#

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ New site, new repo.
44

55
## Packages
66

7-
This is a Lerna monorepo.
7+
This is an npm workspaces monorepo.
88

99
- lit-dev-content: Main content of lit.dev
1010
- lit-dev-server: Production web server for lit.dev
@@ -15,7 +15,7 @@ This is a Lerna monorepo.
1515
### Install dependencies
1616

1717
```sh
18-
npm i && npm run bootstrap
18+
npm ci
1919
```
2020

2121
### Build all

lerna.json

-4
This file was deleted.

0 commit comments

Comments
 (0)