Skip to content

Commit

Permalink
Merge branch 'main' into himself65/20241123/migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Dec 11, 2024
2 parents 8c872c8 + b59f5a1 commit 63b5896
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 15 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/canary-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Canary CI

on:
issue_comment:
types: [created]

jobs:
canary-ci:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/canary-ci run') }}
uses: ./.github/workflows/ci.yml
with:
use_canary: true
32 changes: 23 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main]
pull_request:
types: [opened, synchronize]
workflow_call:
inputs:
use_canary:
required: true
type: boolean

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -21,25 +26,31 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
cache: 'pnpm'
cache: ${{ inputs.use_canary && '' || 'pnpm' }}
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- name: Install dependencies
run: |
${{ inputs.use_canary && 'pnpm -r update react@canary react-dom@canary react-server-dom-webpack@canary' || '' }}
pnpm install --frozen-lockfile
- run: pnpm test

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
cache: ${{ inputs.use_canary && '' || 'pnpm' }}
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- name: Install dependencies
run: |
${{ inputs.use_canary && 'pnpm -r update react@canary react-dom@canary react-server-dom-webpack@canary' || '' }}
pnpm install --frozen-lockfile
- run: pnpm run compile
- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -81,12 +92,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
cache: 'pnpm'
cache: ${{ inputs.use_canary && '' || 'pnpm' }}
cache-dependency-path: '**/pnpm-lock.yaml'
- run: pnpm install --frozen-lockfile
- name: Install dependencies
run: |
${{ inputs.use_canary && 'pnpm -r update react@canary react-dom@canary react-server-dom-webpack@canary' || '' }}
pnpm install --frozen-lockfile
- uses: actions/download-artifact@v4
with:
name: create-waku
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ export const fsRouterTypegenPlugin = (opts: { srcDir: string }): Plugin => {
}
}

result += `\ntype Page = {
DO_NOT_USE_pages:`;
result += `\ntype Page =\n`;

for (const file of fileInfo) {
const moduleName = moduleNames[file.src];
Expand All @@ -198,7 +197,7 @@ export const fsRouterTypegenPlugin = (opts: { srcDir: string }): Plugin => {
}
}

result += `};
result += `;
declare module 'waku/router' {
interface RouteConfig {
Expand Down
13 changes: 10 additions & 3 deletions packages/waku/src/router/create-pages-utils/inferred-path-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,17 @@ export type AnyPage = {
* type MyPaths = PathsForPages<typeof pages>;
* // type MyPaths = '/foo' | '/bar';
*/
export type PathsForPages<PagesResult extends { DO_NOT_USE_pages: AnyPage }> =
CollectPaths<PagesResult['DO_NOT_USE_pages']> extends never
export type PathsForPages<
PagesResult extends { DO_NOT_USE_pages: AnyPage } | AnyPage,
> = PagesResult extends { DO_NOT_USE_pages: AnyPage }
? CollectPaths<PagesResult['DO_NOT_USE_pages']> extends never
? string
: CollectPaths<PagesResult['DO_NOT_USE_pages']>;
: CollectPaths<PagesResult['DO_NOT_USE_pages']>
: PagesResult extends AnyPage
? CollectPaths<PagesResult> extends never
? string
: CollectPaths<PagesResult>
: never;

type _GetSlugs<
Route extends string,
Expand Down

0 comments on commit 63b5896

Please sign in to comment.