Giter VIP home page Giter VIP logo

moleculer-cli's People

Contributors

a06kin avatar andremaz avatar bbmarkus avatar ccampanale avatar devalexandre avatar disce-omnes avatar faeron avatar icebob avatar karnith avatar keawade avatar leestex avatar ngraef avatar slinkardbrandon avatar zacbraddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

moleculer-cli's Issues

After "call" command is successfully done, script is still running and never stops

I'm using this command to run a script from a CRON:

#!/bin/sh

moleculer call \
    --ns="localdev" \
    -t "nats://nats:4222" \
    "myservice.test" 

RESULT=$?

echo "Done"

exit $RESULT

The test action is as simple as:

module.exports = {
    name: 'myservice',
    actions: {
        test(ctx) {
            return 0;
        }
    }
};

When running the script locally, logs show the returned value (here 0), but script doesn't stop. It's still runnnig.

Checking the call/index.js code of this repo, I see that when an error is thrown, process.exit() is called and script ends. But when everything goes right, the broker is stopped, but no process.exit() is called.

https://github.com/moleculerjs/moleculer-cli/blob/master/src/call/index.js#LL75C24-L75C24

Because of that, CRON job can't detect the end of the script. After a few days, I have tons of CRON jobs running in the wild.

Should the successful call be followed by an exit code of zero, or should I explore an other way to say to my CRON "ok, job's done"?

Thanks.

add ability to install dependencies with npm or yarn

The current install process for templates uses npm only to install dependencies after initializing a project by template as seen below:

}).then(({ install }) => {
if (install) {
console.log("\nRunning 'npm install'...");
return exeq([
"cd " + values.projectPath,
"npm install"
]);
}
});

What I propose is that this be modified to look for a yarn.lock file provided in the template, if a yarn.lock is not found then default to npm install. This change should be relatively simple and will allow those users that use yarn to have dependencies installed with yarn when prompted if dependencies should be installed. Currently users that use yarn init a template then must select no to installing dependencies in order to then install them via yarn, this change would bring the experience of using yarn inline with users using npm.

Add a flag to make it so that you can avoid the overwrite prompt in init

Hi there

I'm making a service generator for our services that are using moleculer and as part of that I'm using the moleculer-cli init function to upgrade services that already exist. Basically the process that I've automated thus far is delete all files that aren't logic relating to the function of the service itself and then run moleculer init again (there's a bit more to it but I'll save you the explanation as that isn't the issue).

This upgrade process is something that I plan to run quite frequently and I want to be able to just quickly hit enter through the prompts. But when I get to the overwrite one it's defaulted to false so I end up accidentally exiting out of the process.

I was wondering if it would be alright for us to modify the code for init so that we could put a flag in the meta.js to toggle whether we want to have that prompt or not. Basically we could just add a line before this one that would be something like:

if (templateMetadata.promptForProjectOverwrite === false) return;

I'm happy to put in a PR for this but wanted to raise the issue first to make sure that this was ok with the project maintainers.

Cheers
Zac

AMQP as transporter creates a docker-compose file with wrong naming

After creating a new project and with AMQP as transporter selected, the docker-compose up command fails with the following error.

ERROR: Service 'greeter' depends on service 'amqp' which is undefined.

Renaming amqp with rabbit in the docker-compose file let it work.

command `moleculer` won't execute

My environment:

OS: Darwin failbowl.turner.com 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

Node: v7.9.0
NPM: 4.2.0

Issue:

After running npm install -g moleculer-cli, the moleculer command will not execute properly. This appears to be related to some newline encoding within bin/moleculer.js.

❯ moleculer
env: node\r: No such file or directory

feat: configuration from env

Need to add an override of the configuration from env as it is done in the runner. Now can setting cacher only in config.moleculer.js

Duplicate entry in generated package.json

Duplicate entries for ioredis in generated package.json when running the command moleculer init project-simple first-demo and selecting redis for transporter and for cache.

npm run dev using AMQP and redis

Hey guys, first of all - thanks for your work! I will consider creating PR for this issue, but.

When I use cli, and select AMQP and Redis for caching I run 'npm run dev' which fails, because Redis and Rabbitmq is not running or configured, so my proposition will be - add steps to run/configure it.

Feedback appreceated. Thanks in advance.

Outdated npm Page

Hello there,

I've been trying to use the moleculer-cli with a custom template to act as a service generator and upgrader. One of the last pieces to the puzzle is the new promptForProjectOverwrite property.

I noticed this morning when updating my moleculer-cli version that the new version hasn't been published to npm yet so the change can't be pulled down using npm install.

Can this be updated please?

Thanks!

Amber

deprecated coffee-script

What is the current behavior?

Installing the cli tool throws the error:

npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)

What is the expected behavior?

The installation should work as long as the dependencies point to the correct location

Which versions of molecular-cli, and which browser / OS are affected by this issue? Did this work in previous versions?

