metacall / deploy Goto Github PK
View Code? Open in Web Editor NEWTool for deploying into MetaCall FaaS platform.
Home Page: https://dashboard.metacall.io
License: Apache License 2.0
Tool for deploying into MetaCall FaaS platform.
Home Page: https://dashboard.metacall.io
License: Apache License 2.0
copy of
TODO
./src/lib
to a new repo so it can be reused in https://github.com/metacall/faas -> https://github.com/metacall/protocolPackageError.None
in index.ts
:
index.ts
Essential
, Standard
, Premium
, also we should implement an enum type for this and replace in in places like: https://github.com/metacall/deploy/blob/97951f907c166b856c9952ddf89b778a9fdc7fb1/src/lib/protocol.ts#L23 , https://github.com/metacall/deploy/blob/97951f907c166b856c9952ddf89b778a9fdc7fb1/src/lib/protocol.ts#L116 , ] (-P, --plan)
string
type to Plans
enum.PackageError.JsonNotFound
in index.ts
:
metacall-${lang_id}.json
s once the wizard finishes so it can be reused on the next run of the deployUNKNOWN_VALUE: Unknown value: dist/test/
at Object.commandLineArgs [as default] (/home/raj/Desktop/metacall/deploy/node_modules/command-line-args/dist/index.js:1369:21)
at parse (/home/raj/Desktop/metacall/deploy/node_modules/ts-command-line-args/dist/parse.js:60:49)
at Object.<anonymous> (/home/raj/Desktop/metacall/deploy/dist/cli/args.js:24:52)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/raj/Desktop/metacall/deploy/dist/auth.js:10:32)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/raj/Desktop/metacall/deploy/dist/startup.js:10:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/raj/Desktop/metacall/deploy/dist/test/protocol.integration.spec.js:10:19)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async formattedImport (/home/raj/Desktop/metacall/deploy/node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
at async Object.exports.requireOrImport (/home/raj/Desktop/metacall/deploy/node_modules/mocha/lib/nodejs/esm-utils.js:48:32)
at async Object.exports.loadFilesAsync (/home/raj/Desktop/metacall/deploy/node_modules/mocha/lib/nodejs/esm-utils.js:103:20)
at async singleRun (/home/raj/Desktop/metacall/deploy/node_modules/mocha/lib/cli/run-helpers.js:125:3)
at async Object.exports.handler (/home/raj/Desktop/metacall/deploy/node_modules/mocha/lib/cli/run.js:374:5)
protocol.integration.spec.test
to metacall/protocoldist/test
, simply means moving the file mentioned above will not solve the issue.cli.integration.spec.test
and Remove before()
from protocol.integration.spec.test
and mark every test case to turn true, then test will not fail. [
'/home/pc/.nvm/versions/node/v16.14.0/bin/node',
'/home/pc/Desktop/metacall/deploy/node_modules/.bin/mocha',
'dist/test/'
]
When doing metacall-deploy -f
if the deploy is empty, it does not work and it should. This is a bug, it should deploy anyway.
Refer Todo, --force flag requirement.
Currently, user can pass an unknown flag to the CLI, and an error is thrown.
Error should be handled and user should be notified that the flag don't exist.
We need some enviroment variables while testing and there is a possiblity that dev won't add .env file and running tests without those env vars will be useless.
So this function will check for every enviroment var we need while testing and if succeed then we will run the tests and if not we will simply skip those tests by raising a failure with a message "Env not found or whatever".
@viferga Should we add a flag, which will list out plans available in the user's account, this will be very handy before anyone tries to deploy, wdyt?
This will also be good for testing in the beginning before we actually start testing by deployment like user must have one essential plan to test.
File to refer -> https://github.com/metacall/protocol/blob/master/src/language.ts
{
tag: 'node',
displayName: 'NodeJS',
hexColor: '#3c873a',
fileExtRegex: /^js$/,
runnerName: 'nodejs',
runnerFilesRegexes: [/^package\.json$/]
}
Should use displayName instead of runnerName.
The TODO.md has not been updated accordingly, so there's no proper control of what features are already done and which ones are not. Review this and update with tasks done.
We need an additional flag --logout, in order to remove the login cache.
This can help us in several ways:-
If the user has multiple accounts, he can switch in between.
In testing auth-based flags such as --email, --password, --token -> What happens when we test one of the flags from these, it saves the token and this can pass all the tests written next to them. CLI won't calculate a new token if it's already present. So, we need to remove the cache before running all auth-based tests.
Every time we attempt to deploy, we receive a list of plans; however, it is possible that a user has only one plan, in which case we should automatically deploy without providing a list of plan options.
Any interactive screen like inspect should show at the top or bottom a message like:
Press Ctrl+C for cancel.
So it becomes more intuitive.
Before, the options to choose a plan for a particular application came before the authentication procedure, which was incorrect because the proper order was authentication, followed by a check of the user account's available plans before granting access to deploy.
For installing metacall:protocol you need to install 2 extra package
these 2 packages are already devdepencies of metacall/protocol
It should ask for a plan in the user (we should store this in the configuration, in a list of projects mapped to plans) or reuse an existent plan if it has been already selected.
Use the protocol integration test and the descriptor in order to deploy it, we can implement a function which wraps all the behavior into a simple function or implement it directly in the index.ts
\n#################] \ Compressing and deploying... > c.txt
i Deploying F:\Project\metacall\deploy...ploying... > gauge.d.ts <--here
Error: Request failed with status code 500loying... > gauge.d.ts <--here
at createError (F:\Project\metacall\deploy\node_modules\axios\lib\core\createError.js:16:15) <--not here
at settle (F:\Project\metacall\deploy\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (F:\Project\metacall\deploy\node_modules\axios\lib\adapters\http.js:269:11)
gauge.show() only flush stdout before showing progress bar but not after that
last gauge progressbar stays in process.stdout which keep on printing itself untill process.stdout is flushed
deploy/src/test/cli.integration.spec.ts
Line 159 in 605258c
Tasks:
@metacall/deploy
.@metacall/protocol
.We are using axios package only for AxiosError and this is unnecessary.
We should remove the axios package and export some type like APIError or similar from metacall/protocol wrapping axios error.
When doing deployment, node_modules appears under file selection, is not so intuitive to go up in the list to select the files that are not on node_modules.
I propose we hide folders of this nature or we simply put them at the bottom, leaving the most relevant at the top.
Is your feature request related to a problem? Please describe.
Currently, we deploy applications with environment variables but our "Deploy CLI" doesn't have an env variable caching mechanism.
Describe the solution you'd like
What I think is, we should store a particular application config at the below path:
$ .metacall/deploy/applications/projectName.ini
For Ex:
$ .metacall/deploy/applications/auth-middleware.ini
Now, Why I think it should look like that is because:-
Let's see config file structure
[path.home_raj_desktop_authMiddleware.plan.essential.env]
ENVIROMENT=dev
PORT=5000
HOST=localhost
USER=Creatoon
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc
[path.home_raj_desktop_authMiddleware.plan.standard.env]
ENVIROMENT=prod
PORT=9000
HOST=https://creatoon.tech
USER=SuperUser
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc
[path.home_raj_desktop_authMiddleware.plan.premium.env]
ENVIROMENT=prod
PORT=8000
HOST=https://creatoon.tech
USER=SuperUser
MAILCHIMP_API_KEY=fssdgdfgfg565756867993ddcbbcbc
Why this kind of config structure?
It's simply because there may be a case when a user deploys a minimal version of an application on "Essential" Plan with some environment variables & production-grade version on "Standard and Premium" Plans with different values of env variables, that's why I figured out this structure for caching.
So after parsing it would look something like this:
{
path: {
home_raj_desktop_authMiddleware : {
plan : {
essential : {
env: {
ENVIROMENT: "dev",
PORT: 5000,
HOST: "localhost",
USER: "Creatoon",
MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
}
},
standard : {
env: {
ENVIROMENT: "prod",
PORT: 9000,
HOST: "https://creatoon.tech",
USER: "SuperUser",
MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
}
},
premium : {
env: {
ENVIROMENT: "prod",
PORT: 8000,
HOST: "https://creatoon.tech",
USER: "SuperUser",
MAILCHIMP_API_KEY: "fssdgdfgfg565756867993ddcbbcbc"
}
}
}
}
}
}
Additional Context
We should also think about, what if the user re-deploys with some additional environment variables then we should give him an option to add more and update ones that are already cached.
@trgwii @viferga What do you think sir?
If you think it is incorrect or whatever you think about it, let me discuss it.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.