@atlas-cmdb/extension-sdk 0.0.0-stage → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +331 -2
- package/atlas-extension.schema.json +573 -0
- package/atlas-index.schema.json +173 -0
- package/dist/build.d.ts +27 -0
- package/dist/build.js +114 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +215 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +120 -0
- package/dist/client.js +144 -0
- package/dist/client.js.map +1 -0
- package/dist/dev.d.ts +11 -0
- package/dist/dev.js +23 -0
- package/dist/dev.js.map +1 -0
- package/dist/index-schema.d.ts +1 -0
- package/dist/index-schema.js +10 -0
- package/dist/index-schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +216 -0
- package/dist/manifest.js +380 -0
- package/dist/manifest.js.map +1 -0
- package/dist/package.d.ts +34 -0
- package/dist/package.js +107 -0
- package/dist/package.js.map +1 -0
- package/dist/registry.d.ts +124 -0
- package/dist/registry.js +158 -0
- package/dist/registry.js.map +1 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +10 -0
- package/dist/schema.js.map +1 -0
- package/dist/server.d.ts +152 -0
- package/dist/server.js +254 -0
- package/dist/server.js.map +1 -0
- package/package.json +49 -5
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://registry.atlas-cmdb.com/schema/atlas-index.schema.json",
|
|
3
|
+
"title": "Atlas extension registry index",
|
|
4
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"format": {
|
|
8
|
+
"type": "number",
|
|
9
|
+
"const": 1
|
|
10
|
+
},
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
14
|
+
},
|
|
15
|
+
"serial": {
|
|
16
|
+
"type": "integer",
|
|
17
|
+
"minimum": 0,
|
|
18
|
+
"maximum": 9007199254740991
|
|
19
|
+
},
|
|
20
|
+
"generated_at": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"expires_at": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
},
|
|
26
|
+
"publishers": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"propertyNames": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"name": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"keys": {
|
|
39
|
+
"maxItems": 10,
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"keys"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"packages": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"propertyNames": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"name": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1,
|
|
63
|
+
"maxLength": 80
|
|
64
|
+
},
|
|
65
|
+
"description": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"maxLength": 500
|
|
68
|
+
},
|
|
69
|
+
"publisher": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
72
|
+
},
|
|
73
|
+
"homepage": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"format": "uri"
|
|
76
|
+
},
|
|
77
|
+
"icon": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"maxLength": 64
|
|
80
|
+
},
|
|
81
|
+
"versions": {
|
|
82
|
+
"minItems": 1,
|
|
83
|
+
"maxItems": 200,
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"properties": {
|
|
88
|
+
"version": {
|
|
89
|
+
"type": "string"
|
|
90
|
+
},
|
|
91
|
+
"atlasApi": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1,
|
|
94
|
+
"maxLength": 40
|
|
95
|
+
},
|
|
96
|
+
"url": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"format": "uri"
|
|
99
|
+
},
|
|
100
|
+
"sha256": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
103
|
+
},
|
|
104
|
+
"size": {
|
|
105
|
+
"type": "integer",
|
|
106
|
+
"exclusiveMinimum": 0,
|
|
107
|
+
"maximum": 9007199254740991
|
|
108
|
+
},
|
|
109
|
+
"digest": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"pattern": "^[a-f0-9]{64}$"
|
|
112
|
+
},
|
|
113
|
+
"scopes": {
|
|
114
|
+
"default": [],
|
|
115
|
+
"maxItems": 50,
|
|
116
|
+
"type": "array",
|
|
117
|
+
"items": {
|
|
118
|
+
"type": "string"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"image": {
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
"lifecycle": {
|
|
125
|
+
"maxItems": 3,
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "string"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"isolation": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"enum": [
|
|
134
|
+
"shared",
|
|
135
|
+
"per-organization"
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"published_at": {
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"yanked": {
|
|
142
|
+
"type": "boolean"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"required": [
|
|
146
|
+
"version",
|
|
147
|
+
"atlasApi",
|
|
148
|
+
"url",
|
|
149
|
+
"sha256",
|
|
150
|
+
"size",
|
|
151
|
+
"digest"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"required": [
|
|
157
|
+
"name",
|
|
158
|
+
"publisher",
|
|
159
|
+
"versions"
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"required": [
|
|
165
|
+
"format",
|
|
166
|
+
"name",
|
|
167
|
+
"serial",
|
|
168
|
+
"generated_at",
|
|
169
|
+
"expires_at",
|
|
170
|
+
"publishers",
|
|
171
|
+
"packages"
|
|
172
|
+
]
|
|
173
|
+
}
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ExtensionManifest } from './manifest.js';
|
|
2
|
+
/**
|
|
3
|
+
* `atlas-ext build`: bundle the UI as custom elements, collect assets, validate the manifest
|
|
4
|
+
* and write `<id>-<version>.atlasx` (optionally signed).
|
|
5
|
+
*
|
|
6
|
+
* Project layout:
|
|
7
|
+
* atlas-extension.json
|
|
8
|
+
* ui/index.ts|js entry that imports the elements (Svelte files compile as custom elements)
|
|
9
|
+
* assets/** icons, images
|
|
10
|
+
*/
|
|
11
|
+
export type BuildOptions = {
|
|
12
|
+
root: string;
|
|
13
|
+
/** pinned image (`registry/name@sha256:…`), overrides `image` in the manifest */
|
|
14
|
+
image?: string;
|
|
15
|
+
/** ed25519 private key (PKCS8 PEM) to sign with */
|
|
16
|
+
privateKeyPem?: string;
|
|
17
|
+
/** skip the UI bundle (tests, UI-less packages) */
|
|
18
|
+
skipUi?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type BuildResult = {
|
|
21
|
+
manifest: ExtensionManifest;
|
|
22
|
+
archive: Buffer;
|
|
23
|
+
fileName: string;
|
|
24
|
+
files: string[];
|
|
25
|
+
};
|
|
26
|
+
export declare function readManifest(root: string, image?: string): ExtensionManifest;
|
|
27
|
+
export declare function buildPackage(options: BuildOptions): Promise<BuildResult>;
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { checkManifest } from './manifest.js';
|
|
6
|
+
import { MANIFEST_FILE, packFiles, SIGNATURE_FILE, signFiles } from './package.js';
|
|
7
|
+
function walk(dir) {
|
|
8
|
+
if (!existsSync(dir))
|
|
9
|
+
return [];
|
|
10
|
+
return readdirSync(dir).flatMap((name) => {
|
|
11
|
+
const path = join(dir, name);
|
|
12
|
+
return statSync(path).isDirectory() ? walk(path) : [path];
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const toPosix = (path) => path.split(sep).join('/');
|
|
16
|
+
export function readManifest(root, image) {
|
|
17
|
+
const raw = JSON.parse(readFileSync(join(root, MANIFEST_FILE), 'utf8'));
|
|
18
|
+
if (image)
|
|
19
|
+
raw.image = image;
|
|
20
|
+
const checked = checkManifest(raw);
|
|
21
|
+
if (!checked.ok)
|
|
22
|
+
throw new Error(`Invalid ${MANIFEST_FILE}:\n ${checked.errors.join('\n ')}`);
|
|
23
|
+
return checked.manifest;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Import a build tool from the extension project, not from wherever the SDK is installed
|
|
27
|
+
* (a linked SDK has its own node_modules; two Vite copies do not mix).
|
|
28
|
+
*/
|
|
29
|
+
async function importFromProject(root, name) {
|
|
30
|
+
for (let dir = resolve(root);; dir = dirname(dir)) {
|
|
31
|
+
const candidate = join(dir, 'node_modules', name);
|
|
32
|
+
if (existsSync(join(candidate, 'package.json'))) {
|
|
33
|
+
const pkg = JSON.parse(readFileSync(join(candidate, 'package.json'), 'utf8'));
|
|
34
|
+
const pick = (entry) => typeof entry === 'string'
|
|
35
|
+
? entry
|
|
36
|
+
: entry && typeof entry === 'object'
|
|
37
|
+
? pick(entry.import ?? entry.default)
|
|
38
|
+
: undefined;
|
|
39
|
+
const exported = pkg.exports && typeof pkg.exports === 'object' && '.' in pkg.exports ? pkg.exports['.'] : pkg.exports;
|
|
40
|
+
const entry = pick(exported) ?? pkg.module ?? pkg.main ?? 'index.js';
|
|
41
|
+
return (await import(pathToFileURL(join(candidate, entry)).href));
|
|
42
|
+
}
|
|
43
|
+
if (dirname(dir) === dir)
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return (await import(name));
|
|
47
|
+
}
|
|
48
|
+
async function bundleUi(root, outDir) {
|
|
49
|
+
const entry = ['ui/index.ts', 'ui/index.js'].map((path) => join(root, path)).find(existsSync);
|
|
50
|
+
if (!entry)
|
|
51
|
+
return false;
|
|
52
|
+
// optional peers: typed locally so the SDK builds without them installed
|
|
53
|
+
let vite;
|
|
54
|
+
let svelte;
|
|
55
|
+
try {
|
|
56
|
+
vite = await importFromProject(root, 'vite');
|
|
57
|
+
svelte = await importFromProject(root, '@sveltejs/vite-plugin-svelte');
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
throw new Error('Building the UI needs vite, svelte and @sveltejs/vite-plugin-svelte as dev dependencies');
|
|
61
|
+
}
|
|
62
|
+
await vite.build({
|
|
63
|
+
root,
|
|
64
|
+
configFile: false,
|
|
65
|
+
logLevel: 'warn',
|
|
66
|
+
plugins: [svelte.svelte({ compilerOptions: { customElement: true } })],
|
|
67
|
+
build: {
|
|
68
|
+
outDir,
|
|
69
|
+
emptyOutDir: true,
|
|
70
|
+
lib: { entry, formats: ['es'], fileName: () => 'index.mjs' },
|
|
71
|
+
rollupOptions: {
|
|
72
|
+
output: {
|
|
73
|
+
chunkFileNames: 'chunks/[name]-[hash].mjs',
|
|
74
|
+
assetFileNames: 'static/[name]-[hash][extname]'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
export async function buildPackage(options) {
|
|
82
|
+
const manifest = readManifest(options.root, options.image);
|
|
83
|
+
const files = new Map();
|
|
84
|
+
files.set(MANIFEST_FILE, Buffer.from(`${JSON.stringify(manifest, null, '\t')}\n`));
|
|
85
|
+
if (!options.skipUi) {
|
|
86
|
+
const outDir = mkdtempSync(join(tmpdir(), 'atlas-ext-ui-'));
|
|
87
|
+
try {
|
|
88
|
+
if (await bundleUi(options.root, outDir))
|
|
89
|
+
for (const path of walk(outDir))
|
|
90
|
+
files.set(`ui/${toPosix(relative(outDir, path))}`, readFileSync(path));
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
rmSync(outDir, { recursive: true, force: true });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const path of walk(join(options.root, 'assets')))
|
|
97
|
+
files.set(`assets/${toPosix(relative(join(options.root, 'assets'), path))}`, readFileSync(path));
|
|
98
|
+
const contributesUi = (manifest.contributes.pages?.length ?? 0) +
|
|
99
|
+
(manifest.contributes.assetTabs?.length ?? 0) +
|
|
100
|
+
(manifest.contributes.widgets?.length ?? 0) +
|
|
101
|
+
(manifest.contributes.settingsPanel ? 1 : 0) >
|
|
102
|
+
0;
|
|
103
|
+
if (contributesUi && !files.has('ui/index.mjs'))
|
|
104
|
+
throw new Error('The manifest contributes UI but there is no ui/index.ts or ui/index.js');
|
|
105
|
+
if (options.privateKeyPem)
|
|
106
|
+
files.set(SIGNATURE_FILE, Buffer.from(JSON.stringify(signFiles(files, options.privateKeyPem, manifest.publisher), null, '\t')));
|
|
107
|
+
return {
|
|
108
|
+
manifest,
|
|
109
|
+
archive: await packFiles(files),
|
|
110
|
+
fileName: `${manifest.id}-${manifest.version}.atlasx`,
|
|
111
|
+
files: [...files.keys()].sort()
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAA0B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwBnF,SAAS,IAAI,CAAC,GAAW;IACxB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,G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,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CACpG,CAAC;IAEH,OAAO;QACN,QAAQ;QACR,OAAO,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC;QAC/B,QAAQ,EAAE,GAAG,QAAQ,CAAC,EAAE,IAAI,QAAQ,CAAC,OAAO,SAAS;QACrD,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;KAC/B,CAAC;AACH,CAAC"}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { parseArgs } from 'node:util';
|
|
5
|
+
import { buildPackage } from './build.js';
|
|
6
|
+
import { checkManifest } from './manifest.js';
|
|
7
|
+
import { buildIndex, serializeIndex, signIndex, verifyIndex, versionEntry } from './registry.js';
|
|
8
|
+
import { generatePublisherKey, keyIdOf, MANIFEST_FILE, packFiles, SIGNATURE_FILE, signFiles, unpackFiles, verifyFiles } from './package.js';
|
|
9
|
+
const HELP = `atlas-ext — build and sign Atlas extension packages
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
atlas-ext keygen <name> [--out <dir>] ed25519 publisher key: <name>.key (keep secret) and <name>.pub
|
|
13
|
+
atlas-ext build [--image <ref@sha256:…>] [--key <file>] [--out <dir>]
|
|
14
|
+
bundle ui/, collect assets/, write <id>-<version>.atlasx
|
|
15
|
+
atlas-ext sign <package.atlasx> --key <file> (re)sign a package
|
|
16
|
+
atlas-ext verify <package.atlasx> --pub <base64|file>
|
|
17
|
+
atlas-ext validate check atlas-extension.json
|
|
18
|
+
atlas-ext dev [--port 4100] [--atlas http://localhost:5173] [--entry server/index.ts]
|
|
19
|
+
run the server part locally against a dev Atlas
|
|
20
|
+
|
|
21
|
+
Registries (static signed index, see docs):
|
|
22
|
+
atlas-ext registry entry <package.atlasx> --url <download url> [--pub <key>] [--out <registry dir>]
|
|
23
|
+
version entry for a package (verified with --pub)
|
|
24
|
+
atlas-ext registry build <registry dir> --key <file> [--out <dir>] [--expires <days>] [--name <name>]
|
|
25
|
+
write index.json + index.json.sig
|
|
26
|
+
atlas-ext registry verify <index.json> --pub <base64|file>
|
|
27
|
+
`;
|
|
28
|
+
function readKey(path) {
|
|
29
|
+
if (!path)
|
|
30
|
+
throw new Error('--key <file> is required');
|
|
31
|
+
return readFileSync(path, 'utf8');
|
|
32
|
+
}
|
|
33
|
+
function readPublicKey(value) {
|
|
34
|
+
if (!value)
|
|
35
|
+
throw new Error('--pub <base64|file> is required');
|
|
36
|
+
try {
|
|
37
|
+
return readFileSync(value, 'utf8').trim();
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return value.trim();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function main(argv) {
|
|
44
|
+
const [command, ...rest] = argv;
|
|
45
|
+
const { values, positionals } = parseArgs({
|
|
46
|
+
args: rest,
|
|
47
|
+
allowPositionals: true,
|
|
48
|
+
options: {
|
|
49
|
+
out: { type: 'string' },
|
|
50
|
+
image: { type: 'string' },
|
|
51
|
+
key: { type: 'string' },
|
|
52
|
+
pub: { type: 'string' },
|
|
53
|
+
port: { type: 'string' },
|
|
54
|
+
atlas: { type: 'string' },
|
|
55
|
+
entry: { type: 'string' },
|
|
56
|
+
url: { type: 'string' },
|
|
57
|
+
name: { type: 'string' },
|
|
58
|
+
expires: { type: 'string' }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
switch (command) {
|
|
62
|
+
case 'keygen': {
|
|
63
|
+
const name = positionals[0];
|
|
64
|
+
if (!name || !/^[a-z0-9-]+$/.test(name))
|
|
65
|
+
throw new Error('usage: atlas-ext keygen <name>');
|
|
66
|
+
const out = resolve(values.out ?? '.');
|
|
67
|
+
mkdirSync(out, { recursive: true });
|
|
68
|
+
const key = generatePublisherKey();
|
|
69
|
+
writeFileSync(join(out, `${name}.key`), key.privateKeyPem, { mode: 0o600, flag: 'wx' });
|
|
70
|
+
writeFileSync(join(out, `${name}.pub`), `${key.publicKey}\n`, { flag: 'wx' });
|
|
71
|
+
console.log(`wrote ${join(out, `${name}.key`)} (secret) and ${name}.pub`);
|
|
72
|
+
console.log(`public key: ${key.publicKey}\nkey id: ${key.keyId}`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
case 'build': {
|
|
76
|
+
const result = await buildPackage({
|
|
77
|
+
root: process.cwd(),
|
|
78
|
+
image: values.image,
|
|
79
|
+
privateKeyPem: values.key ? readKey(values.key) : undefined
|
|
80
|
+
});
|
|
81
|
+
const out = resolve(values.out ?? 'dist');
|
|
82
|
+
mkdirSync(out, { recursive: true });
|
|
83
|
+
const path = join(out, result.fileName);
|
|
84
|
+
writeFileSync(path, result.archive);
|
|
85
|
+
console.log(`${path}${values.key ? ' (signed)' : ' (unsigned)'}`);
|
|
86
|
+
for (const file of result.files)
|
|
87
|
+
console.log(` ${file}`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
case 'sign': {
|
|
91
|
+
const path = positionals[0];
|
|
92
|
+
if (!path)
|
|
93
|
+
throw new Error('usage: atlas-ext sign <package.atlasx> --key <file>');
|
|
94
|
+
const files = await unpackFiles(readFileSync(path));
|
|
95
|
+
files.delete(SIGNATURE_FILE);
|
|
96
|
+
const manifest = JSON.parse(files.get(MANIFEST_FILE)?.toString('utf8') ?? 'null');
|
|
97
|
+
if (!manifest?.publisher)
|
|
98
|
+
throw new Error(`${MANIFEST_FILE} missing or without publisher`);
|
|
99
|
+
const signature = signFiles(files, readKey(values.key), manifest.publisher);
|
|
100
|
+
files.set(SIGNATURE_FILE, Buffer.from(JSON.stringify(signature, null, '\t')));
|
|
101
|
+
writeFileSync(path, await packFiles(files));
|
|
102
|
+
console.log(`signed ${path} as ${manifest.publisher} (key ${signature.keyId})`);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
case 'verify': {
|
|
106
|
+
const path = positionals[0];
|
|
107
|
+
if (!path)
|
|
108
|
+
throw new Error('usage: atlas-ext verify <package.atlasx> --pub <key>');
|
|
109
|
+
const publicKey = readPublicKey(values.pub);
|
|
110
|
+
const files = await unpackFiles(readFileSync(path));
|
|
111
|
+
const raw = files.get(SIGNATURE_FILE);
|
|
112
|
+
files.delete(SIGNATURE_FILE);
|
|
113
|
+
if (!raw)
|
|
114
|
+
throw new Error('package is not signed');
|
|
115
|
+
const signature = JSON.parse(raw.toString('utf8'));
|
|
116
|
+
const ok = verifyFiles(files, signature, publicKey);
|
|
117
|
+
console.log(ok
|
|
118
|
+
? `valid signature by ${signature.publisher} (key ${signature.keyId})`
|
|
119
|
+
: `INVALID signature (package key ${signature.keyId}, given key ${keyIdOf(publicKey)})`);
|
|
120
|
+
if (!ok)
|
|
121
|
+
process.exitCode = 1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
case 'validate': {
|
|
125
|
+
const raw = JSON.parse(readFileSync(join(process.cwd(), MANIFEST_FILE), 'utf8'));
|
|
126
|
+
const checked = checkManifest(raw);
|
|
127
|
+
if (checked.ok)
|
|
128
|
+
console.log(`${MANIFEST_FILE} is valid`);
|
|
129
|
+
else {
|
|
130
|
+
console.error(checked.errors.join('\n'));
|
|
131
|
+
process.exitCode = 1;
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
case 'dev': {
|
|
136
|
+
const { runDev } = await import('./dev.js');
|
|
137
|
+
await runDev({
|
|
138
|
+
root: process.cwd(),
|
|
139
|
+
port: Number(values.port ?? 4100),
|
|
140
|
+
entry: values.entry,
|
|
141
|
+
atlas: values.atlas ?? 'http://localhost:5173'
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
case 'registry': {
|
|
146
|
+
const [sub, target] = positionals;
|
|
147
|
+
if (sub === 'entry') {
|
|
148
|
+
if (!target || !values.url)
|
|
149
|
+
throw new Error('usage: atlas-ext registry entry <package.atlasx> --url <url>');
|
|
150
|
+
const result = await versionEntry(readFileSync(target), {
|
|
151
|
+
url: values.url,
|
|
152
|
+
publisherKeys: values.pub ? [readPublicKey(values.pub)] : undefined
|
|
153
|
+
});
|
|
154
|
+
if (!values.out) {
|
|
155
|
+
console.log(JSON.stringify(result.entry, null, ' '));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const folder = join(resolve(values.out), 'packages', result.id);
|
|
159
|
+
mkdirSync(folder, { recursive: true });
|
|
160
|
+
const info = join(folder, 'package.json');
|
|
161
|
+
if (!existsSync(info)) {
|
|
162
|
+
const { name, description, publisher, homepage, icon } = result.manifest;
|
|
163
|
+
writeFileSync(info, `${JSON.stringify({ name, description, publisher, homepage, icon }, null, ' ')}
|
|
164
|
+
`);
|
|
165
|
+
}
|
|
166
|
+
const file = join(folder, `${result.entry.version}.json`);
|
|
167
|
+
if (existsSync(file))
|
|
168
|
+
throw new Error(`${file} exists: a published version never changes`);
|
|
169
|
+
writeFileSync(file, `${JSON.stringify(result.entry, null, ' ')}
|
|
170
|
+
`);
|
|
171
|
+
console.log(`wrote ${file}`);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (sub === 'build') {
|
|
175
|
+
if (!target)
|
|
176
|
+
throw new Error('usage: atlas-ext registry build <registry dir> --key <file>');
|
|
177
|
+
const index = buildIndex(resolve(target), {
|
|
178
|
+
name: values.name,
|
|
179
|
+
expiresInDays: values.expires ? Number(values.expires) : undefined
|
|
180
|
+
});
|
|
181
|
+
const bytes = serializeIndex(index);
|
|
182
|
+
const signature = signIndex(bytes, readKey(values.key));
|
|
183
|
+
const out = resolve(values.out ?? join(target, 'public'));
|
|
184
|
+
mkdirSync(out, { recursive: true });
|
|
185
|
+
writeFileSync(join(out, 'index.json'), bytes);
|
|
186
|
+
writeFileSync(join(out, 'index.json.sig'), `${JSON.stringify(signature)}
|
|
187
|
+
`);
|
|
188
|
+
const count = Object.values(index.packages).reduce((sum, pkg) => sum + pkg.versions.length, 0);
|
|
189
|
+
console.log(`${join(out, 'index.json')}: ${Object.keys(index.packages).length} package(s), ${count} version(s), serial ${index.serial}, key ${signature.keyId}, expires ${index.expires_at}`);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (sub === 'verify') {
|
|
193
|
+
if (!target)
|
|
194
|
+
throw new Error('usage: atlas-ext registry verify <index.json> --pub <key>');
|
|
195
|
+
const bytes = readFileSync(target);
|
|
196
|
+
const signature = JSON.parse(readFileSync(`${target}.sig`, 'utf8'));
|
|
197
|
+
const ok = verifyIndex(bytes, signature, readPublicKey(values.pub));
|
|
198
|
+
console.log(ok ? `valid index signature (key ${signature.keyId})` : 'INVALID index signature');
|
|
199
|
+
if (!ok)
|
|
200
|
+
process.exitCode = 1;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
throw new Error('usage: atlas-ext registry entry|build|verify …');
|
|
204
|
+
}
|
|
205
|
+
default:
|
|
206
|
+
console.log(HELP);
|
|
207
|
+
if (command && command !== 'help' && command !== '--help')
|
|
208
|
+
process.exitCode = 1;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
main(process.argv.slice(2)).catch((error) => {
|
|
212
|
+
console.error(`atlas-ext: ${error.message}`);
|
|
213
|
+
process.exitCode = 1;
|
|
214
|
+
});
|
|
215
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EA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