MCPcopy
hub / github.com/philc/vimium / buildStorePackage

Function buildStorePackage

make.js:114–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112
113// Builds a zip file for submission to the Chrome and Firefox stores. The output is in dist/.
114async function buildStorePackage() {
115 await checkForBuildIssues();
116
117 const excludeList = [
118 "*.md",
119 ".*",
120 "CREDITS",
121 "MIT-LICENSE.txt",
122 "build_scripts",
123 "dist",
124 "make.js",
125 "deno.json",
126 "deno.lock",
127 // These reload scripts are used for development only and shouldn't appear in the build.
128 "reload.html",
129 "reload.js",
130 "test_harnesses",
131 "tests",
132 ];
133
134 const chromeManifest = await parseManifestFile();
135 const rsyncOptions = ["-r", ".", "dist/vimium"].concat(
136 ...excludeList.map((item) => ["--exclude", item]),
137 );
138 const version = chromeManifest["version"];
139 const writeDistManifest = async (manifest) => {
140 await Deno.writeTextFile("dist/vimium/manifest.json", JSON.stringify(manifest, null, 2));
141 };
142 // cd into "dist/vimium" before building the zip, so that the files in the zip don't each have the
143 // path prefix "dist/vimium".
144 // --filesync ensures that files in the archive which are no longer on disk are deleted. It's
145 // equivalent to removing the zip file before the build.
146 const zipCommand = "cd dist/vimium && zip -r --filesync ";
147
148 await shell("rm", ["-rf", "dist/vimium"]);
149 await shell("mkdir", [
150 "-p",
151 "dist/vimium",
152 "dist/chrome-canary",
153 "dist/chrome-store",
154 "dist/firefox",
155 ]);
156 await shell("rsync", rsyncOptions);
157
158 // Build the Firefox / Mozilla Addons store package.
159 const firefoxManifest = createFirefoxManifest(chromeManifest);
160 await writeDistManifest(firefoxManifest);
161 // Exclude PNG icons from the Firefox build, because we use the SVG directly.
162 await shell("bash", [
163 "-c",
164 `${zipCommand} ../firefox/vimium-firefox-${version}.zip . -x icons/*.png`,
165 ]);
166
167 // Build the Chrome Store package.
168 await writeDistManifest(chromeManifest);
169 await shell("bash", [
170 "-c",
171 `${zipCommand} ../chrome-store/vimium-chrome-store-${version}.zip .`,

Callers 1

make.jsFile · 0.85

Calls 5

checkForBuildIssuesFunction · 0.85
parseManifestFileFunction · 0.85
shellFunction · 0.85
createFirefoxManifestFunction · 0.85
writeDistManifestFunction · 0.85

Tested by

no test coverage detected