1
0
Fork 0

feat(plugin-cutlist): New plugin to manage cutlist

This also removed the cutlist-related functionality that was added to
core as an early v3 feature.
This commit is contained in:
Joost De Cock 2022-09-07 21:16:44 +02:00
parent ef4a70c8f3
commit 55e5dc3d0c
11 changed files with 664 additions and 182 deletions

View file

@ -0,0 +1,50 @@
/* This script will build the package with esbuild */
import esbuild from 'esbuild'
import pkg from './package.json' assert { type: 'json' }
// Create banner based on package info
const banner = `/**
* ${pkg.name} | v${pkg.version}
* ${pkg.description}
* (c) ${new Date().getFullYear()} ${pkg.author}
* @license ${pkg.license}
*/`
// Shared esbuild options
const options = {
banner: { js: banner },
bundle: true,
entryPoints: ['src/index.mjs'],
format: 'esm',
outfile: 'dist/index.mjs',
external: ["@freesewing"],
metafile: process.env.VERBOSE ? true : false,
minify: process.env.NO_MINIFY ? false : true,
sourcemap: true,
}
// Let esbuild generate the build
let result
(async () => {
result = await esbuild.build(options).catch(() => process.exit(1))
if (process.env.VERBOSE) {
const info = await esbuild.analyzeMetafile(result.metafile)
console.log(info)
}
// Also build a version that has all dependencies bundled
// This makes it easy to run tests
await esbuild
.build({
...options,
minify: false,
keepNames: true,
sourcemap: false,
outfile: 'tests/dist/index.mjs',
format: 'esm',
external: [],
})
.catch(() => process.exit(1))
})()