metacall / install

Cross-platform set of script to install MetaCall infrastructure.
https://metacall.io
Apache License 2.0
11 stars 10 forks source link

POC: Aliasing metacall-deploy to run as metacall deploy #23

Open aakritiawasthi opened 3 weeks ago

aakritiawasthi commented 3 weeks ago

Installation and Setup

Step 1: Install @metacall/deploy

First, you need to install @metacall/deploy from npm using metacall runtime:

$ metacall npm install -g @metacall/deploy

This command will install the metacall-deploy distribution source code. Depending on your setup, it might be installed in a directory similar to the following (in this example, it's installed under node_modules of Node.js version 14):

/gnu/store/pqx5ssnibdrcp36xzfjwqin2ig8j4lp0-node-14.19.3/lib/node_modules/@metacall/deploy

Step 2: Create a Bash script

Next, create a Bash script inside /gnu/bin and write the path to the dist/index.js file that will be executed:

$ cd /gnu/bin
$ echo '#!/bin/bash' > deploy
$ echo '/gnu/store/pqx5ssnibdrcp36xzfjwqin2ig8j4lp0-node-14.19.3/lib/node_modules/@metacall/deploy/dist/index.js $@' >> deploy
$ chmod +x deploy 

Verification

To verify that everything is set up correctly, you can check the version using metacall deploy:

metacall deploy --version

>> 0.1.31
aakritiawasthi commented 3 weeks ago

Executing metacall-deploy dist/index.js with metacall runtime throws this error, The same error happens if use the proper shebang by replacing #!/usr/bin/env node -> #!/usr/bin/env metacall

akriti: ~/$ metacall /gnu/lib/.metacall/lib/node_modules/@metacall/deploy/dist/index.js --version
! 0x7f0b60, 0x7fcd70f97e00 does not exists as a valid command.

Official CLI for metacall-deploy

  Usage: metacall-deploy [--args]

Options
  Alias   Flag                 Accepts      Description
  -h      --help               string       Prints a user manual to assist you in using the CLI.
  -v      --version            nothing      Prints current version of the CLI.
  -a      --addrepo            string       Deploy from repository.
  -w      --workdir            string       Accepts path to application directory.
  -d      --dev                nothing      Run CLI in dev mode (deploy locally to metacall/faas).
  -n      --projectName        string       Accepts name of the application.
  -e      --email              string       Accepts email id for authentication.
  -p      --password           string       Accepts password for authentication.
  -t      --token              string       Accepts token for authentication, either pass email & password or token.
  -f      --force              nothing      Accepts boolean value: it deletes the deployment present on an existing plan and deploys again.
  -P      --plan               string       Accepts type of plan: "Essential", "Standard", "Premium".
  -i      --inspect            string       Lists out all the deployments with specifications (it defaults to Table format, otherwise they are serialized into specified format: Table | Raw | OpenAPI).
  -D      --delete             nothing      Accepts boolean value: it provides you all the available deployment options to delete.
  -l      --logout             nothing      Accepts boolean value: use it in order to expire your current session.
  -r      --listPlans          nothing      Accepts boolean value: list all the plans that are offered in your account using it.
  -u      --serverUrl          string       Change the base URL for the FaaS.
  -c      --confDir            string       (TODO) Overwrite the default configuration directory.

Then Tried

$ touch index.js
$ echo 'console.log(process.argv)' > index.js

$ metacall index.js
> [
  '/gnu/store/szllrsimcnm8r1iiampsikhnnpk3c4zd-metacall-0.6.2/metacallcli',
  '/gnu/store/szllrsimcnm8r1iiampsikhnnpk3c4zd-metacall-0.6.2/lib/bootstrap.js',
  '0xc1ab10',
  '0x7f89333cce00'
]