Tweak build script
parent
df8857be2f
commit
3df69994c4
|
@ -2491,6 +2491,28 @@
|
||||||
"@esbuild/win32-x64": "0.19.5"
|
"@esbuild/win32-x64": "0.19.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/esbuild-node-externals": {
|
||||||
|
"version": "1.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/esbuild-node-externals/-/esbuild-node-externals-1.9.0.tgz",
|
||||||
|
"integrity": "sha512-WV6Ogvl+AZEX3vWAM0UGxqb08l3M73EUeymizKGccUC0iWlF1CwdpkZVu200bSqONamjSV0v22vf4YBahJXs8g==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"find-up": "^5.0.0",
|
||||||
|
"tslib": "^2.4.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"esbuild": "0.12 - 0.19"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild-node-externals/node_modules/tslib": {
|
||||||
|
"version": "2.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||||
|
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/esbuild/node_modules/@esbuild/android-arm": {
|
"node_modules/esbuild/node_modules/@esbuild/android-arm": {
|
||||||
"version": "0.19.5",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz",
|
||||||
|
@ -7632,9 +7654,10 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.19.5",
|
"esbuild": "^0.19.5",
|
||||||
|
"esbuild-node-externals": "^1.9.0",
|
||||||
"prettier": "2.3.0",
|
"prettier": "2.3.0",
|
||||||
"tslib": "2.2.0",
|
"tslib": "2.2.0",
|
||||||
"typescript": "4.6.4"
|
"typescript": "^5.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/tailwindcss-language-service/node_modules/lru-cache": {
|
"packages/tailwindcss-language-service/node_modules/lru-cache": {
|
||||||
|
@ -7662,6 +7685,19 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"packages/tailwindcss-language-service/node_modules/typescript": {
|
||||||
|
"version": "5.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||||
|
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"packages/vscode-tailwindcss": {
|
"packages/vscode-tailwindcss": {
|
||||||
"version": "0.10.1",
|
"version": "0.10.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -40,8 +40,9 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"esbuild": "^0.19.5",
|
"esbuild": "^0.19.5",
|
||||||
|
"esbuild-node-externals": "^1.9.0",
|
||||||
"prettier": "2.3.0",
|
"prettier": "2.3.0",
|
||||||
"tslib": "2.2.0",
|
"tslib": "2.2.0",
|
||||||
"typescript": "4.6.4"
|
"typescript": "^5.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import esbuild from 'esbuild'
|
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
import { spawnSync } from 'node:child_process'
|
||||||
|
import esbuild from 'esbuild'
|
||||||
import minimist from 'minimist'
|
import minimist from 'minimist'
|
||||||
|
import { nodeExternalsPlugin } from 'esbuild-node-externals'
|
||||||
|
|
||||||
const __dirname = new URL('.', import.meta.url).pathname
|
const __dirname = new URL('.', import.meta.url).pathname
|
||||||
|
|
||||||
|
@ -9,37 +11,43 @@ const args = minimist(process.argv.slice(2), {
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('- Preparing')
|
console.log('- Preparing')
|
||||||
let builds = await Promise.all([
|
let build = await esbuild.context({
|
||||||
esbuild.context({
|
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
|
||||||
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
|
bundle: true,
|
||||||
bundle: true,
|
platform: 'node',
|
||||||
platform: 'node',
|
external: [],
|
||||||
external: [],
|
outdir: 'dist',
|
||||||
outdir: 'dist',
|
minify: args.minify,
|
||||||
minify: args.minify,
|
|
||||||
|
|
||||||
format: 'cjs',
|
format: 'esm',
|
||||||
}),
|
|
||||||
|
|
||||||
esbuild.context({
|
plugins: [
|
||||||
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
|
nodeExternalsPlugin(),
|
||||||
bundle: true,
|
{
|
||||||
platform: 'node',
|
name: 'generate-types',
|
||||||
external: [],
|
async setup(build) {
|
||||||
outdir: 'dist',
|
build.onEnd(async (result) => {
|
||||||
minify: args.minify,
|
// Call the tsc command to generate the types
|
||||||
|
spawnSync(
|
||||||
format: 'esm',
|
'tsc',
|
||||||
}),
|
['--emitDeclarationOnly', '--outDir', path.resolve(__dirname, '../dist')],
|
||||||
])
|
{
|
||||||
|
stdio: 'inherit',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
console.log('- Building')
|
console.log('- Building')
|
||||||
await Promise.all(builds.map((build) => build.rebuild()))
|
await build.rebuild()
|
||||||
|
|
||||||
if (args.watch) {
|
if (args.watch) {
|
||||||
console.log('- Watching')
|
console.log('- Watching')
|
||||||
await Promise.all(builds.map((build) => build.watch()))
|
await build.watch()
|
||||||
} else {
|
} else {
|
||||||
console.log('- Cleaning up')
|
console.log('- Cleaning up')
|
||||||
await Promise.all(builds.map((build) => build.dispose()))
|
await build.dispose()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"include": ["src", "../../types"],
|
"include": ["src", "../../types"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "esnext",
|
"module": "NodeNext",
|
||||||
"lib": ["ES2020"],
|
"lib": ["ES2020"],
|
||||||
"target": "ES2020",
|
"target": "ES2020",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
"noUnusedParameters": false,
|
"noUnusedParameters": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "NodeNext",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"esModuleInterop": true
|
"esModuleInterop": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue