ash-framework / cli

Cli for the Ash API framework
MIT License
8 stars 1 forks source link

Possible problem with README being incorrect ? #2

Open shearichard opened 7 years ago

shearichard commented 7 years ago

My Node is 7.7.2 .

So I think this is primarily a documentation issue and if you could confirm that I'd be happy to do a PR ...

Just following the 'start from scratch' instructions. When I start the server (ash server) I get this

rshea@polo /media/poloextra/dev/ash-cli-testbed/my-awesome-project $ ash server
🦄  Ash server listening on port 3010
/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/load-file.js:14
      throw new FileNotFoundError(name, directory)
      ^

FileNotFoundError: Unable to find file posts.js in /media/poloextra/dev/ash-cli-testbed/my-awesome-project/app/routes
    at module.exports (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/load-file.js:14:13)
    at allowedMethods.forEach.method (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:52:21)
    at Array.forEach (native)
    at routeObjects.forEach.routeObj (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:48:22)
    at Array.forEach (native)
    at addRouteCallbacks (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:10:16)
    at module.exports (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/router/index.js:24:18)
    at Function.start (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/node_modules/@ash-framework/ash/src/classes/application.js:235:13)
    at Object.<anonymous> (/media/poloextra/dev/ash-cli-testbed/my-awesome-project/app/application.js:6:13)
    at Module._compile (module.js:571:32)
    at loader (/home/rshea/.config/yarn/global/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/rshea/.config/yarn/global/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.Module.runMain (module.js:605:10)
✖ App has crashed, waiting for file changes

I had noticed when amending the ./app/routes/posts.js (as per the README instructions) that the import Ash differed in the README from the import seen in ./app/routes/posts.js immediately after the ash generate route posts command created it.

It was like this immediately after the command

import Ash from '@ash-framework/ash'

and the README wanted it changed to

import Ash from 'ash-core'

Well when the server blew up I decided to try switching the import back to the way it had been and that indeed seems to have fixed it, the server starts without error and is able to serve resources .

Is this just a question of the README being out of date ?

digitalsadhu commented 7 years ago

Hi again Richard!

So, it seems to me like somehow your versions are out of date. The readme is actually correct when referring to ash-core as I have migrated everything to 2 repos (pretty much) 'ash-core' and the 'ash-cli' now. Any reference to @ash-framework/core is out of date.

I just tried another fresh install of the cli and scaffolded up a project no problem so I'm a bit confused as to whats going on. It could be just caching on my part but i've been through the code again, checked the published versions on npm etc and all is correct.

If you type ash -V what version do you get? It should be 0.2.1 After running ash init if you look at the apps package.json you should see "ash-core": "^0.1.6"

Is that what you are seeing?

(And thanks for giving it a go!)

shearichard commented 7 years ago

Sorry for slow response ... work, family, house etc ;-)

OK so this is a bit weird, ash -V gives me 0.1.3 .

WRT package.json this is what I've got

rshea@polo /media/poloextra/dev/ash-cli-testbed/my-awesome-project $ cat package.json
{
  "name": "name-goes-here",
  "version": "0.0.0",
  "description": "Small description for goes here",
  "private": true,
  "main": "app/application.js",
  "scripts": {
    "start": "babel-node --harmony-async-await .",
    "build": "babel app -d prod",
    "server": "node --harmony-async-await prod/application.js",
    "test": ""
  },
  "repository": "",
  "engines": {
    "node": ">=7.1.0"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@ash-framework/ash": "^0.1.1",
    "babel": "^6.23.0",
    "babel-cli": "^6.24.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.24.0",
    "standard": "^9.0.2"
  }
}

As you can see no mention of ash-core at all !

Just double-checked the node version in case that was signficant

rshea@polo /media/poloextra/dev/ash-cli-testbed/my-awesome-project $ nvm ls
         v4.2.2
         v5.5.0
->       v7.7.2
         system
default -> stable (-> v7.7.2)
node -> stable (-> v7.7.2) (default)
stable -> 7.7 (-> v7.7.2) (default)
iojs -> N/A (default)

Because I wasn't particularly paying attention when I did all this the first time I'm going to start again and make quite sure I am following the instructions etc. I'll try to do that later today and then I'll update the issue with whether that makes a difference.

digitalsadhu commented 7 years ago

