gmailjs-node-boilerplate icon indicating copy to clipboard operation
gmailjs-node-boilerplate copied to clipboard

Package for publication in the Chrome Web Store

Open dblock opened this issue 10 months ago • 6 comments

I'm trying to redistribute https://github.com/dblock/hide-read-categories.

What are the changes one needs to do to create a package to publish to the Chrome web store? Zipping up the source doesn't seem right because that would include all dev node_modules. Zipping up dist isn't enough because that doesn't have a manifest.

I am not familiar with the best way to package things, but could contribute with some guidance. We probably need changes to npm run dist and an npm run zip that produce something Chrome-store ready?

dblock avatar Feb 23 '25 22:02 dblock

I guess this is a web-extension question in general, and not specific to GmailJS. That said I've been doing custom NPM build-tasks in their own build-scripts, custom-tailored for my extensions need.

Below are parts of those scripts, to show roughly the strategy I've been using.

"use strict";

const { paths } = require("./buildPaths");
const { copyFilesToDir, copyDirToDir, readJson, writeJson, getVersionString } = require("./buildHelpers");
const path = require("path");

// prep base-folder

copyFilesToDir("icons/*", path.join(paths.stagingDir, "icons"));
copyFilesToDir("dist/*", path.join(paths.stagingDir, "dist"));
copyFilesToDir("manifest.json", paths.stagingDir);
copyFilesToDir(".web-extension-id", paths.stagingDir);
// etc

// apply version
const manifestFile = paths.stagingDir + "/manifest.json";
const manifest = readJson(manifestFile);

manifest.version = getVersionString();
writeJson(manifestFile, manifest);

josteink avatar Feb 24 '25 18:02 josteink

@josteink Do you have a full project I can look at somewhere?

dblock avatar Feb 24 '25 18:02 dblock

Nope. All corporate 🙂

josteink avatar Feb 24 '25 18:02 josteink

But like I’ve said elsewhere, this is not really a GmailJS related problem, but it’s a general web extension development thing.

I suggest you look up the regular places like ChatGPT, stack overflow, whatever and see if there are some standard solutions for this problem.

josteink avatar Feb 24 '25 20:02 josteink

Yes thanks, this is really for this boilerplate which is a chrome extension. I’ll contribute when I get it to work!

dblock avatar Feb 24 '25 20:02 dblock

I ended up using webpack in https://github.com/dblock/gmail-hide-read-categories/commit/8b229a618cf0fefdcce74cff22dabf372351ca05 copying from the output of https://github.com/dutiyesh/chrome-extension-cli.

I think this boilerplate should be turned into that, maybe I'll find some time to contribute.

dblock avatar Mar 01 '25 16:03 dblock