Skip to content

Commit

Permalink
try mini-build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr Martian committed Oct 3, 2024
1 parent dfde675 commit af43377
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import WgslPlugin from './config/wgsl-loader/bun';

// first convert the wasm file to base64
// const dataS2Cell = await Bun.file('./zig-out/bin/optimized-s2cell.wasm').arrayBuffer();
const dataS2Cell = await Bun.file(
Expand All @@ -10,14 +12,16 @@ await Bun.write('./src/wasm/uint64.wasm.ts', code);

try {
console.info('Starting the build process...');
await Bun.build({
const output = await Bun.build({
entrypoints: ['src/index.ts'],
outdir: 'dist',
format: 'esm',
minify: false,
sourcemap: 'external',
plugins: [WgslPlugin],
// target: 'esnext', // Adjust target based on your project needs
});
console.info(output);
console.info('Build completed successfully!');
} catch (error) {
console.error('Build failed:', error);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prettier:fix": "bunx prettier -- --write",
"format": "bunx prettier:fix && bun run lint:fix",
"build": "bun run build:rust && bun run build:ts",
"build:ts": "rm -rf dist && mkdir dist && rm -f -- tsconfig.tsbuildinfo && tsc",
"build:ts": "rm -rf dist && mkdir dist && rm -f -- tsconfig.tsbuildinfo && bun run build.ts && tsc",
"build:rust": "bun build:rust:cargo && bun build:rust:optimize && bun build:rust:strip",
"build:rust:cargo": "cargo build --target wasm32-unknown-unknown --release --workspace --package rust-uint64",
"build:rust:optimize": "wasm-opt -Oz -o target/wasm32-unknown-unknown/release/optimized.wasm target/wasm32-unknown-unknown/release/uint64.wasm",
Expand Down
1 change: 0 additions & 1 deletion src/dataStore/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './externalSort';
export * from './kv';
export * from './multimap';
export * from './vector';
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
/* Emit */
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
"declarationMap": true /* Create sourcemaps for d.ts files. */,
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
"outDir": "dist" /* Specify an output folder for all emitted files. */,
Expand Down

0 comments on commit af43377

Please sign in to comment.