Skip to content

Commit 972875b

Browse files
committed
chore: remove linkcheck-bin which required postinstall scripts
1 parent 9a311b2 commit 972875b

8 files changed

Lines changed: 140 additions & 1152 deletions

File tree

docs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
!linkcheck-bin-3.0.0-1.fix-issue-56.tgz

docs/.vitepress/components/Prop.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default defineComponent({
175175
// - `(` (nongeneric method)
176176
// - ` {` (prop definition)
177177
// - `<eol>` (field definition, or prop where {get;set;} were omitted from the def)
178-
const result = / (\w+)(?:<|\(| \{|$)/.exec(this.def);
178+
const result = / ([\w.]+)(?:<|\(| \{|$)/.exec(this.def);
179179
this.idAttr = result ? this.idPrefix + "-" + result[1] : null;
180180
}
181181
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
github.com/intellitect/coalesce/edit
22
github.com/IntelliTect/Coalesce/blob/main
3-
github.com/IntelliTect/Coalesce/blob/1fb00c7de5e363aaf3c1a78f45af3b949b11dff4/src/coalesce-vue/test/utils.spec.ts#L5
3+
github.com/IntelliTect/Coalesce/blob/1fb00c7de5e363aaf3c1a78f45af3b949b11dff4/src/coalesce-vue/test/utils.spec.ts#L5
4+
www.npmjs.com/package/vue-facing-decorator
5+
www.kalzumeus.com

docs/check-links.mjs

Lines changed: 119 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,112 @@
11
import { createServer } from "http";
2+
import { chmod, mkdir, access, rm, writeFile } from "fs/promises";
3+
import { spawn } from "child_process";
4+
import path from "path";
25
import handler from "serve-handler";
36
import waitOn from "wait-on";
4-
import { spawn } from "child_process";
57

6-
function run(command, args, options = {}) {
8+
const LINKCHECK_VERSION = "3.0.0";
9+
10+
function getLinkcheckPlatformInfo() {
11+
const { platform, arch } = process;
12+
if (platform === "darwin" && ["x64", "arm64"].includes(arch))
13+
return {
14+
filename: `linkcheck-${LINKCHECK_VERSION}-macos-${arch}.tar.gz`,
15+
bin: "linkcheck/linkcheck",
16+
};
17+
if (platform === "win32" && arch === "x64")
18+
return {
19+
filename: `linkcheck-${LINKCHECK_VERSION}-windows-${arch}.zip`,
20+
bin: "linkcheck/linkcheck.bat",
21+
};
22+
if (platform === "linux" && ["x64", "arm64"].includes(arch))
23+
return {
24+
filename: `linkcheck-${LINKCHECK_VERSION}-linux-${arch}.tar.gz`,
25+
bin: "linkcheck/linkcheck",
26+
};
27+
throw new Error(`Unsupported platform: ${platform} ${arch}`);
28+
}
29+
30+
async function fileExists(filePath) {
31+
try {
32+
await access(filePath);
33+
return true;
34+
} catch {
35+
return false;
36+
}
37+
}
38+
39+
async function extractTarGz(buffer, destDir) {
40+
const tarball = path.join(destDir, "_archive.tar.gz");
41+
await writeFile(tarball, buffer);
42+
await runProcess("tar", ["xzf", tarball, "-C", destDir]);
43+
await rm(tarball);
44+
}
45+
46+
async function extractZip(buffer, destDir) {
47+
const zipPath = path.join(destDir, "_archive.zip");
48+
await writeFile(zipPath, buffer);
49+
// Use PowerShell on Windows to extract
50+
await runProcess("powershell", [
51+
"-NoProfile",
52+
"-Command",
53+
`Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force`,
54+
]);
55+
await rm(zipPath);
56+
}
57+
58+
async function downloadAndVerifyLinkcheck(destDir) {
59+
const info = getLinkcheckPlatformInfo();
60+
const binPath = path.join(destDir, info.bin);
61+
62+
if (await fileExists(binPath)) {
63+
console.log(`linkcheck already downloaded at ${binPath}`);
64+
return binPath;
65+
}
66+
67+
await mkdir(destDir, { recursive: true });
68+
69+
const releaseUrl = `https://github.com/filiph/linkcheck/releases/download/${LINKCHECK_VERSION}/${info.filename}`;
70+
71+
console.log(`Downloading linkcheck ${LINKCHECK_VERSION} from ${releaseUrl}`);
72+
73+
// Download the release
74+
const response = await fetch(releaseUrl);
75+
if (!response.ok)
76+
throw new Error(
77+
`Failed to download linkcheck: ${response.status} ${response.statusText}`,
78+
);
79+
const buffer = Buffer.from(await response.arrayBuffer());
80+
81+
// Extract
82+
if (info.filename.endsWith(".tar.gz")) {
83+
await extractTarGz(buffer, destDir);
84+
} else if (info.filename.endsWith(".zip")) {
85+
await extractZip(buffer, destDir);
86+
}
87+
88+
// Make executable on non-Windows
89+
if (process.platform !== "win32") {
90+
await chmod(binPath, 0o755);
91+
}
92+
93+
console.log(`linkcheck installed to ${binPath}`);
94+
return binPath;
95+
}
96+
97+
function runProcess(command, args, options = {}) {
798
return new Promise((resolve, reject) => {
8-
const proc = spawn(command, args, {
9-
shell: true,
10-
stdio: "inherit",
11-
...options,
12-
});
99+
// On Windows, .bat files need cmd.exe /c to avoid shell:true deprecation
100+
const proc =
101+
process.platform === "win32" && command.endsWith(".bat")
102+
? spawn("cmd.exe", ["/c", command, ...args], {
103+
stdio: "inherit",
104+
...options,
105+
})
106+
: spawn(command, args, {
107+
stdio: "inherit",
108+
...options,
109+
});
13110
proc.on("close", (code) => {
14111
code === 0
15112
? resolve()
@@ -18,9 +115,18 @@ function run(command, args, options = {}) {
18115
});
19116
}
20117

118+
const vendorDir = path.join(
119+
path.dirname(new URL(import.meta.url).pathname.replace(/^\/(\w:)/, "$1")),
120+
"node_modules",
121+
`.linkcheck-${LINKCHECK_VERSION}`,
122+
);
123+
21124
let server;
22125

23126
try {
127+
// Download linkcheck binary if needed
128+
const linkcheckBin = await downloadAndVerifyLinkcheck(vendorDir);
129+
24130
// Start static file server
25131
server = createServer((req, res) =>
26132
handler(req, res, { public: ".vitepress/dist" }),
@@ -41,7 +147,12 @@ try {
41147
console.log(`Running linkcheck with skip file: ${skipFile} (CI: ${isCI})`);
42148

43149
// Run linkcheck
44-
await run("linkcheck", ["localhost:8087", "-e", "--skip-file", skipFile]);
150+
await runProcess(linkcheckBin, [
151+
"localhost:8087",
152+
"-e",
153+
"--skip-file",
154+
skipFile,
155+
]);
45156

46157
process.exit(0);
47158
} catch (err) {

docs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
},
1818
"devDependencies": {
1919
"gray-matter": "^4.0.3",
20-
"linkcheck-bin": "3.0.0-2",
2120
"serve-handler": "^6.1.6",
2221
"vitepress": "2.0.0-alpha.12",
2322
"wait-on": "^8.0.4"

docs/topics/audit-logging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public class OperationContext : DefaultAuditOperationContext<AuditLog>
8484

8585
When you're inheriting from `DefaultAuditLog` for your `IAuditLog` implementation, you'll want to similarly inherit from `DefaultAuditOperationContext<>` for your operation context. It will take care of populating the HTTP request tracking fields on the `AuditLog` record. If you want a totally custom implementation, you only need to implement the `IAuditOperationContext<TAuditLog>` interface.
8686

87-
The operation context class passed to `WithAugmentation` will be injected from the application service provider if available; otherwise, a new instance will be constructed using dependencies from the application service provider. To make an injected dependency optional, make the constructor parameter nullable with a default value of `null`, or create [alternate constructors](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection#multiple-constructor-discovery-rules).
87+
The operation context class passed to `WithAugmentation` will be injected from the application service provider if available; otherwise, a new instance will be constructed using dependencies from the application service provider. To make an injected dependency optional, make the constructor parameter nullable with a default value of `null`, or create [alternate constructors](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection/overview#constructor-selection-rules).
8888

8989
### 4. Add the UI
9090

docs/topics/template-features.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Azure OpenAI can be configured in two ways: through .NET Aspire (recommended) or
6161

6262
#### Using .NET Aspire (Recommended)
6363

64-
When launching with the Aspire AppHost, Azure OpenAI will configure and provision cloud resources automatically with [Aspire's local provisioning](https://learn.microsoft.com/en-us/dotnet/aspire/azure/local-provisioning#configuration). Configure the required Azure settings in your AppHost project's `appsettings.json`, `appsettings.localhost.json`, or `dotnet user-secrets`:
64+
When launching with the Aspire AppHost, Azure OpenAI will configure and provision cloud resources automatically with [Aspire's local provisioning](https://aspire.dev/integrations/cloud/azure/local-provisioning/#configuration). Configure the required Azure settings in your AppHost project's `appsettings.json`, `appsettings.localhost.json`, or `dotnet user-secrets`:
6565

6666
```json
6767
{
@@ -74,9 +74,9 @@ When launching with the Aspire AppHost, Azure OpenAI will configure and provisio
7474
}
7575
```
7676

77-
If there's an existing resource you'd rather use instead of provisioning a new resource, see the documentation for [Connecting to an existing Azure OpenAI service](https://learn.microsoft.com/en-us/dotnet/aspire/azureai/azureai-openai-integration?tabs=package-reference#connect-to-an-existing-azure-openai-service).
77+
If there's an existing resource you'd rather use instead of provisioning a new resource, see the documentation for [Connecting to an existing Azure OpenAI service](https://aspire.dev/integrations/cloud/azure/azure-openai/azure-openai-get-started/).
7878

79-
For more details on Aspire's Azure OpenAI integration, see the [official documentation](https://learn.microsoft.com/en-us/dotnet/aspire/azureai/azureai-openai-integration).
79+
For more details on Aspire's Azure OpenAI integration, see the [official documentation](https://aspire.dev/integrations/cloud/azure/azure-openai/azure-openai-get-started/).
8080

8181
#### Manual Configuration (Without Aspire)
8282

0 commit comments

Comments
 (0)