Create dist and npm package
Closed this issue · 3 comments
Create dist and npm package, while keeping most of the Lovefield public API usage.
This will need to write a sample test to test usage of it (maybe the harness min one).
First attempt: use rollup and its TypeScript plugin. It successfully generates lf.js, but there are two showstopper:
- It does not allow me to control what to export
- It does not generate .d.ts (that's a real show stopper)
The rollup config tested is
import multiEntry from 'rollup-plugin-multi-entry';
import typescript from 'rollup-plugin-typescript2';
export default {
input: 'lib/**/*.ts',
output: [{
name: 'lf',
file: 'dist/lf.js',
format: 'umd'
}],
plugins: [
multiEntry(),
typescript()
]
}
Use one index.ts
to export everything you want and this index.ts
would be the entry too. And it would make rollup and https://www.npmjs.com/package/dts-bundle-generator easy to setup.
Dist target created, now it can generate one single TypeScript file, that in turn compile into one JS file without changing TSConfig. Advantage: I no longer need to care about umd/commonjs/es6 since everything is in a file.
Remaining work:
- minify this JS file
- provide proper .d.ts for this JS file
- publish .d.ts of this JS file