Skip to content

Commit 9ac06bd

Browse files
author
Ajit Kumar
committed
chore(rename pack-zip.js file)
1 parent 32b92b1 commit 9ac06bd

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

esbuild.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const isServe = process.argv.includes("--serve");
55

66
// Function to pack the ZIP file
77
function packZip() {
8-
exec("node .vscode/pack-zip.js", (err, stdout, stderr) => {
8+
exec("node ./pack-zip.js", (err, stdout, stderr) => {
99
if (err) {
1010
console.error("Error packing zip:", err);
1111
return;
Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ const path = require('path');
22
const fs = require('fs');
33
const jszip = require('jszip');
44

5-
const iconFile = path.join(__dirname, '../icon.png');
6-
const pluginJSON = path.join(__dirname, '../plugin.json');
7-
const distFolder = path.join(__dirname, '../dist');
5+
const iconFile = path.join(__dirname, 'icon.png');
6+
const pluginJSON = path.join(__dirname, 'plugin.json');
7+
const distFolder = path.join(__dirname, 'dist');
88
const json = JSON.parse(fs.readFileSync(pluginJSON, 'utf8'));
99
let readmeDotMd;
1010
let changelogDotMd;
1111

1212
if (!json.readme) {
13-
readmeDotMd = path.join(__dirname, '../readme.md');
13+
readmeDotMd = path.join(__dirname, 'readme.md');
1414
if (!fs.existsSync(readmeDotMd)) {
15-
readmeDotMd = path.join(__dirname, '../README.md');
15+
readmeDotMd = path.join(__dirname, 'README.md');
1616
}
1717
}
1818

1919

2020
if (!json.changelogs) {
2121
if (!fs.existsSync(changelogDotMd)) {
22-
changelogDotMd = path.join(__dirname, '../CHANGELOG.md');
22+
changelogDotMd = path.join(__dirname, 'CHANGELOG.md');
2323
}
2424

2525
if (!fs.existsSync(changelogDotMd)) {
26-
changelogDotMd = path.join(__dirname, '../changelog.md');
26+
changelogDotMd = path.join(__dirname, 'changelog.md');
2727
}
2828
}
2929

@@ -33,14 +33,19 @@ const zip = new jszip();
3333

3434
zip.file('icon.png', fs.readFileSync(iconFile));
3535
zip.file('plugin.json', fs.readFileSync(pluginJSON));
36-
zip.file('readme.md', fs.readFileSync(readmeDotMd));
37-
zip.file('changelogs.md', fs.readFileSync(changelogDotMd));
36+
37+
if (readmeDotMd) {
38+
zip.file("readme.md", fs.readFileSync(readmeDotMd));
39+
}
40+
if (changelogDotMd) {
41+
zip.file("changelog.md", fs.readFileSync(changelogDotMd));
42+
}
3843

3944
loadFile('', distFolder);
4045

4146
zip
4247
.generateNodeStream({ type: 'nodebuffer', streamFiles: true })
43-
.pipe(fs.createWriteStream(path.join(__dirname, '../plugin.zip')))
48+
.pipe(fs.createWriteStream(path.join(__dirname, 'plugin.zip')))
4449
.on('finish', () => {
4550
console.log('Plugin plugin.zip written.');
4651
});

plugin.zip

-2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)