@platforma-sdk/package-builder-lib 1.1.0
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/assets/conda-dockerfile.template +45 -0
- package/assets/python-dockerfile.template +22 -0
- package/dist/_virtual/_rolldown/runtime.cjs +33 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/core/archive.cjs +52 -0
- package/dist/core/archive.cjs.map +1 -0
- package/dist/core/archive.js +47 -0
- package/dist/core/archive.js.map +1 -0
- package/dist/core/conda/builder.cjs +226 -0
- package/dist/core/conda/builder.cjs.map +1 -0
- package/dist/core/conda/builder.js +220 -0
- package/dist/core/conda/builder.js.map +1 -0
- package/dist/core/conda/validate-spec.cjs +76 -0
- package/dist/core/conda/validate-spec.cjs.map +1 -0
- package/dist/core/conda/validate-spec.js +73 -0
- package/dist/core/conda/validate-spec.js.map +1 -0
- package/dist/core/core.cjs +403 -0
- package/dist/core/core.cjs.map +1 -0
- package/dist/core/core.d.ts +82 -0
- package/dist/core/core.d.ts.map +1 -0
- package/dist/core/core.js +397 -0
- package/dist/core/core.js.map +1 -0
- package/dist/core/docker-conda.cjs +75 -0
- package/dist/core/docker-conda.cjs.map +1 -0
- package/dist/core/docker-conda.js +71 -0
- package/dist/core/docker-conda.js.map +1 -0
- package/dist/core/docker-python.cjs +147 -0
- package/dist/core/docker-python.cjs.map +1 -0
- package/dist/core/docker-python.js +144 -0
- package/dist/core/docker-python.js.map +1 -0
- package/dist/core/docker.cjs +223 -0
- package/dist/core/docker.cjs.map +1 -0
- package/dist/core/docker.js +207 -0
- package/dist/core/docker.js.map +1 -0
- package/dist/core/envs.cjs +58 -0
- package/dist/core/envs.cjs.map +1 -0
- package/dist/core/envs.d.ts +26 -0
- package/dist/core/envs.d.ts.map +1 -0
- package/dist/core/envs.js +51 -0
- package/dist/core/envs.js.map +1 -0
- package/dist/core/package-info.cjs +450 -0
- package/dist/core/package-info.cjs.map +1 -0
- package/dist/core/package-info.d.ts +57 -0
- package/dist/core/package-info.d.ts.map +1 -0
- package/dist/core/package-info.js +447 -0
- package/dist/core/package-info.js.map +1 -0
- package/dist/core/paths.cjs +15 -0
- package/dist/core/paths.cjs.map +1 -0
- package/dist/core/paths.js +14 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/resolver.cjs +99 -0
- package/dist/core/resolver.cjs.map +1 -0
- package/dist/core/resolver.js +95 -0
- package/dist/core/resolver.js.map +1 -0
- package/dist/core/schemas/artifacts.cjs +136 -0
- package/dist/core/schemas/artifacts.cjs.map +1 -0
- package/dist/core/schemas/artifacts.d.ts +280 -0
- package/dist/core/schemas/artifacts.d.ts.map +1 -0
- package/dist/core/schemas/artifacts.js +122 -0
- package/dist/core/schemas/artifacts.js.map +1 -0
- package/dist/core/schemas/entrypoints.cjs +43 -0
- package/dist/core/schemas/entrypoints.cjs.map +1 -0
- package/dist/core/schemas/entrypoints.d.ts +32 -0
- package/dist/core/schemas/entrypoints.d.ts.map +1 -0
- package/dist/core/schemas/entrypoints.js +41 -0
- package/dist/core/schemas/entrypoints.js.map +1 -0
- package/dist/core/schemas/sw-json.cjs +111 -0
- package/dist/core/schemas/sw-json.cjs.map +1 -0
- package/dist/core/schemas/sw-json.js +110 -0
- package/dist/core/schemas/sw-json.js.map +1 -0
- package/dist/core/storage.cjs +86 -0
- package/dist/core/storage.cjs.map +1 -0
- package/dist/core/storage.js +83 -0
- package/dist/core/storage.js.map +1 -0
- package/dist/core/sw-json-render.cjs +327 -0
- package/dist/core/sw-json-render.cjs.map +1 -0
- package/dist/core/sw-json-render.js +322 -0
- package/dist/core/sw-json-render.js.map +1 -0
- package/dist/core/util.cjs +313 -0
- package/dist/core/util.cjs.map +1 -0
- package/dist/core/util.d.ts +66 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/util.js +281 -0
- package/dist/core/util.js.map +1 -0
- package/dist/defaults.cjs +54 -0
- package/dist/defaults.cjs.map +1 -0
- package/dist/defaults.d.ts +21 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +37 -0
- package/dist/defaults.js.map +1 -0
- package/dist/index.cjs +31 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
- package/src/__test__/Dockerfile +1 -0
- package/src/__test__/docker.test.ts +67 -0
- package/src/__test__/package.json +39 -0
- package/src/__test__/python-example/main.py +1 -0
- package/src/__test__/python-example/requirements.txt +0 -0
- package/src/__test__/vite.config.mts +7 -0
- package/src/core/__tests__/docker-conda.test.ts +145 -0
- package/src/core/__tests__/docker-entrypoint-generation.test.ts +119 -0
- package/src/core/__tests__/docker-python.test.ts +374 -0
- package/src/core/__tests__/publish-docker-images.test.ts +309 -0
- package/src/core/archive.ts +102 -0
- package/src/core/conda/builder.test.ts +71 -0
- package/src/core/conda/builder.ts +384 -0
- package/src/core/conda/validate-spec.test.ts +213 -0
- package/src/core/conda/validate-spec.ts +107 -0
- package/src/core/core.ts +835 -0
- package/src/core/docker-conda.ts +149 -0
- package/src/core/docker-python.ts +283 -0
- package/src/core/docker.ts +300 -0
- package/src/core/envs.ts +31 -0
- package/src/core/package-info.test.ts +82 -0
- package/src/core/package-info.ts +843 -0
- package/src/core/paths.ts +16 -0
- package/src/core/resolver.ts +195 -0
- package/src/core/schemas/artifacts.test.ts +72 -0
- package/src/core/schemas/artifacts.ts +279 -0
- package/src/core/schemas/entrypoints.test.ts +171 -0
- package/src/core/schemas/entrypoints.ts +150 -0
- package/src/core/schemas/sw-json.ts +216 -0
- package/src/core/schemas/test-artifacts.ts +362 -0
- package/src/core/storage.ts +125 -0
- package/src/core/sw-json-render.test.ts +215 -0
- package/src/core/sw-json-render.ts +682 -0
- package/src/core/util.ts +390 -0
- package/src/defaults.ts +38 -0
- package/src/index.ts +31 -0
- package/src/requirements.txt +1 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { isCI, isRunnerDebug } from "./envs.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import * as path$1 from "node:path";
|
|
5
|
+
import * as os from "node:os";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import winston from "winston";
|
|
8
|
+
//#region src/core/util.ts
|
|
9
|
+
var util_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
AllPlatforms: () => AllPlatforms,
|
|
11
|
+
AllSoftwareSources: () => AllSoftwareSources,
|
|
12
|
+
Arches: () => Arches,
|
|
13
|
+
CLIError: () => CLIError,
|
|
14
|
+
CLIErrorClass: () => CLIErrorClass,
|
|
15
|
+
OSes: () => OSes,
|
|
16
|
+
artifactIDFromString: () => artifactIDFromString,
|
|
17
|
+
artifactIDToString: () => artifactIDToString,
|
|
18
|
+
assertNever: () => assertNever,
|
|
19
|
+
createLogger: () => createLogger,
|
|
20
|
+
currentArch: () => currentArch,
|
|
21
|
+
currentOS: () => currentOS,
|
|
22
|
+
currentPlatform: () => currentPlatform,
|
|
23
|
+
ensureDirsExist: () => ensureDirsExist,
|
|
24
|
+
findInstalledModule: () => findInstalledModule,
|
|
25
|
+
findNodeModules: () => findNodeModules,
|
|
26
|
+
findPackageRoot: () => findPackageRoot,
|
|
27
|
+
formatZodIssues: () => formatZodIssues,
|
|
28
|
+
hashDirMetaSync: () => hashDirMetaSync,
|
|
29
|
+
hashDirSync: () => hashDirSync,
|
|
30
|
+
indentText: () => indentText,
|
|
31
|
+
isDevLocalMode: () => isDevLocalMode,
|
|
32
|
+
isPlatformSupported: () => isPlatformSupported,
|
|
33
|
+
joinPlatform: () => joinPlatform,
|
|
34
|
+
packageJsonName: () => packageJsonName,
|
|
35
|
+
rSplit: () => rSplit,
|
|
36
|
+
softwareConfigName: () => softwareConfigName,
|
|
37
|
+
splitPlatform: () => splitPlatform,
|
|
38
|
+
toInt: () => toInt,
|
|
39
|
+
trimPrefix: () => trimPrefix,
|
|
40
|
+
trimSuffix: () => trimSuffix,
|
|
41
|
+
urlJoin: () => urlJoin,
|
|
42
|
+
wrapErr: () => wrapErr
|
|
43
|
+
});
|
|
44
|
+
const packageJsonName = "package.json";
|
|
45
|
+
const softwareConfigName = "package.json";
|
|
46
|
+
function assertNever(_a) {
|
|
47
|
+
throw new Error(`code logic error: assertNever() call for ${JSON.stringify(_a)}`);
|
|
48
|
+
}
|
|
49
|
+
function trimPrefix(str, prefix) {
|
|
50
|
+
if (str.startsWith(prefix)) return str.slice(prefix.length);
|
|
51
|
+
return str;
|
|
52
|
+
}
|
|
53
|
+
function trimSuffix(str, suffix) {
|
|
54
|
+
if (str.endsWith(suffix)) return str.slice(0, -suffix.length);
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
function hashDirMetaSync(folder, hasher) {
|
|
58
|
+
const hash = hasher ? hasher : createHash("sha256");
|
|
59
|
+
const info = fs.readdirSync(folder, { withFileTypes: true });
|
|
60
|
+
for (const item of info) {
|
|
61
|
+
const fullPath = path$1.join(folder, item.name);
|
|
62
|
+
if (item.isFile()) {
|
|
63
|
+
const statInfo = fs.statSync(fullPath);
|
|
64
|
+
const fileInfo = `${fullPath}:${statInfo.size}:${statInfo.mtimeMs}`;
|
|
65
|
+
hash.update(fileInfo);
|
|
66
|
+
} else if (item.isDirectory()) hashDirMetaSync(fullPath, hash);
|
|
67
|
+
}
|
|
68
|
+
return hash;
|
|
69
|
+
}
|
|
70
|
+
function hashDirSync(rootDir, hasher, subdir) {
|
|
71
|
+
const hash = hasher ? hasher : createHash("sha256");
|
|
72
|
+
const folder = path$1.join(rootDir, subdir ?? ".");
|
|
73
|
+
const info = fs.readdirSync(folder, { withFileTypes: true });
|
|
74
|
+
for (const item of info) {
|
|
75
|
+
const relPath = path$1.join(subdir ?? ".", item.name);
|
|
76
|
+
const fullPath = path$1.join(folder, item.name);
|
|
77
|
+
hash.update(relPath);
|
|
78
|
+
if (item.isFile()) {
|
|
79
|
+
const fileDescriptor = fs.openSync(fullPath, "r");
|
|
80
|
+
const buffer = Buffer.alloc(65536);
|
|
81
|
+
let bytesRead;
|
|
82
|
+
while ((bytesRead = fs.readSync(fileDescriptor, buffer, 0, buffer.length, null)) !== 0) hash.update(buffer.subarray(0, bytesRead));
|
|
83
|
+
fs.closeSync(fileDescriptor);
|
|
84
|
+
} else if (item.isDirectory()) hashDirSync(fullPath, hash);
|
|
85
|
+
}
|
|
86
|
+
return hash;
|
|
87
|
+
}
|
|
88
|
+
function ensureDirsExist(dirPath) {
|
|
89
|
+
if (fs.existsSync(dirPath)) return;
|
|
90
|
+
ensureDirsExist(path$1.dirname(dirPath));
|
|
91
|
+
fs.mkdirSync(dirPath);
|
|
92
|
+
}
|
|
93
|
+
function findPackageRoot(logger, startPath) {
|
|
94
|
+
if (!startPath) startPath = process.cwd();
|
|
95
|
+
logger.debug(`Detecting package root...`);
|
|
96
|
+
const pkgRoot = searchPathUp(startPath, startPath, packageJsonName);
|
|
97
|
+
logger.debug(` package root found at '${pkgRoot}'`);
|
|
98
|
+
return pkgRoot;
|
|
99
|
+
}
|
|
100
|
+
function findNodeModules(logger, startPath) {
|
|
101
|
+
if (!startPath) startPath = process.cwd();
|
|
102
|
+
logger.debug(`Detecting 'node_modules' directory...`);
|
|
103
|
+
const nodeModules = searchPathUp(startPath, startPath, "node_modules");
|
|
104
|
+
logger.debug(` 'node_modules' found at '${nodeModules}'`);
|
|
105
|
+
return path$1.join(nodeModules, "node_modules");
|
|
106
|
+
}
|
|
107
|
+
function findInstalledModule(logger, packageName, startPath) {
|
|
108
|
+
const nodeModules = findNodeModules(logger, startPath);
|
|
109
|
+
const packagePath = path$1.resolve(nodeModules, packageName);
|
|
110
|
+
if (!fs.existsSync(packagePath)) throw CLIError(`package '${packageName}' not found in '${nodeModules}'. Did you forget to add it as a dependency?`);
|
|
111
|
+
return packagePath;
|
|
112
|
+
}
|
|
113
|
+
function searchPathUp(startPath, pathToCheck, itemToCheck) {
|
|
114
|
+
const itemPath = path$1.resolve(pathToCheck, itemToCheck);
|
|
115
|
+
if (fs.existsSync(itemPath)) return pathToCheck;
|
|
116
|
+
const parentDir = path$1.dirname(pathToCheck);
|
|
117
|
+
if (parentDir === pathToCheck || pathToCheck === "") throw CLIError(`failed to find '${itemToCheck}' file in any of parent directories starting from '${startPath}'`);
|
|
118
|
+
return searchPathUp(startPath, parentDir, itemToCheck);
|
|
119
|
+
}
|
|
120
|
+
function createLogger(level = "debug") {
|
|
121
|
+
if (isCI() && isRunnerDebug()) level = "debug";
|
|
122
|
+
return winston.createLogger({
|
|
123
|
+
level,
|
|
124
|
+
format: winston.format.printf(({ level, message }) => {
|
|
125
|
+
const indent = " ".repeat(level.length + 2);
|
|
126
|
+
if (typeof message !== "string") {
|
|
127
|
+
const messageJson = JSON.stringify(message);
|
|
128
|
+
throw new Error(`logger message ${messageJson} is not a string`);
|
|
129
|
+
}
|
|
130
|
+
const indentedMessage = message.split("\n").map((line, index) => index === 0 ? line : indent + line).join("\n");
|
|
131
|
+
const colorize = (l) => winston.format.colorize().colorize(l, l);
|
|
132
|
+
return `${colorize(level)}: ${indentedMessage}`;
|
|
133
|
+
}),
|
|
134
|
+
transports: [new winston.transports.Console({
|
|
135
|
+
stderrLevels: [
|
|
136
|
+
"error",
|
|
137
|
+
"warn",
|
|
138
|
+
"info",
|
|
139
|
+
"debug"
|
|
140
|
+
],
|
|
141
|
+
handleExceptions: true
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function rSplit(input, delimiter, limit) {
|
|
146
|
+
const parts = input.split(delimiter);
|
|
147
|
+
if (!limit || parts.length <= limit) return parts;
|
|
148
|
+
return [parts.slice(0, -limit + 1).join(delimiter), ...parts.slice(-limit + 1)];
|
|
149
|
+
}
|
|
150
|
+
const replaceDuplicateSlashes = /* @__PURE__ */ new RegExp("//+", "g");
|
|
151
|
+
function urlJoin(url, appendPath) {
|
|
152
|
+
const u = new URL(url, "file:/nonexistent-9672674c/");
|
|
153
|
+
if (u.protocol === "file:" && u.pathname.startsWith("/nonexistent-9672674c/")) throw new Error(`string '${url}' is not valid URL`);
|
|
154
|
+
u.pathname = u.pathname + "/" + appendPath;
|
|
155
|
+
u.pathname = u.pathname.replaceAll(replaceDuplicateSlashes, "/");
|
|
156
|
+
return u.toString();
|
|
157
|
+
}
|
|
158
|
+
function wrapErr(e, msg) {
|
|
159
|
+
if (!(e instanceof Error)) return e;
|
|
160
|
+
const wrappedError = /* @__PURE__ */ new Error(`${msg}: ${e.message}`);
|
|
161
|
+
wrappedError.name = e.name;
|
|
162
|
+
wrappedError.stack = e.stack;
|
|
163
|
+
Object.assign(wrappedError, e);
|
|
164
|
+
return wrappedError;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Converts any value to integer number 1 if value is truthful and 0 otherwice.
|
|
168
|
+
* Provides simple way to count values that are defined in an object:
|
|
169
|
+
* toInt(options.a) + toInt(options.b) + toInt(options.c) === 1
|
|
170
|
+
* @param input: any
|
|
171
|
+
* @returns number - '1' or '0'
|
|
172
|
+
*/
|
|
173
|
+
function toInt(input) {
|
|
174
|
+
return input ? 1 : 0;
|
|
175
|
+
}
|
|
176
|
+
const OSes = [
|
|
177
|
+
"linux",
|
|
178
|
+
"macosx",
|
|
179
|
+
"windows"
|
|
180
|
+
];
|
|
181
|
+
function currentOS() {
|
|
182
|
+
const platform = os.platform();
|
|
183
|
+
switch (platform) {
|
|
184
|
+
case "darwin": return "macosx";
|
|
185
|
+
case "linux": return "linux";
|
|
186
|
+
case "win32": return "windows";
|
|
187
|
+
default: throw CLIError(`operating system '${platform}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(OSes));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const Arches = ["x64", "aarch64"];
|
|
191
|
+
function currentArch() {
|
|
192
|
+
const arch = os.arch();
|
|
193
|
+
switch (arch) {
|
|
194
|
+
case "arm64": return "aarch64";
|
|
195
|
+
case "x64": return "x64";
|
|
196
|
+
default: throw CLIError(`processor architecture '${arch}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(Arches));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const AllPlatforms = [
|
|
200
|
+
"linux-x64",
|
|
201
|
+
"linux-aarch64",
|
|
202
|
+
"macosx-x64",
|
|
203
|
+
"macosx-aarch64",
|
|
204
|
+
"windows-x64"
|
|
205
|
+
];
|
|
206
|
+
function splitPlatform(platform) {
|
|
207
|
+
const parts = platform.split("-");
|
|
208
|
+
return {
|
|
209
|
+
os: parts[0],
|
|
210
|
+
arch: parts[1]
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function joinPlatform(os, arch) {
|
|
214
|
+
return `${os}-${arch}`;
|
|
215
|
+
}
|
|
216
|
+
function isPlatformSupported(os, arch) {
|
|
217
|
+
return AllPlatforms.includes(`${os}-${arch}`);
|
|
218
|
+
}
|
|
219
|
+
function currentPlatform() {
|
|
220
|
+
return `${currentOS()}-${currentArch()}`;
|
|
221
|
+
}
|
|
222
|
+
const AllSoftwareSources = ["archive", "docker"];
|
|
223
|
+
/** True for dev-local build mode. */
|
|
224
|
+
function isDevLocalMode(mode) {
|
|
225
|
+
return mode === "dev-local";
|
|
226
|
+
}
|
|
227
|
+
function artifactIDFromString(s) {
|
|
228
|
+
const parts = s.split(":", 2);
|
|
229
|
+
if (parts.length < 2) throw CLIError(`string '${s}' is not an artifact ID (artifact ID format is <packageName>:<artifactName>)`);
|
|
230
|
+
return {
|
|
231
|
+
package: parts[0],
|
|
232
|
+
name: parts[1]
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function artifactIDToString(a) {
|
|
236
|
+
return `${a.package}:${a.name}`;
|
|
237
|
+
}
|
|
238
|
+
function indentText(txt, indent, skipFirstLine = false) {
|
|
239
|
+
indent = typeof indent === "number" ? " ".repeat(indent) : indent;
|
|
240
|
+
return txt.split("\n").map((line, index) => index === 0 && skipFirstLine ? line : `${indent}${line}`).join("\n");
|
|
241
|
+
}
|
|
242
|
+
const formatZodIssues = (issues, i = "", p = []) => {
|
|
243
|
+
const _errors = [];
|
|
244
|
+
const formatSubpath = (path, prefix = "") => {
|
|
245
|
+
let pp = path.join(".");
|
|
246
|
+
if (pp != "" && p.length > 0) pp = `.${pp}`;
|
|
247
|
+
if (pp != "") pp = `${prefix}${pp}`;
|
|
248
|
+
return pp;
|
|
249
|
+
};
|
|
250
|
+
const addItem = (item) => _errors.push(indentText(item, i));
|
|
251
|
+
for (const issue of issues) if (issue.code === "invalid_union") {
|
|
252
|
+
addItem(`✖ Expected one of several possible values`);
|
|
253
|
+
addItem(` → at '${formatSubpath(issue.path, "")}':`);
|
|
254
|
+
for (const errGrp of issue.errors) _errors.push(formatZodIssues(errGrp, `${i} `, [...p, ...issue.path]));
|
|
255
|
+
} else if (issue.code === "invalid_element" || issue.code === "invalid_key") {
|
|
256
|
+
addItem(`✖ ${issue.code.replaceAll("_", " ")}:`);
|
|
257
|
+
_errors.push(formatZodIssues(issue.issues, `${i} `, [...p, ...issue.path]));
|
|
258
|
+
} else if (issue.code === "invalid_type") {
|
|
259
|
+
const path = formatSubpath(issue.path, " ");
|
|
260
|
+
const prefix = `✖ (${issue.expected})${path}: `;
|
|
261
|
+
addItem(`${prefix}${indentText(issue.message, Math.min(prefix.length, 20), true)}`);
|
|
262
|
+
} else {
|
|
263
|
+
const path = formatSubpath(issue.path, " ");
|
|
264
|
+
const prefix = `✖ (${issue.code.replaceAll("_", " ")})${path}: `;
|
|
265
|
+
addItem(`${prefix}${indentText(issue.message, Math.min(prefix.length, 20), true)}`);
|
|
266
|
+
}
|
|
267
|
+
return _errors.join("\n");
|
|
268
|
+
};
|
|
269
|
+
var CLIErrorClass = class extends Error {
|
|
270
|
+
constructor(msg) {
|
|
271
|
+
super(typeof msg === "string" ? msg : msg.message);
|
|
272
|
+
this.name = "CLIError";
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
function CLIError(msg) {
|
|
276
|
+
return new CLIErrorClass(msg);
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
export { AllPlatforms, CLIError, artifactIDToString, assertNever, currentArch, currentOS, currentPlatform, ensureDirsExist, findInstalledModule, findPackageRoot, formatZodIssues, hashDirMetaSync, hashDirSync, isDevLocalMode, joinPlatform, packageJsonName, rSplit, softwareConfigName, splitPlatform, toInt, trimPrefix, urlJoin, util_exports, wrapErr };
|
|
280
|
+
|
|
281
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","names":["path","envs.isCI","envs.isRunnerDebug"],"sources":["../../src/core/util.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as os from \"node:os\";\nimport fs from \"node:fs\";\nimport type { Hash } from \"node:crypto\";\nimport { createHash } from \"node:crypto\";\nimport winston from \"winston\";\nimport type { z } from \"zod/v4\";\nimport * as envs from \"./envs\";\n\nexport const packageJsonName = \"package.json\";\nexport const softwareConfigName = \"package.json\";\n\nexport function assertNever(_a: never) {\n throw new Error(`code logic error: assertNever() call for ${JSON.stringify(_a)}`);\n}\n\nexport function trimPrefix(str: string, prefix: string): string {\n if (str.startsWith(prefix)) {\n return str.slice(prefix.length);\n }\n return str;\n}\n\nexport function trimSuffix(str: string, suffix: string): string {\n if (str.endsWith(suffix)) {\n return str.slice(0, -suffix.length);\n }\n return str;\n}\n\nexport function hashDirMetaSync(folder: string, hasher?: Hash): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const info = fs.readdirSync(folder, { withFileTypes: true });\n\n for (const item of info) {\n const fullPath = path.join(folder, item.name);\n\n if (item.isFile()) {\n const statInfo = fs.statSync(fullPath);\n const fileInfo = `${fullPath}:${statInfo.size}:${statInfo.mtimeMs}`;\n hash.update(fileInfo);\n } else if (item.isDirectory()) {\n hashDirMetaSync(fullPath, hash);\n }\n }\n\n return hash;\n}\n\nexport function hashDirSync(rootDir: string, hasher?: Hash, subdir?: string): Hash {\n const hash = hasher ? hasher : createHash(\"sha256\");\n const folder = path.join(rootDir, subdir ?? \".\");\n\n const info = fs.readdirSync(folder, { withFileTypes: true });\n\n for (const item of info) {\n const relPath = path.join(subdir ?? \".\", item.name);\n const fullPath = path.join(folder, item.name);\n\n hash.update(relPath);\n\n if (item.isFile()) {\n const fileDescriptor = fs.openSync(fullPath, \"r\");\n const buffer = Buffer.alloc(65536);\n let bytesRead: number;\n\n while ((bytesRead = fs.readSync(fileDescriptor, buffer, 0, buffer.length, null)) !== 0) {\n hash.update(buffer.subarray(0, bytesRead));\n }\n\n fs.closeSync(fileDescriptor);\n } else if (item.isDirectory()) {\n hashDirSync(fullPath, hash);\n }\n }\n\n return hash;\n}\n\n//\n// Creates all intermediate directories down to given <dirPath>.\n//\nexport function ensureDirsExist(dirPath: string) {\n if (fs.existsSync(dirPath)) {\n return;\n }\n const parentDir = path.dirname(dirPath);\n ensureDirsExist(parentDir);\n fs.mkdirSync(dirPath);\n}\n\nexport function findPackageRoot(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting package root...`);\n const pkgRoot = searchPathUp(startPath, startPath, packageJsonName);\n logger.debug(` package root found at '${pkgRoot}'`);\n\n return pkgRoot;\n}\n\nexport function findNodeModules(logger: winston.Logger, startPath?: string): string {\n if (!startPath) {\n startPath = process.cwd();\n }\n logger.debug(`Detecting 'node_modules' directory...`);\n const nodeModules = searchPathUp(startPath, startPath, \"node_modules\");\n logger.debug(` 'node_modules' found at '${nodeModules}'`);\n\n return path.join(nodeModules, \"node_modules\");\n}\n\nexport function findInstalledModule(\n logger: winston.Logger,\n packageName: string,\n startPath?: string,\n): string {\n const nodeModules = findNodeModules(logger, startPath);\n const packagePath = path.resolve(nodeModules, packageName);\n\n if (!fs.existsSync(packagePath)) {\n throw CLIError(\n `package '${packageName}' not found in '${nodeModules}'. Did you forget to add it as a dependency?`,\n );\n }\n\n return packagePath;\n}\n\nfunction searchPathUp(startPath: string, pathToCheck: string, itemToCheck: string): string {\n const itemPath = path.resolve(pathToCheck, itemToCheck);\n\n if (fs.existsSync(itemPath)) {\n return pathToCheck;\n }\n\n const parentDir = path.dirname(pathToCheck);\n if (parentDir === pathToCheck || pathToCheck === \"\") {\n throw CLIError(\n `failed to find '${itemToCheck}' file in any of parent directories starting from '${startPath}'`,\n );\n }\n\n return searchPathUp(startPath, parentDir, itemToCheck);\n}\n\nexport function createLogger(level: string = \"debug\"): winston.Logger {\n if (envs.isCI() && envs.isRunnerDebug()) {\n level = \"debug\";\n }\n\n return winston.createLogger({\n level: level,\n\n format: winston.format.printf(({ level, message }) => {\n const indent = \" \".repeat(level.length + 2); // For ': ' after the level\n if (typeof message !== \"string\") {\n const messageJson = JSON.stringify(message);\n throw new Error(`logger message ${messageJson} is not a string`);\n }\n const indentedMessage = message\n .split(\"\\n\")\n .map((line: string, index: number) => (index === 0 ? line : indent + line))\n .join(\"\\n\");\n\n const colorize = (l: string) => winston.format.colorize().colorize(l, l);\n\n return `${colorize(level)}: ${indentedMessage}`;\n }),\n\n transports: [\n new winston.transports.Console({\n stderrLevels: [\"error\", \"warn\", \"info\", \"debug\"],\n handleExceptions: true,\n }),\n ],\n });\n}\n\nexport function rSplit(input: string, delimiter: string, limit?: number): string[] {\n const parts = input.split(delimiter);\n if (!limit || parts.length <= limit) {\n return parts;\n }\n\n return [parts.slice(0, -limit + 1).join(delimiter), ...parts.slice(-limit + 1)];\n}\n\nconst replaceDuplicateSlashes = new RegExp(\"//+\", \"g\");\nexport function urlJoin(url: string, appendPath: string): string {\n const u = new URL(url, \"file:/nonexistent-9672674c/\");\n if (u.protocol === \"file:\" && u.pathname.startsWith(\"/nonexistent-9672674c/\")) {\n throw new Error(`string '${url}' is not valid URL`);\n }\n\n u.pathname = u.pathname + \"/\" + appendPath;\n u.pathname = u.pathname.replaceAll(replaceDuplicateSlashes, \"/\");\n return u.toString();\n}\n\nexport function wrapErr(e: any, msg: string): any {\n if (!(e instanceof Error)) {\n return e;\n }\n\n const wrappedError = new Error(`${msg}: ${e.message}`);\n wrappedError.name = e.name;\n wrappedError.stack = e.stack;\n // Copy any additional custom properties\n Object.assign(wrappedError, e);\n return wrappedError;\n}\n\n/**\n * Converts any value to integer number 1 if value is truthful and 0 otherwice.\n * Provides simple way to count values that are defined in an object:\n * toInt(options.a) + toInt(options.b) + toInt(options.c) === 1\n * @param input: any\n * @returns number - '1' or '0'\n */\nexport function toInt(input: any): number {\n return input ? 1 : 0;\n}\n\nexport const OSes = [\"linux\", \"macosx\", \"windows\"] as const;\nexport type OSType = (typeof OSes)[number];\n\nexport function currentOS(): OSType {\n const platform = os.platform();\n switch (platform) {\n case \"darwin\":\n return \"macosx\";\n case \"linux\":\n return \"linux\";\n case \"win32\":\n return \"windows\";\n default:\n throw CLIError(\n `operating system '${platform}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` +\n JSON.stringify(OSes),\n );\n }\n}\n\nexport const Arches = [\"x64\", \"aarch64\"] as const;\nexport type ArchType = (typeof Arches)[number];\n\nexport function currentArch(): ArchType {\n const arch = os.arch();\n switch (arch) {\n case \"arm64\":\n return \"aarch64\";\n case \"x64\":\n return \"x64\";\n default:\n throw CLIError(\n `processor architecture '${arch}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` +\n JSON.stringify(Arches),\n );\n }\n}\n\n// Combinartions of OS and architecture, Platforma supports.\nexport const AllPlatforms: `${OSType}-${ArchType}`[] = [\n \"linux-x64\",\n \"linux-aarch64\",\n \"macosx-x64\",\n \"macosx-aarch64\",\n \"windows-x64\",\n] as const;\nexport type PlatformType = (typeof AllPlatforms)[number];\n\nexport function splitPlatform(platform: PlatformType): { os: OSType; arch: ArchType } {\n const parts = platform.split(\"-\");\n\n return {\n os: parts[0] as OSType,\n arch: parts[1] as ArchType,\n };\n}\n\nexport function joinPlatform(os: OSType, arch: ArchType): PlatformType {\n return `${os}-${arch}`;\n}\n\nexport function isPlatformSupported(os: OSType, arch: ArchType): boolean {\n return AllPlatforms.includes(`${os}-${arch}`);\n}\n\nexport function currentPlatform(): PlatformType {\n return `${currentOS()}-${currentArch()}`;\n}\n\nexport const AllSoftwareSources = [\"archive\", \"docker\"] as const; // add 'image', '<whatever>' here when supported\nexport type SoftwareSource = (typeof AllSoftwareSources)[number];\n\nexport type BuildMode = \"dev-local\" | \"release\";\n\n/** True for dev-local build mode. */\nexport function isDevLocalMode(mode: BuildMode): mode is \"dev-local\" {\n return mode === \"dev-local\";\n}\n\nexport type artifactID = {\n package: string;\n name: string;\n};\n\nexport function artifactIDFromString(s: string): artifactID {\n const parts = s.split(\":\", 2);\n if (parts.length < 2) {\n throw CLIError(\n `string '${s}' is not an artifact ID (artifact ID format is <packageName>:<artifactName>)`,\n );\n }\n return {\n package: parts[0],\n name: parts[1],\n };\n}\n\nexport function artifactIDToString(a: artifactID): string {\n return `${a.package}:${a.name}`;\n}\n\nexport function indentText(txt: string, indent: string | number, skipFirstLine: boolean = false) {\n indent = typeof indent === \"number\" ? \" \".repeat(indent) : indent;\n\n return txt\n .split(\"\\n\")\n .map((line, index) => (index === 0 && skipFirstLine ? line : `${indent}${line}`))\n .join(\"\\n\");\n}\n\nexport const formatZodIssues = (\n issues: z.core.$ZodIssue[],\n i: string = \"\",\n p: PropertyKey[] = [],\n): string => {\n const _errors: string[] = [];\n\n const formatSubpath = (path: PropertyKey[], prefix: string = \"\") => {\n let pp = path.join(\".\");\n if (pp != \"\" && p.length > 0) pp = `.${pp}`;\n if (pp != \"\") pp = `${prefix}${pp}`;\n return pp;\n };\n\n const addItem = (item: string) => _errors.push(indentText(item, i));\n\n for (const issue of issues) {\n if (issue.code === \"invalid_union\") {\n addItem(`✖ Expected one of several possible values`);\n const path = formatSubpath(issue.path, \"\");\n addItem(` → at '${path}':`);\n for (const errGrp of issue.errors) {\n _errors.push(formatZodIssues(errGrp, `${i} `, [...p, ...issue.path]));\n }\n } else if (issue.code === \"invalid_element\" || issue.code === \"invalid_key\") {\n addItem(`✖ ${issue.code.replaceAll(\"_\", \" \")}:`);\n _errors.push(formatZodIssues(issue.issues, `${i} `, [...p, ...issue.path]));\n } else if (issue.code === \"invalid_type\") {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.expected})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n } else {\n const path = formatSubpath(issue.path, \" \");\n const prefix = `✖ (${issue.code.replaceAll(\"_\", \" \")})${path}: `;\n const msg = indentText(issue.message, Math.min(prefix.length, 20), true);\n addItem(`${prefix}${msg}`);\n }\n }\n\n return _errors.join(\"\\n\");\n};\n\n// User-facing CLI error. The top-level handler (bin/run.mjs) prints its\n// message without a stack trace and exits non-zero.\nexport class CLIErrorClass extends Error {\n constructor(msg: string | Error) {\n super(typeof msg === \"string\" ? msg : msg.message);\n this.name = \"CLIError\";\n }\n}\n\nexport function CLIError(msg: string | Error): CLIErrorClass {\n return new CLIErrorClass(msg);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,kBAAkB;AAC/B,MAAa,qBAAqB;AAElC,SAAgB,YAAY,IAAW;AACrC,OAAM,IAAI,MAAM,4CAA4C,KAAK,UAAU,GAAG,GAAG;;AAGnF,SAAgB,WAAW,KAAa,QAAwB;AAC9D,KAAI,IAAI,WAAW,OAAO,CACxB,QAAO,IAAI,MAAM,OAAO,OAAO;AAEjC,QAAO;;AAGT,SAAgB,WAAW,KAAa,QAAwB;AAC9D,KAAI,IAAI,SAAS,OAAO,CACtB,QAAO,IAAI,MAAM,GAAG,CAAC,OAAO,OAAO;AAErC,QAAO;;AAGT,SAAgB,gBAAgB,QAAgB,QAAqB;CACnE,MAAM,OAAO,SAAS,SAAS,WAAW,SAAS;CACnD,MAAM,OAAO,GAAG,YAAY,QAAQ,EAAE,eAAe,MAAM,CAAC;AAE5D,MAAK,MAAM,QAAQ,MAAM;EACvB,MAAM,WAAWA,OAAK,KAAK,QAAQ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AQ,GAAG,SADC,WAAW,MAAM,SAAS,KAAK,IAAI,OAAO,QAAQ,GAAG,EAAE,KAAK,GAC9C;;AAI9B,QAAO,QAAQ,KAAK,KAAK;;AAK3B,IAAa,gBAAb,cAAmC,MAAM;CACvC,YAAY,KAAqB;AAC/B,QAAM,OAAO,QAAQ,WAAW,MAAM,IAAI,QAAQ;AAClD,OAAK,OAAO;;;AAIhB,SAAgB,SAAS,KAAoC;AAC3D,QAAO,IAAI,cAAc,IAAI"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/defaults.ts
|
|
2
|
+
var defaults_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__exportAll({
|
|
3
|
+
BIN_REGISTRY_DOWNLOAD_URL: () => BIN_REGISTRY_DOWNLOAD_URL,
|
|
4
|
+
BIN_REGISTRY_NAME: () => BIN_REGISTRY_NAME,
|
|
5
|
+
CONDA_DATA_LOCATION: () => CONDA_DATA_LOCATION,
|
|
6
|
+
CONDA_DOCKER_BASE_IMAGE: () => CONDA_DOCKER_BASE_IMAGE,
|
|
7
|
+
CONDA_FROZEN_ENV_SPEC_FILE: () => CONDA_FROZEN_ENV_SPEC_FILE,
|
|
8
|
+
CONDA_MICROMAMBA_VERSION: () => CONDA_MICROMAMBA_VERSION,
|
|
9
|
+
CONDA_SOURCE_ENV_SPEC_FILE: () => CONDA_SOURCE_ENV_SPEC_FILE,
|
|
10
|
+
DEV_DOCKER_REGISTRY: () => DEV_DOCKER_REGISTRY,
|
|
11
|
+
DOCKER_BUILD_PLATFORM: () => DOCKER_BUILD_PLATFORM,
|
|
12
|
+
DOCKER_DOCKERFILE: () => DOCKER_DOCKERFILE,
|
|
13
|
+
DOCKER_PLACEHOLDER_PKG: () => DOCKER_PLACEHOLDER_PKG,
|
|
14
|
+
DOCKER_REGISTRY: () => DOCKER_REGISTRY,
|
|
15
|
+
PYTHON_DOCKER_BASE_IMAGE: () => PYTHON_DOCKER_BASE_IMAGE,
|
|
16
|
+
PYTHON_REQUIREMENTS_FILE: () => PYTHON_REQUIREMENTS_FILE,
|
|
17
|
+
PYTHON_TOOLSET: () => "pip"
|
|
18
|
+
});
|
|
19
|
+
const BIN_REGISTRY_NAME = "platforma-open";
|
|
20
|
+
const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
|
|
21
|
+
const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
|
|
22
|
+
const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
|
|
23
|
+
const CONDA_MICROMAMBA_VERSION = "2.3.2-0";
|
|
24
|
+
const CONDA_SOURCE_ENV_SPEC_FILE = "conda-spec.yaml";
|
|
25
|
+
const CONDA_FROZEN_ENV_SPEC_FILE = "frozen-spec.yaml";
|
|
26
|
+
const CONDA_DATA_LOCATION = "conda-env-data";
|
|
27
|
+
const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
|
|
28
|
+
const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
|
|
29
|
+
const DOCKER_DOCKERFILE = "Dockerfile";
|
|
30
|
+
const DOCKER_PLACEHOLDER_PKG = "/app";
|
|
31
|
+
const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
|
|
32
|
+
const DOCKER_BUILD_PLATFORM = "linux/amd64";
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.BIN_REGISTRY_DOWNLOAD_URL = BIN_REGISTRY_DOWNLOAD_URL;
|
|
35
|
+
exports.BIN_REGISTRY_NAME = BIN_REGISTRY_NAME;
|
|
36
|
+
exports.CONDA_DATA_LOCATION = CONDA_DATA_LOCATION;
|
|
37
|
+
exports.CONDA_DOCKER_BASE_IMAGE = CONDA_DOCKER_BASE_IMAGE;
|
|
38
|
+
exports.CONDA_FROZEN_ENV_SPEC_FILE = CONDA_FROZEN_ENV_SPEC_FILE;
|
|
39
|
+
exports.CONDA_MICROMAMBA_VERSION = CONDA_MICROMAMBA_VERSION;
|
|
40
|
+
exports.CONDA_SOURCE_ENV_SPEC_FILE = CONDA_SOURCE_ENV_SPEC_FILE;
|
|
41
|
+
exports.DOCKER_BUILD_PLATFORM = DOCKER_BUILD_PLATFORM;
|
|
42
|
+
exports.DOCKER_DOCKERFILE = DOCKER_DOCKERFILE;
|
|
43
|
+
exports.DOCKER_PLACEHOLDER_PKG = DOCKER_PLACEHOLDER_PKG;
|
|
44
|
+
exports.DOCKER_REGISTRY = DOCKER_REGISTRY;
|
|
45
|
+
exports.PYTHON_DOCKER_BASE_IMAGE = PYTHON_DOCKER_BASE_IMAGE;
|
|
46
|
+
exports.PYTHON_REQUIREMENTS_FILE = PYTHON_REQUIREMENTS_FILE;
|
|
47
|
+
Object.defineProperty(exports, "defaults_exports", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function() {
|
|
50
|
+
return defaults_exports;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=defaults.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.cjs","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/u5p1x5q2/pl-containers\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAIzC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,sBAAsB;AAMnC,MAAa,wBAAwB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare namespace defaults_d_exports {
|
|
2
|
+
export { BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DEV_DOCKER_REGISTRY, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, PYTHON_TOOLSET };
|
|
3
|
+
}
|
|
4
|
+
declare const BIN_REGISTRY_NAME = "platforma-open";
|
|
5
|
+
declare const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
|
|
6
|
+
declare const PYTHON_TOOLSET = "pip";
|
|
7
|
+
declare const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
|
|
8
|
+
declare const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
|
|
9
|
+
declare const CONDA_MICROMAMBA_VERSION = "2.3.2-0";
|
|
10
|
+
declare const CONDA_SOURCE_ENV_SPEC_FILE = "conda-spec.yaml";
|
|
11
|
+
declare const CONDA_FROZEN_ENV_SPEC_FILE = "frozen-spec.yaml";
|
|
12
|
+
declare const CONDA_DATA_LOCATION = "conda-env-data";
|
|
13
|
+
declare const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
|
|
14
|
+
declare const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
|
|
15
|
+
declare const DOCKER_DOCKERFILE = "Dockerfile";
|
|
16
|
+
declare const DOCKER_PLACEHOLDER_PKG = "/app";
|
|
17
|
+
declare const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
|
|
18
|
+
declare const DOCKER_BUILD_PLATFORM = "linux/amd64";
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defaults_d_exports };
|
|
21
|
+
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","names":[],"sources":["../src/defaults.ts"],"mappings":";;;cAOa,iBAAA;AAAA,cACA,yBAAA;AAAA,cAGA,cAAA;AAAA,cACA,wBAAA;AAAA,cAEA,wBAAA;AAAA,cAGA,wBAAA;AAAA,cACA,0BAAA;AAAA,cACA,0BAAA;AAAA,cACA,mBAAA;AAAA,cAEA,uBAAA;AAAA,cAGA,eAAA;AAAA,cACA,iBAAA;AAAA,cACA,sBAAA;AAAA,cAIA,mBAAA;AAAA,cAMA,qBAAA"}
|
package/dist/defaults.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/defaults.ts
|
|
3
|
+
var defaults_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
BIN_REGISTRY_DOWNLOAD_URL: () => BIN_REGISTRY_DOWNLOAD_URL,
|
|
5
|
+
BIN_REGISTRY_NAME: () => BIN_REGISTRY_NAME,
|
|
6
|
+
CONDA_DATA_LOCATION: () => CONDA_DATA_LOCATION,
|
|
7
|
+
CONDA_DOCKER_BASE_IMAGE: () => CONDA_DOCKER_BASE_IMAGE,
|
|
8
|
+
CONDA_FROZEN_ENV_SPEC_FILE: () => CONDA_FROZEN_ENV_SPEC_FILE,
|
|
9
|
+
CONDA_MICROMAMBA_VERSION: () => CONDA_MICROMAMBA_VERSION,
|
|
10
|
+
CONDA_SOURCE_ENV_SPEC_FILE: () => CONDA_SOURCE_ENV_SPEC_FILE,
|
|
11
|
+
DEV_DOCKER_REGISTRY: () => DEV_DOCKER_REGISTRY,
|
|
12
|
+
DOCKER_BUILD_PLATFORM: () => DOCKER_BUILD_PLATFORM,
|
|
13
|
+
DOCKER_DOCKERFILE: () => DOCKER_DOCKERFILE,
|
|
14
|
+
DOCKER_PLACEHOLDER_PKG: () => DOCKER_PLACEHOLDER_PKG,
|
|
15
|
+
DOCKER_REGISTRY: () => DOCKER_REGISTRY,
|
|
16
|
+
PYTHON_DOCKER_BASE_IMAGE: () => PYTHON_DOCKER_BASE_IMAGE,
|
|
17
|
+
PYTHON_REQUIREMENTS_FILE: () => PYTHON_REQUIREMENTS_FILE,
|
|
18
|
+
PYTHON_TOOLSET: () => "pip"
|
|
19
|
+
});
|
|
20
|
+
const BIN_REGISTRY_NAME = "platforma-open";
|
|
21
|
+
const BIN_REGISTRY_DOWNLOAD_URL = "https://bin.pl-open.science/";
|
|
22
|
+
const PYTHON_REQUIREMENTS_FILE = "requirements.txt";
|
|
23
|
+
const PYTHON_DOCKER_BASE_IMAGE = "python:3.12-slim";
|
|
24
|
+
const CONDA_MICROMAMBA_VERSION = "2.3.2-0";
|
|
25
|
+
const CONDA_SOURCE_ENV_SPEC_FILE = "conda-spec.yaml";
|
|
26
|
+
const CONDA_FROZEN_ENV_SPEC_FILE = "frozen-spec.yaml";
|
|
27
|
+
const CONDA_DATA_LOCATION = "conda-env-data";
|
|
28
|
+
const CONDA_DOCKER_BASE_IMAGE = "ubuntu:22.04";
|
|
29
|
+
const DOCKER_REGISTRY = "containers.pl-open.science/milaboratories/pl-containers";
|
|
30
|
+
const DOCKER_DOCKERFILE = "Dockerfile";
|
|
31
|
+
const DOCKER_PLACEHOLDER_PKG = "/app";
|
|
32
|
+
const DEV_DOCKER_REGISTRY = "public.ecr.aws/u5p1x5q2/pl-containers";
|
|
33
|
+
const DOCKER_BUILD_PLATFORM = "linux/amd64";
|
|
34
|
+
//#endregion
|
|
35
|
+
export { BIN_REGISTRY_DOWNLOAD_URL, BIN_REGISTRY_NAME, CONDA_DATA_LOCATION, CONDA_DOCKER_BASE_IMAGE, CONDA_FROZEN_ENV_SPEC_FILE, CONDA_MICROMAMBA_VERSION, CONDA_SOURCE_ENV_SPEC_FILE, DOCKER_BUILD_PLATFORM, DOCKER_DOCKERFILE, DOCKER_PLACEHOLDER_PKG, DOCKER_REGISTRY, PYTHON_DOCKER_BASE_IMAGE, PYTHON_REQUIREMENTS_FILE, defaults_exports };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["// This file contains default values that are part of external contract from the package-builder prospective.\n//\n// DO NOT CHANGE THEIR VALUES UNLESS YOU KNOW WHAT YOU ARE DOING,\n//\n// as these values could be used in different parts of the system (i.e. tengo code, go code of backend and so on).\n\n// Global\nexport const BIN_REGISTRY_NAME = \"platforma-open\";\nexport const BIN_REGISTRY_DOWNLOAD_URL = \"https://bin.pl-open.science/\";\n\n// Python\nexport const PYTHON_TOOLSET = \"pip\";\nexport const PYTHON_REQUIREMENTS_FILE = \"requirements.txt\";\n\nexport const PYTHON_DOCKER_BASE_IMAGE = \"python:3.12-slim\";\n\n// Conda\nexport const CONDA_MICROMAMBA_VERSION = \"2.3.2-0\";\nexport const CONDA_SOURCE_ENV_SPEC_FILE = \"conda-spec.yaml\"; // inside git repo: what env to build in CI\nexport const CONDA_FROZEN_ENV_SPEC_FILE = \"frozen-spec.yaml\"; // inside built package: how to restore env on backend side\nexport const CONDA_DATA_LOCATION = \"conda-env-data\"; // inside built package: where MICROMAMBA_ROOT_PREFIX should point on backend side\n\nexport const CONDA_DOCKER_BASE_IMAGE = \"ubuntu:22.04\";\n\n// Docker\nexport const DOCKER_REGISTRY = \"containers.pl-open.science/milaboratories/pl-containers\";\nexport const DOCKER_DOCKERFILE = \"Dockerfile\"; // inside git repo: path to Dockerfile to build by default\nexport const DOCKER_PLACEHOLDER_PKG = \"/app\"; // {pkg} placeholder value to by used in 'cmd' (for autogenerated docker images)\n\n// Block-software dev pushes (pl-pkg build --dev=local) target this ECR by default.\n// Override per-run with --docker-registry / PL_DOCKER_REGISTRY.\nexport const DEV_DOCKER_REGISTRY = \"public.ecr.aws/u5p1x5q2/pl-containers\";\n\n// All docker images are built for and pushed as linux/amd64, regardless of host arch.\n// Platforma's K8s nodes are linux/amd64; building for any other platform produces\n// a non-runnable artifact. On non-x64 hosts the build cross-compiles via the\n// Docker daemon's qemu emulation.\nexport const DOCKER_BUILD_PLATFORM = \"linux/amd64\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAOA,MAAa,oBAAoB;AACjC,MAAa,4BAA4B;AAIzC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,2BAA2B;AACxC,MAAa,6BAA6B;AAC1C,MAAa,6BAA6B;AAC1C,MAAa,sBAAsB;AAEnC,MAAa,0BAA0B;AAGvC,MAAa,kBAAkB;AAC/B,MAAa,oBAAoB;AACjC,MAAa,yBAAyB;AAItC,MAAa,sBAAsB;AAMnC,MAAa,wBAAwB"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_defaults = require("./defaults.cjs");
|
|
3
|
+
const require_envs = require("./core/envs.cjs");
|
|
4
|
+
const require_util = require("./core/util.cjs");
|
|
5
|
+
const require_core = require("./core/core.cjs");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
function createBuilder(logger, opts) {
|
|
8
|
+
return new require_core.Core(logger, opts);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.createBuilder = createBuilder;
|
|
12
|
+
Object.defineProperty(exports, "defaults", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return require_defaults.defaults_exports;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "envs", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return require_envs.envs_exports;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "util", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return require_util.util_exports;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Core"],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,cAAc,QAAwB,MAA0C;AAC9F,QAAO,IAAIA,aAAAA,KAAK,QAAQ,KAAK"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { util_d_exports } from "./core/util.js";
|
|
2
|
+
import { Core } from "./core/core.js";
|
|
3
|
+
import { envs_d_exports } from "./core/envs.js";
|
|
4
|
+
import { defaults_d_exports } from "./defaults.js";
|
|
5
|
+
import winston from "winston";
|
|
6
|
+
|
|
7
|
+
//#region src/index.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Public surface of the build engine. Derived from `Core` so signatures never
|
|
10
|
+
* drift, while the `Core` class itself stays internal (per A-0023: the engine is
|
|
11
|
+
* a library, not a half-binary with an exported orchestrator class). Consumers
|
|
12
|
+
* (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.
|
|
13
|
+
*/
|
|
14
|
+
type Builder = Pick<Core, "buildMode" | "targetPlatform" | "allPlatforms" | "fullDirHash" | "version" | "isPrivate" | "buildDockerImages" | "buildSoftwareArchives" | "buildSwJsonFiles" | "publishPackages" | "publishDockerImages">;
|
|
15
|
+
declare function createBuilder(logger: winston.Logger, opts?: {
|
|
16
|
+
packageRoot?: string;
|
|
17
|
+
}): Builder;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Builder, createBuilder, defaults_d_exports as defaults, envs_d_exports as envs, util_d_exports as util };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;AAaA;;;;KAAY,OAAA,GAAU,IAAA,CACpB,IAAA;AAAA,iBAcc,aAAA,CAAc,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,IAAA;EAAS,WAAA;AAAA,IAAyB,OAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defaults_exports } from "./defaults.js";
|
|
2
|
+
import { envs_exports } from "./core/envs.js";
|
|
3
|
+
import { util_exports } from "./core/util.js";
|
|
4
|
+
import { Core } from "./core/core.js";
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
function createBuilder(logger, opts) {
|
|
7
|
+
return new Core(logger, opts);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createBuilder, defaults_exports as defaults, envs_exports as envs, util_exports as util };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type winston from \"winston\";\nimport { Core } from \"./core/core\";\n\nexport * as util from \"./core/util\";\nexport * as envs from \"./core/envs\";\nexport * as defaults from \"./defaults\";\n\n/**\n * Public surface of the build engine. Derived from `Core` so signatures never\n * drift, while the `Core` class itself stays internal (per A-0023: the engine is\n * a library, not a half-binary with an exported orchestrator class). Consumers\n * (`pl-pkg`, and later `block-tools software`) wrap this, they do not subclass it.\n */\nexport type Builder = Pick<\n Core,\n | \"buildMode\"\n | \"targetPlatform\"\n | \"allPlatforms\"\n | \"fullDirHash\"\n | \"version\"\n | \"isPrivate\"\n | \"buildDockerImages\"\n | \"buildSoftwareArchives\"\n | \"buildSwJsonFiles\"\n | \"publishPackages\"\n | \"publishDockerImages\"\n>;\n\nexport function createBuilder(logger: winston.Logger, opts?: { packageRoot?: string }): Builder {\n return new Core(logger, opts);\n}\n"],"mappings":";;;;;AA4BA,SAAgB,cAAc,QAAwB,MAA0C;AAC9F,QAAO,IAAI,KAAK,QAAQ,KAAK"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@platforma-sdk/package-builder-lib",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "MiLaboratories Platforma Package builder engine (library)",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"./dist/**/*",
|
|
9
|
+
"./src/**/*",
|
|
10
|
+
"./assets"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"require": "./dist/index.cjs",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@aws-sdk/client-s3": "3.859.0",
|
|
25
|
+
"@aws-sdk/lib-storage": "3.859.0",
|
|
26
|
+
"archiver": "^7.0.1",
|
|
27
|
+
"undici": "~7.16.0",
|
|
28
|
+
"winston": "^3.17.0",
|
|
29
|
+
"yaml": "^2.8.0",
|
|
30
|
+
"zod": "~3.25.76",
|
|
31
|
+
"@milaboratories/resolve-helper": "1.1.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@platforma-open/milaboratories.runenv-python-3": "1.10.6",
|
|
35
|
+
"@types/archiver": "^6.0.3",
|
|
36
|
+
"@types/node": "~24.5.2",
|
|
37
|
+
"@vitest/coverage-istanbul": "^4.1.3",
|
|
38
|
+
"typescript": "~5.9.3",
|
|
39
|
+
"vite": "^8.0.6",
|
|
40
|
+
"vitest": "^4.1.3",
|
|
41
|
+
"@milaboratories/ts-builder": "1.5.2",
|
|
42
|
+
"@milaboratories/build-configs": "2.0.0",
|
|
43
|
+
"@milaboratories/ts-configs": "1.2.3"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "ts-builder build --target node",
|
|
47
|
+
"watch": "ts-builder build --target node --watch",
|
|
48
|
+
"check": "ts-builder check --target node",
|
|
49
|
+
"formatter:check": "ts-builder formatter --check",
|
|
50
|
+
"linter:check": "ts-builder linter --check",
|
|
51
|
+
"types:check": "ts-builder type-check --target node",
|
|
52
|
+
"test": "vitest run --coverage",
|
|
53
|
+
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz",
|
|
54
|
+
"fmt": "ts-builder format"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
FROM scratch
|