@quantum-hub/qhubctl 2.2.1 → 2.2.2
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/README.md +26 -2
- package/dist/commands/compress.d.ts +1 -1
- package/dist/commands/compress.js +15 -15
- package/dist/commands/datapool-upload.d.ts +1 -1
- package/dist/commands/datapool-upload.js +35 -35
- package/dist/commands/get-context.d.ts +1 -1
- package/dist/commands/get-context.js +5 -5
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +33 -29
- package/dist/commands/list-contexts.d.ts +1 -1
- package/dist/commands/list-contexts.js +21 -13
- package/dist/commands/login.d.ts +1 -1
- package/dist/commands/login.js +16 -16
- package/dist/commands/logout.d.ts +1 -1
- package/dist/commands/logout.js +10 -10
- package/dist/commands/openapi.d.ts +1 -1
- package/dist/commands/openapi.js +112 -94
- package/dist/commands/run.d.ts +2 -2
- package/dist/commands/run.js +37 -34
- package/dist/commands/serve.d.ts +1 -1
- package/dist/commands/serve.js +30 -19
- package/dist/commands/services-build-logs.d.ts +2 -2
- package/dist/commands/services-build-logs.js +26 -26
- package/dist/commands/services-build-status.d.ts +1 -1
- package/dist/commands/services-build-status.js +21 -21
- package/dist/commands/services-list.d.ts +1 -1
- package/dist/commands/services-list.js +20 -17
- package/dist/commands/set-context.d.ts +1 -1
- package/dist/commands/set-context.js +19 -24
- package/dist/commands/up.d.ts +1 -1
- package/dist/commands/up.js +50 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/command.js +2 -2
- package/dist/lib/config-dir.js +3 -3
- package/dist/lib/debug.js +1 -1
- package/dist/lib/entrypoint-resolver.js +15 -15
- package/dist/lib/error.js +4 -4
- package/dist/lib/fetch.js +3 -1
- package/dist/lib/init-user-input.d.ts +1 -1
- package/dist/lib/init-user-input.js +28 -26
- package/dist/lib/output.d.ts +2 -2
- package/dist/lib/output.js +3 -3
- package/dist/lib/random-name.js +147 -147
- package/dist/lib/random-string.js +2 -2
- package/dist/lib/repository.js +5 -5
- package/dist/lib/stream-to-blob.d.ts +1 -1
- package/dist/lib/stream-to-blob.js +5 -5
- package/dist/lib/up/get-description.js +8 -8
- package/dist/lib/up/ignore.js +8 -8
- package/dist/lib/up/qhubignore-help.js +10 -10
- package/dist/lib/up/required-files.js +17 -12
- package/dist/lib/up/source.d.ts +2 -2
- package/dist/lib/up/source.js +7 -7
- package/dist/lib/up/zip.js +8 -8
- package/dist/main.js +3 -3
- package/dist/model/command.d.ts +2 -2
- package/dist/model/command.js +9 -9
- package/dist/model/managed-service-config.d.ts +1 -1
- package/dist/model/user-config.js +1 -1
- package/dist/program.d.ts +1 -1
- package/dist/program.js +24 -24
- package/dist/service/auth-service.d.ts +3 -3
- package/dist/service/auth-service.js +11 -9
- package/dist/service/command-service.d.ts +1 -1
- package/dist/service/quantum-hub-service.d.ts +3 -3
- package/dist/service/quantum-hub-service.js +34 -20
- package/dist/service/service-config-service.d.ts +1 -1
- package/dist/service/service-config-service.js +8 -8
- package/dist/service/user-config-service.d.ts +1 -1
- package/dist/service/user-config-service.js +7 -7
- package/dist/service/user-service.d.ts +2 -2
- package/dist/service/user-service.js +4 -4
- package/package.json +8 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn } from
|
|
1
|
+
import { warn } from "./output.js";
|
|
2
2
|
export class EntrypointResolver {
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the entrypoint string from various flag combinations.
|
|
@@ -14,8 +14,8 @@ export class EntrypointResolver {
|
|
|
14
14
|
return entryPoint.entrypoint;
|
|
15
15
|
}
|
|
16
16
|
// If package and/or method flags are provided, construct the entrypoint
|
|
17
|
-
const packagePath = entryPoint.package ||
|
|
18
|
-
const method = entryPoint.method ||
|
|
17
|
+
const packagePath = entryPoint.package || "src.program";
|
|
18
|
+
const method = entryPoint.method || "run";
|
|
19
19
|
const entrypoint = `${packagePath}:${method}`;
|
|
20
20
|
this.validateEntrypoint(entrypoint);
|
|
21
21
|
return entrypoint;
|
|
@@ -31,12 +31,12 @@ export class EntrypointResolver {
|
|
|
31
31
|
*/
|
|
32
32
|
static validateEntrypoint(entrypoint) {
|
|
33
33
|
if (!entrypoint) {
|
|
34
|
-
throw new Error(
|
|
34
|
+
throw new Error("Entrypoint cannot be empty");
|
|
35
35
|
}
|
|
36
|
-
const parts = entrypoint.split(
|
|
36
|
+
const parts = entrypoint.split(":");
|
|
37
37
|
if (parts.length !== 2) {
|
|
38
38
|
throw new Error(`Invalid entrypoint format: "${entrypoint}". ` +
|
|
39
|
-
|
|
39
|
+
"Must contain exactly one colon separating module and object reference");
|
|
40
40
|
}
|
|
41
41
|
const [modulePath, objectPath] = parts;
|
|
42
42
|
// Check for empty parts first
|
|
@@ -49,7 +49,7 @@ export class EntrypointResolver {
|
|
|
49
49
|
// Validate object path (function or Class.method)
|
|
50
50
|
this.validateObjectPath(objectPath, entrypoint);
|
|
51
51
|
// Warn if object path starts with underscore (private methods/classes)
|
|
52
|
-
if (objectPath.startsWith(
|
|
52
|
+
if (objectPath.startsWith("_")) {
|
|
53
53
|
warn(`Object "${objectPath}" starts with underscore. Make sure this is intended for a private object.`);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -58,16 +58,16 @@ export class EntrypointResolver {
|
|
|
58
58
|
*/
|
|
59
59
|
static validateModulePath(modulePath, fullEntrypoint) {
|
|
60
60
|
// Check for leading/trailing dots or consecutive dots
|
|
61
|
-
if (modulePath.startsWith(
|
|
61
|
+
if (modulePath.startsWith(".") || modulePath.endsWith(".")) {
|
|
62
62
|
throw new Error(`Invalid module path in entrypoint: "${modulePath}". ` +
|
|
63
|
-
|
|
63
|
+
"Module path should not start or end with dots.");
|
|
64
64
|
}
|
|
65
|
-
if (modulePath.includes(
|
|
65
|
+
if (modulePath.includes("..")) {
|
|
66
66
|
throw new Error(`Invalid module path in entrypoint: "${modulePath}". ` +
|
|
67
|
-
|
|
67
|
+
"Module path should not contain consecutive dots.");
|
|
68
68
|
}
|
|
69
69
|
// Split by dots and validate each identifier
|
|
70
|
-
const moduleIdentifiers = modulePath.split(
|
|
70
|
+
const moduleIdentifiers = modulePath.split(".");
|
|
71
71
|
for (const identifier of moduleIdentifiers) {
|
|
72
72
|
if (!this.isValidPythonIdentifier(identifier)) {
|
|
73
73
|
throw new Error(`Invalid entrypoint format: "${fullEntrypoint}". ` +
|
|
@@ -80,7 +80,7 @@ export class EntrypointResolver {
|
|
|
80
80
|
*/
|
|
81
81
|
static validateObjectPath(objectPath, fullEntrypoint) {
|
|
82
82
|
// Split by dots and validate each identifier
|
|
83
|
-
const objectIdentifiers = objectPath.split(
|
|
83
|
+
const objectIdentifiers = objectPath.split(".");
|
|
84
84
|
for (const identifier of objectIdentifiers) {
|
|
85
85
|
if (!this.isValidPythonIdentifier(identifier)) {
|
|
86
86
|
throw new Error(`Invalid entrypoint format: "${fullEntrypoint}". ` +
|
|
@@ -106,7 +106,7 @@ export class EntrypointResolver {
|
|
|
106
106
|
*/
|
|
107
107
|
static extractPackagePath(entrypoint) {
|
|
108
108
|
this.validateEntrypoint(entrypoint);
|
|
109
|
-
return entrypoint.split(
|
|
109
|
+
return entrypoint.split(":")[0];
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Extracts the method name from an entrypoint string.
|
|
@@ -116,6 +116,6 @@ export class EntrypointResolver {
|
|
|
116
116
|
*/
|
|
117
117
|
static extractMethod(entrypoint) {
|
|
118
118
|
this.validateEntrypoint(entrypoint);
|
|
119
|
-
return entrypoint.split(
|
|
119
|
+
return entrypoint.split(":")[1];
|
|
120
120
|
}
|
|
121
121
|
}
|
package/dist/lib/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HubPlatformError, HubPlatformTimeoutError } from
|
|
2
|
-
import { HubUserError, HubUserTimeoutError } from
|
|
3
|
-
import { debugEnabled } from
|
|
1
|
+
import { HubPlatformError, HubPlatformTimeoutError } from "@quantum-hub/qhub-api/platform";
|
|
2
|
+
import { HubUserError, HubUserTimeoutError } from "@quantum-hub/qhub-api/user";
|
|
3
|
+
import { debugEnabled } from "./debug.js";
|
|
4
4
|
export const handleError = async (error) => {
|
|
5
5
|
if (error instanceof HubPlatformError || error instanceof HubUserError) {
|
|
6
6
|
const httpStatus = error.statusCode;
|
|
@@ -30,5 +30,5 @@ export const handleError = async (error) => {
|
|
|
30
30
|
console.error(JSON.stringify(error));
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return "Internal error occurred, please contact your KQH administrator";
|
|
34
34
|
};
|
package/dist/lib/fetch.js
CHANGED
|
@@ -24,7 +24,9 @@ export const getErrorMessage = async (response) => {
|
|
|
24
24
|
catch {
|
|
25
25
|
// ignore
|
|
26
26
|
}
|
|
27
|
-
const httpStatus = response.status && response.statusText
|
|
27
|
+
const httpStatus = response.status && response.statusText
|
|
28
|
+
? `${response.status} - ${response.statusText}`
|
|
29
|
+
: response.status;
|
|
28
30
|
// message is either in body.errorMessage, body.error or body.detail
|
|
29
31
|
let errorMessage;
|
|
30
32
|
if (body?.errorMessage)
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { input, select, number } from
|
|
2
|
-
import path from
|
|
3
|
-
import { GpuType, Runtime } from
|
|
4
|
-
export const resolveServiceDirectory = (targetDirectory, starter) => starter?.serviceDirectory
|
|
1
|
+
import { input, select, number } from "@inquirer/prompts";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { GpuType, Runtime } from "../model/managed-service-config.js";
|
|
4
|
+
export const resolveServiceDirectory = (targetDirectory, starter) => starter?.serviceDirectory
|
|
5
|
+
? path.join(targetDirectory, starter.serviceDirectory)
|
|
6
|
+
: targetDirectory;
|
|
5
7
|
export const DEFAULT_STARTER = {
|
|
6
|
-
url:
|
|
8
|
+
url: "https://repository.hub.kipu-quantum.com/cec4a31d-5856-4387-b4cf-718345803558/qhub-starter-python.git",
|
|
7
9
|
runtime: Runtime.PYTHON_TEMPLATE,
|
|
8
10
|
};
|
|
9
11
|
export const promptUserInput = async (defaultName) => {
|
|
@@ -12,32 +14,32 @@ export const promptUserInput = async (defaultName) => {
|
|
|
12
14
|
default: defaultName,
|
|
13
15
|
});
|
|
14
16
|
const starter = await select({
|
|
15
|
-
message:
|
|
17
|
+
message: "Choose a starter template",
|
|
16
18
|
choices: [
|
|
17
19
|
{
|
|
18
|
-
name:
|
|
20
|
+
name: "Python Starter (recommended to get started quickly)",
|
|
19
21
|
value: DEFAULT_STARTER,
|
|
20
22
|
},
|
|
21
23
|
{
|
|
22
|
-
name:
|
|
24
|
+
name: "Docker Starter (setup for experienced users)",
|
|
23
25
|
value: {
|
|
24
|
-
url:
|
|
26
|
+
url: "https://repository.hub.kipu-quantum.com/cec4a31d-5856-4387-b4cf-718345803558/qhub-starter-docker.git",
|
|
25
27
|
runtime: Runtime.DOCKER,
|
|
26
28
|
},
|
|
27
29
|
},
|
|
28
30
|
{
|
|
29
|
-
name:
|
|
31
|
+
name: "NVIDIA CUDA-Q Starter (for GPU accelerated applications; setup for experienced users)",
|
|
30
32
|
value: {
|
|
31
|
-
url:
|
|
33
|
+
url: "https://repository.hub.kipu-quantum.com/cec4a31d-5856-4387-b4cf-718345803558/qhub-starter-gpu.git",
|
|
32
34
|
runtime: Runtime.DOCKER,
|
|
33
35
|
},
|
|
34
36
|
},
|
|
35
37
|
{
|
|
36
|
-
name:
|
|
38
|
+
name: "Service Demo Starter (full-stack example with frontend accessing a service)",
|
|
37
39
|
value: {
|
|
38
|
-
url:
|
|
40
|
+
url: "https://repository.hub.kipu-quantum.com/cec4a31d-5856-4387-b4cf-718345803558/qhub-starter-service-demo.git",
|
|
39
41
|
runtime: Runtime.PYTHON_TEMPLATE,
|
|
40
|
-
serviceDirectory:
|
|
42
|
+
serviceDirectory: "service",
|
|
41
43
|
},
|
|
42
44
|
},
|
|
43
45
|
{ name: 'None (creates "qhub.json" in current directory)', value: undefined },
|
|
@@ -45,39 +47,39 @@ export const promptUserInput = async (defaultName) => {
|
|
|
45
47
|
default: DEFAULT_STARTER,
|
|
46
48
|
});
|
|
47
49
|
const cpu = await number({
|
|
48
|
-
message:
|
|
50
|
+
message: "Enter vCPU configuration (may be between 1 and 220 vCPUs, depending on your account):",
|
|
49
51
|
default: 1,
|
|
50
52
|
validate: (input) => {
|
|
51
53
|
if (input === null || input === undefined || !Number.isInteger(input)) {
|
|
52
|
-
return
|
|
54
|
+
return "Please enter a valid integer";
|
|
53
55
|
}
|
|
54
56
|
if (input < 1 || input > 220) {
|
|
55
|
-
return
|
|
57
|
+
return "vCPU must be between 1 and 220";
|
|
56
58
|
}
|
|
57
59
|
return true;
|
|
58
60
|
},
|
|
59
61
|
});
|
|
60
62
|
const memory = await number({
|
|
61
|
-
message:
|
|
63
|
+
message: "Enter memory configuration in GB (may be between 1 and 848 GBs, depending on your account):",
|
|
62
64
|
default: 1,
|
|
63
65
|
validate: (input) => {
|
|
64
66
|
if (input === null || input === undefined || !Number.isInteger(input)) {
|
|
65
|
-
return
|
|
67
|
+
return "Please enter a valid integer";
|
|
66
68
|
}
|
|
67
69
|
if (input < 1 || input > 848) {
|
|
68
|
-
return
|
|
70
|
+
return "Memory must be between 1 and 848 GB";
|
|
69
71
|
}
|
|
70
72
|
return true;
|
|
71
73
|
},
|
|
72
74
|
});
|
|
73
75
|
let gpu = undefined;
|
|
74
|
-
if (!starter || starter.url.includes(
|
|
76
|
+
if (!starter || starter.url.includes("qhub-starter-gpu")) {
|
|
75
77
|
gpu = await select({
|
|
76
|
-
message:
|
|
78
|
+
message: "Choose your GPU configuration",
|
|
77
79
|
choices: [
|
|
78
|
-
{ name:
|
|
79
|
-
{ name:
|
|
80
|
-
{ name:
|
|
80
|
+
{ name: "No GPU support", value: undefined },
|
|
81
|
+
{ name: "NVIDIA® T4", value: GpuType.NVIDIA_TESLA_T4 },
|
|
82
|
+
{ name: "NVIDIA® V100", value: GpuType.NVIDIA_TESLA_V100 },
|
|
81
83
|
],
|
|
82
84
|
default: undefined,
|
|
83
85
|
});
|
|
@@ -88,6 +90,6 @@ export const promptUserInput = async (defaultName) => {
|
|
|
88
90
|
cpu: cpu,
|
|
89
91
|
memory: memory,
|
|
90
92
|
gpu,
|
|
91
|
-
descriptionFile:
|
|
93
|
+
descriptionFile: "README.md",
|
|
92
94
|
};
|
|
93
95
|
};
|
package/dist/lib/output.d.ts
CHANGED
package/dist/lib/output.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ora from
|
|
1
|
+
import ora from "ora";
|
|
2
2
|
/**
|
|
3
3
|
* Output helpers — replaces oclif's `ux.*` surface.
|
|
4
4
|
*
|
|
@@ -7,8 +7,8 @@ import ora from 'ora';
|
|
|
7
7
|
* error → ux.error() / this.error()
|
|
8
8
|
* spinner → ux.action.start() / ux.action.stop()
|
|
9
9
|
*/
|
|
10
|
-
export function stdout(msg =
|
|
11
|
-
process.stdout.write(msg +
|
|
10
|
+
export function stdout(msg = "") {
|
|
11
|
+
process.stdout.write(msg + "\n");
|
|
12
12
|
}
|
|
13
13
|
export function warn(msg) {
|
|
14
14
|
process.stderr.write(`Warning: ${msg}\n`);
|
package/dist/lib/random-name.js
CHANGED
|
@@ -5,153 +5,153 @@ export const randomName = () => {
|
|
|
5
5
|
return `${randomAdjective}-${randomAnimal}-${suffix}`;
|
|
6
6
|
};
|
|
7
7
|
const adjectives = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
8
|
+
"admiring",
|
|
9
|
+
"adoring",
|
|
10
|
+
"agile",
|
|
11
|
+
"ambitious",
|
|
12
|
+
"blissful",
|
|
13
|
+
"bold",
|
|
14
|
+
"brave",
|
|
15
|
+
"brilliant",
|
|
16
|
+
"calm",
|
|
17
|
+
"charming",
|
|
18
|
+
"cozy",
|
|
19
|
+
"creative",
|
|
20
|
+
"curious",
|
|
21
|
+
"dazzling",
|
|
22
|
+
"delightful",
|
|
23
|
+
"diligent",
|
|
24
|
+
"dynamic",
|
|
25
|
+
"eager",
|
|
26
|
+
"efficient",
|
|
27
|
+
"elegant",
|
|
28
|
+
"fantastic",
|
|
29
|
+
"fierce",
|
|
30
|
+
"fluffy",
|
|
31
|
+
"focused",
|
|
32
|
+
"generous",
|
|
33
|
+
"gentle",
|
|
34
|
+
"gloomy",
|
|
35
|
+
"graceful",
|
|
36
|
+
"harmonious",
|
|
37
|
+
"honest",
|
|
38
|
+
"innovative",
|
|
39
|
+
"intelligent",
|
|
40
|
+
"jolly",
|
|
41
|
+
"joyful",
|
|
42
|
+
"jubilant",
|
|
43
|
+
"kind",
|
|
44
|
+
"lively",
|
|
45
|
+
"luminous",
|
|
46
|
+
"magnificent",
|
|
47
|
+
"misty",
|
|
48
|
+
"noble",
|
|
49
|
+
"optimistic",
|
|
50
|
+
"peaceful",
|
|
51
|
+
"precious",
|
|
52
|
+
"quiet",
|
|
53
|
+
"radiant",
|
|
54
|
+
"resilient",
|
|
55
|
+
"serene",
|
|
56
|
+
"silly",
|
|
57
|
+
"trustworthy",
|
|
58
|
+
"unique",
|
|
59
|
+
"vibrant",
|
|
60
|
+
"wise",
|
|
61
|
+
"xenial",
|
|
62
|
+
"youthful",
|
|
63
|
+
"zealous",
|
|
64
64
|
];
|
|
65
65
|
const animals = [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
66
|
+
"aardvark",
|
|
67
|
+
"alpaca",
|
|
68
|
+
"anaconda",
|
|
69
|
+
"antelope",
|
|
70
|
+
"armadillo",
|
|
71
|
+
"baboon",
|
|
72
|
+
"badger",
|
|
73
|
+
"bat",
|
|
74
|
+
"bear",
|
|
75
|
+
"beaver",
|
|
76
|
+
"bison",
|
|
77
|
+
"boar",
|
|
78
|
+
"buffalo",
|
|
79
|
+
"camel",
|
|
80
|
+
"cat",
|
|
81
|
+
"cheetah",
|
|
82
|
+
"chimpanzee",
|
|
83
|
+
"chinchilla",
|
|
84
|
+
"cobra",
|
|
85
|
+
"cougar",
|
|
86
|
+
"coyote",
|
|
87
|
+
"crocodile",
|
|
88
|
+
"deer",
|
|
89
|
+
"dingo",
|
|
90
|
+
"dog",
|
|
91
|
+
"dolphin",
|
|
92
|
+
"donkey",
|
|
93
|
+
"eagle",
|
|
94
|
+
"elephant",
|
|
95
|
+
"elk",
|
|
96
|
+
"falcon",
|
|
97
|
+
"ferret",
|
|
98
|
+
"flamingo",
|
|
99
|
+
"fox",
|
|
100
|
+
"gazelle",
|
|
101
|
+
"giraffe",
|
|
102
|
+
"goat",
|
|
103
|
+
"gorilla",
|
|
104
|
+
"grizzly bear",
|
|
105
|
+
"hamster",
|
|
106
|
+
"hedgehog",
|
|
107
|
+
"hippopotamus",
|
|
108
|
+
"horse",
|
|
109
|
+
"hummingbird",
|
|
110
|
+
"hyena",
|
|
111
|
+
"iguana",
|
|
112
|
+
"jackal",
|
|
113
|
+
"jaguar",
|
|
114
|
+
"kangaroo",
|
|
115
|
+
"koala",
|
|
116
|
+
"lemur",
|
|
117
|
+
"leopard",
|
|
118
|
+
"lion",
|
|
119
|
+
"llama",
|
|
120
|
+
"lynx",
|
|
121
|
+
"mantis",
|
|
122
|
+
"marmot",
|
|
123
|
+
"mongoose",
|
|
124
|
+
"moose",
|
|
125
|
+
"narwhal",
|
|
126
|
+
"octopus",
|
|
127
|
+
"orangutan",
|
|
128
|
+
"ostrich",
|
|
129
|
+
"otter",
|
|
130
|
+
"panda",
|
|
131
|
+
"panther",
|
|
132
|
+
"peacock",
|
|
133
|
+
"penguin",
|
|
134
|
+
"platypus",
|
|
135
|
+
"puma",
|
|
136
|
+
"quail",
|
|
137
|
+
"rabbit",
|
|
138
|
+
"raccoon",
|
|
139
|
+
"raven",
|
|
140
|
+
"rhinoceros",
|
|
141
|
+
"salamander",
|
|
142
|
+
"seal",
|
|
143
|
+
"shark",
|
|
144
|
+
"skunk",
|
|
145
|
+
"sloth",
|
|
146
|
+
"squirrel",
|
|
147
|
+
"tapir",
|
|
148
|
+
"tiger",
|
|
149
|
+
"turtle",
|
|
150
|
+
"viper",
|
|
151
|
+
"walrus",
|
|
152
|
+
"whale",
|
|
153
|
+
"wombat",
|
|
154
|
+
"wolverine",
|
|
155
|
+
"yak",
|
|
156
|
+
"zebra",
|
|
157
157
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const characters =
|
|
1
|
+
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
2
2
|
export const randomString = (length) => {
|
|
3
|
-
let value =
|
|
3
|
+
let value = "";
|
|
4
4
|
for (let i = 0; i < length; i++) {
|
|
5
5
|
value += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
6
6
|
}
|
package/dist/lib/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import git from
|
|
3
|
-
import http from
|
|
4
|
-
import nodeFs from
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import git from "isomorphic-git";
|
|
3
|
+
import http from "isomorphic-git/http/node";
|
|
4
|
+
import nodeFs from "node:fs";
|
|
5
5
|
/**
|
|
6
6
|
* Clones a git repository (shallow, depth=1) into targetDirectory and removes
|
|
7
7
|
* the .git metadata afterwards, leaving only the working-tree files.
|
|
@@ -19,7 +19,7 @@ export const cloneRepository = async (url, targetDirectory) => {
|
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
21
|
console.error(error);
|
|
22
|
-
throw new Error(
|
|
22
|
+
throw new Error("Failed to download starter template.", { cause: error });
|
|
23
23
|
}
|
|
24
24
|
// Remove git metadata so the project directory is a clean working tree
|
|
25
25
|
await fs.remove(`${targetDirectory}/.git`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ReadStream } from
|
|
1
|
+
import type { ReadStream } from "node:fs";
|
|
2
2
|
export declare const streamToBlob: (stream: ReadStream, mimeType?: string) => Promise<Blob>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export const streamToBlob = (stream, mimeType) => {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
3
|
const chunks = [];
|
|
4
|
-
stream.on(
|
|
4
|
+
stream.on("data", (chunk) => {
|
|
5
5
|
// ReadStream can emit either string or Buffer, ensure we have Buffer
|
|
6
|
-
if (typeof chunk ===
|
|
6
|
+
if (typeof chunk === "string") {
|
|
7
7
|
chunks.push(Buffer.from(chunk));
|
|
8
8
|
}
|
|
9
9
|
else {
|
|
10
10
|
chunks.push(chunk);
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
stream.on(
|
|
13
|
+
stream.on("end", () => {
|
|
14
14
|
// Concatenate all chunks into a single Buffer, then convert to Blob
|
|
15
15
|
const buffer = Buffer.concat(chunks);
|
|
16
|
-
const blob = new Blob([buffer], { type: mimeType ||
|
|
16
|
+
const blob = new Blob([buffer], { type: mimeType || "application/octet-stream" });
|
|
17
17
|
resolve(blob);
|
|
18
18
|
});
|
|
19
|
-
stream.on(
|
|
19
|
+
stream.on("error", (error) => {
|
|
20
20
|
reject(error);
|
|
21
21
|
});
|
|
22
22
|
});
|