|
1
|
#!/usr/bin/env node |
|
2
|
|
|
3
|
const fs = require("fs"); |
|
4
|
const path = require("path"); |
|
5
|
|
|
6
|
const [packageName, version, operatingSystem, architecture] = process.argv.slice(2); |
|
7
|
|
|
8
|
if (!packageName || !version || !operatingSystem || !architecture) { |
|
9
|
throw new Error("Usage: render-platform-package.cjs <package-name> <version> <os> <arch>"); |
|
10
|
} |
|
11
|
|
|
12
|
const packageDirectory = path.resolve(__dirname, "..", packageName); |
|
13
|
|
|
14
|
fs.mkdirSync(packageDirectory, { recursive: true }); |
|
15
|
|
|
16
|
const packageJson = { |
|
17
|
name: `@getsigit/${packageName}`, |
|
18
|
version, |
|
19
|
description: "Platform binary for the si CLI.", |
|
20
|
license: "Apache-2.0", |
|
21
|
repository: { |
|
22
|
type: "git", |
|
23
|
url: "git+https://github.com/getsigit/si.git", |
|
24
|
}, |
|
25
|
keywords: [packageName, "si", "sigit", "cli", "binary"], |
|
26
|
os: [operatingSystem], |
|
27
|
cpu: [architecture], |
|
28
|
files: ["bin"], |
|
29
|
}; |
|
30
|
|
|
31
|
const readme = `# ${packageName} |
|
32
|
|
|
33
|
Not meant to be used directly. Please see [@getsigit/si](https://www.npmjs.com/package/@getsigit/si). |
|
34
|
`; |
|
35
|
|
|
36
|
fs.writeFileSync(path.join(packageDirectory, "package.json"), `${JSON.stringify(packageJson, null, 2)}\n`); |
|
37
|
fs.writeFileSync(path.join(packageDirectory, "README.md"), readme); |