1
0
Fork 0
freesewing/packages/config-helpers/build.js
Joost De Cock 447970c689 feat(config-helpers): Renamed snapseries to config-helpers
It would be useful to have a place where we can place methods
like the pctBasedOn method that we now import from core, even though
it has nothing to do with core.

So I've decided to rename this packet since it's essentially also
things that facilitate pattern configuration (files).

Since this is a very new package, and I am 100% certain that we
(FreeSewing itself) are the only ones using it, no need to major
bump this. The most recent snapseries package will remain available
for people who want to use it.

I'll update all patterns accordingly.
2022-06-12 23:49:52 +02:00

33 lines
754 B
JavaScript

/* This script will build the package with esbuild */
const esbuild = require('esbuild')
const pkg = require('./package.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.js'],
minify: true,
sourcemap: true,
}
// Different formats
const formats = {
esm: "dist/index.mjs",
cjs: "dist/index.js"
}
// Let esbuild generate different formats
for (const [format, outfile] of Object.entries(formats)) esbuild
.build({ ...options, outfile, format })
.catch(() => process.exit(1))