From 43bd233bb9e265d9b602f7de82028f28248f5afa Mon Sep 17 00:00:00 2001 From: shmck Date: Sun, 5 Jul 2020 16:22:14 -0700 Subject: [PATCH] support reset command Signed-off-by: shmck --- src/schema/skeleton.ts | 13 ++++++++++++- src/schema/tutorial.ts | 13 ++++++++++++- tests/parse.test.ts | 6 ++++++ typings/tutorial.d.ts | 7 ++++++- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/schema/skeleton.ts b/src/schema/skeleton.ts index 48c45c9..6c04ee8 100644 --- a/src/schema/skeleton.ts +++ b/src/schema/skeleton.ts @@ -80,7 +80,18 @@ export default { additionalProperties: false, required: ["uri", "branch"], }, - + reset: { + type: "object", + description: "Configuration options for resetting a tutorial", + properties: { + command: { + type: "string", + description: "An optional command to run on reset", + examples: ["npm install"], + }, + }, + additionalProperties: false, + }, dependencies: { type: "array", description: "A list of tutorial dependencies", diff --git a/src/schema/tutorial.ts b/src/schema/tutorial.ts index 14ffc33..58711f9 100644 --- a/src/schema/tutorial.ts +++ b/src/schema/tutorial.ts @@ -99,7 +99,18 @@ export default { additionalProperties: false, required: ["uri", "branch"], }, - + reset: { + type: "object", + description: "Configuration options for resetting a tutorial", + properties: { + command: { + type: "string", + description: "An optional command to run on reset", + examples: ["npm install"], + }, + }, + additionalProperties: false, + }, dependencies: { type: "array", description: "A list of tutorial dependencies", diff --git a/tests/parse.test.ts b/tests/parse.test.ts index 478918b..7164c3f 100644 --- a/tests/parse.test.ts +++ b/tests/parse.test.ts @@ -998,6 +998,9 @@ Description. uri: "https://path.to/repo", branch: "aBranch", }, + reset: { + command: "some command", + }, dependencies: [ { name: "node", @@ -1031,6 +1034,9 @@ Description. uri: "https://path.to/repo", branch: "aBranch", }, + reset: { + command: "some command", + }, dependencies: [ { name: "node", diff --git a/typings/tutorial.d.ts b/typings/tutorial.d.ts index f19830b..6ee6e5c 100644 --- a/typings/tutorial.d.ts +++ b/typings/tutorial.d.ts @@ -1,10 +1,15 @@ export type Maybe = T | null; +export type ConfigReset = { + command?: string; +}; + export type TutorialConfig = { - appVersions: TutorialAppVersions; + appVersions?: TutorialAppVersions; testRunner: TestRunnerConfig; repo: TutorialRepo; dependencies?: TutorialDependency[]; + reset?: ConfigReset; }; /** Logical groupings of tasks */