e2814943e9
* [feature] grids * Shows relative grids at different zoom levels * Update colors * Restores vec and intersect to monorepo, changes vec.round to vec.toFixed, adds vec.snap * Snapping in translate and transforms, fix shortcut * fix bugs in build * use grid size for nudge too * update scripts * Update grid.tsx * Update grid.tsx * Fixed! * Update grid.tsx * Fix package imports * Update Editor.tsx * Improve tsconfigs, imports * Fix tiny arrow bugs, snap starting points to grid * Update tsconfig.base.json * Update shape-styles.ts * Fix example tsconfig * Fix translate type error * Fix types, paths Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
61 lines
1.4 KiB
JavaScript
61 lines
1.4 KiB
JavaScript
/* eslint-disable */
|
||
const fs = require('fs')
|
||
const esbuild = require('esbuild')
|
||
const { gzip } = require('zlib')
|
||
const pkg = require('../package.json')
|
||
|
||
async function main() {
|
||
if (fs.existsSync('./dist')) {
|
||
fs.rmSync('./dist', { recursive: true }, (e) => {
|
||
if (e) {
|
||
throw e
|
||
}
|
||
})
|
||
}
|
||
|
||
try {
|
||
esbuild.buildSync({
|
||
entryPoints: ['./src/index.ts'],
|
||
outdir: 'dist/cjs',
|
||
minify: false,
|
||
bundle: true,
|
||
format: 'cjs',
|
||
target: 'es6',
|
||
tsconfig: './tsconfig.build.json',
|
||
metafile: false,
|
||
sourcemap: true,
|
||
})
|
||
|
||
const esmResult = esbuild.buildSync({
|
||
entryPoints: ['./src/index.ts'],
|
||
outdir: 'dist/esm',
|
||
minify: false,
|
||
bundle: true,
|
||
format: 'esm',
|
||
target: 'es6',
|
||
tsconfig: './tsconfig.build.json',
|
||
metafile: true,
|
||
sourcemap: true,
|
||
})
|
||
|
||
let esmSize = 0
|
||
Object.values(esmResult.metafile.outputs).forEach((output) => {
|
||
esmSize += output.bytes
|
||
})
|
||
|
||
fs.readFile('./dist/esm/index.js', (_err, data) => {
|
||
gzip(data, (_err, result) => {
|
||
console.log(
|
||
`✔ ${pkg.name}: Built package. ${(esmSize / 1000).toFixed(2)}kb (${(
|
||
result.length / 1000
|
||
).toFixed(2)}kb minified)`
|
||
)
|
||
})
|
||
})
|
||
} catch (e) {
|
||
console.log(`× ${pkg.name}: Build failed due to an error.`)
|
||
console.log(e)
|
||
}
|
||
}
|
||
|
||
main()
|