Giter VIP home page Giter VIP logo

generator-trails-old's Introduction

generator-trails

Gitter NPM version Linux + OSX Build Status Windows Build Status Dependency Status Follow @trailsjs on Twitter

Trails Yeoman Generator.

Usage

Make sure you are using a recent version of yeoman (>=1.8). You can install the latest Yeoman with npm i -g yo

$ yo trails --help

Usage:
  yo trails [options] 

Options:
        --help          # Print the generator's options and usage
        --skip-cache    # Do not remember prompt answers             Default: false
        --skip-install  # Do not automatically install dependencies  Default: false
        --skip-update   # Do not check for generator's updates       Default: false

Generators:

  Create New Api
    yo trails:api <api-name>

  Create New Model
    yo trails:model <model-name>

  Create New Controller
    yo trails:controller <controller-name>

  Create New Policy
    yo trails:policy <policy-name>

  Create New Service
    yo trails:service <service-name>
    
  Install New Trailpacks
    yo trails:trailpack <trailpacks-name> (like yo trails:trailpack trailpack-repl,trailpack-webpack,...)

Contributing

We love contributions! Please see our Contribution Guide for more information.

License

MIT

generator-trails-old's People

Contributors

ghaiklor avatar gitter-badger avatar greenkeeperio-bot avatar incocode avatar jaumard avatar konstantinzolotarev avatar tjwebb avatar tnunes avatar wbprice avatar yannbertrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

generator-trails-old's Issues

views config documentation link gives 403 Forbidden

I see there was discussion in #8 about template engines. It would be very helpful to have some documentation about where the views files go.

In config/views.js the comments point to http://trailsjs.io/doc/config/views.js but that goes nowhere and is not helpful. Where should templates go and what should the config object look like?

screen shot 2016-07-15 at 10 20 20 pm

dependencies are missed in package.json

after i generate trails app i have
packs: [ require('trailpack-core'), require('trailpack-repl'), require('trailpack-router'), require('trailpack-hapi'), require('trailpack-waterline'), require('trailpack-footprints') ],
in main.js , but don't have required trailpacks in package.json
"dependencies": { "trailpack-core": "^1.0.0-beta-3", "trailpack-repl": "^1.0.0-beta-3", "trailpack-router": "^1.0.0-beta-4", "trails": "^1.0.0-beta-1", "trails-controller": "^1.0.0-beta-2", "trails-model": "^1.0.0-beta-2", "trails-policy": "^1.0.1", "trails-service": "1.0.0-beta-2", "winston": "^2.2" },

