-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_updateMod.ts
40 lines (35 loc) · 1.01 KB
/
_updateMod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const readmeContentOriginal = Deno.readTextFileSync("README.md");
const jsonStr = Deno.readTextFileSync("deno.jsonc");
const jsonConf = JSON.parse(jsonStr) as { version: string };
let readmeContent = readmeContentOriginal.replaceAll(
/https:\/\/deno.land\/x\/logger@v[\d.]+\/logger.ts/g,
`https://deno.land/x/logger@v${jsonConf.version}/logger.ts`,
).replaceAll(
/version: "[\d.]+"/g,
`version: "${jsonConf.version}"`,
);
// update current version in readme
if (readmeContent !== readmeContentOriginal) {
Deno.writeTextFileSync("README.md", readmeContent);
}
readmeContent = readmeContent.replaceAll(
/https:\/\/deno.land\/x\/logger@v[\d.]+\/logger.ts/g,
`jsr:@deno-library/logger@${jsonConf.version}`,
);
// Write the updated content back to the mod.ts file
Deno.writeTextFileSync(
"mod.ts",
`/**
* ${readmeContent}
* @module
*/
/**
* The Logger class
*/
export { default as Logger } from "./logger.ts";
/**
* The Logger class default instance
*/
export { default as default } from "./logger.ts";
`,
);