@lakutata/cli 1.0.21 → 1.0.24
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/build/CLI.js +9 -4
- package/build/CLI.js.map +1 -1
- package/build/Deploy.js +49 -42
- package/build/Deploy.js.map +1 -1
- package/build/constants/GitIgnore.js +4 -1
- package/build/constants/GitIgnore.js.map +1 -1
- package/build/constants/LicenseList.js +4 -1
- package/build/constants/LicenseList.js.map +1 -1
- package/build/interfaces/IApplicationInfo.js +2 -1
- package/build/interfaces/IComponentInfo.js +2 -1
- package/build/interfaces/IGenerator.js +2 -1
- package/build/interfaces/IModuleInfo.js +2 -1
- package/build/interfaces/IPluginInfo.js +2 -1
- package/build/interfaces/IPreparePackageConfigOptions.js +2 -1
- package/build/interfaces/IProjectGeneratorOptions.js +2 -1
- package/build/interfaces/IProjectInfo.js +2 -1
- package/build/lib/LatestVersion.d.ts +1 -0
- package/build/lib/LatestVersion.js +13 -0
- package/build/lib/LatestVersion.js.map +1 -0
- package/build/lib/generators/application/ApplicationGenerator.js +12 -8
- package/build/lib/generators/application/ApplicationGenerator.js.map +1 -1
- package/build/lib/generators/application/files/AppFile.js +6 -2
- package/build/lib/generators/application/files/AppFile.js.map +1 -1
- package/build/lib/generators/application/files/ConfigFile.js +14 -10
- package/build/lib/generators/application/files/ConfigFile.js.map +1 -1
- package/build/lib/generators/component/ComponentGenerator.js +11 -7
- package/build/lib/generators/component/ComponentGenerator.js.map +1 -1
- package/build/lib/generators/component/files/ComponentFile.js +12 -8
- package/build/lib/generators/component/files/ComponentFile.js.map +1 -1
- package/build/lib/generators/component/files/ComponentTestFile.js +6 -2
- package/build/lib/generators/component/files/ComponentTestFile.js.map +1 -1
- package/build/lib/generators/module/ModuleGenerator.js +11 -7
- package/build/lib/generators/module/ModuleGenerator.js.map +1 -1
- package/build/lib/generators/module/files/ModuleFile.js +32 -28
- package/build/lib/generators/module/files/ModuleFile.js.map +1 -1
- package/build/lib/generators/module/files/ModuleTestFile.js +6 -2
- package/build/lib/generators/module/files/ModuleTestFile.js.map +1 -1
- package/build/lib/generators/plugin/PluginGenerator.js +11 -7
- package/build/lib/generators/plugin/PluginGenerator.js.map +1 -1
- package/build/lib/generators/plugin/files/PluginFile.js +11 -7
- package/build/lib/generators/plugin/files/PluginFile.js.map +1 -1
- package/build/lib/generators/plugin/files/PluginTestFile.js +6 -2
- package/build/lib/generators/plugin/files/PluginTestFile.js.map +1 -1
- package/build/lib/generators/project/ProjectGenerator.js +32 -25
- package/build/lib/generators/project/ProjectGenerator.js.map +1 -1
- package/build/lib/generators/project/ProjectSourceFile.js +5 -1
- package/build/lib/generators/project/ProjectSourceFile.js.map +1 -1
- package/build/lib/generators/project/configs/ProjectEslintrcConfig.js +4 -1
- package/build/lib/generators/project/configs/ProjectEslintrcConfig.js.map +1 -1
- package/build/lib/generators/project/configs/ProjectPackageConfig.js +4 -1
- package/build/lib/generators/project/configs/ProjectPackageConfig.js.map +1 -1
- package/build/lib/generators/project/configs/ProjectTypescriptConfig.js +4 -1
- package/build/lib/generators/project/configs/ProjectTypescriptConfig.js.map +1 -1
- package/build/lib/manipulators/CreateComponentManipulator.js +17 -10
- package/build/lib/manipulators/CreateComponentManipulator.js.map +1 -1
- package/build/lib/manipulators/CreateDockerFileManipulator.js +25 -18
- package/build/lib/manipulators/CreateDockerFileManipulator.js.map +1 -1
- package/build/lib/manipulators/CreateModuleManipulator.js +37 -30
- package/build/lib/manipulators/CreateModuleManipulator.js.map +1 -1
- package/build/lib/manipulators/CreatePluginManipulator.js +16 -9
- package/build/lib/manipulators/CreatePluginManipulator.js.map +1 -1
- package/build/lib/manipulators/CreateProcessManipulator.js +13 -6
- package/build/lib/manipulators/CreateProcessManipulator.js.map +1 -1
- package/build/lib/manipulators/CreateThreadManipulator.js +13 -6
- package/build/lib/manipulators/CreateThreadManipulator.js.map +1 -1
- package/build/lib/manipulators/application/ApplicationIndexManipulator.js +10 -6
- package/build/lib/manipulators/application/ApplicationIndexManipulator.js.map +1 -1
- package/build/lib/menus/MainMenu.js +37 -30
- package/build/lib/menus/MainMenu.js.map +1 -1
- package/build/lib/menus/initializeMenus/InitializeApplicationProject.js +17 -10
- package/build/lib/menus/initializeMenus/InitializeApplicationProject.js.map +1 -1
- package/build/lib/menus/initializeMenus/InitializeComponentProject.js +17 -10
- package/build/lib/menus/initializeMenus/InitializeComponentProject.js.map +1 -1
- package/build/lib/menus/initializeMenus/InitializeModuleProject.js +17 -10
- package/build/lib/menus/initializeMenus/InitializeModuleProject.js.map +1 -1
- package/build/lib/menus/initializeMenus/InitializePluginProject.js +17 -10
- package/build/lib/menus/initializeMenus/InitializePluginProject.js.map +1 -1
- package/build/lib/menus/manipulateMenus/ManipulateApplicationProject.js +24 -17
- package/build/lib/menus/manipulateMenus/ManipulateApplicationProject.js.map +1 -1
- package/build/lib/menus/manipulateMenus/ManipulateComponentProject.js +5 -1
- package/build/lib/menus/manipulateMenus/ManipulateComponentProject.js.map +1 -1
- package/build/lib/menus/manipulateMenus/ManipulateModuleProject.js +20 -13
- package/build/lib/menus/manipulateMenus/ManipulateModuleProject.js.map +1 -1
- package/build/lib/menus/manipulateMenus/ManipulatePluginProject.js +5 -1
- package/build/lib/menus/manipulateMenus/ManipulatePluginProject.js.map +1 -1
- package/package.json +6 -3
- package/src/CLI.ts +1 -2
- package/src/Deploy.ts +37 -22
- package/src/lib/LatestVersion.ts +6 -0
- package/src/lib/generators/project/ProjectGenerator.ts +3 -3
- package/src/lib/manipulators/CreateDockerFileManipulator.ts +2 -2
- package/src/lib/menus/MainMenu.ts +4 -4
- package/tsconfig.json +1 -1
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ManipulateModuleProject = void 0;
|
|
7
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
8
|
+
const CreateComponentManipulator_1 = require("../../manipulators/CreateComponentManipulator");
|
|
9
|
+
const CreateModuleManipulator_1 = require("../../manipulators/CreateModuleManipulator");
|
|
10
|
+
const CreatePluginManipulator_1 = require("../../manipulators/CreatePluginManipulator");
|
|
11
|
+
const CreateThreadManipulator_1 = require("../../manipulators/CreateThreadManipulator");
|
|
12
|
+
const CreateProcessManipulator_1 = require("../../manipulators/CreateProcessManipulator");
|
|
13
|
+
async function ManipulateModuleProject(projectPath, tsConfigFilePath, lakutataProjectInfo) {
|
|
8
14
|
const projectDirectories = lakutataProjectInfo.directories;
|
|
9
|
-
const opt = await
|
|
15
|
+
const opt = await inquirer_1.default.prompt([{
|
|
10
16
|
type: 'list',
|
|
11
17
|
name: 'opr',
|
|
12
18
|
message: '请选择需要进行的操作',
|
|
@@ -20,23 +26,24 @@ export async function ManipulateModuleProject(projectPath, tsConfigFilePath, lak
|
|
|
20
26
|
}]);
|
|
21
27
|
switch (opt.opr) {
|
|
22
28
|
case 'createComponent': {
|
|
23
|
-
return await CreateComponentManipulator(projectPath, tsConfigFilePath, projectDirectories);
|
|
29
|
+
return await (0, CreateComponentManipulator_1.CreateComponentManipulator)(projectPath, tsConfigFilePath, projectDirectories);
|
|
24
30
|
}
|
|
25
31
|
case 'createModule': {
|
|
26
|
-
return await CreateModuleManipulator(projectPath, tsConfigFilePath, projectDirectories);
|
|
32
|
+
return await (0, CreateModuleManipulator_1.CreateModuleManipulator)(projectPath, tsConfigFilePath, projectDirectories);
|
|
27
33
|
}
|
|
28
34
|
case 'createPlugin': {
|
|
29
|
-
return await CreatePluginManipulator(projectPath, tsConfigFilePath, projectDirectories);
|
|
35
|
+
return await (0, CreatePluginManipulator_1.CreatePluginManipulator)(projectPath, tsConfigFilePath, projectDirectories);
|
|
30
36
|
}
|
|
31
37
|
case 'createThread': {
|
|
32
|
-
return await CreateThreadManipulator(projectPath, tsConfigFilePath, projectDirectories);
|
|
38
|
+
return await (0, CreateThreadManipulator_1.CreateThreadManipulator)(projectPath, tsConfigFilePath, projectDirectories);
|
|
33
39
|
}
|
|
34
40
|
case 'createProcess': {
|
|
35
|
-
return await CreateProcessManipulator(projectPath, tsConfigFilePath, projectDirectories);
|
|
41
|
+
return await (0, CreateProcessManipulator_1.CreateProcessManipulator)(projectPath, tsConfigFilePath, projectDirectories);
|
|
36
42
|
}
|
|
37
43
|
default: {
|
|
38
44
|
return console.error('无效的操作选项');
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
}
|
|
48
|
+
exports.ManipulateModuleProject = ManipulateModuleProject;
|
|
42
49
|
//# sourceMappingURL=ManipulateModuleProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManipulateModuleProject.js","sourceRoot":"","sources":["../../../../src/lib/menus/manipulateMenus/ManipulateModuleProject.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ManipulateModuleProject.js","sourceRoot":"","sources":["../../../../src/lib/menus/manipulateMenus/ManipulateModuleProject.ts"],"names":[],"mappings":";;;;;;AAAA,wDAA+B;AAC/B,8FAAwF;AACxF,wFAAkF;AAClF,wFAAkF;AAClF,wFAAkF;AAClF,0FAAoF;AAS7E,KAAK,UAAU,uBAAuB,CAAC,WAAmB,EAAE,gBAAwB,EAAE,mBAAwB;IACjH,MAAM,kBAAkB,GAA+B,mBAAmB,CAAC,WAAW,CAAA;IACtF,MAAM,GAAG,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC,CAAC;YAC/B,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,YAAY;YACrB,OAAO,EAAE;gBACL,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAC;gBAC1C,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAC;gBACvC,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAC;gBACvC,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAC;gBACvC,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAC;aAC3C;SACJ,CAAC,CAAC,CAAA;IACH,QAAQ,GAAG,CAAC,GAAG,EAAE;QACb,KAAK,iBAAiB,CAAC,CAAC;YACpB,OAAO,MAAM,IAAA,uDAA0B,EAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;SAC7F;QACD,KAAK,cAAc,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,iDAAuB,EAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;SAC1F;QACD,KAAK,cAAc,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,iDAAuB,EAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;SAC1F;QACD,KAAK,cAAc,CAAC,CAAC;YACjB,OAAO,MAAM,IAAA,iDAAuB,EAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;SAC1F;QACD,KAAK,eAAe,CAAC,CAAC;YAClB,OAAO,MAAM,IAAA,mDAAwB,EAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,CAAA;SAC3F;QACD,OAAO,CAAC,CAAC;YACL,OAAO,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;SAClC;KACJ;AACL,CAAC;AAlCD,0DAkCC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ManipulatePluginProject = void 0;
|
|
4
|
+
async function ManipulatePluginProject(projectPath, tsConfigFilePath, lakutataProjectInfo) {
|
|
2
5
|
const projectDirectories = lakutataProjectInfo.directories;
|
|
3
6
|
console.info('无可用操作');
|
|
4
7
|
}
|
|
8
|
+
exports.ManipulatePluginProject = ManipulatePluginProject;
|
|
5
9
|
//# sourceMappingURL=ManipulatePluginProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManipulatePluginProject.js","sourceRoot":"","sources":["../../../../src/lib/menus/manipulateMenus/ManipulatePluginProject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ManipulatePluginProject.js","sourceRoot":"","sources":["../../../../src/lib/menus/manipulateMenus/ManipulatePluginProject.ts"],"names":[],"mappings":";;;AASO,KAAK,UAAU,uBAAuB,CAAC,WAAmB,EAAE,gBAAwB,EAAE,mBAAwB;IACjH,MAAM,kBAAkB,GAA+B,mBAAmB,CAAC,WAAW,CAAA;IACtF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACzB,CAAC;AAHD,0DAGC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lakutata/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Lakutata CLI Tool",
|
|
5
5
|
"main": "./build/CLI.js",
|
|
6
6
|
"types": "./build/CLI.d.ts",
|
|
7
|
+
"type": "commonjs",
|
|
7
8
|
"bin": {
|
|
8
9
|
"lakutata": "./build/CLI.js",
|
|
9
10
|
"lakutata-deploy": "./build/Deploy.js"
|
|
@@ -34,9 +35,11 @@
|
|
|
34
35
|
"author": "alex.ma",
|
|
35
36
|
"license": "MIT",
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
38
|
+
"@types/args": "^5.0.0",
|
|
39
|
+
"args": "^5.0.3",
|
|
40
|
+
"inquirer": "^8.2.4",
|
|
39
41
|
"moment-timezone": "^0.5.34",
|
|
42
|
+
"package-json": "^7.0.0",
|
|
40
43
|
"semver": "^7.3.7",
|
|
41
44
|
"shelljs": "^0.8.5",
|
|
42
45
|
"simple-git": "^3.9.0",
|
package/src/CLI.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import fs from 'fs'
|
|
3
3
|
import path from 'path'
|
|
4
4
|
import {MainMenu} from './lib/menus/MainMenu'
|
|
5
|
-
|
|
6
5
|
(async () => {
|
|
7
|
-
await MainMenu(JSON.parse(fs.readFileSync(path.resolve(__dirname,'../package.json')).toString()))
|
|
6
|
+
await MainMenu(JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json')).toString()))
|
|
8
7
|
})()
|
package/src/Deploy.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
(async () => {
|
|
3
3
|
const path = require('path')
|
|
4
|
+
const args = require('args')
|
|
4
5
|
const inquirer = require('inquirer')
|
|
5
6
|
const shelljs = require('shelljs')
|
|
6
7
|
const moment = require('moment-timezone')
|
|
7
8
|
const packageJson = require(path.resolve(process.cwd(), './package.json'))
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
args
|
|
10
|
+
.option('dockerfile')
|
|
11
|
+
.option('repository')
|
|
12
|
+
.option('username')
|
|
13
|
+
.option('password')
|
|
14
|
+
.option('platform')
|
|
15
|
+
.option('tagLatest')
|
|
16
|
+
const flags = args.parse(process.argv)
|
|
17
|
+
const REGISTRY_ADDR = flags.repository
|
|
18
|
+
const DOCKERFILE_PATH = flags.dockerfile
|
|
11
19
|
const REPOSITORY_ADDR = new URL(`repo://${REGISTRY_ADDR}`).hostname
|
|
12
20
|
if (!REGISTRY_ADDR) throw new Error('未配置仓库地址')
|
|
13
21
|
const TIMESTAMP = Date.now()
|
|
@@ -20,46 +28,53 @@
|
|
|
20
28
|
})
|
|
21
29
|
})
|
|
22
30
|
}
|
|
23
|
-
const
|
|
31
|
+
const platforms = [
|
|
32
|
+
'linux/amd64',
|
|
33
|
+
'linux/arm64',
|
|
34
|
+
'linux/riscv64',
|
|
35
|
+
'linux/ppc64le',
|
|
36
|
+
'linux/s390x',
|
|
37
|
+
'linux/386',
|
|
38
|
+
'linux/arm/v7',
|
|
39
|
+
'linux/arm/v6'
|
|
40
|
+
]
|
|
41
|
+
const username = flags.username ? flags.username : (await inquirer.prompt(
|
|
24
42
|
{
|
|
25
43
|
type: 'input',
|
|
26
44
|
name: 'username',
|
|
27
45
|
message: 'Docker仓库账号'
|
|
28
|
-
}
|
|
46
|
+
}
|
|
47
|
+
)).username
|
|
48
|
+
const password = flags.password ? flags.password : (await inquirer.prompt(
|
|
29
49
|
{
|
|
30
50
|
type: 'password',
|
|
31
51
|
name: 'password',
|
|
32
52
|
message: 'Docker仓库密码',
|
|
33
53
|
mask: '*'
|
|
34
54
|
}
|
|
35
|
-
|
|
36
|
-
const
|
|
55
|
+
)).password
|
|
56
|
+
const platform = flags.platform ? flags.platform : (await inquirer.prompt(
|
|
37
57
|
{
|
|
38
58
|
type: 'list',
|
|
39
59
|
name: 'platform',
|
|
40
60
|
message: '目标构建平台架构',
|
|
41
|
-
choices:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'linux/ppc64le',
|
|
46
|
-
'linux/s390x',
|
|
47
|
-
'linux/386',
|
|
48
|
-
'linux/arm/v7',
|
|
49
|
-
'linux/arm/v6'
|
|
50
|
-
]
|
|
51
|
-
},
|
|
61
|
+
choices: platforms
|
|
62
|
+
}
|
|
63
|
+
)).platform
|
|
64
|
+
let tagLatest = flags.tagLatest ? flags.tagLatest : (await inquirer.prompt(
|
|
52
65
|
{
|
|
53
66
|
type: 'confirm',
|
|
54
67
|
name: 'tagLatest',
|
|
55
68
|
message: '是否为镜像打上latest标签',
|
|
56
69
|
default: false
|
|
57
70
|
}
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
)).tagLatest
|
|
72
|
+
if (typeof tagLatest === 'string') {
|
|
73
|
+
tagLatest = tagLatest !== 'false'
|
|
74
|
+
}
|
|
60
75
|
try {
|
|
61
|
-
await execPromise(`docker login --username=${
|
|
62
|
-
shelljs.exec(`docker buildx build -f ${DOCKERFILE_PATH} -t ${IMAGE_BASE_NAME}:${IMAGE_VERSION} --platform=${
|
|
76
|
+
await execPromise(`docker login --username=${username} ${REPOSITORY_ADDR} -p${password}`)
|
|
77
|
+
shelljs.exec(`docker buildx build -f ${DOCKERFILE_PATH} -t ${IMAGE_BASE_NAME}:${IMAGE_VERSION} --platform=${platform} .`)
|
|
63
78
|
shelljs.exec(`docker tag ${IMAGE_BASE_NAME}:${IMAGE_VERSION} ${REGISTRY_ADDR}:${IMAGE_VERSION}`)
|
|
64
79
|
if (tagLatest) {
|
|
65
80
|
shelljs.exec(`docker tag ${IMAGE_BASE_NAME}:${IMAGE_VERSION} ${REGISTRY_ADDR}:latest`)
|
|
@@ -9,7 +9,7 @@ import {IProjectGeneratorOptions} from '../../../interfaces/IProjectGeneratorOpt
|
|
|
9
9
|
import {IGenerator} from '../../../interfaces/IGenerator'
|
|
10
10
|
import {GitIgnore} from '../../../constants/GitIgnore'
|
|
11
11
|
import {ProjectSourceFile} from './ProjectSourceFile'
|
|
12
|
-
import
|
|
12
|
+
import { LatestVersion } from '../../LatestVersion'
|
|
13
13
|
|
|
14
14
|
export class ProjectGenerator implements IGenerator {
|
|
15
15
|
private readonly project: Project
|
|
@@ -54,7 +54,7 @@ export class ProjectGenerator implements IGenerator {
|
|
|
54
54
|
* @private
|
|
55
55
|
*/
|
|
56
56
|
private async checkLatestFrameworkVersion(): Promise<void> {
|
|
57
|
-
this.lakutataCoreVersion = await
|
|
57
|
+
this.lakutataCoreVersion = await LatestVersion(this.lakutataPackageName)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -123,7 +123,7 @@ export class ProjectGenerator implements IGenerator {
|
|
|
123
123
|
packageConfig.scripts = options.scripts ? Object.assign(packageConfig.scripts, options.scripts) : packageConfig.scripts
|
|
124
124
|
packageConfig.dependencies = options.dependencies ? Object.assign(packageConfig.dependencies, options.dependencies) : packageConfig.dependencies
|
|
125
125
|
packageConfig.devDependencies = Object.assign(options.devDependencies ? Object.assign(packageConfig.devDependencies, options.devDependencies) : packageConfig.devDependencies, {
|
|
126
|
-
'@lakutata/cli': await
|
|
126
|
+
'@lakutata/cli': await LatestVersion('@lakutata/cli')
|
|
127
127
|
})
|
|
128
128
|
const gitRepository: string | null = await this.getGitRepository()
|
|
129
129
|
if (gitRepository) {
|
|
@@ -72,7 +72,7 @@ export async function CreateDockerFileManipulator(projectPath: string, tsConfigF
|
|
|
72
72
|
const dockerfiles: { [key: string]: string } = {}
|
|
73
73
|
if (productionRepository) {
|
|
74
74
|
dockerfiles.Dockerfile = generateDockerfileContent(timezone, 'production', outDir, 'node', mainEntry)
|
|
75
|
-
packageJson.scripts.deploy = `lakutata-deploy ./Dockerfile ${productionRepository}`
|
|
75
|
+
packageJson.scripts.deploy = `lakutata-deploy --dockerfile ./Dockerfile --repository ${productionRepository}`
|
|
76
76
|
}
|
|
77
77
|
if (packageJson?.scripts?.test && developmentRepository) {
|
|
78
78
|
//有测试主入口并且仓库地址被正确配置
|
|
@@ -102,7 +102,7 @@ export async function CreateDockerFileManipulator(projectPath: string, tsConfigF
|
|
|
102
102
|
}
|
|
103
103
|
if (testEntryPoint && runtime) {
|
|
104
104
|
dockerfiles.DockerfileDev = generateDockerfileContent(timezone, 'development', outDir, runtime, testEntryPoint)
|
|
105
|
-
packageJson.scripts['deploy:dev'] = `lakutata-deploy ./DockerfileDev ${developmentRepository}`
|
|
105
|
+
packageJson.scripts['deploy:dev'] = `lakutata-deploy --dockerfile ./DockerfileDev --repository ${developmentRepository}`
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
for (const dockerfileName of Object.keys(dockerfiles)) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import inquirer from 'inquirer'
|
|
2
|
-
import latestVersion from 'latest-version'
|
|
3
2
|
import {InitializeApplicationProject} from './initializeMenus/InitializeApplicationProject'
|
|
4
3
|
import {InitializeModuleProject} from './initializeMenus/InitializeModuleProject'
|
|
5
4
|
import {InitializeComponentProject} from './initializeMenus/InitializeComponentProject'
|
|
6
5
|
import {InitializePluginProject} from './initializeMenus/InitializePluginProject'
|
|
7
6
|
import {gt} from 'semver'
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import path from 'path'
|
|
8
|
+
import fs from 'fs'
|
|
10
9
|
import {ManipulateApplicationProject} from './manipulateMenus/ManipulateApplicationProject'
|
|
11
10
|
import {ManipulateModuleProject} from './manipulateMenus/ManipulateModuleProject'
|
|
12
11
|
import {ManipulateComponentProject} from './manipulateMenus/ManipulateComponentProject'
|
|
13
12
|
import {ManipulatePluginProject} from './manipulateMenus/ManipulatePluginProject'
|
|
13
|
+
import { LatestVersion } from '../LatestVersion'
|
|
14
14
|
|
|
15
15
|
export async function MainMenu(packageJson: any) {
|
|
16
16
|
const mainMenuOpt = await inquirer.prompt([{
|
|
@@ -133,7 +133,7 @@ export async function MainMenu(packageJson: any) {
|
|
|
133
133
|
case 'check-update': {
|
|
134
134
|
try {
|
|
135
135
|
const localVersion: string = packageJson.version
|
|
136
|
-
const npmVersion: string = await
|
|
136
|
+
const npmVersion: string = await LatestVersion(packageJson.name.toString())
|
|
137
137
|
if (gt(npmVersion, localVersion)) {
|
|
138
138
|
console.info('有可用更新:', localVersion, '➡', npmVersion)
|
|
139
139
|
console.info('执行', `npm install -g ${packageJson.name}`, '进行更新')
|