Skip to content

Commit 9ffde1c

Browse files
Ah, yes, ofc
1 parent 7d4cea0 commit 9ffde1c

2 files changed

Lines changed: 45 additions & 45 deletions

File tree

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,104 @@
1-
import { existsSync, readdirSync, readFileSync } from 'node:fs'
2-
import { join } from 'node:path'
3-
import { spawnSync } from 'node:child_process'
1+
import { existsSync, readdirSync, readFileSync } from "node:fs";
2+
import { join } from "node:path";
3+
import { spawnSync } from "node:child_process";
44

55
if (!process.env.NPM_TOKEN) {
6-
console.error('NPM_TOKEN is required for first package releases.')
7-
process.exit(1)
6+
console.error("NPM_TOKEN is required for first package releases.");
7+
process.exit(1);
88
}
99

10-
const root = JSON.parse(readFileSync('package.json', 'utf8'))
10+
const root = JSON.parse(readFileSync("package.json", "utf8"));
1111
const workspaces = Array.isArray(root.workspaces)
1212
? root.workspaces
13-
: (root.workspaces?.packages ?? [])
13+
: (root.workspaces?.packages ?? []);
1414

15-
const packages = []
15+
const packages = [];
1616

1717
for (const workspace of workspaces) {
18-
if (workspace !== '*/') {
19-
continue
18+
if (workspace !== "*/") {
19+
continue;
2020
}
2121

22-
for (const entry of readdirSync('.', { withFileTypes: true })) {
23-
if (!entry.isDirectory() || entry.name.startsWith('.')) {
24-
continue
22+
for (const entry of readdirSync(".", { withFileTypes: true })) {
23+
if (!entry.isDirectory() || entry.name.startsWith(".")) {
24+
continue;
2525
}
2626

2727
try {
2828
const manifest = JSON.parse(
29-
readFileSync(join(entry.name, 'package.json'), 'utf8'),
30-
)
29+
readFileSync(join(entry.name, "package.json"), "utf8"),
30+
);
3131
if (!manifest.private && manifest.name && manifest.version) {
3232
packages.push({
3333
dir: entry.name,
3434
name: manifest.name,
3535
version: manifest.version,
36-
})
36+
});
3737
}
3838
} catch {
3939
// Not a workspace package.
4040
}
4141
}
4242
}
4343

44-
const missingPackages = []
44+
const missingPackages = [];
4545

4646
for (const pkg of packages) {
47-
const result = spawnSync('npm', ['view', pkg.name, 'version'], {
48-
encoding: 'utf8',
49-
})
47+
const result = spawnSync("npm", ["view", pkg.name, "version"], {
48+
encoding: "utf8",
49+
});
5050

5151
if (result.status === 0) {
52-
continue
52+
continue;
5353
}
5454

55-
const error = `${result.stderr}\n${result.stdout}`
55+
const error = `${result.stderr}\n${result.stdout}`;
5656
if (/E404|404 Not Found/.test(error)) {
57-
console.log(`${pkg.name} is not published yet.`)
58-
missingPackages.push(pkg)
59-
continue
57+
console.log(`${pkg.name} is not published yet.`);
58+
missingPackages.push(pkg);
59+
continue;
6060
}
6161

62-
process.stderr.write(error)
63-
process.exit(result.status ?? 1)
62+
process.stderr.write(error);
63+
process.exit(result.status ?? 1);
6464
}
6565

6666
if (missingPackages.length === 0) {
67-
console.error('No unpublished public workspace packages found.')
68-
process.exit(1)
67+
console.error("No unpublished public workspace packages found.");
68+
process.exit(1);
6969
}
7070

7171
for (const pkg of missingPackages) {
72-
const changelogPath = join(pkg.dir, 'CHANGELOG.md')
72+
const changelogPath = join(pkg.dir, "CHANGELOG.md");
7373
if (!existsSync(changelogPath)) {
7474
console.error(
7575
`${pkg.name} is missing CHANGELOG.md. Create the first version changelog before publishing so changesets/action can create the GitHub Release.`,
76-
)
77-
process.exit(1)
76+
);
77+
process.exit(1);
7878
}
7979

80-
const changelog = readFileSync(changelogPath, 'utf8')
81-
const versionHeading = new RegExp(`^#{1,6}\\s+${pkg.version}\\s*$`, 'm')
80+
const changelog = readFileSync(changelogPath, "utf8");
81+
const versionHeading = new RegExp(`^#{1,6}\\s+${pkg.version}\\s*$`, "m");
8282
if (!versionHeading.test(changelog)) {
8383
console.error(
8484
`${pkg.name} CHANGELOG.md is missing a ${pkg.version} entry. Create the first version changelog before publishing so changesets/action can create the GitHub Release.`,
85-
)
86-
process.exit(1)
85+
);
86+
process.exit(1);
8787
}
8888
}
8989

9090
for (const pkg of missingPackages) {
91-
const result = spawnSync('npm', ['publish', pkg.dir, '--provenance'], {
92-
encoding: 'utf8',
93-
stdio: ['inherit', 'pipe', 'pipe'],
94-
})
91+
const result = spawnSync("npm", ["publish", pkg.dir, "--provenance"], {
92+
encoding: "utf8",
93+
stdio: ["inherit", "pipe", "pipe"],
94+
});
9595

96-
process.stdout.write(result.stdout)
97-
process.stderr.write(result.stderr)
96+
process.stdout.write(result.stdout);
97+
process.stderr.write(result.stderr);
9898

9999
if (result.status !== 0) {
100-
process.exit(result.status ?? 1)
100+
process.exit(result.status ?? 1);
101101
}
102102

103-
console.log(`New tag: ${pkg.name}@${pkg.version}`)
103+
console.log(`New tag: ${pkg.name}@${pkg.version}`);
104104
}

msw-atproto/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ First release, yay!
77
As said in the README: `@fujocoded/msw-atproto` uses the power of
88
[MSW](https://mswjs.io/) to give you(r tests) fake, <u>stateful</u> ATproto
99
accounts that respond to HTTP requests exactly like real PDSes on the real
10-
network would!
10+
network would!

0 commit comments

Comments
 (0)