Commit e251aa3a authored by xsahxl's avatar xsahxl
Browse files

feat: :guitar: s edit 初始化

Showing with 57 additions and 2 deletions
+57 -2
......@@ -15,7 +15,7 @@ push:
git push --force-with-lease origin $(CURRENT_BRANCH_NAME)
release-dev:
gh release create 2.0.100-beta.6 --notes "release dev" --target shl/parse --title "Release dev" --prerelease
gh release create 2.1.1-beta.1 --notes "release dev" --target develop --title "Release dev" --prerelease
roll-back-dev:
git reset --soft HEAD~1
......
#!/usr/bin/env node
require('../lib/edit');
......@@ -67,6 +67,7 @@
"jest": "^27.4.7",
"latest-version": "^5.1.0",
"lint-staged": "^10.0.8",
"open": "^8.4.0",
"os-locale": "5.0.0",
"prettier": "^2.2.1",
"semver": "^7.3.5",
......
......@@ -15,5 +15,6 @@ esbuild lib/clean/index.js --bundle --log-level=error --minify --external:@serve
esbuild lib/component/index.js --bundle --log-level=error --minify --external:@serverless-devs/core --platform=node --format=cjs --target=node10.4 --allow-overwrite --outfile=lib/component/index.js
esbuild lib/update-notifier/index.js --bundle --log-level=error --minify --external:@serverless-devs/core --platform=node --format=cjs --target=node10.4 --allow-overwrite --outfile=lib/update-notifier/index.js
esbuild lib/verify/index.js --bundle --log-level=error --minify --external:@serverless-devs/core --platform=node --format=cjs --target=node10.4 --allow-overwrite --outfile=lib/verify/index.js
esbuild lib/edit/index.js --bundle --log-level=error --minify --external:@serverless-devs/core --platform=node --format=cjs --target=node10.4 --allow-overwrite --outfile=lib/edit/index.js
export const DEFAULT_REGIRSTRY = 'http://registry.devsapp.cn/simple';
export const UPDATE_CHECK_INTERVAL = 1000 * 60 * 60 * 12;
export const COMMAND_LIST = ['clean', 'cli', 'component', 'config', 'init', 'set', 'verify'];
export const COMMAND_LIST = ['clean', 'cli', 'component', 'config', 'init', 'set', 'verify', 'edit'];
import program from '@serverless-devs/commander';
import core from '../utils/core';
import { emoji, getProcessArgv, i18n } from '../utils';
import { HandleError } from '../error';
import execa from 'execa';
import open from 'open';
const { colors } = core;
const description = `Get details of installed components.
Example:
$ s component
$ s component --component fc-api
${emoji('📖')} Document: ${colors.underline(
'https://github.com/Serverless-Devs/Serverless-Devs/tree/master/docs/zh/command/component.md',
)}`;
const command = program
.name('s component')
.usage('[options]')
.option('--component [componentName]', 'Gets the specified component information (like: fc, fc@0.0.1)')
.helpOption('-h, --help', i18n('display_help_for_command'))
.description(description)
.addHelpCommand(false)
.parse(process.argv);
(async () => {
console.log(process.argv);
const { help, template } = getProcessArgv();
if (help) {
command.help();
}
const spath = await core.getTemplatePath(template);
const port = await core.getAvailablePort(7000);
console.log(spath);
execa(
process.execPath,
['/Users/shihuali/workspace/serverless-devs-ui/server/app.js', '--template', spath, '--port', port],
{
stdio: 'inherit',
shell: true,
},
);
await core.sleep(1000);
await open(`http://localhost:${port}`);
})().catch(async error => {
await HandleError(error);
});
......@@ -22,6 +22,7 @@ const descption = {
{ set: '🔧 Settings for the tool.' },
{ clean: '💥 Clean up the environment.' },
{ component: '🔌 Installed component information.' },
{ edit: '🔌 Installed component information.' },
],
Examples: [{ init: 'Perform [s init] fast experience Serverless Devs.' }],
};
......
......@@ -28,6 +28,7 @@ const { join, includes } = lodash;
.command('set', `${emoji('🔧')} Settings for the tool.`)
.command('clean', `${emoji('💥')} Clean up the environment.`)
.command('component', `${emoji('🔌')} Installed component information.`)
.command('edit', `${emoji('🔌')} Installed component information.`)
.version(getVersion(), '-v, --version', 'Output the version number.')
.addHelpCommand(false);
// 将参数argv存储到env
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment