serverless / serverless/serverless
Refactor: Seclude non-service specific commands out of internals
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46.9k
- Forks
- 5.7k
- Avg merge
- 10h 7m
- Merged PRs (30d)
- 57
Description
Use case description
Currently lifecycle engine implemented into Serverless powers most of our commands. Whole point of lifecycle engine is to make our commands hack-able by plugins. Still that's not a use case for commands which are not designed to work in service context (e.g. config, dashboard, login), and actually implementing them through lifecycle engine makes it more complicated then it should.
We've already reconfigured interactive CLI setup, so it doesn't run through Serveless instance and best if same is done with other commands.
It's an important shift especially in light of moving into multi providers engine (https://github.com/serverless/serverless/issues/9583), where we will deprecate old single provider engine, but those non-service specific commands should not be affected
Proposed solution
Refactor following commands out of Serverless instance:
Let's propose each command as public module in commands/<command-name>.js. If there'll be a need to seclude some common utils, let's put them into lib/commands/... (let's agree that lib is considered a private scope, not be used publicly)
Each item should be addressed with separate PR
-
config(to be implemented incommands/config.js) -
config credentials(to be implemented incommands/config-credentials.js) -
config tabcompletion install&config tabcompletion uninstall(to be implemented incommands/tabcompletion-install.jsandcommands/tabcompletion-uninstall.js) -
dashboard(to be implemented incommands/dashboard.js) -
generate-event(to be implemented incommands/generate-event.js) -
login&logout(to be implemented incommands/login.js&commands/logout.js) -
slsstats(to be implemented incommands/slsstats.js) -
upgrade&uninstall(to be implemented incommands/upgrade.js&commands/uninstall.js)
Unless proven needed, let's not attempt to migratecreate and install commands, as they're soft deprecated, and no longer advertised to be used.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by selecting one unchecked command and tracing its current implementation through the Serverless instance. Move that command to the specified public path under commands/, using lib/commands/ only for private shared utilities if needed. The work is done when the selected command no longer depends on the Serverless instance and its intended CLI behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100