so first npm start is following by errors((

Ask about template engine

Would be nice to add witch template engine to use. Cause jade is not "simple" for new developers
Few example :
jade
ejs
handlebar
mustache

Save user choices

I see some yo generators who save users choices so it can be cool if this one can do it to generate new trails project with previous choices.

Yeoman Generator is not specfiging correct dependecies. E.g 'trails-controller'

When I use Yo Trails(generator recently updated), then run node server.js and npm throws error:

`module.js:471
throw err;
^

Error: Cannot find module 'trails-controller'`

Here is my package.json:

{
"name": "trails-course",
"version": "0.0.0",
"description": "A new Trails.js Application",
"homepage": "http://trailsjs.io",
"author": {
"name": "xxxxxxxxxxx",
"email": "[email protected]",
"url": "https://github.com/trailsjs"
},
"main": "index.js",
"keywords": [
"",
"trails",
"trailsjs"
],
"dependencies": {
"express": "^4.14.1",
"trailpack-express": "^2.0.2",
"trailpack-footprints": "^2.0.0",
"trailpack-repl": "v2",
"trailpack-router": "v2",
"trailpack-waterline": "^2.0.0-rc2",
"trails": "v2",
"winston": "^2.3"
},
"devDependencies": {
"eslint": "^2.11",
"eslint-config-trails": "^2",
"mocha": "^2.5",
"supertest": "^1.2"
},
"scripts": {
"test": "eslint . && mocha"
},
"engines": {
"node": ">= 4.0.0"
},
"eslintConfig": {
"extends": "trails"
},
"repository": "/trails-course",
"license": "Apache-2.0"
}

If I add "trailpack-controller": "^1.0.2" to package.json and run npm install, then the app runs ok.

Problems with trailpack-sequelize (and maybe other) versions

Hi! I tried to install trailpack using the v3 branch and I realised that we're using the trails version to install the trailpacks, in the v3 branch the trails version is set to next, but trailpack-sequelize doesn't have such version so it leads to an error.

HMVC

Requested to open a ticket here, from trailsjs/trails#28.

This is regarding creating a generator for HMVC version of trails.

I currently have a POC of how this could be organised here.

Cannot find module './main'

I installed the generator and then create the app like below

$ npm install -g generator-trails
$ mkdir myApp; cd myApp
$ yo trails
$ npm start

And i got this error Cannot find module './main' from the config/index.js file where there is a require of a missing folder/file exports.main = require('./main')

Ask about front framework

It would be nice is the generator ask the user witch front framework they want to use. And generate the right webpack config file for the framework.

Here some :
no framework
react
jquery

Error: Cannot find module 'yeoman-generator/node_modules/path-exists'

Copied from trailsjs/trails#53. Thank you @muxahuk
trying generate controller gives the same error:

C:\Users\M7\trails-demo2>yo trails:controller Main
module.js:328
    throw err;
    ^

Error: Cannot find module 'yeoman-generator/node_modules/path-exists'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (C:\Users\M7\AppData\Roaming\npm\node_modules\generator-trails\generators\app\util.js:13:46)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)

Name of create policy is not consistant

Hi,

When I create a Policy with yo : yo trails:policy Auth or yo trails:policy AuthPolicy, it's create me a file named api/policies/Auth.js with AuthPolicy class. In api/policies/index.js, I have exports.Auth = require('./Auth').

So to use my policy :

// config/policies.js
module.exports = {
  ExampleController: {
    test: [ 'Auth.test' ] // Should be AuthPolicy.test
  }
}

But in the example (readme.md) there is :

// config/policies.js
module.exports = {
  ExampleController: {
    test: [ 'ExamplePolicy.test' ]
  }
}

I find this is not consistent regarding to the controllers and services system which add Controller and Service prefix to the new generated controller or service. So when I generate a policy, I should have AuthPolicy.js instead of Auth.js isn't it ?

The same note applies to models too.

Generator fails when mongoose is selected

The generator fails when creating a new app with mongoose selected as the ORM. The following error was thrown:

npm ERR! notarget No compatible version found: trailpack-mongoose@v2-latest
npm ERR! notarget Valid install targets:
npm ERR! notarget 2.1.1, 2.1.0, 2.0.0, 1.0.1, 1.0.0, 0.4.4, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.0, 0.2.2, 0.2.0, 0.1.0

Windows problem

Don't know why but currently tests are failing on windows

Publish latest version to npm

Hi mates!

We have currently the version 2.0.1published in NPM, which has an old version of eslint and throws errors, that's fixed in the 2.0.3 version, could we publish it?

Thank you!

Warn user when an override is needed

Don't know if it's currently possible, but it can be nice when a trailpack needs to override some files, to let the user know which trailpack needs to override the files. This will help the user to understand what is going on and to make a decision if the user wants to override the files or not.

Generated package.json uses old dependencies

Hello, I've a doubt about the generated dependencies

I'm using [email protected]

Generating a new trails app with this setting

? Choose a Web Server express
? What express version do you want to use ? 4
? Choose an ORM sequelize
? Do you want to use Footprints (automatic REST API from models) ? No
? Module Name heroku-trails-test
? Description 
? Project homepage url 
? Author's Name Mattia Lobertini <[email protected]>
? Author's Email [email protected]
? Author's Homepage 
? Package keywords (comma to split) 
? GitHub username or organization 
? Which license do you want to use? MIT

Will write this dependencies in package.json

"dependencies": {
    ...
    "trailpack-core": "^1.0.0-beta-3",
    "trailpack-express": "^1.0.1",
    "trailpack-repl": "^1.0.0-beta-3",
    "trailpack-router": "^1.0.0-beta-4",
    "trailpack-sequelize": "^1.0.0",
    "trails": "^1.0.0-beta-1",
    "trails-controller": "^1.0.0-beta-2",
    "trails-model": "^1.0.0-beta-2",
    "trails-policy": "^1.0.1",
    "trails-service": "1.0.0-beta-2",
    ...
 }

A lot of dep seems outdated, it's a desired behavior?

Web.js ignored with beta-1 version

Now web.js is copied from web server trailpack. So there some conflict on the config/index.js and some files are not added it can be the web.js but it can another config file from a trailpack choose on the generator.

First though : One way to resolve this is to rebuild index.js after all trailpacks was installed.

Related to trailsjs/trails#149

Mocha tests should not use arrow functions

From Mocha Docs:

Passing arrow functions (“lambdas”) to Mocha is discouraged. Due to the lexical binding of this, such functions are unable to access the Mocha context. For example, the following code will fail due to the nature of lambdas:

describe('my suite', () => {
  it('my test', () => {
    // should set the timeout of this test to 1000 ms; instead will fail
    this.timeout(1000);
    assert.ok(true);
  });
});

I'm thinking particularly of the templates for things like services, policies, etc.

[email protected] crashes during scaffolding

On OSX v10.11.4 (15E65) [email protected] crashes during scaffolding. My selections were:

? Choose a Web Server hapi
? Choose an ORM waterline
? Do you want to use Footprints (automatic REST API from models) ? Yes
? Module Name (test-trails-generator)

Stack trace:

events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: this.env.adapter.prompt(...).then is not a function
    at Base.prompt (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/lib/base.js:232:45)
    at askName (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/inquirer-npm-name/lib/index.js:25:19)
    at module.exports.generators.Base.extend.prompting.askForModuleName (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/generators/app/index.js:112:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/lib/base.js:431:23)
    at /usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/node_modules/run-async/index.js:26:25
    at /usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/node_modules/run-async/index.js:25:19
    at /usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/lib/base.js:432:9
    at processImmediate [as _immediateCallback] (timers.js:383:17)

Generate api

It could be great to have :

yo trailpack:api name

It would generate controller, model and both test classes as in Sails.

how did i break this?

Hey errybody. What did I do wrong here? Generated a new trails app, got an error. Please see below!

yo trails

     _-----_
    |       |    .------------------------------------------.
    |--(o)--|    | Update available: 1.7.0 (current: 1.6.0) |
   `---------´   |     Run npm install -g yo to update.     |
    ( _´U`_ )    '------------------------------------------'
    /___A___\    
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 


