serverless / serverless

⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services.
https://serverless.com
MIT License
46.62k stars 5.74k forks source link

Questions about installing Serverless Framework V4 binaries and scripts #12988

Open Hiroki-Aoki opened 2 months ago

Hiroki-Aoki commented 2 months ago

Issue description

I have several questions about the binary files that binary.js installs when I run the serverless (sls) command, and the JavaScript files (such as sf-core.js) that the binary files appear to install under $HOME/.serverless/releases/x.y.z/.

Q.1 Under the following conditions, if I have already run the serverless (sls) command once and installed a binary file named serverless--- (e.g. serverless-linux-amd64-0.0.2) locally using run.js and binary.js, is it guaranteed that it will not be overwritten the second time onwards? (I read binary.js and think the specifications are as written above, but I just want to confirm if my understanding is correct.)

Q.2 What does the binary file serverless--- (e.g. serverless-linux-amd64-0.0.2) do? (I assume that this binary file reads the frameworkVersion: x.y.z specified in serverless.yml, if any, and then downloads the corresponding version of the Serverless Framework JavaScript files (such as sf-core.js) from the server you manage, and installs it under $HOME/.serverless/releases/x.y.z/. But is that correct? Does this binary file do anything else?)

Q.3 Is the source code for serverless--- available for viewing?

Q.4 Will the contents under the $HOME/.serverless/releases/x.y.z/ will be exactly the same as long as the frameworkVersion: x.y.z specified in serverless.yml does not change?)

Q.5 By default, JavaScript files (such as sf-core.js) seem to be installed in $HOME/.serverless/releases/x.y.z/, but can I change this path to a path of my choice? For example, can I change it to the same directory as binary.js as follows?

/<PATH>/<TO>/<MY_SERVERLESS_PROJECT>/node_modules/serverless
├── README.md
├── binary.js
├── node_modules
│   └── .bin
│       └── serverless-linux-amd64-0.0.2
├── package.json
├── postInstall.js
├── .serverless
│   └── releases
│       └── 4.4.18
└── run.js

Context

No response