Closed tb-b closed 2 years ago
Slightly easier way than deconstructing manifest is to use yarn add -D genversion
generate version.ts on build/dev/serve
/* package.json */
"dev": "genversion --es6 ./src/version.ts && ..."
"build": "genversion --es6 ./src/version.ts && ..."
and then import to cep.config.ts
/* cep.config.ts */
import { version } from './src/version'
const config: CEP_Config = { // ... version: version, }
but still, would be better to pass it directly to cep.config.ts somehow
Great suggestion!
This did cross my mind a while back but forgot to investigate. Looks like a simple import should work with the JSON plugin for Rollup so no file generation is needed.
import { version } from "./package.json";
const config: CEP_Config = {
version,
[...]
}
Will add this to the boilerplate going forward, and if the user wants to break the link, they can.
Is there a way to pass package.json version to manifest.xml other than
let p = require('./package.json')
? It would be good to have the versions in sync automatically. I have a decunstructor xml function that runs after the build and updates this version in manifest.xml, but it would be better to just pass it down to cep.config.ts somehow