adapt-cli 3.0.11 → 3.1.1
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/lib/api.js +34 -0
- package/lib/integration/AdaptFramework/erase.js +2 -11
- package/package.json +1 -1
package/lib/api.js
CHANGED
@@ -64,6 +64,40 @@ class API {
|
|
64
64
|
})
|
65
65
|
}
|
66
66
|
|
67
|
+
/**
|
68
|
+
* Updates an existing installation of the framework
|
69
|
+
* @param {Object} options
|
70
|
+
* @param {string} [options.version=null] Specific version of the framework to install
|
71
|
+
* @param {string} [options.repository] URL to github repo
|
72
|
+
* @param {string} [options.cwd=process.cwd()] Directory to install into
|
73
|
+
* @return {Promise}
|
74
|
+
*/
|
75
|
+
async updateFramework ({
|
76
|
+
version = null,
|
77
|
+
repository = ADAPT_FRAMEWORK,
|
78
|
+
cwd = process.cwd(),
|
79
|
+
logger
|
80
|
+
} = {}) {
|
81
|
+
// cache state of plugins, as these will be wiped
|
82
|
+
const plugins = (await new Project({ cwd }).getInstallTargets())
|
83
|
+
.map(p => p.isLocalSource ? p.sourcePath : `${p.name}@${p.requestedVersion}`)
|
84
|
+
|
85
|
+
await this.installFramework({ version, repository, cwd, logger })
|
86
|
+
// restore plugins
|
87
|
+
await this.installPlugins({ plugins, cwd, logger })
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* @param {Object} options
|
92
|
+
* @param {string} [options.cwd=process.cwd()] Directory to install into
|
93
|
+
* @returns {string}
|
94
|
+
*/
|
95
|
+
getCurrentFrameworkVersion ({
|
96
|
+
cwd = process.cwd(),
|
97
|
+
} = {}) {
|
98
|
+
return new Project({ cwd }).version
|
99
|
+
}
|
100
|
+
|
67
101
|
/**
|
68
102
|
* @param {Object} options
|
69
103
|
* @param {Object} [options.repository=ADAPT_FRAMEWORK] The github repository url
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import chalk from 'chalk'
|
2
2
|
import fs from 'fs-extra'
|
3
3
|
import inquirer from 'inquirer'
|
4
|
-
import globs from 'globs'
|
5
4
|
import path from 'path'
|
6
5
|
|
7
6
|
export default async function erase ({
|
@@ -22,13 +21,5 @@ export default async function erase ({
|
|
22
21
|
}
|
23
22
|
}
|
24
23
|
logger?.log(chalk.cyan('deleting existing course'))
|
25
|
-
|
26
|
-
|
27
|
-
if (err) return reject(err)
|
28
|
-
resolve(files)
|
29
|
-
})
|
30
|
-
})
|
31
|
-
for (const file of files) {
|
32
|
-
await fs.rm(file, { recursive: true })
|
33
|
-
}
|
34
|
-
}
|
24
|
+
await fs.rm(cwd, { recursive: true })
|
25
|
+
}
|