Giter Site home page Giter Site logo

dadi / cli Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 3.0 54.3 MB

DADI CLI is a command-line tool to help with the installation and customisation of the various services within the DADI platform

License: MIT License

JavaScript 100.00%

cli's People

Contributors

davidmacp avatar eduardoboucas avatar jimlambie avatar mingard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

Handle abort without throwing errors

Expected behaviour

When a user exits a process by means of selecting an option, a goodbye message of some sort should be logged.

Current behaviour

An Error is thrown e.g.

Error
    at inquirer.prompt.then.answers (/usr/local/lib/node_modules/@dadi/cli/lib/fs.js:39:25)

Steps to reproduce

  1. Type dadi api new
  2. When prompted The target directory (/home/ubuntu) is not empty. Would you like to proceed? type 'n' to abort.
  3. Observe error.

Further to this, I was unsure how to change the target directory. When I typed dadi help api new I was given only two options; name and version. If this is not possible I'll raise a separate ticket.

`dadi web new` adds `@dadi/web-dustjs` even if it's not chosen in the picker

I create a new project using dadi web new and pick web-es6-templates. However, @dadi/cli proceeds to also install @dadi/web-dustjs as well, even though I didn't pick it.

Presumably this is because the demo web page uses dustjs, so I think it would be better if @dadi/cli made a decision to create demo page(s) based on which templating engine(s) I picked (since it seems to allow multiple).

Anyway, I thought dustjs was dead...

Work directly on app directories

Currently, any commands will look for the target application under node_modules/@dadi/APP-NAME. This means that running a command on a cloned repository for a development workflow doesn't work.

It's worth investigating how much work would it be required to add support for this use case.

Create client step hangs if db auth specified

If installing the mongodb connector and you specify a db username and password, CLI tries to connect to the database using those credentials. This fails if the db hasn't get been created and the install hangs.

A thought - perhaps the db could be created and a db user added?

Ability to `npm init @dadi`

npm init has a new option to create a project with a template: https://docs.npmjs.com/cli/init
It would be super cool if someone could just npm init @dadi or npm init @dadi/cli (which would require the projects @dadi/create or @dadi/create-cli respectively), with the correct binaries in place to do the creation. This would just do the npm init and fill in the blanks. We could even do a full-project thing, installing everything already hooked together for a much easier start.

Currently what we can do however without installing CLI is to use npx, so for example for Web:
npx -p @dadi/cli dadi web new

Alert when directories aren't empty

When running installation commands, CLI should check if the target directory exists and is empty and ask for user confirmation if it's not the case.

First install globally on armhf installs x86_64 binary

When I first do a npm -g install @dadi/cli I get a binary from the wrong architecture plonked in my bin directory. Shouldn't this either be a script or match the source arch?

Reproducing the issue, just install @dadi/cli on a Pi and notice that you get a 64-bit PC version of the dadi binary appearing.

Add password generator

A command for generating strong passwords would be useful. This could be integrated with existing commands that require a password (such as api clients:create).

/cc @jimlambie

Make connections to the registry fail gracefully

command:

dadi api new my-api

version:

node: v8.9.4
dadi-cli: 2.1.0 
mongod: v3.6.2

expected:

A folder structure like this:

my-api/
  config/              # contains environment-specific configuration files
    config.development.json
  server.js            # the entry point for the application
  package.json
  workspace/
    collections/       # collection specification files
    endpoints/         # custom JavaScript endpoints

behavior:

Checking the available versions of DADI API
nothing happens. cli crashes. no new files or folder were created. no error message.

Automatically check for updates

It would be great if CLI could check for new versions at startup and either suggest that users run npm update or, if possible, offer to update automatically.

Incorrect warning for inadequate permissions

When trying to create an instance of web, the warning The connection to the DADI registry has failed. Are you connected to the Internet? was thrown. After some debugging, I discovered that the issue was with write permissions to the current dir.

Steps to reproduce:

  • create a directory, and change to a user with inadequate write permissions.
  • run dadi web new.
  • Observer the connection issue error.

Could CLI check permissions prior to install?

[Mac OS 10.12] Permissions issues

After installing Web with the cli dadi web new I cannot delete the config and workspace folders. I get a "Finder wants to make changes" password prompt. After entering the password the folders do not get removed.

If I inspect the folders I see my user is not in the "Sharing and permissions" block.

screen shot 2018-03-13 at 09 49 22

Removing using the rm command does work, however

Incorrect access type property when creating API users

Using CLI to create your oAuth2 client the user is created as so...

{
    "_id" : ObjectId("5b51258f97e5af67fbd7a6f4"),
    "clientId" : "myclient",
    "secret" : "mysecret",
    "type" : "admin"
}

if you use npm explore @dadi/api -- npm run create-client then user is created as...

{
    "_id" : ObjectId("5b551636b9d3b4943309c398"),
    "clientId" : "my-api-admin",
    "secret" : "mys3cr3t",
    "accessType" : "admin"
}

Error when installing CDN: no such file or directory

When installing CDN with dadi cdn new the following error is encountered:

? The target directory (/path-to-dadi/cdn) is not empty. Would you like to proceed? Yes
โœ” Checking the available versions of DADI CDN
โœ” Downloading boilerplate (100%)
โœ” Installing DADI CDN (3.x)
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT: no such file or directory, open './config/config.development.json' 

I renamed config.development.json.sample to config.development.json and was able to start CDN but as a user the process felt interrupted and it was unclear if the installation was complete.

Ubuntu
Node: 6.13.0
NPM: 5.7.1

Add paths to default API config

The following is almost ubiquitous with API setups but by default isn't written to the API config. I think perhaps it should be, what do you think, @eduardoboucas?

"paths": {
    "collections": "workspace/collections",
    "endpoints": "workspace/endpoints",
    "hooks": "workspace/hooks"
  },

Install error

when trying to install dadi cli
npm install @dadi/cli -g
I'm getting error for invalid json reponse at https://registry.dadi.tech/v1/cli.json
which in fact returns 503 service temporarily unavailable

Add support for environments

When a command reads from an app's configuration file, it matters which environment it's running on, because that will dictate which file will be picked up.

Perhaps the best approach is to add an --environment parameter to any command that is environment-specific.

For example:

dadi api clients:add --environment=production

[Windows] @dadi\cli\runner is not recognized

Hi,
when I try to install @dadi/cli on my Windows 10 machine, I get a is not recognized as an internal or external command, error.

See logs:

C:\Users\lmach\projects>npm install @dadi/cli -g
C:\Users\lmach\AppData\Roaming\npm\dadi -> C:\Users\lmach\AppData\Roaming\npm\node_modules\@dadi\cli\bin\runner

> @dadi/[email protected] postinstall C:\Users\lmach\AppData\Roaming\npm\node_modules\@dadi\cli
> node install.js

downloading the latest version of DADI CLI [====================] 100% (ETA: 0.0s)
+ @dadi/[email protected]
updated 1 package in 7.899s

C:\Users\lmach\projects>dadi cdn new cdn
'"C:\Users\lmach\AppData\Roaming\npm\\node_modules\@dadi\cli\bin\runner"' is not recognized as an internal or external command,
operable program or batch file.

There is an invalid path : npm\\node_modules\@dadi, but I don't think this is the issue.
I guess the problem is, that there is no runner.bat oder runner.exe

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.