Awesome thanks Richard! On Sun, 26 Mar 2017 at 06:39, Richard Shea notifications@github.com wrote:

Sorry for slow response ... work, family, house etc ;-)

OK so this is a bit weird, ash -V gives me 0.1.3 .

WRT package.json this is what I've got

rshea@polo /media/poloextra/dev/ash-cli-testbed/my-awesome-project $ cat package.json { "name": "name-goes-here", "version": "0.0.0", "description": "Small description for goes here", "private": true, "main": "app/application.js", "scripts": { "start": "babel-node --harmony-async-await .", "build": "babel app -d prod", "server": "node --harmony-async-await prod/application.js", "test": "" }, "repository": "", "engines": { "node": ">=7.1.0" }, "author": "", "license": "MIT", "dependencies": { "@ash-framework/ash": "^0.1.1", "babel": "^6.23.0", "babel-cli": "^6.24.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.0", "standard": "^9.0.2" } }

As you can see no mention of ash-core at all !

Just double-checked the node version in case that was signficant

rshea@polo /media/poloextra/dev/ash-cli-testbed/my-awesome-project $ nvm ls v4.2.2 v5.5.0 -> v7.7.2 system default -> stable (-> v7.7.2) node -> stable (-> v7.7.2) (default) stable -> 7.7 (-> v7.7.2) (default) iojs -> N/A (default)

Because I wasn't particularly paying attention when I did all this the first time I'm going to start again and make quite sure I am following the instructions etc. I'll try to do that later today and then I'll update the issue with whether that makes a difference.

— You are receiving this because you are on a team that was mentioned.

Reply to this email directly, view it on GitHub https://github.com/ash-framework/cli/issues/2#issuecomment-289258007, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH2CtAdq24pEDI_btFX38IoYRA5J24Rks5rpev_gaJpZM4MmiU8 .

shearichard commented 7 years ago

Hi Richard - Well unfortunately I'm getting the same effect. It's quite late and maybe when I consider this further in the morning something will come to me but here's what I did .

As part of that I cleaned out the npm and bower cache.

So I now has this lot

rshea@polo /media/poloextra/dev/ash-cli-testbed-2 $ npm ls -g --depth=0
/home/rshea/.nvm/versions/node/v7.7.2/lib
+-- @ash-framework/cli@0.1.3
+-- ember-cli@2.12.1
+-- npm@4.4.4
+-- yarn@0.21.3

Then I did ...

mkdir my-awesome-project
cd my-awesome-project
ash init
ash generate route posts

Changed content of routes/posts.js to be

// app/routes/posts.js
import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route {
  model () {
    return [
      {id: 1, title: 'My post 1', description: 'WoW'},
      {id: 2, title: 'My post 2', description: 'WoWsErS'}
    ]
  }
}

But when I did

ash server

I get

FileNotFoundError: Unable to find file posts.js in /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/routes
    at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/load-file.js:14:13)
? App has crashed, waiting for file changes
    at allowedMethods.forEach.method (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:52:21)
    at Array.forEach (native)
    at routeObjects.forEach.routeObj (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:48:22)
    at Array.forEach (native)
    at addRouteCallbacks (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:10:16)
    at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/index.js:24:18)
    at Function.start (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/classes/application.js:235:13)
    at Object.<anonymous> (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/application.js:6:13)
    at Module._compile (module.js:571:32)
    at loader (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.Module.runMain (module.js:605:10)

So then I went back to routes\posts.js and amended it to read

import Ash from '@ash-framework/ash'

//export default class PostRoute extends Ash.Route {
//  model () {
//
//  }
//}
// app/routes/posts.js
//import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route {
  model () {
    return [
      {id: 1, title: 'My post 1', description: 'WoW'},
      {id: 2, title: 'My post 2', description: 'WoWsErS'}
    ]
  }
}

Started the server again

ash server

And now the server runs and I get a response on

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ curl http://127.0.0.1:3010/posts
[{"id":1,"title":"My post 1","description":"WoW"},{"id":2,"title":"My post 2","description":"WoWsErS"}]

