track-cli 4.1.0-rc2 → 4.1.0-rc3
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/esm/src/action/run.js +10 -7
- package/esm/src/meta.d.ts +1 -1
- package/esm/src/meta.js +1 -1
- package/esm/src/shared/types.d.ts +4 -0
- package/package.json +1 -1
package/esm/src/action/run.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { OrcaClient } from "../orca/client.js";
|
|
3
|
+
import { FileType } from "../orca/types.js";
|
|
2
4
|
import { load as loadConfig } from "../shared/config.js";
|
|
3
5
|
import { CantReadFile } from "../shared/errors.js";
|
|
4
6
|
import { getCommonChallengeContext, listFileNames, printTimeLeft, trackClientFromConfig, } from "../shared/mod.js";
|
|
5
7
|
import { EnvSettings, FileListType, } from "../shared/types.js";
|
|
6
|
-
import { OrcaClient } from "../orca/client.js";
|
|
7
|
-
import { FileType } from "../orca/types.js";
|
|
8
8
|
import * as colors from "../../deps/deno.land/std@0.195.0/fmt/colors.js";
|
|
9
9
|
import { exists } from "../../deps/deno.land/std@0.195.0/fs/mod.js";
|
|
10
10
|
import { FileNotFound } from "../shared/errors.js";
|
|
@@ -15,7 +15,7 @@ export async function run(options) {
|
|
|
15
15
|
const [codingContext, challenge] = await getCommonChallengeContext(config, api);
|
|
16
16
|
// const orcaHost = Deno.env.get("ORCA_HOST") || "track-prod-frontend.orca.run";
|
|
17
17
|
// Temporary code to retrieve the Orca host. Will be able to get from CodingContext in the future.
|
|
18
|
-
const orcaHost = codingContext.orcaHost || await api.orcaHost();
|
|
18
|
+
const orcaHost = codingContext.orcaHost || (await api.orcaHost());
|
|
19
19
|
const token = await api.orcaToken(codingContext);
|
|
20
20
|
const orca = new OrcaClient(orcaHost, token);
|
|
21
21
|
await orca.connect();
|
|
@@ -32,20 +32,23 @@ export async function run(options) {
|
|
|
32
32
|
if (codingContext.answers.appCommand) {
|
|
33
33
|
envVars["APP_COMMAND"] = codingContext.answers.appCommand;
|
|
34
34
|
}
|
|
35
|
+
if (codingContext.answers?.frontendSettings?.target) {
|
|
36
|
+
// Currently, the `envConfig.variables` from Track Test does not including the frontend template's FRONTEND_TARGET.
|
|
37
|
+
envVars["FRONTEND_TARGET"] = codingContext.answers?.frontendSettings?.target;
|
|
38
|
+
}
|
|
35
39
|
await orca.envVars(envVars);
|
|
36
|
-
const
|
|
37
|
-
|
|
40
|
+
const updatedFiles = await getAllEditableFileContent(codingContext);
|
|
41
|
+
const files = Object.entries(updatedFiles).map(([name, content]) => ({
|
|
38
42
|
name,
|
|
39
43
|
content,
|
|
40
44
|
type: FileType.UTF8,
|
|
41
45
|
}));
|
|
42
46
|
let saveFilesRequest;
|
|
43
47
|
if (!options?.noSave) {
|
|
44
|
-
const updatedFiles = await getAllEditableFileContent(codingContext);
|
|
45
48
|
saveFilesRequest = {
|
|
46
49
|
versionId: codingContext.challengeVersionId,
|
|
47
50
|
addedFiles: codingContext.answers.addedFiles || [],
|
|
48
|
-
updatedFiles
|
|
51
|
+
updatedFiles,
|
|
49
52
|
};
|
|
50
53
|
console.log("Saving challenge files");
|
|
51
54
|
await api.saveFiles(saveFilesRequest);
|
package/esm/src/meta.d.ts
CHANGED
package/esm/src/meta.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as colors from "../deps/deno.land/std@0.195.0/fmt/colors.js";
|
|
2
2
|
// @ts-ignore: has no exported member
|
|
3
3
|
import { CookieJar, fetch } from "node-fetch-cookies";
|
|
4
|
-
export const VERSION = "4.1.0-
|
|
4
|
+
export const VERSION = "4.1.0-rc3";
|
|
5
5
|
export const DESCRIPTION = "A CLI for interacting with tracks.run and running code tests on track's servers";
|
|
6
6
|
const VERSION_RE = /^(\d+)\.(\d+)\.(\d+)(?:-?(.*))$/;
|
|
7
7
|
function parseSemver(s) {
|
|
@@ -114,6 +114,10 @@ export interface CodingAnswers {
|
|
|
114
114
|
addedFiles?: string[];
|
|
115
115
|
fileVersions: object;
|
|
116
116
|
envConfig?: EnvSettings;
|
|
117
|
+
frontendSettings?: {
|
|
118
|
+
/** The directory containing compiled frontend assets */
|
|
119
|
+
target?: string;
|
|
120
|
+
};
|
|
117
121
|
}
|
|
118
122
|
export interface SaveFilesRequest {
|
|
119
123
|
versionId: number;
|