mirror of
https://github.com/voideditor/void
synced 2026-05-24 01:48:25 +00:00
back up build
This commit is contained in:
parent
1c32d3a1c9
commit
70ce23862b
3 changed files with 43 additions and 14 deletions
3
void-imports/build-to-be-built.ts
Normal file
3
void-imports/build-to-be-built.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
26
void-imports/compile-to-be-built.ts
Normal file
26
void-imports/compile-to-be-built.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import * as esbuild from 'esbuild'
|
||||
import * as path from 'path'
|
||||
|
||||
// import tsup from 'tsup' // Void added tsup as a dependency
|
||||
// import * as path from 'path'
|
||||
|
||||
|
||||
// export const compileFiles = async (imports: string[], src_folder: string, outDir: string) => {
|
||||
// const fileEntries = imports.map((importName) => path.join(src_folder, `${importName}.ts`))
|
||||
// await tsup.build({
|
||||
// entry: fileEntries,
|
||||
// format: ['cjs'],
|
||||
// sourcemap: false,
|
||||
// bundle: true,
|
||||
// clean: true,
|
||||
// // minify: true, // no need to minify since it all gets bundled later
|
||||
// outDir: path.join(outDir),
|
||||
// dts: false,
|
||||
// noExternal: [/.*/], // This bundles everything
|
||||
// platform: 'browser', // Important for browser compatibility
|
||||
// target: 'es2020',
|
||||
// banner: {
|
||||
// js: '/* eslint-disable */'
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
import tsup from 'tsup' // Void added tsup as a dependency
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import * as esbuild from 'esbuild'
|
||||
|
||||
const buildFiles = (imports, to_be_built_folder) => {
|
||||
export const buildFiles = (imports, to_be_built_folder) => {
|
||||
// create a file with name importName that imports importName and immediately re-exports it
|
||||
for (const importName of imports) {
|
||||
const content = `\
|
||||
|
|
@ -20,19 +20,17 @@ export default mod
|
|||
}
|
||||
}
|
||||
|
||||
const compileFiles = async (imports, to_be_built_folder, outDir) => {
|
||||
const fileEntries = imports.map((importName) => path.join(to_be_built_folder, `${importName}.ts`))
|
||||
await tsup.build({
|
||||
entry: fileEntries,
|
||||
format: ['cjs'],
|
||||
sourcemap: false,
|
||||
|
||||
|
||||
export const compileFiles = async (imports: string[], srcFolder: string, outDir: string) => {
|
||||
const entryPoints = imports.map(name => path.join(srcFolder, `${name}.ts`))
|
||||
|
||||
await esbuild.build({
|
||||
entryPoints,
|
||||
outdir: outDir,
|
||||
bundle: true,
|
||||
clean: true,
|
||||
// minify: true, // no need to minify since it all gets bundled later
|
||||
outDir: path.join(outDir),
|
||||
dts: false,
|
||||
noExternal: [/.*/], // This bundles everything
|
||||
platform: 'browser', // Important for browser compatibility
|
||||
format: 'iife',
|
||||
platform: 'browser',
|
||||
target: 'es2020',
|
||||
banner: {
|
||||
js: '/* eslint-disable */'
|
||||
|
|
@ -40,6 +38,8 @@ const compileFiles = async (imports, to_be_built_folder, outDir) => {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
const to_be_built_folder = 'to_be_built'
|
||||
fs.rmSync(to_be_built_folder, { recursive: true, force: true });
|
||||
|
||||
Loading…
Reference in a new issue