mantrajs / mantra-cli Goto Github PK
View Code? Open in Web Editor NEWCommand line interface for building Meteor apps with Mantra
License: MIT License
Command line interface for building Meteor apps with Mantra
License: MIT License
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 (
...
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
Reproduce:
mantra g collection users
mantra d collection users
The following lines is not deleted from index.js:
import Users from './users';
...
Users
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.
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.
work in progress
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;
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:
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.
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.
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
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.
The --version
option should also display the supported/used Meteor version. Right now this seems to be 1.3-beta.11
.
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
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
CLI assumes that you are on the app root directory.
~/.mantrarc
file to keep paths to all apps generated by CLI. Add command to register/deregister appsMANTRA_ROOT
before using CLI. Maybe add a command to do so..meteor
directory and execute commandSuggestions welcomed.
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)
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.
We need to create some unit tests.
For that, write tests close to the source with a directory called __tests__
.
For an example, see: https://github.com/kadirahq/npm-base
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
mantra g collection reposToAdd
results in
import Repostoadd from './repos_to_add';
...
in index.js.
The variable's name should be ReposToAdd
.
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;
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?
I saw we are using collections2 by default. Do we need it by default?
libs
directory in a module is not generated
Which are the differences with the Mantra Atom Package. So far they look very similar in functionality. Are they aligned somehow?
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?
It's great if we can do this as well:
mantra c
mantra g action core:users
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.
import methods from './methods';
is missing from server/main.js
I think it would be nice to add the .eslint file provided by mantra kickstarter and blog applications.
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
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.
After running mantra create [appPath]
, main.html
and main.css
is created in /client
by Meteor. They should not be there.
It would be great to generate with component
file also empty test
file.
Maybe putting there one assertion which will fail by default force to think about tests.
How about that?
Running mantra create
should not create another meteor app while already inside a meteor app. Helpful when someone accidentally runs mantra create
when she really means mantra generate
.
1.3 is officially out and we need to bump the meteor version.
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.
http://guide.meteor.com/v1.3/structure.html#structuring-imports
Meteor 1.3 support folder 'imports' for lazy loading, but Mantra and Mantra CLI still keep files and folders in old structure.
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.
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>
);
Hi,
Any plans adding scaffolding support?
Thank you.
If you like, you can do it now.
With that, we could more visibility and help.
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!
constructor(props) {
super(props);
}
should be added to a components generated using -c
options.
when a file exists, the file is still added to index.js causing duplicate definition.
e.g. method
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?
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.
Work in progress
Should
mantra g collection foo
generate both a collection and a publication?
Feedback welcomed.
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.