extend-chrome / ts-react-boilerplate

Chrome extension boilerplate with TypeScript and React
MIT License
70 stars 14 forks source link

Release artefact caveat #1

Closed rangeoshun closed 3 years ago

rangeoshun commented 3 years ago

Expected Behavior / Situation

Running npm run release should produce an artefact in the releases folder.

Actual Behavior / Situation

Because the name in the package.json starts with @extend-chrome/ the zip({ dir: 'releases' }) call doesn't produce the artefact. It's because of how it generates names:

`${npm_package_name}-${npm_package_version}.zip` || `bundle-${npm_package_version}.zip` || 'bundle.zip' 

So no modern namespaced package names work.

Modification Proposal

I see two ways of solving this.

Update the rollup config

Recommending manual name generation would solve the confusing behaviour. I concatenate package name and version but run it through a _.snakeCase call, which ensures a valid filename.

// rollup.config.js

const zipName = "my_lovely_extension_v1_0_0"

// ...

    zip({ file: `../releases/${zipName}.zip` }),
  ],
}

Update README.md

A note/warning should be added to the README.md to help users mitigate this problem.

jacksteamdev commented 3 years ago

@rangeoshun Thanks for the heads up!

We put together a CLI to git clone and customize this boilerplate. Using it will eliminate this problem. It's called create-react-crx.

npx create-react-crx

I've also added some warnings to the readme, just in case.