The output from ash -V is still 0.1.3 and the contents of package.json looks like this

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ cat package.json
{
  "name": "name-goes-here",
  "version": "0.0.0",
  "description": "Small description for goes here",
  "private": true,
  "main": "app/application.js",
  "scripts": {
    "start": "babel-node --harmony-async-await .",
    "build": "babel app -d prod",
    "server": "node --harmony-async-await prod/application.js",
    "test": ""
  },
  "repository": "",
  "engines": {
    "node": ">=7.1.0"
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "@ash-framework/ash": "^0.1.1",
    "babel": "^6.23.0",
    "babel-cli": "^6.24.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.24.0",
    "standard": "^9.0.2"
  }
}

So I do understand what you're saying in https://github.com/ash-framework/cli/issues/2#issuecomment-288695144 that the way I'm making it work shouldn't work . Is there any other question you could put to me about my setup that I haven't covered in this ?

In any case I'm going to carry on giving ash a spin using the amended imports and if you have any ideas I'd be interested to hear.

all the best.

digitalsadhu commented 7 years ago

Ah got it! You need to install ash-cli not ash-framework/cli. I made some changes to the repo structures just after the conference. On Sun, 26 Mar 2017 at 13:38, Richard Shea notifications@github.com wrote:

Hi Richard - Well unfortunately I'm getting the same effect. It's quite late and maybe when I consider this further in the morning something will come to me but here's what I did .

  • Uninstalled ash-framework
  • Upgraded ember-cli to 2.12.1
  • Reinstalled ash-framework

So I now has this lot

rshea@polo /media/poloextra/dev/ash-cli-testbed-2 $ npm ls -g --depth=0 /home/rshea/.nvm/versions/node/v7.7.2/lib +-- @ash-framework/cli@0.1.3 +-- ember-cli@2.12.1 +-- npm@4.4.4 +-- yarn@0.21.3

Then I did ...

mkdir my-awesome-project cd my-awesome-project ash init ash generate route posts

Changed content of routes/posts.js to be

// app/routes/posts.js import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route { model () { return [ {id: 1, title: 'My post 1', description: 'WoW'}, {id: 2, title: 'My post 2', description: 'WoWsErS'} ] } }

But when I did

ash server

I get

FileNotFoundError: Unable to find file posts.js in /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/routes at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/load-file.js:14:13) ? App has crashed, waiting for file changes at allowedMethods.forEach.method (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:52:21) at Array.forEach (native) at routeObjects.forEach.routeObj (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:48:22) at Array.forEach (native) at addRouteCallbacks (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:10:16) at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/index.js:24:18) at Function.start (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/classes/application.js:235:13) at Object. (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/application.js:6:13) at Module._compile (module.js:571:32) at loader (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:154:7) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module.runMain (module.js:605:10)

So then I went back to routes\posts.js and amended it to read

import Ash from '@ash-framework/ash'

//export default class PostRoute extends Ash.Route { // model () { // // } //} // app/routes/posts.js //import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route { model () { return [ {id: 1, title: 'My post 1', description: 'WoW'}, {id: 2, title: 'My post 2', description: 'WoWsErS'} ] } }

Started the server again

ash server

And now the server runs and I get a response on

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ curl http://127.0.0.1:3010/posts [{"id":1,"title":"My post 1","description":"WoW"},{"id":2,"title":"My post 2","description":"WoWsErS"}]

The output from ash -V is still 0.1.3 and the contents of package.json looks like this

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ cat package.json { "name": "name-goes-here", "version": "0.0.0", "description": "Small description for goes here", "private": true, "main": "app/application.js", "scripts": { "start": "babel-node --harmony-async-await .", "build": "babel app -d prod", "server": "node --harmony-async-await prod/application.js", "test": "" }, "repository": "", "engines": { "node": ">=7.1.0" }, "author": "", "license": "MIT", "dependencies": { "@ash-framework/ash": "^0.1.1", "babel": "^6.23.0", "babel-cli": "^6.24.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.0", "standard": "^9.0.2" } }

So I do understand what you're saying in #2 (comment) https://github.com/ash-framework/cli/issues/2#issuecomment-288695144 that the way I'm making it work shouldn't work . Is there any other question you could put to me about my setup that I haven't covered in this ?

In any case I'm going to carry on giving ash a spin using the amended imports and if you have any ideas I'd be interested to hear.

all the best.

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/ash-framework/cli/issues/2#issuecomment-289275815, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH2Cg94QZkguBIKGq78MgvOZe9qapPvks5rpk48gaJpZM4MmiU8 .

digitalsadhu commented 7 years ago

