7 changed files with 69 additions and 17 deletions
@ -1,7 +0,0 @@ |
|||
import { defineBuildConfig } from 'unbuild'; |
|||
|
|||
export default defineBuildConfig({ |
|||
clean: true, |
|||
declaration: true, |
|||
entries: ['src/index'], |
|||
}); |
|||
@ -0,0 +1,37 @@ |
|||
import { spawnSync } from 'node:child_process'; |
|||
|
|||
const pnpmCommand = |
|||
process.env.npm_execpath && |
|||
process.env.npm_execpath.endsWith('.cjs') |
|||
? [process.execPath, process.env.npm_execpath] |
|||
: [process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm']; |
|||
|
|||
const steps = [ |
|||
['exec', 'tsdown', '--no-dts'], |
|||
[ |
|||
'exec', |
|||
'tsc', |
|||
'-p', |
|||
'tsconfig.build.json', |
|||
'--emitDeclarationOnly', |
|||
'--declaration', |
|||
'--outDir', |
|||
'dist', |
|||
], |
|||
]; |
|||
|
|||
for (const args of steps) { |
|||
const [command, ...commandArgs] = pnpmCommand; |
|||
const result = spawnSync(command, [...commandArgs, ...args], { |
|||
shell: false, |
|||
stdio: 'inherit', |
|||
}); |
|||
|
|||
if (result.error) { |
|||
throw result.error; |
|||
} |
|||
|
|||
if (result.status !== 0) { |
|||
process.exit(result.status ?? 1); |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"$schema": "https://json.schemastore.org/tsconfig", |
|||
"extends": "./tsconfig.json", |
|||
"compilerOptions": { |
|||
"noEmit": false |
|||
}, |
|||
"exclude": ["node_modules", "src/__tests__"] |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
import { defineConfig } from 'tsdown'; |
|||
|
|||
export default defineConfig({ |
|||
clean: false, |
|||
deps: { |
|||
skipNodeModulesBundle: true, |
|||
}, |
|||
entry: ['src/index.ts'], |
|||
format: ['esm'], |
|||
}); |
|||
Loading…
Reference in new issue