Skip to content

Commit 84eb132

Browse files
authored
Fix: Added missing adapt create extension (fixes #216) (#218)
1 parent 7aaacaf commit 84eb132

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

lib/commands/create.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import inquirer from 'inquirer'
22
import component from './create/component.js'
33
import question from './create/question.js'
4+
import extension from './create/extension.js'
45
import course from './create/course.js'
56
import { ADAPT_FRAMEWORK } from '../util/constants.js'
67
import { getLatestVersion as getAdaptLatestVersion } from '../integration/AdaptFramework.js'
78

89
const subTasks = {
910
component,
1011
question,
12+
extension,
1113
course
1214
}
1315

@@ -17,7 +19,8 @@ const subTasks = {
1719
export const DEFAULT_TYPE_NAME = {
1820
course: 'my-adapt-course',
1921
component: 'myAdaptComponent',
20-
question: 'myAdaptQuestion'
22+
question: 'myAdaptQuestion',
23+
extension: 'myAdaptExtension'
2124
}
2225

2326
export default async function create (logger, type = 'course', name, branch, bypassPrompts) {
@@ -55,7 +58,7 @@ async function confirmOptions ({ logger, type, name, branch }) {
5558
const typeSchema = [
5659
{
5760
name: 'type',
58-
choices: ['course', 'component', 'question'],
61+
choices: ['course', 'component', 'question', 'extension'],
5962
type: 'list',
6063
default: type
6164
}

lib/commands/create/extension.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import component from 'adapt-cli/lib/commands/create/component.js'
2+
import { ADAPT_EXTENSION } from 'adapt-cli/lib/util/constants.js'
3+
4+
export default async function extension ({
5+
name,
6+
repository = ADAPT_EXTENSION,
7+
cwd,
8+
branch,
9+
logger
10+
}) {
11+
return component({
12+
name,
13+
repository,
14+
cwd,
15+
branch,
16+
logger
17+
})
18+
}

lib/util/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const ADAPT_COMPONENT = process.env.ADAPT_COMPONENT || 'https://github.co
88

99
export const ADAPT_QUESTION = process.env.ADAPT_QUESTION || 'https://github.com/adaptlearning/adapt-questionComponent'
1010

11+
export const ADAPT_EXTENSION = process.env.ADAPT_EXTENSION || 'https://github.com/adaptlearning/adapt-extension'
12+
1113
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'
1214

1315
export const HOME_DIRECTORY = [

0 commit comments

Comments
 (0)