Get ready to blaze a new Trails Application!

Checking for updates...
? Choose a Web Server express
? What express version do you want to use ? 4
? Choose an ORM waterline
? Do you want to use Footprints (automatic REST API from models) ? Yes
? Module Name (trails-tutorial) 

events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: this.env.adapter.prompt(...).then is not a function
    at Base.prompt (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/lib/base.js:232:45)
    at askName (/usr/local/lib/node_modules/generator-trails/node_modules/inquirer-npm-name/lib/index.js:25:19)
    at module.exports.generators.Base.extend.prompting.askForModuleName (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/generators/app/index.js:112:14)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modules/yeoman-generator/lib/base.js:431:23)
    at /usr/local/lib/node_modules/generator-trails/node_modules/run-async/index.js:26:25
    at /usr/local/lib/node_modules/generator-trails/node_modules/run-async/index.js:25:19
    at /usr/local/lib/node_modules/generator-trails/node_modules/@trails/generator-node/node_modu%            

copy i18n template files

With last trailpack-core version Trails doesn't start cause it need i18n config file that under trailpack-core/archetype that files need to be copy.

Add tests to test generated project

For now tests only test if files are copy/generate correctly. But doesn't test the generated project (with basic configuration). A test to see if server is starting/running correctly can be nice.

Generated package.json test script doesn't run tests.

In a freshly scaffolded Trails app with one generated model, the model tests aren't seen by mocha when the developer runs npm test.

  // package.json
  . . .
  "scripts": {
    "test": "eslint . && mocha"
  },
  . . .

Could be fixed by adding test --recursive to the test script or by adding a mocha configuration file.

  // package.json
  . . .
  "scripts": {
    "test": "eslint . && mocha test --recursive"
  },
  . . .

add mocha.opts in test/

something like

--reporter spec
--recursive
--check-leaks
--full-trace
--slow 50
--no-exit

Generator trails fails to install when behind corporate proxy

I've had a little bit more time to investigate this which I orginally reported here:
trailsjs/trails#210

When dumping the options that are passed into the got library, it seems that this generator module is attempting to directly call out to npm itself for installation, which doesn't use my proxy environment.

[user@localhost trails-app]$ yo trails

Get ready to blaze a new Trails Application!

Checking for updates...
? Choose a Web Server express
? What express version do you want to use ? 5
? Choose an ORM mongoose
? Do you want to use Footprints (automatic REST API from models) ? Yes
? Module Name trails-app
Opts =>  { protocol: 'https:',
  path: '/trails-app',
  retries: [Function: backoff],
  slashes: true,
  auth: null,
  host: 'registry.npmjs.org',
  port: null,
  hostname: 'registry.npmjs.org',
  hash: null,
  search: null,
  query: null,
  pathname: '/trails-app',
  href: 'https://registry.npmjs.org/trails-app',
  method: 'HEAD',
  headers: 
   { 'user-agent': 'got/6.3.0 (https://github.com/sindresorhus/got)',
     'accept-encoding': 'gzip,deflate' },
  followRedirect: true }


RequestError: socket hang up
    at ClientRequest.req.once.err (/home/user/.nvm/versions/node/v6.3.0/lib/node_modules/generator-trails/node_modules/npm-name/node_modules/got/index.js:67:21)
    at ClientRequest.g (events.js:286:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at emitErrorNT (net.js:1272:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

events.js:160
      throw er; // Unhandled 'error' event
      ^
RequestError: socket hang up
    at ClientRequest.req.once.err (/home/user/.nvm/versions/node/v6.3.0/lib/node_modules/generator-trails/node_modules/npm-name/node_modules/got/index.js:67:21)
    at ClientRequest.g (events.js:286:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at emitErrorNT (net.js:1272:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

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.