Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting issues #24

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
---
name: _build
name: _build

on:
workflow_call:
inputs:
node_version:
description: The Node.js version.
type: string
required: false
default: "20"
outputs:
artifact_name:
description: The artifact name.
value: build-${{ github.sha }}
on:
workflow_call:
inputs:
node_version:
description: The Node.js version.
type: string
required: false
default: "20"
outputs:
artifact_name:
description: The artifact name.
value: build-${{ github.sha }}

jobs:
build:
name: Package
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ inputs.node_version }}
- name: Build
run: npm run build
- name: Package
run: npm pack
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-${{ github.sha }}
if-no-files-found: error
path: "*.tgz"
jobs:
build:
name: Package
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ inputs.node_version }}
- name: Build
run: npm run build
- name: Package
run: npm pack
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build-${{ github.sha }}
if-no-files-found: error
path: "*.tgz"
260 changes: 130 additions & 130 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,133 +1,133 @@
---
name: Check
name: Check

on:
push:
branches:
- "**"
on:
push:
branches:
- "**"

jobs:
test:
name: Test (Node.js v${{ matrix.node }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- "18"
- "20"
include:
- os: ubuntu-latest
os_name: Linux
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
- name: Test
run: npm test
lint:
name: Lint (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- "18"
- "20"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
node_auth_token: ${{ secrets.GH_TOKEN }}
- name: Lint
run: npm run lint
build:
name: Build
uses: ./.github/workflows/_build.yml
install:
name: Install (Node.js v${{ matrix.node }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- "18"
- "20"
include:
- os: ubuntu-latest
os_name: Linux
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact_name }}
path: .
- name: Find packages
uses: tj-actions/glob@v16
id: packages
with:
files: "*.tgz"
- name: Create package.json
uses: DamianReeves/[email protected]
with:
write-mode: overwrite
path: package.json
contents: |
{"type":"module"}
- name: Create index.js
uses: DamianReeves/[email protected]
with:
write-mode: overwrite
path: index.js
contents: |
import 'edgespec'
- name: Install
run: npm install --ignore-scripts --save ${{ steps.packages.outputs.paths }}
- name: Rebuild Node.js modules
shell: bash
run: npm rebuild
- name: Run postinstall script
shell: bash
run: npm run postinstall --if-present
- name: Run prepare script
shell: bash
run: npm run prepare --if-present
- name: Run
run: node index.js
typecheck:
name: Typecheck (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- "18"
- "20"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
- name: Check types
run: npm run typecheck
jobs:
test:
name: Test (Node.js v${{ matrix.node }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- "18"
- "20"
include:
- os: ubuntu-latest
os_name: Linux
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
- name: Test
run: npm test
lint:
name: Lint (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- "18"
- "20"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
node_auth_token: ${{ secrets.GH_TOKEN }}
- name: Lint
run: npm run lint
build:
name: Build
uses: ./.github/workflows/_build.yml
install:
name: Install (Node.js v${{ matrix.node }} on ${{ matrix.os_name }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: build
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
node:
- "18"
- "20"
include:
- os: ubuntu-latest
os_name: Linux
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact_name }}
path: .
- name: Find packages
uses: tj-actions/glob@v16
id: packages
with:
files: "*.tgz"
- name: Create package.json
uses: DamianReeves/[email protected]
with:
write-mode: overwrite
path: package.json
contents: |
{"type":"module"}
- name: Create index.js
uses: DamianReeves/[email protected]
with:
write-mode: overwrite
path: index.js
contents: |
import 'edgespec'
- name: Install
run: npm install --ignore-scripts --save ${{ steps.packages.outputs.paths }}
- name: Rebuild Node.js modules
shell: bash
run: npm rebuild
- name: Run postinstall script
shell: bash
run: npm run postinstall --if-present
- name: Run prepare script
shell: bash
run: npm run prepare --if-present
- name: Run
run: node index.js
typecheck:
name: Typecheck (Node.js v${{ matrix.node }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
node:
- "18"
- "20"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
with:
node_version: ${{ matrix.node }}
- name: Check types
run: npm run typecheck
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ export default withEdgeSpec({
return new Response(
JSON.stringify({
sum: a + b,
}),
})
)
})
```

EdgeSpec requires a config file called `edgespec.config.ts` or `edgespec.config.js` to be placed next to your routes directory:

```ts
import {defineConfig} from "edgespec"
import { defineConfig } from "edgespec"

export default defineConfig({
emulateWinterCGRuntimeLocally: true,
Expand All @@ -87,7 +87,7 @@ Run `edgespec bundle`. Then, depending on your target:
Create an `entrypoint.js` file:

```js
import {startServer} from "edgespec/adapters/node"
import { startServer } from "edgespec/adapters/node"
import bundle from "./dist"

startServer(bundle, 3000)
Expand All @@ -98,7 +98,7 @@ startServer(bundle, 3000)
Create an `entrypoint.js` file:

```js
import {addFetchListener} from "edgespec/adapters/wintercg-minimal"
import { addFetchListener } from "edgespec/adapters/wintercg-minimal"
import bundle from "./dist"
addFetchListener(edgeSpec)
```
Expand Down
2 changes: 1 addition & 1 deletion ava.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default () => {
return {
files: ["**/*.test.ts"],
watchMode: {
ignoreChanges: [".next", ".nsm", "**/bundled*.*s"]
ignoreChanges: [".next", ".nsm", "**/bundled*.*s"],
},
nodeArguments: ["--import=tsx"],
extensions: {
Expand Down
Loading
Loading