Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 820897d

Browse files
committed
chore: Do not use semis
1 parent ae0403f commit 820897d

File tree

3 files changed

+48
-46
lines changed

3 files changed

+48
-46
lines changed

.prettierrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"printWidth": 80,
3+
"semi": false,
4+
35
"overrides": [
46
{
57
"files": ["*.md"],

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"scripts": {
3-
"fmt": "prettier --check '**/*.{json,md,yaml,yml}'",
4-
"fmt:fix": "prettier --write '**/*.{json,md,yaml,yml}'",
3+
"fmt": "prettier --check '**/*.{json,md,ts,yaml,yml}'",
4+
"fmt:fix": "prettier --write '**/*.{json,md,ts,yaml,yml}'",
55
"lint": "markdownlint '**/*.md'",
66
"lint:fix": "markdownlint --fix '**/*.md'"
77
},
@@ -25,7 +25,7 @@
2525
}
2626
},
2727
"lint-staged": {
28-
"*.{json,yaml,yml}": "prettier --write",
28+
"*.{json,ts,yaml,yml}": "prettier --write",
2929
"*.md": [
3030
"markdownlint --fix",
3131
"prettier --write"

scripts/add_clog_to_manifest.ts

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,94 +3,94 @@
33
* @description Adds a changelog entry to manifest.json
44
* @example add_clog_to_manifest.ts --version=1.18.3
55
*/
6-
import { writeFileSync } from "fs";
7-
import parseArgs from "minimist";
8-
import { resolve } from "path";
9-
import semverCompare from "semver-compare";
10-
import manifestJSON from "../manifest.json";
6+
import { writeFileSync } from "fs"
7+
import parseArgs from "minimist"
8+
import { resolve } from "path"
9+
import semverCompare from "semver-compare"
10+
import manifestJSON from "../manifest.json"
1111

1212
/**
1313
* Prints information for how to use this program and exits with status code 1
1414
*/
1515
const usage = () => {
16-
console.log("Usage: append_manifest.ts [--version=<version>]");
17-
console.log("Update manifest.json with a changelog");
18-
console.log("Arguments:");
19-
console.log(" <version>: A version string 'x.y.z'");
20-
process.exit(1);
21-
};
16+
console.log("Usage: append_manifest.ts [--version=<version>]")
17+
console.log("Update manifest.json with a changelog")
18+
console.log("Arguments:")
19+
console.log(" <version>: A version string 'x.y.z'")
20+
process.exit(1)
21+
}
2222

2323
interface Arguments {
2424
/** A version string in the form of x.y.z. */
25-
version?: string;
25+
version?: string
2626
}
2727

2828
/**
2929
* Parses arguments
3030
*/
3131
const init = (): Arguments => {
32-
const args = parseArgs(process.argv.slice(2));
33-
const result: Arguments = {};
32+
const args = parseArgs(process.argv.slice(2))
33+
const result: Arguments = {}
3434
if (args.version && typeof args.version === "string") {
35-
result.version = args.version;
35+
result.version = args.version
3636
}
37-
return result;
38-
};
37+
return result
38+
}
3939

4040
/**
4141
* Appends manifest.json with a changelog entry using the provided version
4242
*/
4343
const appendClogManifest = (version: string): void => {
4444
const clogIdx = manifestJSON.routes.findIndex(
4545
(route) => route.path === "./changelog/index.md"
46-
);
46+
)
4747

4848
if (clogIdx < 0) {
49-
console.error("failed to parse manifest.json");
50-
process.exit(1);
49+
console.error("failed to parse manifest.json")
50+
process.exit(1)
5151
}
5252

53-
(manifestJSON.routes[clogIdx].children as { path: string }[]).unshift({
53+
;(manifestJSON.routes[clogIdx].children as { path: string }[]).unshift({
5454
path: `./changelog/${version}.md`,
55-
});
55+
})
5656

5757
// Capture the semver version from /(1.2.3).md
58-
const filenameRegex = /\/([0-9\.]+)\.md$/gi;
58+
const filenameRegex = /\/([0-9\.]+)\.md$/gi
5959

6060
manifestJSON.routes[clogIdx].children.sort((a, b) => {
61-
const versionA = a.path.match(filenameRegex);
62-
const versionB = b.path.match(filenameRegex);
61+
const versionA = a.path.match(filenameRegex)
62+
const versionB = b.path.match(filenameRegex)
6363
if (
6464
versionA === null ||
6565
versionA.length !== 1 ||
6666
versionB === null ||
6767
versionB.length !== 1
6868
) {
69-
console.error("failed to parse manifest.json");
70-
process.exit(1);
69+
console.error("failed to parse manifest.json")
70+
process.exit(1)
7171
}
72-
return -semverCompare(versionA[0], versionB[0]);
73-
});
72+
return -semverCompare(versionA[0], versionB[0])
73+
})
7474

75-
console.log("appending manifest.json with clog version: ", version);
76-
const serializedJSON = JSON.stringify(manifestJSON, null, 2);
77-
const manifestPath = resolve(__dirname, "../", "manifest.json");
78-
writeFileSync(manifestPath, serializedJSON, "utf8");
79-
};
75+
console.log("appending manifest.json with clog version: ", version)
76+
const serializedJSON = JSON.stringify(manifestJSON, null, 2)
77+
const manifestPath = resolve(__dirname, "../", "manifest.json")
78+
writeFileSync(manifestPath, serializedJSON, "utf8")
79+
}
8080

8181
/**
8282
* Main program
8383
*/
8484
const main = () => {
85-
const args = init();
85+
const args = init()
8686
if (!args.version) {
87-
console.error("version is a required argument");
88-
return usage();
87+
console.error("version is a required argument")
88+
return usage()
8989
}
90-
appendClogManifest(args.version);
91-
console.log("Done");
92-
console.info("tip: run yarn fmt:fix to prettify manifest.json");
93-
process.exit(0);
94-
};
90+
appendClogManifest(args.version)
91+
console.log("Done")
92+
console.info("tip: run yarn fmt:fix to prettify manifest.json")
93+
process.exit(0)
94+
}
9595

96-
main();
96+
main()

0 commit comments

Comments
 (0)