Code Monkey home page Code Monkey logo

mantra-cli's People

Contributors

adrianliaw avatar fermuch avatar gilesbutler avatar haizi-zh avatar imagdy avatar lesstoks avatar macrozone avatar mayankchhabra avatar minicast avatar polguixe avatar remolueoend avatar storytellercz avatar thancock20 avatar thpubs avatar varavut avatar vjau 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  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  avatar  avatar  avatar  avatar

Watchers

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

mantra-cli's Issues

Sanitize template variable

mantra g component foo:header.menu

Results in:

import React from 'react';

const Header.Menu = React.createClass({
  render() {
...

Note Header.Menu on line 3.

Related

mantra g component foo:header_menu

Results in:

import React from 'react';

const Header_menu = React.createClass({
  render() {
    return (
...

0.3.2 Issue => $mantra create = Halt on init

After updating to 0.3.2 mantra create is not working as expected.

$mantra c myapp
$create  myapp/
$invoke  init

And then it halts creating just 2 empty folders "myapp" & "test"

Downgraded to 0.3.1 make it work as expected

problems with module creation (fs module failed somewhat)

Os I tried to create a module named gallery but this is the output.
`$ mantra g module gallery
create client/modules/gallery/
create client/modules/gallery/components/
create client/modules/gallery/containers/
create client/modules/gallery/configs/
create client/modules/gallery/actions/index.js
create client/modules/gallery/index.js
create client/modules/gallery/routes.jsx
fs.js:585
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: ENOENT: no such file or directory, open './client/main.js'
at Error (native)
at Object.fs.openSync (fs.js:585:18)
at Object.fs.readFileSync (fs.js:432:33)
at editFile (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/dist/utils.js:42:34)
at insertToFile (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/dist/utils.js:63:3)
at generateModule (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/dist/generators/module.js:37:27)
at generate (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/dist/commands/generate.js:75:3)
at Command. (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/dist/cli.js:22:26)
at Command.listener (/home/roberto/.nvm/versions/node/v5.2.0/lib/node_modules/mantra-cli/node_modules/commander/index.js:301:8)
at emitTwo (events.js:88:13)
` It looks like it is smth with fs module but what it is... all I can recall that node sometimes complains on some optional dependency on fs (cause it's designed for OSX) and I'm on linux, but I've no clue if this can be related to this issue or not.

Insert comma when adding to export block

Given:

libs/index.js

import Foo from './foo';

export {
  Foo
}

the following command

mantra g collections bar

changes the file into:

import Foo from './foo';
import bar from './bar';

export {
  Foo // Syntax error (need comma)
  bar
}

Also note that bar must be capitalized to follow the convention.

Cannot find module '../dist/cli'

A new user who doesn't know anything about Mantra gets the following error when running mantra create foo for the first time:

Error: Cannot find module '../dist/cli'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/mantra-cli/bin/mantra:3:1)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)
Abigails-Mac-mini:Mantra abigailwatson$ mantra generate foo
module.js:338
    throw err;

"TypeError: undefined is not a function" when creating new project

I installed the latest mantra-cli via npm, and when I try to create a new project I get the following:

mantra create logApp_web
  create  logApp_web/
  invoke  init

/usr/local/lib/node_modules/mantra-cli/dist/utils.js:155
  (0, _child_process.execSync)('bash ' + pathToScript + ' ' + args.join(' '),
                              ^
TypeError: undefined is not a function
    at runScriptFile (/usr/local/lib/node_modules/mantra-cli/dist/utils.js:155:31)
    at create (/usr/local/lib/node_modules/mantra-cli/dist/commands/create.js:28:44)
    at Command.<anonymous> (/usr/local/lib/node_modules/mantra-cli/dist/cli.js:18:24)
    at Command.listener (/usr/local/lib/node_modules/mantra-cli/node_modules/commander/index.js:301:8)
    at Command.emit (events.js:98:17)
    at Command.parseArgs (/usr/local/lib/node_modules/mantra-cli/node_modules/commander/index.js:615:12)
    at Command.parse (/usr/local/lib/node_modules/mantra-cli/node_modules/commander/index.js:458:21)
    at Object.<anonymous> (/usr/local/lib/node_modules/mantra-cli/dist/cli.js:38:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Specs are as follows:

  • OS X vers. 10.11.2
  • npm vers. 1.4.21
  • Node vers. 0.10.30
  • Mantra CLI vers. 0.3.0 (according to npm view)

I should also say that I installed Mantra CLI as root, as it gave errors when I tried to install it as my normal user. Also, I am using zsh, which I only mention because the error references bash, although bash still works.

Remove undefined when using `mantra generate collection`

The initial lib/collections/index.js looks like this:

export {
  undefined
};

So, after running mantra generate collection posts, it did add posts to the export object, but undefined was still there:

import posts from "./posts";

export {
  undefined
  posts
}

We need a way to remove that undefined when generating the first collection.

mantra create doesn't create anything or show any logs :/

Seems a bit like #34, but I have meteor installed, so this can't be the problem :/
When running "mentra create test" the console promts:

  create  test/
  invoke  init

and nothing happens any more.
The folders remain empty...

I'm Running:
โžœ npm -v
3.7.3
โžœ node -v
v5.8.0
If this matters.

Regards and thanks for your help,
lukas

Mantra create -- nothing is happen

Hello

Faced with problem when trying to create a new mantra project

Nothing is happen. No log output is appear with verbose too

mantra create -v Tes1
  create  Tes1/
  invoke  init

Just infinite process

Node and meteor ver.

meteor 1.2.1 global
node v0.12.4

Is it possible to create a new empty meteor project (version 1.2 branch) and then update it to 1.3 branch manually and then recreate structure by mantra?

meteor update --release 1.3-beta.16

smth. like mantra create . in root of meteor application.

Browserify error on startup

I'm getting this error thrown after a clean mantra create sampleapp and running meteor inside of it.

While processing files with cosmos:browserify (for target web.browser):
   packages/kadira:flow-router/client.browserify.js: Arguments to path.resolve
   must be strings

   Browserify options:
   >  undefined

This just only started happening after the latest CLI update

EISDIR error on mantra create

When I try to create a new mantra project, it throws the following error
$ mantra create
create undefined/
invoke init
toEnd: could not append to file (code EISDIR): .meteor/packages

Can only run CLI when on app root

CLI assumes that you are on the app root directory.

possible solutions

  • ~/.mantrarc file to keep paths to all apps generated by CLI. Add command to register/deregister apps
  • Make users set env variable MANTRA_ROOT before using CLI. Maybe add a command to do so.
  • Walk up the directory until it finds .meteor directory and execute command

Suggestions welcomed.

File not found with mantra create myapp

Using nodejs 5.4.1 on OSX

  run  meteor create databook --release 1.3-beta.11
  create  databook/
  create  databook/client/configs/context.js
  create  databook/client/main.js
  create  databook/client/modules/core/index.js
  create  databook/client/modules/core/routes.jsx
  create  databook/client/modules/core/containers/
  create  databook/client/modules/core/configs/
  create  databook/client/modules/core/actions/index.js
  create  databook/client/modules/core/components/main_layout.jsx
  create  databook/client/modules/core/components/home.jsx
fs.js:584
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/dist/commands/../../templates/lib/collections/index.js'
    at Error (native)
    at Object.fs.openSync (fs.js:584:18)
    at Object.fs.readFileSync (fs.js:431:33)
    at getFileContent (/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/dist/commands/create.js:32:45)
    at createFile (/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/dist/commands/create.js:42:28)
    at create (/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/dist/commands/create.js:79:10)
    at Command.<anonymous> (/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/dist/cli.js:18:24)
    at Command.listener (/Users/matt/.nvm/versions/node/v5.4.1/lib/node_modules/mantra-cli/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:87:13)
    at Command.emit (events.js:172:7)

`mantra generate method` error

If I use mantra generate method approveDevice, it shows the following:

  create  ./server/methods/approve_device.js
  update  ./server/methods/index.js

which is OK, but it appends to server/methods/index.js this:

import approveDevice from './approveDevice'; // <- here is the problem
...
export default function() {
  approveDevice();
}

And since the file is being written with lodashes, the import should also use the same structure.

component generation bug on 3.10

Hello,
when trying to generate a component mantra g component microphone:core I get:

create ./client/modules/microphone/components/core.jsx
fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open './client/modules/microphone/components/tests/core.js'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1156:15)
    at _generateTest (/usr/lib/node_modules/mantra-cli/dist/generators/utils.js:362:16)
    at generateComponent (/usr/lib/node_modules/mantra-cli/dist/generators/component.js:27:28)
    at generate (/usr/lib/node_modules/mantra-cli/dist/commands/generate.js:75:3)
    at Command.<anonymous> (/usr/lib/node_modules/mantra-cli/dist/cli.js:22:26)
    at Command.listener (/usr/lib/node_modules/mantra-cli/node_modules/commander/index.js:301:8)
    at emitTwo (events.js:87:13)
    at Command.emit (events.js:172:7)

Regards,
Lukas

Generate local mongo collection

Add a command to generate a local collection

e.g.

mantra g collection files --local

import {Mongo} from 'meteor/mongo';

const Files = new Mongo.Collection(null);

export default Files;

Generate unit tests

Can we have the cli generate associated test files too? It's probably one of the files with the most setup.

We could generate the outer describe and add a pending test that would be picked up.

As a side, is there a reason all test-related features have been left out of the CLI scaffolds? If it's a key component of the Mantra spec, shouldn't the CLI also generate these files?

About the ESLint version

I've noticed that by default mantra cli created a project with an old-version ESLint:

"eslint": "1.10.x"

I'm wondering if there is a particular reason for which not to use ESLint 2.x?

Short commands

It's great if we can do this as well:

mantra c
mantra g action core:users

Use stateless components or ES2015 classes

Here we use React.createClass which is not recommended these days. (But not wrong)
So, we need to create React classes either as stateless components or ES2015 classes extending React.Component.

Stateless components should be the default. But we need to have a way to create the ES2015 classes version as well.

.eslint

I think it would be nice to add the .eslint file provided by mantra kickstarter and blog applications.

Republish with comma fix

Can you republish the package to include the comma fix?

It's a bit annoying right now to run mantra create, wait for it finish, fail on npm install, delete the comma, and then re-run npm install

simpleSchema is imported by default

mantra generate collection command generates a collection file with the line

import {SimpleSchema} from 'meteor/aldeed:simple-schema';

even though user has not specified -s collection flag.

mantra create should download Meteor if not found

I just installed mantra-cli and tried to create a project. The directory was created but nothing else happened. I realized it was because I didn't have Meteor installed. It'd be great if Mantra either downloaded Meteor for you, or if it notified you that Meteor was not installed.

npm package.json typo

There is a , on the last dependency:

"dependencies": {
    "mantra-core": "^1.2.0",
    "react": "^0.14.7",
    "react-dom": "^0.14.7",
    "react-komposer": "^1.3.0",
    "react-mounter": "^1.0.0",
    "react-simple-di": "^1.0.1",
    "eslint": "1.10.x",
    "eslint-plugin-react": "3.15.x",
  }

That doesn't allow npm to parse the json properly.

Generating components, 2 possible results

I noticed 2 ways components are built one way depending on how you generate them. I'm still a newb in this area I'll completely admit that, so there might be a perfectly good reason for this discrepancy. If its the case why is that?
Whats the benefit of using one way over the other?

mantra g component core:messages

class Messages extends React.Component {
  render() {
    return (
      <div>
        Messages
      </div>
    );
  }
}

vs

mantra g container core:messages
Generates container and following component

const Messages = () => (
  <div>
    Messages
  </div>
);

Scaffolding?

Hi,

Any plans adding scaffolding support?

Thank you.

Move to mantrajs org

If you like, you can do it now.
With that, we could more visibility and help.

Error on Generate Collection?

I ran these commands:

mantra g module job_specialties
mantra g publication job_specialties
mantra g method job_specialties
mantra g container job_specialties:job_specialties_list
mantra g container job_specialties:new_job_specialty
mantra g action job_specialties:job_specialties
mantra g collection job_specialties -s collection2

Everything went perfectly until the last command:

mantra g collection job_specialties -s collection2

That command generated the following error:

fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: ENOENT: no such file or directory, open './lib/collections/job_specialties.js'

How can I correct this?

Thanks in advance for the info!

Generate entity in a nested path

Currently

mantra g component core:foo/bar

generates:

./client/modules/core/components/foo_bar.jsx

It should generate

./client/modules/slide_engine/components/foo/bar.jsx

@arunoda Do we support such nested components in Mantra?

mantra is not recognized as an internal command

I have not clue why this does not work for me. I install the package as an admin and otherwise but no matter how I approach it I continue to get an error

'mantra' is not recognized as an internal or external command, operable program or batch file.

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.