Building the library inside a Docker node:8 container with a non-root user -u 1000 on OS X

Error: Missing helper: "if_eq" on moleculer init project

Error: Missing helper: "if_eq"
{ Error: Missing helper: "if_eq"
    at Object.<anonymous> (/Users/fugufish/node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js:19:13)
    at Object.eval [as main] (eval at createFunctionContext (/Users/fugufish/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), <anonymous>:29:78)
    at main (/Users/fugufish/node_modules/handlebars/dist/cjs/handlebars/runtime.js:175:32)
    at ret (/Users/fugufish/node_modules/handlebars/dist/cjs/handlebars/runtime.js:178:12)
    at ret (/Users/fugufish/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:526:21)
    at /Users/fugufish/node_modules/consolidate/lib/consolidate.js:876:16
    at /Users/fugufish/node_modules/consolidate/lib/consolidate.js:161:5
    at Promise._execute (/Users/fugufish/node_modules/bluebird/js/release/debuggability.js:313:9)
    at Promise._resolveFromExecutor (/Users/fugufish/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/Users/fugufish/node_modules/bluebird/js/release/promise.js:79:10)
    at promisify (/Users/fugufish/node_modules/consolidate/lib/consolidate.js:154:10)
    at exports.handlebars.render (/Users/fugufish/node_modules/consolidate/lib/consolidate.js:866:10)
    at /Users/fugufish/node_modules/moleculer-cli/src/init/index.js:319:6
    at /Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:3880:24
    at replenish (/Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:1011:17)
    at /Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:1016:9
    at eachOfLimit (/Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:1041:24)
    at /Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:1046:16
    at _parallel (/Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:3879:5)
    at Object.series (/Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:4735:5)
    at async.each (/Users/fugufish/node_modules/moleculer-cli/src/init/index.js:310:10)
    at /Users/fugufish/node_modules/moleculer-cli/node_modules/async/dist/async.js:3110:16
  description: undefined,
  fileName: undefined,
  lineNumber: undefined,
  message: 'Missing helper: "if_eq"',
  name: 'Error',
  number: undefined }

More file generator

Add more file generator to create command:

  • dbservice (database entity service with moleculer-db)
  • middleware v2
  • mixin

Support the Windows 10 bash shell

Cannot install moleculer-cli in Windows 10 bash shell

$ npm i -g moleculer-cli
npm WARN deprecated [email protected]: Please upgrade to Chalk 2.1.0 - template literals in this version (2.0.1) are quite buggy.
npm ERR! path /home/xmrg/.nvm/versions/node/v8.1.4/lib/node_modules/moleculer-cli/node_modules/es5-ext
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/xmrg/.nvm/versions/node/v8.1.4/lib/node_modules/moleculer-cli/node_modules/es5-ext' -> '/home/xmrg/.nvm/versions/node/v8.1.4/lib/node_modules/moleculer-cli/node_modules/.es5-ext.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xmrg/.npm/_logs/2017-08-24T08_15_58_523Z-debug.log

Non-interactive init with answer files

I'd like to be able to run the init function in a non-interactive way.
Supplying a file with the answers for the init function.

jHipster is using yeoman for their init scripts and it saves all their answers in a .yo.rc.json file that contains all the answers to the questions that were posed.

As a bonus they can use that file to for future upgrade scripts.

moleculer: command not found

Moleculer command not found after running npm i moleculer-cli -g
OS: Catalina v0.15.4

Node: v10.16.0
NPM: v6.9.0

Error on using moleculer init

I get the following error on trying to initialise a moleculer project -
Failed to download repo from 'moleculerjs/moleculer-template-project'!

moleculer connect - transport issue using config

Using moleculer connect --config ./moleculer.config.js transport is not loaded properly.

To verify this after running the command and executing info most of the config is loaded, while the transporter stays TCP

Error after update

Hi, try to run moleculer cli.

  • [2018-11-29T07:55:24.645Z] INFO cli-x0rium-tm1701-24724/BROKER: Moleculer v0.13.4 is starting...
  • [2018-11-29T07:55:24.645Z] INFO cli-x0rium-tm1701-24724/BROKER: Node ID: cli-x0rium-tm1701-24724
  • [2018-11-29T07:55:24.645Z] INFO cli-x0rium-tm1701-24724/BROKER: Namespace:
  • [2018-11-29T07:55:24.646Z] INFO cli-x0rium-tm1701-24724/REGISTRY: Strategy: RoundRobinStrategy
  • [2018-11-29T07:55:24.649Z] INFO cli-x0rium-tm1701-24724/BROKER: Serializer: JSONSerializer
  • [2018-11-29T07:55:24.650Z] INFO cli-x0rium-tm1701-24724/BROKER: Registered 10 internal middleware(s).
  • [2018-11-29T07:55:24.656Z] INFO cli-x0rium-tm1701-24724/REGISTRY: '$node' service is registered.
  • [2018-11-29T07:55:24.657Z] INFO cli-x0rium-tm1701-24724/BROKER: ServiceBroker with 1 service(s) is started successfully.
    - The 'moleculer-repl' package is missing. Please install it with 'npm install moleculer-repl' command.
  • [2018-11-29T07:55:24.792Z] ERROR cli-x0rium-tm1701-24724/BROKER: The 'moleculer-repl' package is missing. Please install it with 'npm install moleculer-repl' command.
  • [2018-11-29T07:55:24.793Z] INFO cli-x0rium-tm1701-24724/BROKER: ServiceBroker is stopped. Good bye.

