hyperbrew / vite-cep-plugin

A Vite plugin to build Adobe CEP Extension Panels
MIT License
16 stars 16 forks source link

manifest.xml version update #6

Closed tb-b closed 2 years ago

tb-b commented 2 years ago

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

tb-b commented 2 years ago

Slightly easier way than deconstructing manifest is to use yarn add -D genversion

  1. generate version.ts on build/dev/serve

    /* package.json */
    "dev": "genversion --es6 ./src/version.ts && ..."
    "build": "genversion --es6 ./src/version.ts && ..."
  2. 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
justintaylor-dev commented 2 years ago

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.

justintaylor-dev commented 2 years ago

Fixed in:

https://github.com/hyperbrew/bolt-cep/commit/5262bc8ff2247eed269bcddc6ca4301b3957903c