@kradle/cli 0.0.11 → 0.0.12
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.
|
@@ -5,7 +5,7 @@ import { Listr } from "listr2";
|
|
|
5
5
|
import pc from "picocolors";
|
|
6
6
|
import { ApiClient } from "../../lib/api-client.js";
|
|
7
7
|
import { getChallengeSlugArgument } from "../../lib/arguments.js";
|
|
8
|
-
import { Challenge } from "../../lib/challenge.js";
|
|
8
|
+
import { Challenge, SOURCE_FOLDER } from "../../lib/challenge.js";
|
|
9
9
|
import { loadConfig } from "../../lib/config.js";
|
|
10
10
|
import { clearScreen, debounced } from "../../lib/utils.js";
|
|
11
11
|
export default class Watch extends Command {
|
|
@@ -91,7 +91,7 @@ export default class Watch extends Command {
|
|
|
91
91
|
this.log(pc.dim("Watching for changes... (Ctrl+C to stop)\n"));
|
|
92
92
|
const watcher = chokidar.watch([challenge.challengeDir], {
|
|
93
93
|
// ⚠️ WE IGNORE THE DATAPACK FOLDER FOR NOW, BUT IT'S A SHORT TERM FIX.
|
|
94
|
-
ignored: [/(^|[/\\])\../, (p) => p.includes("/datapack")], // ignore dotfiles and datapack folder
|
|
94
|
+
ignored: [/(^|[/\\])\../, (p) => p.includes("/datapack"), (p) => p.includes(`/${SOURCE_FOLDER}`)], // ignore dotfiles and datapack folder
|
|
95
95
|
persistent: true,
|
|
96
96
|
ignoreInitial: true,
|
|
97
97
|
});
|
package/dist/lib/challenge.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApiClient } from "./api-client.js";
|
|
2
2
|
import type { Config } from "./config.js";
|
|
3
3
|
import { type ChallengeSchemaType } from "./schemas.js";
|
|
4
|
+
export declare const SOURCE_FOLDER = ".src";
|
|
4
5
|
export declare class Challenge {
|
|
5
6
|
readonly name: string;
|
|
6
7
|
private readonly config;
|
package/dist/lib/challenge.js
CHANGED
|
@@ -6,6 +6,7 @@ import pc from "picocolors";
|
|
|
6
6
|
import * as tar from "tar";
|
|
7
7
|
import { ChallengeSchema } from "./schemas.js";
|
|
8
8
|
import { executeNodeCommand, executeTypescriptFile, getStaticResourcePath, readDirSorted } from "./utils.js";
|
|
9
|
+
export const SOURCE_FOLDER = ".src";
|
|
9
10
|
export class Challenge {
|
|
10
11
|
name;
|
|
11
12
|
config;
|
|
@@ -99,10 +100,9 @@ export class Challenge {
|
|
|
99
100
|
throw new Error(`Failed to build datapack: ${error instanceof Error ? error.message : error}`);
|
|
100
101
|
}
|
|
101
102
|
// @TODO - re-enable once we have a proper build pipeline
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// });
|
|
103
|
+
// Copy challenge.ts and config.ts to the src directory
|
|
104
|
+
await fs.cp(path.join(this.challengeDir, "challenge.ts"), path.join(this.config.KRADLE_CHALLENGES_PATH, this.shortSlug, SOURCE_FOLDER, "challenge.ts"));
|
|
105
|
+
await fs.cp(path.join(this.challengeDir, "config.ts"), path.join(this.config.KRADLE_CHALLENGES_PATH, this.shortSlug, SOURCE_FOLDER, "config.ts"));
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Load the challenge configuration from config.ts
|
|
@@ -133,7 +133,7 @@ export class Challenge {
|
|
|
133
133
|
gzip: true,
|
|
134
134
|
cwd: this.datapackPath, // Input directory
|
|
135
135
|
strict: true,
|
|
136
|
-
}, ["datapack"]);
|
|
136
|
+
}, ["datapack", SOURCE_FOLDER]);
|
|
137
137
|
const uploadUrl = await apiClient.getChallengeUploadUrl(this);
|
|
138
138
|
const fileBuffer = await fs.readFile(this.tarballPath);
|
|
139
139
|
const response = await fetch(uploadUrl, {
|
package/oclif.manifest.json
CHANGED