From eff45d943d62a738fb167648fa7de9d9694193ae Mon Sep 17 00:00:00 2001 From: Oliver Foster Date: Tue, 4 Mar 2025 10:50:56 +0000 Subject: [PATCH] Fix: Added missing adapt create extension (fixes #216) --- lib/commands/create.js | 7 +++++-- lib/commands/create/extension.js | 18 ++++++++++++++++++ lib/util/constants.js | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 lib/commands/create/extension.js diff --git a/lib/commands/create.js b/lib/commands/create.js index f491000..5219744 100644 --- a/lib/commands/create.js +++ b/lib/commands/create.js @@ -1,6 +1,7 @@ import inquirer from 'inquirer' import component from './create/component.js' import question from './create/question.js' +import extension from './create/extension.js' import course from './create/course.js' import { ADAPT_FRAMEWORK } from '../util/constants.js' import { getLatestVersion as getAdaptLatestVersion } from '../integration/AdaptFramework.js' @@ -8,6 +9,7 @@ import { getLatestVersion as getAdaptLatestVersion } from '../integration/AdaptF const subTasks = { component, question, + extension, course } @@ -17,7 +19,8 @@ const subTasks = { export const DEFAULT_TYPE_NAME = { course: 'my-adapt-course', component: 'myAdaptComponent', - question: 'myAdaptQuestion' + question: 'myAdaptQuestion', + extension: 'myAdaptExtension' } export default async function create (logger, type = 'course', name, branch, bypassPrompts) { @@ -55,7 +58,7 @@ async function confirmOptions ({ logger, type, name, branch }) { const typeSchema = [ { name: 'type', - choices: ['course', 'component', 'question'], + choices: ['course', 'component', 'question', 'extension'], type: 'list', default: type } diff --git a/lib/commands/create/extension.js b/lib/commands/create/extension.js new file mode 100644 index 0000000..bebf9a4 --- /dev/null +++ b/lib/commands/create/extension.js @@ -0,0 +1,18 @@ +import component from 'adapt-cli/lib/commands/create/component.js' +import { ADAPT_EXTENSION } from 'adapt-cli/lib/util/constants.js' + +export default async function extension ({ + name, + repository = ADAPT_EXTENSION, + cwd, + branch, + logger +}) { + return component({ + name, + repository, + cwd, + branch, + logger + }) +} diff --git a/lib/util/constants.js b/lib/util/constants.js index bbd4d23..c63876a 100644 --- a/lib/util/constants.js +++ b/lib/util/constants.js @@ -8,6 +8,8 @@ export const ADAPT_COMPONENT = process.env.ADAPT_COMPONENT || 'https://github.co export const ADAPT_QUESTION = process.env.ADAPT_QUESTION || 'https://github.com/adaptlearning/adapt-questionComponent' +export const ADAPT_EXTENSION = process.env.ADAPT_EXTENSION || 'https://github.com/adaptlearning/adapt-extension' + export const ADAPT_DEFAULT_USER_AGENT = process.env.ADAPT_DEFAULT_USER_AGENT || 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36' export const HOME_DIRECTORY = [