dadi / cli Goto Github PK
View Code? Open in Web Editor NEWDADI CLI is a command-line tool to help with the installation and customisation of the various services within the DADI platform
License: MIT License
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
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.
As discussed in #16, this should be made clearer.
Supplying a client ID or secret with a )
character causes the script to fail.
dadi api new my-api
node: v8.9.4
dadi-cli: 2.1.0
mongod: v3.6.2
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
Checking the available versions of DADI API
nothing happens. cli crashes. no new files or folder were created. no error message.
After API is updated to handle batch search indexing, it'd be lovely if CLI could handle calls to this script. Something like:
dadi api search:index
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
Result is a dead link (docs.dadi.tech/cli/)
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
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
When a user exits a process by means of selecting an option, a goodbye message of some sort should be logged.
An Error is thrown e.g.
Error
at inquirer.prompt.then.answers (/usr/local/lib/node_modules/@dadi/cli/lib/fs.js:39:25)
dadi api new
The target directory (/home/ubuntu) is not empty. Would you like to proceed?
type 'n' to abort.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.
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
dadi --version
should be the same as dadi -v
.
(Totally my idea, not @adamkdean's)
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
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?
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:
dadi web new
.Could CLI check permissions prior to install?
🙏
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"
}
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.
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...
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.
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.
Removing using the rm
command does work, however
The find
and insert
methods have changed to allow different data connectors, which should be reflected in CLI.
Reference: https://github.com/dadi/api/blob/feature/3.0.0/utils/create-client.js#L65-L67
CLI could check and alert if any of the minimum system requirements (e.g. Node/npm versions) are not met.
Legacy Publish to be represented as version 0.x and new version as 1.x
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
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.
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.
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"
},
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.