Skip to content

Commit 4fbda5c

Browse files
committed
fix: correct version number in package.json and improve error handling in publish and update-security-md scripts
1 parent 9187b9c commit 4fbda5c

3 files changed

Lines changed: 24 additions & 16 deletions

File tree

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@m2d/table",
33
"author": "Mayank Kumar Chaudhari (https://mayank-chaudhari.vercel.app)",
44
"private": false,
5-
"version": "0.1.2",
5+
"version": "0.0.7",
66
"description": "Plugin to convert Markdown tables (MDAST) to DOCX with support for rich formatting and seamless integration into mdast2docx.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",

scripts/publish.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ if (isPatch) {
4343
);
4444
} catch {}
4545
} else {
46-
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
47-
/** Create new release branch for every Major or Minor release */
48-
execSync(`git checkout -b ${releaseBranch} && git push origin ${releaseBranch}`);
46+
try {
47+
require("./update-security-md")(`${newMajor}.${newMinor}`, `${oldMajor}.${oldMinor}`);
48+
/** Create new release branch for every Major or Minor release */
49+
execSync(`git checkout -b ${releaseBranch} && git push origin ${releaseBranch}`);
50+
} catch (err){
51+
console.error("Failed to create release branch", err);
52+
}
4953
}
5054

5155
const { visibility } = JSON.parse(execSync("gh repo view --json visibility").toString());
@@ -61,7 +65,7 @@ try {
6165
/** Create GitHub release */
6266
try {
6367
execSync(
64-
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' CHANGELOG.md)" --title "Release v${VERSION}"`,
68+
`gh release create ${VERSION} --generate-notes --latest -n "$(sed '1,/^## /d;/^## /,$d' lib/CHANGELOG.md)" --title "Release v${VERSION}"`,
6569
);
6670
} catch {
6771
execSync(`gh release create ${VERSION} --generate-notes --latest --title "Release v${VERSION}"`);

scripts/update-security-md.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
const { execSync } = require("child_process");
22

33
module.exports = (newMajor_minor, oldMajor_minor) => {
4-
/** Update SECURITY.md */
5-
execSync(
6-
`sed -i -e "s/.*| :white_check_mark:.*/| ${newMajor_minor}.x | :white_check_mark: |/" SECURITY.md`,
7-
);
8-
execSync(
9-
`sed -i -e "s/.*| :warning:.*/| ${oldMajor_minor}.x | :warning: |/" SECURITY.md`,
10-
);
11-
execSync(`sed -i -e "s/.*| :x:.*/| < ${oldMajor_minor} | :x: |/" SECURITY.md`);
12-
execSync(
13-
`git add SECURITY.md && git commit -m 'Update SECURITY.md [skip ci]' && git push origin ${process.env.BRANCH}`,
14-
);
4+
try {
5+
/** Update SECURITY.md */
6+
execSync(
7+
`sed -i -e "s/.*| :white_check_mark:.*/| ${newMajor_minor}.x | :white_check_mark: |/" SECURITY.md`,
8+
);
9+
execSync(
10+
`sed -i -e "s/.*| :warning:.*/| ${oldMajor_minor}.x | :warning: |/" SECURITY.md`,
11+
);
12+
execSync(`sed -i -e "s/.*| :x:.*/| < ${oldMajor_minor} | :x: |/" SECURITY.md`);
13+
execSync(
14+
`git add SECURITY.md && git commit -m 'Update SECURITY.md [skip ci]' && git push origin ${process.env.BRANCH}`,
15+
);
16+
} catch (error) {
17+
console.log("Error updating Security.md", error);
18+
}
1519
};

0 commit comments

Comments
 (0)