chore: fix Windows build (#4358)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
main
Joaquín Sánchez 5 days ago committed by GitHub
parent d200f4e125
commit 564907152e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -20,11 +20,15 @@ concurrency:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node_version: [18, 20, 22]
include:
- os: windows-latest
node_version: 22
runs-on: ${{ matrix.os }}
steps:
- name: Checkout

@ -1,22 +1,17 @@
import * as fs from 'node:fs/promises'
import { builtinModules, createRequire } from 'node:module'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { type RollupOptions, defineConfig } from 'rollup'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import alias from '@rollup/plugin-alias'
import commonjs from '@rollup/plugin-commonjs'
import esbuild from 'rollup-plugin-esbuild'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import alias from '@rollup/plugin-alias'
import { type RollupOptions, defineConfig } from 'rollup'
import dts from 'rollup-plugin-dts'
import esbuild from 'rollup-plugin-esbuild'
import { globSync } from 'tinyglobby'
const ROOT = fileURLToPath(import.meta.url)
const r = (p: string) => resolve(ROOT, '..', p)
const require = createRequire(import.meta.url)
const pkg = require(r('package.json'))
const pkg = require('./package.json')
const DEV = !!process.env.DEV
const PROD = !DEV
@ -45,15 +40,15 @@ const plugins = [
const esmBuild: RollupOptions = {
input: [
r('src/node/index.ts'),
r('src/node/cli.ts'),
...globSync(r('src/node/worker_*.ts'))
'src/node/index.ts',
'src/node/cli.ts',
...globSync('src/node/worker_*.ts')
],
output: {
format: 'esm',
entryFileNames: `[name].js`,
chunkFileNames: 'chunk-[hash].js',
dir: r('dist/node'),
dir: 'dist/node',
sourcemap: DEV
},
external,
@ -72,7 +67,7 @@ const typesExternal = [
const dtsNode = dts({
respectExternal: true,
tsconfig: r('src/node/tsconfig.json')
tsconfig: 'src/node/tsconfig.json'
})
const originalResolveId = dtsNode.resolveId
@ -84,20 +79,20 @@ dtsNode.resolveId = async function (source, importer) {
}
const nodeTypes: RollupOptions = {
input: r('src/node/index.ts'),
input: 'src/node/index.ts',
output: {
format: 'esm',
file: r('dist/node/index.d.ts')
file: 'dist/node/index.d.ts'
},
external: typesExternal,
plugins: [dtsNode]
}
const clientTypes: RollupOptions = {
input: r('dist/client-types/index.d.ts'),
input: 'dist/client-types/index.d.ts',
output: {
format: 'esm',
file: r('dist/client/index.d.ts')
file: 'dist/client/index.d.ts'
},
external: typesExternal,
plugins: [
@ -106,7 +101,7 @@ const clientTypes: RollupOptions = {
name: 'cleanup',
async closeBundle() {
if (PROD) {
await fs.rm(r('dist/client-types'), { recursive: true })
await fs.rm('dist/client-types', { recursive: true })
}
}
}

Loading…
Cancel
Save