Skip to content

Commit 39dcf5e

Browse files
committed
Copy over changes to scripts/ from v3.0.0 branch of original repo
1 parent 7b8b0a8 commit 39dcf5e

7 files changed

Lines changed: 65 additions & 6 deletions

File tree

scripts/changelog-beta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
* LICENSE file in the root directory of this source tree.
77
* ========================================================================== */
88

9-
import pkg from "../lerna.json";
109
import { getOutput } from "./utils/get-output";
1110
import { printBanner, printSpacer } from "./utils/print-utils";
11+
import pkg from "../lerna.json";
1212

1313
const ORG = "PaloAltoNetworks";
1414
const REPO = "docusaurus-openapi-docs";
15-
const BRANCH = "v2.0.0";
15+
const BRANCH = "v3.0.0";
1616

1717
const COMMIT_FILTERS = [/\(release\) v.*/];
1818

scripts/changelog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* LICENSE file in the root directory of this source tree.
77
* ========================================================================== */
88

9-
import pkg from "../lerna.json";
109
import { getOutput } from "./utils/get-output";
1110
import { printBanner, printSpacer } from "./utils/print-utils";
11+
import pkg from "../lerna.json";
1212

1313
const ORG = "PaloAltoNetworks";
1414
const REPO = "docusaurus-openapi-docs";

scripts/check-pr-title.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* LICENSE file in the root directory of this source tree.
77
* ========================================================================== */
88

9-
import { version } from "../lerna.json";
109
import { getOutput } from "./utils/get-output";
10+
import { version } from "../lerna.json";
1111

1212
// Makes the script crash on unhandled rejections instead of silently
1313
// ignoring them. In the future, promise rejections that are not handled will

scripts/copyUntypedFiles.mjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* ============================================================================
2+
* Copyright (c) Palo Alto Networks
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
* ========================================================================== */
7+
8+
import fs from "fs-extra";
9+
import path from "path";
10+
import chokidar from "chokidar";
11+
12+
const srcDir = path.join(process.cwd(), "src");
13+
const libDir = path.join(process.cwd(), "lib");
14+
15+
const ignoredPattern = /(?:__tests__|\.tsx?$)/;
16+
17+
async function copy() {
18+
await fs.copy(srcDir, libDir, {
19+
filter(testedPath) {
20+
return !ignoredPattern.test(testedPath);
21+
},
22+
});
23+
}
24+
25+
if (process.argv.includes("--watch")) {
26+
const watcher = chokidar.watch(srcDir, {
27+
ignored: ignoredPattern,
28+
ignoreInitial: true,
29+
persistent: true,
30+
});
31+
["add", "change", "unlink", "addDir", "unlinkDir"].forEach((event) =>
32+
watcher.on(event, copy)
33+
);
34+
} else {
35+
await copy();
36+
}

scripts/publish-beta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { execSync } from "child_process";
1010
import fs from "fs";
1111
import path from "path";
1212

13-
import { version } from "../lerna.json";
1413
import { createDryRun } from "./utils/dry-run";
1514
import { getOutput } from "./utils/get-output";
1615
import { printBanner } from "./utils/print-utils";
16+
import { version } from "../lerna.json";
1717

1818
const ORG = "PaloAltoNetworks";
1919
const REPO = "docusaurus-openapi-docs";

scripts/publish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { execSync } from "child_process";
1010
import fs from "fs";
1111
import path from "path";
1212

13-
import { version } from "../lerna.json";
1413
import { createDryRun } from "./utils/dry-run";
1514
import { getOutput } from "./utils/get-output";
1615
import { printBanner } from "./utils/print-utils";
16+
import { version } from "../lerna.json";
1717

1818
const ORG = "PaloAltoNetworks";
1919
const REPO = "docusaurus-openapi-docs";

scripts/version.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,28 @@ function generateVersion(
2929
| "prepatch"
3030
| "prerelease"
3131
| "graduate"
32+
| "betamajor"
33+
| "betapatch"
3234
) {
35+
if (bump === "betamajor") {
36+
const v = semver.parse(pkg.version);
37+
if (v === null) {
38+
console.error("Error: Invalid package version.");
39+
process.exit(1);
40+
}
41+
return `${v.major + 1}.0.0-beta.0`;
42+
}
43+
44+
if (bump === "betapatch") {
45+
const v = semver.parse(pkg.version);
46+
if (v === null) {
47+
console.error("Error: Invalid package version.");
48+
process.exit(1);
49+
}
50+
const patch = (v.prerelease[1] as number) + 1;
51+
return `${v.major}.0.0-beta.${patch}`;
52+
}
53+
3354
if (bump === "graduate") {
3455
const v = semver.parse(pkg.version);
3556
if (v === null) {
@@ -60,6 +81,8 @@ function main() {
6081
case "prepatch":
6182
case "prerelease":
6283
case "graduate":
84+
case "betamajor":
85+
case "betapatch":
6386
nextVersion = generateVersion(bump);
6487
break;
6588
default:

0 commit comments

Comments
 (0)