Skip to content

Commit

Permalink
Merge branch 'master' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
bashmish committed Feb 19, 2024
2 parents 0509460 + f7fcf29 commit 967357f
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 82 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: '18'
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,24 @@ env:
FORCE_COLOR: true

jobs:
verify-linux:
linux:
timeout-minutes: 30
name: Verify linux
name: Linux
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '18'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Setup Node 20
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: ${{ matrix.node-version }}
node-version: 20
cache: npm

- name: Install Dependencies
run: npm ci

- name: Lint
run: npm run lint
run: npm run lint
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: '18'
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'

Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/verify-browser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Verify Browser
name: Browser tests

on: pull_request

Expand All @@ -8,22 +8,18 @@ env:
jobs:
verify-linux:
timeout-minutes: 30
name: Verify linux
name: Linux
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '18'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Setup Node 20
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: ${{ matrix.node-version }}
node-version: 20
cache: npm

- name: Install Dependencies
Expand Down
50 changes: 45 additions & 5 deletions .github/workflows/verify-node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Verify Node
name: Node tests

on: pull_request

Expand All @@ -8,19 +8,20 @@ env:
jobs:
verify-linux:
timeout-minutes: 30
name: Verify linux
name: Linux
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '18'
- '19'
- '20'
- 'latest'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
Expand Down Expand Up @@ -48,3 +49,42 @@ jobs:

- name: Test
run: npm run test:node

verify-windows:
timeout-minutes: 30
name: Windows
runs-on: windows-2022
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4

- name: Setup Node '20'
uses: actions/setup-node@v4
env:
FORCE_COLOR: 0
with:
node-version: '20'
cache: 'npm'

- name: Install Playwright dependencies
run: npx playwright install-deps

# Set up GitHub Actions caching for Wireit.
- uses: google/wireit@setup-github-actions-caching/v1

- name: Install Dependencies
run: npm ci

- name: Build
run: npm run build

# build for production in CI to make sure tests can run with production build
- name: Build specific packages for production
run: npm run build:production

- name: Test
run: npm run test:node
43 changes: 0 additions & 43 deletions .github/workflows/verify-windows.yml

This file was deleted.

6 changes: 6 additions & 0 deletions packages/dev-server-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @web/dev-server-core

## 0.7.1

### Patch Changes

- 649edc2b: Add option to modify chokidar watchOptions with @web/dev-server

## 0.7.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web/dev-server-core",
"version": "0.7.0",
"version": "0.7.1",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-server-core/src/server/DevServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DevServer {
constructor(
public config: DevServerCoreConfig,
public logger: Logger,
public fileWatcher = chokidar.watch([]),
public fileWatcher = chokidar.watch([], config.chokidarOptions),
) {
if (!config) throw new Error('Missing config.');
if (!logger) throw new Error('Missing logger.');
Expand Down
6 changes: 6 additions & 0 deletions packages/dev-server-core/src/server/DevServerCoreConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Middleware } from 'koa';
import { Plugin } from '../plugins/Plugin';
import { Server } from 'net';
import chokidar from 'chokidar';

export type MimeTypeMappings = Record<string, string>;

Expand Down Expand Up @@ -67,4 +68,9 @@ export interface DevServerCoreConfig {
* Useful when you want more control over when files are build (e.g. when doing a test run using @web/test-runner).
*/
disableFileWatcher?: boolean;

/**
* Additional options you want to provide to chokidar file watcher
*/
chokidarOptions?: chokidar.WatchOptions;
}
8 changes: 8 additions & 0 deletions packages/dev-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @web/dev-server

## 0.4.2

### Patch Changes

- 649edc2b: Add option to modify chokidar watchOptions with @web/dev-server
- Updated dependencies [649edc2b]
- @web/dev-server-core@0.7.1

## 0.4.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/dev-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web/dev-server",
"version": "0.4.1",
"version": "0.4.2",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -59,7 +59,7 @@
"@babel/code-frame": "^7.12.11",
"@types/command-line-args": "^5.0.0",
"@web/config-loader": "^0.3.0",
"@web/dev-server-core": "^0.7.0",
"@web/dev-server-core": "^0.7.1",
"@web/dev-server-rollup": "^0.6.1",
"camelcase": "^6.2.0",
"command-line-args": "^5.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/dev-server/src/config/parseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const defaultConfig: Partial<DevServerConfig> = {
clearTerminalOnReload: true,
middleware: [],
plugins: [],
chokidarOptions: {},
};

function validate(config: Record<string, unknown>, key: string, type: string) {
Expand Down
6 changes: 6 additions & 0 deletions packages/mocks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @web/mocks

## 1.1.1

### Patch Changes

- 17906853: workaround for MSW breaking change

## 1.1.0

### Minor Changes
Expand Down
15 changes: 14 additions & 1 deletion packages/mocks/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { _registerMockRoutes } from './registerMockRoutes.js';

const bypassServiceWorker = new URL(window.location.href).searchParams.has('bypass-sw');
const worker = setupWorker();
worker
const workerPromise = worker
.start({
serviceWorker: {
url: '__msw_sw__.js',
Expand All @@ -19,8 +19,21 @@ worker
console.error(`[MOCKS]: Failed to load Service Worker.
Did you forget to use the mockPlugin in the dev server?`);
return Promise.resolve();
});

/**
* It's unfortunate to override native `fetch`, and you should never do it, and please don't take this
* code as an example. We have to do this here because MSW removed this behavior which was released as
* a breaking change in a minor version https://github.com/mswjs/msw/issues/1981
*/
const originalFetch = window.fetch;
window.fetch = async (...args) => {
await workerPromise;
window.fetch = originalFetch;
return window.fetch(...args);
};

/**
* Mock the given mocked routes using a Service Worker.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/mocks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web/mocks",
"version": "1.1.0",
"version": "1.1.1",
"publishConfig": {
"access": "public"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/storybook-builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @web/storybook-builder

## 0.1.6

### Patch Changes

- 010eed69: fix: import both globals and globalsNameReferenceMap from @storybook/preview/globals and use the one that is set. This fixes issue https://github.com/modernweb-dev/web/issues/2619

## 0.1.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web/storybook-builder",
"version": "0.1.5",
"version": "0.1.6",
"publishConfig": {
"access": "public"
},
Expand Down

0 comments on commit 967357f

Please sign in to comment.