Comparing version 2.1.21 to 2.1.23
{ | ||
"name": "@vmm/cli", | ||
"version": "2.1.21", | ||
"version": "2.1.23", | ||
"description": "vmm cli interface", | ||
@@ -22,8 +22,11 @@ "author": { | ||
"node-fetch": "^2.6.0", | ||
"ps-list": "^7.1.0", | ||
"tsconfig-paths-webpack-plugin": "^3.2.0" | ||
"ps-list": "^7.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/fs-extra": "^9.0.1" | ||
"@types/fs-extra": "^9.0.1", | ||
"http-proxy-middleware": "^1.0.4", | ||
"tsconfig-paths-webpack-plugin": "^3.2.0", | ||
"webpack": "^4.43.0", | ||
"webpack-cli": "^3.3.11" | ||
} | ||
} |
@@ -5,1 +5,32 @@ VMM -- Vue MicroService Module | ||
## CLI Client | ||
### gw | ||
vmm cli using 'envoy' as apiGateWay | ||
#### install | ||
- 参考: https://www.getenvoy.io/install/envoy/ubuntu/ | ||
- ubuntu | ||
``` | ||
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | ||
curl -sL 'https://getenvoy.io/gpg' | sudo apt-key add - | ||
sudo add-apt-repository \ | ||
"deb [arch=amd64] https://dl.bintray.com/tetrate/getenvoy-deb \ | ||
$(lsb_release -cs) \ | ||
stable" | ||
sudo apt-get update && sudo apt-get install -y getenvoy-envoy | ||
envoy --version | ||
``` | ||
- centOs | ||
### envoy 概念 | ||
- SDS/EDS 服务/EndPoint发现 | ||
- CDS Upstream 发现服务 | ||
- RDS 路由发现服务 | ||
- LDS Listener 监听发现服务 |
@@ -9,2 +9,3 @@ const fs = require('fs-extra') | ||
const buildHtml = require('./buildHtml') | ||
const buildService = require('./buildService') | ||
@@ -19,3 +20,3 @@ /** | ||
const modPkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')) | ||
switch (modPkg.type) { | ||
switch (modPkg.moduleType) { | ||
case 'html': | ||
@@ -27,5 +28,6 @@ console.log('build html project:', modPkg.name) | ||
console.log('build node project:', modPkg.name) | ||
await buildService(arg) | ||
break; | ||
default: | ||
console.log('invalid vmm project type,must html or service') | ||
console.log('invalid vmm moduleType ,must html or service') | ||
} | ||
@@ -32,0 +34,0 @@ |
@@ -36,2 +36,3 @@ const fs = require('fs-extra') | ||
description: pkg.description, | ||
project: pkg.project, | ||
icon: pkg.icon, | ||
@@ -38,0 +39,0 @@ main: `${buildName}.umd.min.js`, |
@@ -48,20 +48,48 @@ const fs = require('fs-extra') | ||
async function serveHtml(arg) { | ||
const port = detectPort(arg.port || 8100) | ||
const pkg = await fs.readJson('./package.json') | ||
console.log(pkg.name, ' developer run :', port) | ||
// 更新 vue.config.js | ||
fs.writeFileSync('./vue.config.js', defaultVueConfigContent(port)) | ||
// 根据 port 更新 html | ||
updateDebugHtml(port) | ||
// 启动调试 | ||
execSync(`./node_modules/.bin/vue-cli-service serve --port ${port}`, { | ||
stdio: 'inherit' | ||
}) | ||
} | ||
async function serveService(arg) { | ||
const port = detectPort(arg.port || 9100) | ||
const pkg = await fs.readJson('./package.json') | ||
console.log(pkg.name, ' developer run :', port) | ||
execSync(`NODE_ENV=development DEBUG=@* nodemon -i ".git" -i "node_modules" -V -w "./src" -x "ts-node -r tsconfig-paths/register" ./src/index.ts -p ${port}`, { | ||
stdio: 'inherit' | ||
}) | ||
} | ||
/** | ||
* 开发模式运行 | ||
* 检查后台运行的vmm服务调度和应用 | ||
* 监听指定端口, 启动 vue 服务进行调试 | ||
* 自动检测 api 请求并启动相关服务 | ||
* 自动处理 proxy 映射 | ||
*/ | ||
module.exports = async function (arg) { | ||
try { | ||
const port = detectPort(arg.port || 8100) | ||
const pkg = await fs.readJson('./package.json') | ||
console.log(pkg.name, ' developer run :', port) | ||
// 更新 vue.config.js | ||
fs.writeFileSync('./vue.config.js', defaultVueConfigContent(port)) | ||
// 根据 port 更新 html | ||
updateDebugHtml(port) | ||
const modPkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')) | ||
switch (modPkg.moduleType) { | ||
case 'html': | ||
console.log('serve node project:', modPkg.name) | ||
await require('./serveHtml')(arg) | ||
break; | ||
case 'service': | ||
console.log('serve node project:', modPkg.name) | ||
await require('./serveService')(arg) | ||
break; | ||
default: | ||
console.log('invalid vmm project type,must html or service') | ||
} | ||
// 启动调试 | ||
execSync(`./node_modules/.bin/vue-cli-service serve --port ${port}`, { | ||
stdio: 'inherit' | ||
}) | ||
} catch (e) { | ||
@@ -68,0 +96,0 @@ console.log('Error:', e.message) |
@@ -18,3 +18,3 @@ const fs = require('fs-extra') | ||
const modPkg = JSON.parse(fs.readFileSync('./package.json', 'utf8')) | ||
switch (modPkg.type) { | ||
switch (modPkg.moduleType) { | ||
case 'html': | ||
@@ -21,0 +21,0 @@ console.log('update html project:', modPkg.name, arg.local) |
@@ -5,12 +5,9 @@ { | ||
"private": true, | ||
"type": "html", | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build" | ||
"moduleType": "html", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@vmm/loader": "^0.1.20", | ||
"vue": "^2.6.11" | ||
}, | ||
"dependencies": {}, | ||
"loadFiles": [ | ||
"js/chunk-vendors.js", | ||
"js/dev.js" | ||
], | ||
"loadFiles": [], | ||
"devDependencies": { | ||
@@ -17,0 +14,0 @@ "@vue/cli-plugin-typescript": "4.4.1", |
import pkg from '../package.json' | ||
import snakeCase from 'lodash.snakecase' | ||
import loader from '@vmm/loader' | ||
import App from './App.vue' | ||
const mod = {}; | ||
new App().$mount('#app') | ||
(window as any)['__' + snakeCase(pkg.name)] = mod; | ||
export default mod | ||
/** | ||
* 导出模块 UMD 全局引用对象 | ||
*/ | ||
export default loader.umdExternal(pkg.name, { | ||
}) |
@@ -22,3 +22,4 @@ // 配置参考: https://cli.vuejs.org/zh/config/ | ||
contentBase: [path.resolve('./public'), path.resolve('.')], | ||
historyApiFallback: false | ||
historyApiFallback: false, | ||
before: require('./serviceProxy') | ||
}, | ||
@@ -25,0 +26,0 @@ configureWebpack: { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51685
5
40
1034
35
5
17
22
- Removedtsconfig-paths-webpack-plugin@^3.2.0
- Removed@types/json5@0.0.29(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedenhanced-resolve@5.17.1(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedjson5@1.0.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtapable@2.2.1(transitive)
- Removedtsconfig-paths@3.15.0(transitive)
- Removedtsconfig-paths-webpack-plugin@3.5.2(transitive)