File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,15 @@ name: Publish to npm
33on :
44 release :
55 types : [published]
6+ # Called directly by release.yml after it cuts the tag/release. A reusable
7+ # workflow_call is a direct invocation, so it runs even though the release
8+ # was created with GITHUB_TOKEN (whose events don't trigger other workflows).
9+ workflow_call :
10+ inputs :
11+ dry-run :
12+ description : ' Dry run (skip actual publish)'
13+ type : boolean
14+ default : false
615 workflow_dispatch :
716 inputs :
817 dry-run :
Original file line number Diff line number Diff line change 99 runs-on : ubuntu-latest
1010 permissions :
1111 contents : write
12+ outputs :
13+ changed : ${{ steps.version.outputs.changed }}
14+ version : ${{ steps.version.outputs.version }}
1215 steps :
1316 - uses : actions/checkout@v4
1417 with :
4144 gh release create "$TAG" \
4245 --title "$TAG" \
4346 --generate-notes
47+
48+ # Publish straight after the release is cut. Called as a reusable workflow
49+ # (not via the `release: published` event, which GITHUB_TOKEN-created releases
50+ # never fire) so a version bump on main now auto-publishes to npm with no
51+ # manual dispatch and no PAT. Skipped when the version didn't change.
52+ publish :
53+ needs : release
54+ if : needs.release.outputs.changed == 'true'
55+ uses : ./.github/workflows/publish.yml
56+ secrets : inherit
Original file line number Diff line number Diff line change 11import { describe , it , expect } from 'vitest'
2- import { globSync , readFileSync } from 'node:fs'
2+ import { readdirSync , readFileSync } from 'node:fs'
33import path from 'node:path'
44import { fileURLToPath } from 'node:url'
55import ts from 'typescript'
@@ -354,7 +354,12 @@ describe('transformJSX', () => {
354354 path . dirname ( fileURLToPath ( import . meta. url ) ) ,
355355 '../../../playgrounds/simple/react-vite'
356356 )
357- const files = globSync ( 'src/**/*.{tsx,jsx}' , { cwd : playgroundRoot } )
357+ // Recursive readdir (Node 18.17+/20) — NOT fs.globSync, which is Node 22+
358+ // and would throw on CI's Node 20.
359+ const files = readdirSync ( path . join ( playgroundRoot , 'src' ) , { recursive : true } )
360+ . map ( String )
361+ . filter ( ( f ) => f . endsWith ( '.tsx' ) || f . endsWith ( '.jsx' ) )
362+ . map ( ( f ) => path . join ( 'src' , f ) )
358363 expect ( files . length ) . toBeGreaterThan ( 0 )
359364 for ( const rel of files ) {
360365 const file = path . join ( playgroundRoot , rel )
Original file line number Diff line number Diff line change 11import { describe , it , expect } from 'vitest'
2- import { globSync , readFileSync } from 'node:fs'
2+ import { readdirSync , readFileSync } from 'node:fs'
33import path from 'node:path'
44import { fileURLToPath } from 'node:url'
55import { compile } from 'svelte/compiler'
@@ -287,7 +287,12 @@ describe('transformSvelte', () => {
287287 path . dirname ( fileURLToPath ( import . meta. url ) ) ,
288288 '../../../playgrounds/simple/svelte-vite'
289289 )
290- const files = globSync ( 'src/**/*.svelte' , { cwd : playgroundRoot } )
290+ // Recursive readdir (Node 18.17+/20) — NOT fs.globSync, which is Node 22+
291+ // and would throw on CI's Node 20.
292+ const files = readdirSync ( path . join ( playgroundRoot , 'src' ) , { recursive : true } )
293+ . map ( String )
294+ . filter ( ( f ) => f . endsWith ( '.svelte' ) )
295+ . map ( ( f ) => path . join ( 'src' , f ) )
291296 expect ( files . length ) . toBeGreaterThan ( 0 )
292297 for ( const rel of files ) {
293298 const file = path . join ( playgroundRoot , rel )
You can’t perform that action at this time.
0 commit comments