So back to your original question it looks like you were right. Docs in that readme need an update! ASAP thanks! On Sun, 26 Mar 2017 at 17:26, Richie digitalsadhu@gmail.com wrote:

Ah got it! You need to install ash-cli not ash-framework/cli. I made some changes to the repo structures just after the conference. On Sun, 26 Mar 2017 at 13:38, Richard Shea notifications@github.com wrote:

Hi Richard - Well unfortunately I'm getting the same effect. It's quite late and maybe when I consider this further in the morning something will come to me but here's what I did .

  • Uninstalled ash-framework
  • Upgraded ember-cli to 2.12.1
  • Reinstalled ash-framework

So I now has this lot

rshea@polo /media/poloextra/dev/ash-cli-testbed-2 $ npm ls -g --depth=0 /home/rshea/.nvm/versions/node/v7.7.2/lib +-- @ash-framework/cli@0.1.3 +-- ember-cli@2.12.1 +-- npm@4.4.4 +-- yarn@0.21.3

Then I did ...

mkdir my-awesome-project cd my-awesome-project ash init ash generate route posts

Changed content of routes/posts.js to be

// app/routes/posts.js import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route { model () { return [ {id: 1, title: 'My post 1', description: 'WoW'}, {id: 2, title: 'My post 2', description: 'WoWsErS'} ] } }

But when I did

ash server

I get

FileNotFoundError: Unable to find file posts.js in /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/routes at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/load-file.js:14:13) ? App has crashed, waiting for file changes at allowedMethods.forEach.method (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:52:21) at Array.forEach (native) at routeObjects.forEach.routeObj (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:48:22) at Array.forEach (native) at addRouteCallbacks (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/add-route-callbacks.js:10:16) at module.exports (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/router/index.js:24:18) at Function.start (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/node_modules/@ash-framework/ash/src/classes/application.js:235:13) at Object. (/media/poloextra/dev/ash-cli-testbed-2/my-awesome-project/app/application.js:6:13) at Module._compile (module.js:571:32) at loader (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:144:5) at Object.require.extensions.(anonymous function) [as .js] (/home/rshea/.nvm/versions/node/v7.7.2/lib/node_modules/@ash-framework/cli/node_modules/babel-register/lib/node.js:154:7) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Function.Module.runMain (module.js:605:10)

So then I went back to routes\posts.js and amended it to read

import Ash from '@ash-framework/ash'

//export default class PostRoute extends Ash.Route { // model () { // // } //} // app/routes/posts.js //import Ash from 'ash-core'

export default class PostsRoute extends Ash.Route { model () { return [ {id: 1, title: 'My post 1', description: 'WoW'}, {id: 2, title: 'My post 2', description: 'WoWsErS'} ] } }

Started the server again

ash server

And now the server runs and I get a response on

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ curl http://127.0.0.1:3010/posts [{"id":1,"title":"My post 1","description":"WoW"},{"id":2,"title":"My post 2","description":"WoWsErS"}]

The output from ash -V is still 0.1.3 and the contents of package.json looks like this

rshea@polo /media/poloextra/dev/ash-cli-testbed-2/my-awesome-project $ cat package.json { "name": "name-goes-here", "version": "0.0.0", "description": "Small description for goes here", "private": true, "main": "app/application.js", "scripts": { "start": "babel-node --harmony-async-await .", "build": "babel app -d prod", "server": "node --harmony-async-await prod/application.js", "test": "" }, "repository": "", "engines": { "node": ">=7.1.0" }, "author": "", "license": "MIT", "dependencies": { "@ash-framework/ash": "^0.1.1", "babel": "^6.23.0", "babel-cli": "^6.24.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.0", "standard": "^9.0.2" } }

So I do understand what you're saying in #2 (comment) https://github.com/ash-framework/cli/issues/2#issuecomment-288695144 that the way I'm making it work shouldn't work . Is there any other question you could put to me about my setup that I haven't covered in this ?

In any case I'm going to carry on giving ash a spin using the amended imports and if you have any ideas I'd be interested to hear.

all the best.

— You are receiving this because you are on a team that was mentioned. Reply to this email directly, view it on GitHub https://github.com/ash-framework/cli/issues/2#issuecomment-289275815, or mute the thread https://github.com/notifications/unsubscribe-auth/ABH2Cg94QZkguBIKGq78MgvOZe9qapPvks5rpk48gaJpZM4MmiU8 .