I try to install npm install moleculer-repl but nothing changes. Reinstall npm i moleculer-cli -g the same.. Any ideas? Thanks!

Documentation for cli flgas

Hi, can you document somewhere all cli flags?
eg. I found --no-install for init accidentally and it seems to be useful in some cases.

REPL cache commands/configuration not working

I have a configuration file that specifies an in memory cacher (tried both cacher true and with options), yet the service broker never has any cacher active.

info shows that the config loaded is correct, i.e. cacher is true, but it also shows in the broker section that cacher is none, what am I missing here? Obviously the cache commands then complain about there being no cacher.

    Node version             : v12.22.8
    Moleculer version        : 0.14.19
    Protocol version         : 4

---

    Namespace                : <None>
    Node ID                  : cli-desktop-po9k7n1-32464
    Services                 : 1
    Actions                  : 7
    Events                   : 0

    Strategy                 : RoundRobinStrategy
    Cacher                   : <None>
    Nodes                    : 2

---

    default
      namespace              : ""
      metadata
      logger
        type                 : "Console"
      logLevel               : "info"
      cacher                 : true
      serializer             : "JSON"
      requestTimeout         : 10000
      .....

Custom Transporte not work

Following the documentation, when I create a custom Transport, and try to use it by creating a project with moleculer-cli, it doesn't work

https://moleculer.services/docs/0.12/transporters.html#Custom-transporter
https://github.com/moleculerjs/moleculer/blob/master/src/transporters/index.js#L40

My transporter
https://github.com/devalexandre/Moleculer-Transport-AmazonSQS

	transporter:new SQSTransporter({
		accessKeyId: "",
		secretAccessKey: "/YyJK8mZm01edfKAmwuPhq3NLUEnl",
		region: "us-east-1",
		apiVersion: "2006-03-01",
	}),
[2021-11-30T03:30:13.674Z] INFO  melissa-129929/BROKER: Moleculer v0.14.18 is starting...
[2021-11-30T03:30:13.674Z] INFO  melissa-129929/BROKER: Namespace: <not defined>
[2021-11-30T03:30:13.674Z] INFO  melissa-129929/BROKER: Node ID: melissa-129929
[2021-11-30T03:30:13.675Z] INFO  melissa-129929/REGISTRY: Strategy: RoundRobinStrategy
[2021-11-30T03:30:13.676Z] INFO  melissa-129929/REGISTRY: Discoverer: LocalDiscoverer
[2021-11-30T03:30:13.677Z] INFO  melissa-129929/BROKER: Serializer: JSONSerializer
[2021-11-30T03:30:13.681Z] INFO  melissa-129929/BROKER: Validator: FastestValidator
[2021-11-30T03:30:13.683Z] INFO  melissa-129929/BROKER: Registered 14 middleware(s).
[2021-11-30T03:30:13.684Z] INFO  melissa-129929/TRANSPORTER: NATS lib version: 2.4.0
[2021-11-30T03:30:13.684Z] INFO  melissa-129929/BROKER: Transporter: NatsTransporter
[2021-11-30T03:30:13.753Z] INFO  melissa-129929/API: API Gateway server created.
[2021-11-30T03:30:13.754Z] INFO  melissa-129929/API: Register route to '/api'
[2021-11-30T03:30:13.768Z] INFO  melissa-129929/API: ♻ Generate aliases for '/api' route...
[2021-11-30T03:30:13.768Z] INFO  melissa-129929/API: 
[2021-11-30T03:30:13.769Z] INFO  melissa-129929/TRANSIT: Connecting to the transporter...
[2021-11-30T03:30:13.804Z] ERROR melissa-129929/TRANSPORTER: NATS error. CONNECTION_REFUSED
[2021-11-30T03:30:13.804Z] WARN  melissa-129929/TRANSIT: Connection is failed. CONNECTION_REFUSED
^C[2021-11-30T03:30:16.917Z] INFO  melissa-129929/$NODE: Service '$node' stopped.
[2021-11-30T03:30:16.917Z] INFO  melissa-129929/API: Service 'api' stopped.
[2021-11-30T03:30:16.917Z] INFO  melissa-129929/GREETER: Service 'greeter' stopped.
[2021-11-30T03:30:16.918Z] INFO  melissa-129929/BROKER: ServiceBroker is stopped. Good bye.

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.