adapt-cli 2.1.13 → 3.0.6
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/.bowerrc +2 -2
- package/.eslintignore +1 -0
- package/.eslintrc.json +14 -0
- package/.github/CONTRIBUTING.md +8 -0
- package/.github/ISSUE_TEMPLATE.md +17 -0
- package/.github/pull_request_template.md +25 -0
- package/.github/workflows/addtomainproject.yml +19 -0
- package/.github/workflows/releases.yml +25 -0
- package/.travis.yml +46 -46
- package/README.md +266 -266
- package/bin/adapt.js +3 -0
- package/json/help-create/component.json +9 -9
- package/json/help-create/course.json +9 -9
- package/json/help-create/question.json +9 -0
- package/json/help-create.json +12 -11
- package/json/help-devinstall.json +9 -9
- package/json/help-install.json +10 -10
- package/json/help-ls.json +7 -7
- package/json/help-register.json +7 -7
- package/json/help-rename.json +7 -7
- package/json/help-search.json +8 -8
- package/json/help-uninstall.json +7 -7
- package/json/help-unregister.json +8 -8
- package/json/help-update.json +12 -12
- package/json/help-version.json +7 -7
- package/json/help.json +19 -19
- package/lib/api.js +260 -0
- package/lib/cli.js +69 -52
- package/lib/commands/authenticate.js +18 -0
- package/lib/commands/create/component.js +64 -81
- package/lib/commands/create/course.js +26 -81
- package/lib/commands/create/question.js +18 -0
- package/lib/commands/create.js +94 -90
- package/lib/commands/devinstall.js +35 -97
- package/lib/commands/help.js +31 -52
- package/lib/commands/install.js +16 -907
- package/lib/commands/ls.js +9 -24
- package/lib/commands/register.js +11 -196
- package/lib/commands/rename.js +14 -129
- package/lib/commands/search.js +11 -29
- package/lib/commands/uninstall.js +9 -136
- package/lib/commands/unregister.js +12 -96
- package/lib/commands/update.js +12 -867
- package/lib/commands/version.js +13 -15
- package/lib/integration/AdaptFramework/build.js +42 -0
- package/lib/integration/AdaptFramework/clone.js +27 -0
- package/lib/integration/AdaptFramework/deleteSrcCore.js +9 -0
- package/lib/integration/AdaptFramework/deleteSrcCourse.js +9 -0
- package/lib/integration/AdaptFramework/download.js +21 -0
- package/lib/integration/AdaptFramework/erase.js +34 -0
- package/lib/integration/AdaptFramework/getLatestVersion.js +79 -0
- package/lib/integration/AdaptFramework/npmInstall.js +21 -0
- package/lib/integration/AdaptFramework.js +19 -0
- package/lib/integration/Plugin.js +404 -0
- package/lib/integration/PluginManagement/autenticate.js +56 -0
- package/lib/integration/PluginManagement/install.js +224 -0
- package/lib/integration/PluginManagement/print.js +52 -0
- package/lib/integration/PluginManagement/register.js +130 -0
- package/lib/integration/PluginManagement/rename.js +101 -0
- package/lib/integration/PluginManagement/schemas.js +8 -0
- package/lib/integration/PluginManagement/search.js +46 -0
- package/lib/integration/PluginManagement/uninstall.js +141 -0
- package/lib/integration/PluginManagement/unregister.js +101 -0
- package/lib/integration/PluginManagement/update.js +224 -0
- package/lib/integration/PluginManagement.js +21 -0
- package/lib/integration/Project.js +146 -0
- package/lib/integration/Target.js +299 -0
- package/lib/integration/getBowerRegistryConfig.js +34 -0
- package/lib/logger.js +28 -0
- package/lib/util/JSONReadValidate.js +34 -0
- package/lib/util/constants.js +38 -0
- package/lib/util/createPromptTask.js +7 -0
- package/lib/util/download.js +45 -0
- package/lib/util/errors.js +58 -0
- package/lib/util/extract.js +24 -0
- package/lib/util/getDirNameFromImportMeta.js +6 -0
- package/lib/util/promises.js +36 -0
- package/package.json +74 -49
- package/TESTING.md +0 -25
- package/bin/adapt +0 -3
- package/gruntfile.js +0 -18
- package/lib/AdaptConsoleApplication.js +0 -19
- package/lib/CommandParser.js +0 -19
- package/lib/CommandTranslator.js +0 -16
- package/lib/ConsoleRenderer.js +0 -10
- package/lib/Constants.js +0 -68
- package/lib/JsonLoader.js +0 -40
- package/lib/JsonWriter.js +0 -21
- package/lib/PackageMeta.js +0 -41
- package/lib/Plugin.js +0 -53
- package/lib/PluginTypeResolver.js +0 -47
- package/lib/Project.js +0 -89
- package/lib/RendererHelpers.js +0 -41
- package/lib/RepositoryDownloader.js +0 -64
- package/lib/Slug.js +0 -5
- package/lib/VersionChecker.js +0 -7
- package/lib/commands/create/index.js +0 -6
- package/lib/commands/index.js +0 -16
- package/lib/commands/install/InstallLog.js +0 -32
- package/lib/commands/install/InstallTarget.js +0 -259
- package/lib/commands/install/extend.js +0 -31
- package/lib/download.js +0 -101
- package/lib/errors.js +0 -58
- package/lib/promise/authenticate.js +0 -58
- package/lib/promise/build.js +0 -20
- package/lib/promise/cloneInstall.js +0 -35
- package/lib/promise/confirmBuild.js +0 -6
- package/lib/promise/exec.js +0 -39
- package/lib/promise/getRepository.js +0 -26
- package/lib/promise/highest.js +0 -109
- package/lib/promise/install.js +0 -31
- package/lib/promise/installAdaptDependencies.js +0 -30
- package/lib/promise/installNodeDependencies.js +0 -28
- package/lib/promise/removeTemporaryDownload.js +0 -8
- package/lib/promise/replaceTextContent.js +0 -10
- package/lib/promise/uninstallPackage.js +0 -15
- package/lib/promise/update.js +0 -33
- package/lib/promise/util.js +0 -16
- package/test/fixtures/adapt-with-plugins.json +0 -6
- package/test/specs/command_translation_concerns.js +0 -13
- package/test/specs/create_command_concerns.js +0 -22
- package/test/specs/create_concerns.js +0 -30
- package/test/specs/install_concerns.js +0 -31
- package/test/specs/installing_compatible_plugins_concerns.js +0 -126
- package/test/specs/installing_incompatible_plugins_concerns.js +0 -103
- package/test/specs/ls_concerns.js +0 -28
- package/test/specs/plugin_name_concerns.js +0 -82
- package/test/specs/project_concerns.js +0 -128
- package/test/specs/registration_concerns.js +0 -31
- package/test/specs/repository_downloader_concerns.js +0 -55
- package/test/specs/search_concerns.js +0 -30
- package/test/specs/type_resolution_concerns.js +0 -71
- package/test/specs/uninstall_command_concerns.js +0 -64
- package/test/specs/uninstall_concerns.js +0 -31
@@ -0,0 +1,34 @@
|
|
1
|
+
import fs from 'fs-extra'
|
2
|
+
import { findUpSync } from 'find-up'
|
3
|
+
|
4
|
+
export default function getBowerRegistryConfig ({ cwd = process.cwd() } = {}) {
|
5
|
+
function getConfig () {
|
6
|
+
if (process.env.ADAPT_REGISTRY) {
|
7
|
+
return process.env.ADAPT_REGISTRY
|
8
|
+
}
|
9
|
+
const configPath = findUpSync('.bowerrc', { cwd })
|
10
|
+
if (configPath) {
|
11
|
+
// a manifest exists, load it
|
12
|
+
const config = fs.readJSONSync(configPath)
|
13
|
+
return config.registry
|
14
|
+
}
|
15
|
+
// use the default Adapt registry
|
16
|
+
return 'http://adapt-bower-repository.herokuapp.com/'
|
17
|
+
}
|
18
|
+
// normalize to https://github.com/bower/spec/blob/master/config.md
|
19
|
+
const config = getConfig()
|
20
|
+
let normalized = {}
|
21
|
+
switch (typeof config) {
|
22
|
+
case 'string':
|
23
|
+
normalized = {
|
24
|
+
register: config,
|
25
|
+
search: [config]
|
26
|
+
}
|
27
|
+
break
|
28
|
+
case 'object':
|
29
|
+
Object.assign(normalized, config)
|
30
|
+
break
|
31
|
+
}
|
32
|
+
if (typeof normalized.search === 'string') normalized.search = [normalized.search].filter(Boolean)
|
33
|
+
return normalized
|
34
|
+
}
|
package/lib/logger.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
import readline from 'readline'
|
2
|
+
import chalk from 'chalk'
|
3
|
+
|
4
|
+
export default {
|
5
|
+
isLoggingProgress: false,
|
6
|
+
logProgress (...args) {
|
7
|
+
this.isLoggingProgress = true
|
8
|
+
readline.cursorTo(process.stdout, 0)
|
9
|
+
this.write(args.join(' '))
|
10
|
+
},
|
11
|
+
warn (...args) {
|
12
|
+
chalk.yellow(...args)
|
13
|
+
},
|
14
|
+
error (...args) {
|
15
|
+
chalk.red(...args)
|
16
|
+
},
|
17
|
+
log (...args) {
|
18
|
+
if (this.isLoggingProgress) {
|
19
|
+
this.isLoggingProgress = false
|
20
|
+
readline.cursorTo(process.stdout, 0)
|
21
|
+
this.write(args.join(' '))
|
22
|
+
this.write('\n')
|
23
|
+
return
|
24
|
+
}
|
25
|
+
console.log.apply(console, args)
|
26
|
+
},
|
27
|
+
write: process.stdout.write.bind(process.stdout)
|
28
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import fs from 'fs-extra'
|
2
|
+
import JSONLint from 'json-lint'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @param {string} filepath
|
6
|
+
* @param {function} [done]
|
7
|
+
* @returns {Promise}
|
8
|
+
*/
|
9
|
+
export async function readValidateJSON (filepath, done) {
|
10
|
+
try {
|
11
|
+
const data = await fs.readFile(filepath, 'utf8')
|
12
|
+
validateJSON(data, filepath)
|
13
|
+
done?.(null, JSON.parse(data))
|
14
|
+
return JSON.parse(data)
|
15
|
+
} catch (err) {
|
16
|
+
done?.(err.message)
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
export function readValidateJSONSync (filepath) {
|
21
|
+
const data = fs.readFileSync(filepath, 'utf-8')
|
22
|
+
validateJSON(data, filepath)
|
23
|
+
return JSON.parse(data)
|
24
|
+
}
|
25
|
+
|
26
|
+
function validateJSON (jsonData, filepath) {
|
27
|
+
const lint = JSONLint(jsonData)
|
28
|
+
if (!lint.error) return
|
29
|
+
let errorMessage = 'JSON parsing error: ' + lint.error + ', line: ' + lint.line + ', character: ' + lint.character
|
30
|
+
if (filepath) {
|
31
|
+
errorMessage += ', file: \'' + filepath + '\''
|
32
|
+
}
|
33
|
+
throw new Error(errorMessage)
|
34
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import fs from 'fs-extra'
|
2
|
+
|
3
|
+
export const ADAPT_ALLOW_PRERELEASE = process.env.ADAPT_ALLOW_PRERELEASE !== 'false'
|
4
|
+
|
5
|
+
export const ADAPT_FRAMEWORK = process.env.ADAPT_FRAMEWORK || 'https://github.com/adaptlearning/adapt_framework'
|
6
|
+
|
7
|
+
export const ADAPT_COMPONENT = process.env.ADAPT_COMPONENT || 'https://github.com/adaptlearning/adapt-component'
|
8
|
+
|
9
|
+
export const ADAPT_QUESTION = process.env.ADAPT_QUESTION || 'https://github.com/adaptlearning/adapt-questionComponent'
|
10
|
+
|
11
|
+
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'
|
12
|
+
|
13
|
+
export const HOME_DIRECTORY = [
|
14
|
+
process.env.HOME,
|
15
|
+
(process.env.HOMEDRIVE + process.env.HOMEPATH),
|
16
|
+
process.env.USERPROFILE,
|
17
|
+
'/tmp',
|
18
|
+
'/temp'
|
19
|
+
].filter(fs.existsSync)[0]
|
20
|
+
|
21
|
+
/** @type {string} */
|
22
|
+
export const PLUGIN_TYPES = [
|
23
|
+
'component',
|
24
|
+
'extension',
|
25
|
+
'menu',
|
26
|
+
'theme'
|
27
|
+
]
|
28
|
+
|
29
|
+
/** @type {Object} */
|
30
|
+
export const PLUGIN_TYPE_FOLDERS = {
|
31
|
+
component: 'components',
|
32
|
+
extension: 'extensions',
|
33
|
+
menu: 'menu',
|
34
|
+
theme: 'theme'
|
35
|
+
}
|
36
|
+
|
37
|
+
/** @type {string} */
|
38
|
+
export const PLUGIN_DEFAULT_TYPE = PLUGIN_TYPES[0]
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import chalk from 'chalk'
|
2
|
+
import uuid from 'uuid'
|
3
|
+
import fs from 'fs-extra'
|
4
|
+
import path from 'path'
|
5
|
+
import urljoin from 'url-join'
|
6
|
+
import fetch from 'download'
|
7
|
+
import { HOME_DIRECTORY } from './constants.js'
|
8
|
+
import gh from 'parse-github-url'
|
9
|
+
|
10
|
+
export default async function download ({
|
11
|
+
repository,
|
12
|
+
branch,
|
13
|
+
tmp,
|
14
|
+
cwd,
|
15
|
+
logger
|
16
|
+
} = {}) {
|
17
|
+
if (!branch && !repository) throw new Error('Repository details are required.')
|
18
|
+
const repositoryName = gh(repository).name
|
19
|
+
logger?.write(chalk.cyan(`downloading ${repositoryName} to ${cwd}\t`))
|
20
|
+
tmp = (tmp || path.join(HOME_DIRECTORY, '.adapt', 'tmp', uuid.v1()))
|
21
|
+
const downloadFileName = await new Promise((resolve, reject) => {
|
22
|
+
let downloadFileName = ''
|
23
|
+
const url = urljoin(repository, 'archive', branch + '.zip')
|
24
|
+
fetch(url, tmp, {
|
25
|
+
extract: true
|
26
|
+
})
|
27
|
+
.on('response', response => {
|
28
|
+
const disposition = response.headers['content-disposition']
|
29
|
+
if (disposition?.indexOf('attachment') === -1) return
|
30
|
+
const regex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/
|
31
|
+
const matches = regex.exec(disposition)
|
32
|
+
if (!matches?.[1]) return
|
33
|
+
downloadFileName = matches[1].replace(/['"]/g, '')
|
34
|
+
})
|
35
|
+
.on('error', reject)
|
36
|
+
.then(() => resolve(downloadFileName))
|
37
|
+
})
|
38
|
+
const sourceFileName = downloadFileName
|
39
|
+
? path.parse(downloadFileName).name
|
40
|
+
: `${repositoryName}-${branch}`
|
41
|
+
const sourcePath = path.join(tmp, sourceFileName)
|
42
|
+
await fs.copy(sourcePath, cwd)
|
43
|
+
await fs.rm(tmp, { recursive: true })
|
44
|
+
logger?.log(' ', 'done!')
|
45
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
export default {
|
2
|
+
ERROR_COURSE_DIR: {
|
3
|
+
code: 0,
|
4
|
+
message: 'Commands must be run in an Adapt project directory'
|
5
|
+
},
|
6
|
+
ERROR_INCOMPATIBLE_VALID_REQUEST: {
|
7
|
+
code: 1,
|
8
|
+
message: 'No compatible version exists (requested version is valid)'
|
9
|
+
},
|
10
|
+
ERROR_INCOMPATIBLE_BAD_REQUEST: {
|
11
|
+
code: 2,
|
12
|
+
message: 'No compatible version exists (requested version is invalid)'
|
13
|
+
},
|
14
|
+
ERROR_INCOMPATIBLE: {
|
15
|
+
code: 3,
|
16
|
+
message: 'No compatible version exists'
|
17
|
+
},
|
18
|
+
ERROR_COMPATIBLE_INC_REQUEST: {
|
19
|
+
code: 4,
|
20
|
+
message: 'Incompatible version requested (compatible version exists)'
|
21
|
+
},
|
22
|
+
ERROR_COMPATIBLE_BAD_REQUEST: {
|
23
|
+
code: 5,
|
24
|
+
message: 'Requested version is invalid'
|
25
|
+
},
|
26
|
+
ERROR_UNINSTALL: {
|
27
|
+
code: 6,
|
28
|
+
message: 'The plugin could not be uninstalled'
|
29
|
+
},
|
30
|
+
ERROR_NOT_FOUND: {
|
31
|
+
code: 7,
|
32
|
+
message: 'The plugin could not be found'
|
33
|
+
},
|
34
|
+
ERROR_NOTHING_TO_UPDATE: {
|
35
|
+
code: 8,
|
36
|
+
message: 'Could not resolve any plugins to update'
|
37
|
+
},
|
38
|
+
ERROR_UPDATE_INCOMPATIBLE: {
|
39
|
+
code: 9,
|
40
|
+
message: 'Incompatible update requested'
|
41
|
+
},
|
42
|
+
ERROR_INSTALL_ERROR: {
|
43
|
+
code: 10,
|
44
|
+
message: 'Unknown installation error'
|
45
|
+
},
|
46
|
+
ERROR_UPDATE_ERROR: {
|
47
|
+
code: 11,
|
48
|
+
message: 'Unknown update error'
|
49
|
+
},
|
50
|
+
ERROR_NO_RELEASES: {
|
51
|
+
code: 12,
|
52
|
+
message: 'No published releases'
|
53
|
+
},
|
54
|
+
ERROR_NO_UPDATE: {
|
55
|
+
code: 13,
|
56
|
+
message: 'No update available'
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import uuid from 'uuid'
|
2
|
+
import path from 'path'
|
3
|
+
import decompress from 'decompress'
|
4
|
+
import { HOME_DIRECTORY } from './constants.js'
|
5
|
+
|
6
|
+
export default async function extract ({
|
7
|
+
sourcePath,
|
8
|
+
cwd
|
9
|
+
} = {}) {
|
10
|
+
const rootPath = path.join(HOME_DIRECTORY, '.adapt', 'tmp', uuid.v1()).replace(/\\/g, '/')
|
11
|
+
const files = await decompress(path.join(cwd, sourcePath), rootPath, {
|
12
|
+
filter: file => !file.path.endsWith('/')
|
13
|
+
})
|
14
|
+
const rootDirectories = Object.keys(files.reduce((memo, file) => { memo[file.path.split(/\\|\//g)[0]] = true; return memo }, {}))
|
15
|
+
let copyPath = rootPath
|
16
|
+
if (rootDirectories.length === 1) {
|
17
|
+
const rootDirectory = files[0].path.split(/\\|\//g)[0]
|
18
|
+
copyPath = path.join(rootPath, rootDirectory)
|
19
|
+
}
|
20
|
+
return {
|
21
|
+
rootPath,
|
22
|
+
copyPath
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { eachOfLimit, eachOfSeries } from 'async'
|
2
|
+
/**
|
3
|
+
* Execute all promises in parallel, call progress at each promise to allow
|
4
|
+
* progress reporting
|
5
|
+
* @param {Array} array
|
6
|
+
* @param {function} iterator
|
7
|
+
* @param {function} progress
|
8
|
+
* @returns
|
9
|
+
*/
|
10
|
+
export async function eachOfLimitProgress (array, iterator, progress) {
|
11
|
+
let currentIndex = 0
|
12
|
+
progress(0)
|
13
|
+
await eachOfLimit(array, 8, async item => {
|
14
|
+
currentIndex++
|
15
|
+
progress(parseInt((currentIndex * 100) / array.length))
|
16
|
+
return iterator(item)
|
17
|
+
})
|
18
|
+
}
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Execute iterator against each item in the array waiting for the iterator returned
|
22
|
+
* to finish before continuing, calling progress as each stage
|
23
|
+
* @param {Array} array
|
24
|
+
* @param {function} iterator
|
25
|
+
* @param {function} progress
|
26
|
+
* @returns
|
27
|
+
*/
|
28
|
+
export async function eachOfSeriesProgress (array, iterator, progress) {
|
29
|
+
let currentIndex = 0
|
30
|
+
progress(0)
|
31
|
+
await eachOfSeries(array, async item => {
|
32
|
+
currentIndex++
|
33
|
+
progress(parseInt((currentIndex * 100) / array.length))
|
34
|
+
return iterator(item)
|
35
|
+
})
|
36
|
+
}
|
package/package.json
CHANGED
@@ -1,49 +1,74 @@
|
|
1
|
-
{
|
2
|
-
"name": "adapt-cli",
|
3
|
-
"version": "
|
4
|
-
"description": "Command line tools for Adapt",
|
5
|
-
"main": "./lib/
|
6
|
-
"
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"inquirer": "^7.3.3",
|
18
|
-
"json-lint": "^0.1.0",
|
19
|
-
"lodash": "^4.17.
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
25
|
-
"
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
37
|
-
"
|
38
|
-
|
39
|
-
|
40
|
-
"
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
"
|
47
|
-
"
|
48
|
-
|
49
|
-
|
1
|
+
{
|
2
|
+
"name": "adapt-cli",
|
3
|
+
"version": "3.0.6",
|
4
|
+
"description": "Command line tools for Adapt",
|
5
|
+
"main": "./lib/api.js",
|
6
|
+
"type": "module",
|
7
|
+
"dependencies": {
|
8
|
+
"async": "^3.2.3",
|
9
|
+
"bower": "^1.8.13",
|
10
|
+
"bower-endpoint-parser": "^0.2.2",
|
11
|
+
"chalk": "^2.4.1",
|
12
|
+
"decompress": "^4.2.1",
|
13
|
+
"download": "^7.1.0",
|
14
|
+
"find-up": "^6.2.0",
|
15
|
+
"fs-extra": "^10.0.0",
|
16
|
+
"globs": "^0.1.4",
|
17
|
+
"inquirer": "^7.3.3",
|
18
|
+
"json-lint": "^0.1.0",
|
19
|
+
"lodash-es": "^4.17.21",
|
20
|
+
"parse-github-url": "^1.0.2",
|
21
|
+
"request": "^2.88.0",
|
22
|
+
"semver": "^7.3.5",
|
23
|
+
"speakingurl": "^14.0.1",
|
24
|
+
"url-join": "^4.0.0",
|
25
|
+
"uuid": "^3.3.2"
|
26
|
+
},
|
27
|
+
"license": "GPL-3.0",
|
28
|
+
"preferGlobal": true,
|
29
|
+
"bin": {
|
30
|
+
"adapt": "./bin/adapt.js"
|
31
|
+
},
|
32
|
+
"devDependencies": {
|
33
|
+
"eslint": "^7.31.0",
|
34
|
+
"eslint-config-standard": "^16.0.3",
|
35
|
+
"eslint-plugin-import": "^2.23.4",
|
36
|
+
"eslint-plugin-node": "^11.1.0",
|
37
|
+
"eslint-plugin-promise": "^5.1.0",
|
38
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
39
|
+
"@semantic-release/git": "^10.0.1",
|
40
|
+
"@semantic-release/github": "^8.0.5",
|
41
|
+
"@semantic-release/npm": "^9.0.1",
|
42
|
+
"@semantic-release/release-notes-generator": "^10.0.3",
|
43
|
+
"conventional-changelog-eslint": "^3.0.9",
|
44
|
+
"semantic-release": "^19.0.3"
|
45
|
+
},
|
46
|
+
"release": {
|
47
|
+
"plugins": [
|
48
|
+
[
|
49
|
+
"@semantic-release/commit-analyzer",
|
50
|
+
{
|
51
|
+
"preset": "eslint"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
[
|
55
|
+
"@semantic-release/release-notes-generator",
|
56
|
+
{
|
57
|
+
"preset": "eslint"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"@semantic-release/npm",
|
61
|
+
"@semantic-release/github",
|
62
|
+
[
|
63
|
+
"@semantic-release/git",
|
64
|
+
{
|
65
|
+
"assets": [
|
66
|
+
"package.json",
|
67
|
+
"bower.json"
|
68
|
+
],
|
69
|
+
"message": "Chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
]
|
73
|
+
}
|
74
|
+
}
|
package/TESTING.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
### Instructions for testing the adapt-cli update command
|
2
|
-
|
3
|
-
- Use the current LTS version of Node (v8.11.1) as per the [guidance](https://github.com/adaptlearning/adapt_framework/wiki/Setting-up-your-development-environment). Don’t forget to have `grunt` installed globally (`npm install –g grunt-cli`) when you install a new version of Node.
|
4
|
-
- Install globally the latest pre-release of adapt-cli (`npm install -g adapt-cli@next`)
|
5
|
-
- Select an Adapt project to test against. At this point you may find it useful to add the contents of the Adapt installation to version control if you haven't already. This will allow you test the functionality and be able to see easily any changes made to the file system and also be able to revert changes and test alternative commands.
|
6
|
-
- Run `adapt help update` for guidance using the `update` command and for command syntax.
|
7
|
-
- Now run `adapt update`. If you installed the latest version of the framework together with all the latest plugins there should not have been any changes to the installed plugins and you will see a summary of your installed plugins.
|
8
|
-
- You can add the `--check` option to review installed plugins without making changes. For each plugin the output will give its name, the version installed and indicate whether the plugin can be updated.
|
9
|
-
- The update can be limited to specific plugins by providing their names, or to specific groups of plugins by specifying one or more of `components`, `extensions`, `menu`, `theme`.
|
10
|
-
- Attempt to install different versions of various plugins; e.g. `adapt update adapt-contrib-media@>=3`. Observe the changes (if any).
|
11
|
-
- Explore different scenarios; for example updating multiple plugins or groups of plugins together, try different semver ranges and also try the above with older versions of the Adapt framework.
|
12
|
-
|
13
|
-
### Important Notes
|
14
|
-
|
15
|
-
The outcome of an `update` command ensures that all updated plugins reflect the requested versions held on the server. As such **any local changes will be overwritten**.
|
16
|
-
|
17
|
-
The `update` command does **not** use or modify the Adapt manifest (`adapt.json`).
|
18
|
-
|
19
|
-
Occasionally the command may report that one or more plugins cannot be found at the repository. This is a known limitation. The command will attempt to query the repository mulitple times before giving up. The issue is usually resolved by running the command again.
|
20
|
-
|
21
|
-
### Issue logging
|
22
|
-
|
23
|
-
Log issues to the adapt-cli [issue list](https://github.com/adaptlearning/adapt-cli/issues) on GitHub. Please check the list before submission to see if the issue has already been reported.
|
24
|
-
|
25
|
-
As always please report any problems with full steps to reproduce; including what version of Adapt you are using, list of plugins being updated (giving current and target version numbers), the `update` command, the environment (platform, version of Node etc) and of course the error (with stack trace if available).
|
package/bin/adapt
DELETED
package/gruntfile.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module.exports = function(grunt) {
|
2
|
-
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
|
3
|
-
|
4
|
-
grunt.initConfig({
|
5
|
-
pkg: grunt.file.readJSON('package.json'),
|
6
|
-
mochaTest: {
|
7
|
-
test: {
|
8
|
-
options: {
|
9
|
-
reporter: 'spec'
|
10
|
-
},
|
11
|
-
src: ['test/specs/**/*.js']
|
12
|
-
}
|
13
|
-
}
|
14
|
-
});
|
15
|
-
|
16
|
-
grunt.registerTask('default', ['mochaTest']);
|
17
|
-
grunt.registerTask('test', ['mochaTest']);
|
18
|
-
};
|
@@ -1,19 +0,0 @@
|
|
1
|
-
var AdaptConsoleApplication = function (commands, renderer) {
|
2
|
-
this.renderer = renderer || require('./ConsoleRenderer');
|
3
|
-
this.commands = commands;
|
4
|
-
};
|
5
|
-
|
6
|
-
AdaptConsoleApplication.prototype.do = function (command, done) {
|
7
|
-
done = done || function () {};
|
8
|
-
|
9
|
-
if(!this.commands.hasOwnProperty(command.name)) {
|
10
|
-
var e = new Error('Unknown command "' + command.name + '", please check the documentation.');
|
11
|
-
this.renderer.log(e.message);
|
12
|
-
done(e);
|
13
|
-
}
|
14
|
-
|
15
|
-
var commandArguments = [this.renderer].concat(command.parameters).concat([done]);
|
16
|
-
this.commands[command.name].apply(this.commands, commandArguments);
|
17
|
-
};
|
18
|
-
|
19
|
-
module.exports = AdaptConsoleApplication;
|
package/lib/CommandParser.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
var delimiter = ',',
|
3
|
-
CommandTranslator = require('./CommandTranslator'),
|
4
|
-
CommandParser = function (argv) {
|
5
|
-
argv = argv || ['node', 'path'];
|
6
|
-
this.parameters = CommandTranslator(argv.slice(2));
|
7
|
-
if(this.parameters.length) {
|
8
|
-
this.name = String.prototype.toLowerCase.call(this.parameters.shift());
|
9
|
-
}
|
10
|
-
};
|
11
|
-
|
12
|
-
CommandParser.prototype.param = function (index) {
|
13
|
-
if(index >= this.parameters.length)
|
14
|
-
return undefined;
|
15
|
-
|
16
|
-
return this.parameters[index];
|
17
|
-
};
|
18
|
-
|
19
|
-
module.exports = CommandParser;
|
package/lib/CommandTranslator.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
var _ = require('lodash'),
|
2
|
-
translationTable = [
|
3
|
-
{ pattern: /^-v$|^--version$/i, replacement: 'version' },
|
4
|
-
{ pattern: /^upgrade$/i, replacement: 'update' }
|
5
|
-
],
|
6
|
-
CommandTranslator = function (parameters) {
|
7
|
-
parameters = Array.isArray(parameters) ? parameters : [parameters];
|
8
|
-
return parameters.map(function (param) {
|
9
|
-
var translation = _.find(translationTable, function (item) {
|
10
|
-
return item.pattern.test(param);
|
11
|
-
});
|
12
|
-
return translation ? translation.replacement : param;
|
13
|
-
});
|
14
|
-
};
|
15
|
-
|
16
|
-
module.exports = CommandTranslator;
|
package/lib/ConsoleRenderer.js
DELETED
package/lib/Constants.js
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
var bower = require('bower'),
|
2
|
-
fs = require('fs'),
|
3
|
-
path = require('path');
|
4
|
-
|
5
|
-
module.exports = {
|
6
|
-
ManifestFilename: 'adapt.json',
|
7
|
-
FrameworkFilename: 'package.json',
|
8
|
-
DefaultProjectManifestPath: './adapt.json',
|
9
|
-
DefaultProjectFrameworkPath: './package.json',
|
10
|
-
DefaultCreateType : 'course',
|
11
|
-
DefaultTypeNames : {
|
12
|
-
'course':'my-adapt-course',
|
13
|
-
'component':'my-adapt-component'
|
14
|
-
},
|
15
|
-
DefaultUserAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36',
|
16
|
-
DefaultGitHubOrg: 'adaptlearning',
|
17
|
-
FrameworkRepository : process.env.ADAPT_FRAMEWORK || 'https://github.com/adaptlearning/adapt_framework',
|
18
|
-
FrameworkRepositoryName : 'adapt_framework',
|
19
|
-
ComponentRepository : process.env.ADAPT_COMPONENT || 'https://github.com/adaptlearning/adapt-component',
|
20
|
-
ComponentRepositoryName : 'adapt-component',
|
21
|
-
HomeDirectory : searchForHome(),
|
22
|
-
getRegistry:getRegistry,
|
23
|
-
setCwd: setCwd,
|
24
|
-
cwd: '.'
|
25
|
-
};
|
26
|
-
|
27
|
-
var registry = null;
|
28
|
-
|
29
|
-
function searchForHome() {
|
30
|
-
var locations = [
|
31
|
-
process.env.HOME,
|
32
|
-
(process.env.HOMEDRIVE + process.env.HOMEPATH),
|
33
|
-
process.env.USERPROFILE,
|
34
|
-
'/tmp',
|
35
|
-
'/temp',
|
36
|
-
];
|
37
|
-
var validLocations = locations.filter(fs.existsSync);
|
38
|
-
return validLocations[0];
|
39
|
-
}
|
40
|
-
|
41
|
-
function getRegistry() {
|
42
|
-
if (registry !== null) {
|
43
|
-
return registry;
|
44
|
-
}
|
45
|
-
|
46
|
-
if (process.env.ADAPT_REGISTRY) {
|
47
|
-
registry = process.env.ADAPT_REGISTRY;
|
48
|
-
|
49
|
-
} else if (fs.existsSync(path.join(this.cwd, './.bowerrc'))) {
|
50
|
-
// a manifest exists; let bower determine the registry
|
51
|
-
registry = undefined;
|
52
|
-
|
53
|
-
} else {
|
54
|
-
// use the default Adapt registry
|
55
|
-
registry = 'http://adapt-bower-repository.herokuapp.com/';
|
56
|
-
}
|
57
|
-
|
58
|
-
return registry;
|
59
|
-
}
|
60
|
-
|
61
|
-
function setCwd(cwd) {
|
62
|
-
if (!cwd) return;
|
63
|
-
|
64
|
-
this.cwd = cwd;
|
65
|
-
|
66
|
-
this.DefaultProjectManifestPath = path.join(this.cwd, this.ManifestFilename);
|
67
|
-
this.DefaultProjectFrameworkPath = path.join(this.cwd, this.FrameworkFilename);
|
68
|
-
}
|