UNPKG

1.58 kBJavaScriptView Raw
1const client = require('../lib/core');
2
3describe('client core module test ', () => {
4 it('1. get plugins folder and name', () => {
5
6 // client.loaderInstalledPlugin();
7 })
8
9 it('2. excute dintalk command createGenerator', () => {
10 client.createGenerator({
11 /**
12 * configuring 配置模板目录 和 输出目录
13 * @param {string} origin 当前模板目录
14 * @param {string} target 输出模板目录
15 */
16 async configuring() {
17 return { origin: './test/plugin-test-template', target: './test/app-test'}
18 },
19
20 /**
21 * writing 拷贝文件以及处理模板文件
22 * @example
23 * this.fs.copy(source, target);
24 * this.fs.copyTpl(source, target, TemplateData)
25 *
26 * @see https://github.com/SBoudrias/mem-fs-editor
27 */
28 async writing() {
29 client.fs.copy(client.templatePath('/Users/matrix/Documents/dingding/ddt/ding-solution/tools/client-cli/lib/generator/plugin-template/*'), client.destinationPath('src'))
30 },
31
32 /**
33 * install 安装依赖 yarn, tnpm, npm
34 *
35 * @example
36 * this.tnpmInstall();
37 * this.yarnInstall();
38 * this.npmInstall();
39 */
40 async install() {
41 this.tnpmInstall();
42 },
43
44 /**
45 * end 最后操作,运行命令
46 *
47 * @example
48 * this.spawnCommand('tnpm', ['run', 'start'])
49 */
50 async end() {
51 this.spawnCommand('tnpm', ['run', 'start']);
52 this.log.success('generator finish...');
53 }
54
55 })
56 });
57
58
59})