@examplary/cli 1.14.0 → 1.17.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/README.md +21 -20
- package/dist/commands/init.d.ts +14 -0
- package/dist/commands/init.js +103 -0
- package/dist/commands/package.d.ts +1 -0
- package/dist/commands/package.js +16 -0
- package/dist/commands/publish.d.ts +5 -0
- package/dist/commands/publish.js +57 -0
- package/dist/commands/set-secret.d.ts +6 -0
- package/dist/commands/set-secret.js +29 -0
- package/dist/commands/validate.d.ts +0 -1
- package/dist/commands/validate.js +2 -20
- package/dist/index.js +38 -29
- package/dist/lib/api.d.ts +1 -1
- package/dist/lib/api.js +17 -6
- package/dist/lib/build-app.d.ts +21 -0
- package/dist/lib/build-app.js +179 -0
- package/dist/lib/build-current-app.d.ts +4 -0
- package/dist/lib/build-current-app.js +21 -0
- package/dist/lib/build-question-type.d.ts +8 -0
- package/dist/lib/build-question-type.js +48 -0
- package/dist/lib/bundle.d.ts +4 -3
- package/dist/lib/bundle.js +9 -31
- package/dist/lib/styles.d.ts +2 -1
- package/dist/lib/styles.js +3 -1
- package/dist/lib/validate.d.ts +2 -4
- package/dist/lib/validate.js +7 -26
- package/package.json +4 -24
- package/dist/commands/preview.d.ts +0 -5
- package/dist/commands/preview.js +0 -195
- package/dist/commands/upload.d.ts +0 -5
- package/dist/commands/upload.js +0 -114
- package/dist/lib/read-meta.d.ts +0 -20
- package/dist/lib/read-meta.js +0 -44
- package/dist/lib/safe-path.d.ts +0 -5
- package/dist/lib/safe-path.js +0 -13
- package/dist/preview-ui/assets/icon-nodes-CxaTPv-R.js +0 -2
- package/dist/preview-ui/assets/icon-nodes-CxaTPv-R.js.map +0 -1
- package/dist/preview-ui/assets/index-b38eDKFI.js +0 -3663
- package/dist/preview-ui/assets/index-b38eDKFI.js.map +0 -1
- package/dist/preview-ui/assets/index-boullcXq.css +0 -1
- package/dist/preview-ui/assets/tags-BUvo71XG.js +0 -2
- package/dist/preview-ui/assets/tags-BUvo71XG.js.map +0 -1
- package/dist/preview-ui/index.html +0 -21
package/dist/lib/read-meta.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { QuestionType } from "@examplary/schemas";
|
|
2
|
-
export type QuestionTypeDefinition = Partial<QuestionType> & {
|
|
3
|
-
$schema?: string;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Reads and parses a `<baseName>.json` or `<baseName>.yml` file from the
|
|
7
|
-
* given directory, preferring JSON over YAML. Returns null if neither exists.
|
|
8
|
-
*/
|
|
9
|
-
export declare const readJsonOrYamlFile: (dir: string, baseName: string) => Promise<{
|
|
10
|
-
data: any;
|
|
11
|
-
path: string;
|
|
12
|
-
} | null>;
|
|
13
|
-
/**
|
|
14
|
-
* Reads and parses the question-type definition file.
|
|
15
|
-
* Prefers question-type.json over question-type.yml.
|
|
16
|
-
*/
|
|
17
|
-
export declare const readMetaFile: () => Promise<{
|
|
18
|
-
definition: QuestionTypeDefinition;
|
|
19
|
-
path: string;
|
|
20
|
-
}>;
|
package/dist/lib/read-meta.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { readFile } from "fs/promises";
|
|
2
|
-
import { join } from "path";
|
|
3
|
-
import { cwd } from "process";
|
|
4
|
-
import yaml from "yaml";
|
|
5
|
-
/**
|
|
6
|
-
* Reads and parses a `<baseName>.json` or `<baseName>.yml` file from the
|
|
7
|
-
* given directory, preferring JSON over YAML. Returns null if neither exists.
|
|
8
|
-
*/
|
|
9
|
-
export const readJsonOrYamlFile = async (dir, baseName) => {
|
|
10
|
-
for (const { ext, parse, format } of [
|
|
11
|
-
{ ext: "json", parse: (v) => JSON.parse(v), format: "JSON" },
|
|
12
|
-
{ ext: "yml", parse: (v) => yaml.parse(v), format: "YAML" },
|
|
13
|
-
]) {
|
|
14
|
-
const path = join(dir, `${baseName}.${ext}`);
|
|
15
|
-
let contents;
|
|
16
|
-
try {
|
|
17
|
-
contents = await readFile(path, "utf-8");
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
return { data: parse(contents), path };
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
throw new Error(`Invalid ${format} in ${path}: ${error.message}`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Reads and parses the question-type definition file.
|
|
33
|
-
* Prefers question-type.json over question-type.yml.
|
|
34
|
-
*/
|
|
35
|
-
export const readMetaFile = async () => {
|
|
36
|
-
const result = await readJsonOrYamlFile(cwd(), "question-type");
|
|
37
|
-
if (!result) {
|
|
38
|
-
throw new Error("No question-type.json or question-type.yml found in the current directory");
|
|
39
|
-
}
|
|
40
|
-
const definition = result.data;
|
|
41
|
-
if (definition.$schema)
|
|
42
|
-
delete definition.$schema;
|
|
43
|
-
return { definition, path: result.path };
|
|
44
|
-
};
|
package/dist/lib/safe-path.d.ts
DELETED
package/dist/lib/safe-path.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { resolve, sep } from "path";
|
|
2
|
-
/**
|
|
3
|
-
* Resolves `path` against `dir` and throws if the result escapes `dir`,
|
|
4
|
-
* preventing path traversal via `../` segments or absolute paths.
|
|
5
|
-
*/
|
|
6
|
-
export const resolveInside = (dir, path) => {
|
|
7
|
-
const base = resolve(dir);
|
|
8
|
-
const resolved = resolve(base, path);
|
|
9
|
-
if (resolved !== base && !resolved.startsWith(base + sep)) {
|
|
10
|
-
throw new Error(`Path "${path}" is outside of the question type directory`);
|
|
11
|
-
}
|
|
12
|
-
return resolved;
|
|
13
|
-
};
|