Comments (5)
Thanks for trying out dyson.
Let me try to describe how I meant this to work:
- The "init" command creates e.g.
/myApp/configs/get/dummy.js
. - Then from within the
myApp
directory, dyson should be started withdyson configs/
Dyson also sends the registered services to the console on boot (just like the demo), so if there's only "Dyson listening" then it didn't find any configs.
So what might went wrong in your situation is starting dyson with the [dir]
argument (containing the method config directories).
But of course there can also be a bug in dyson, which I would really care to know about.
from dyson.
Well, looks like loader is not overriding the defaults in load():
['get', 'post', 'put', 'delete'].forEach(function(method) {
methodDir = configDir + '/' + method;
methodConfigs = _.flatten(requireDir(methodDir), true);
console.log(methodConfigs)
configs[method] = defaults.assign(methodConfigs, method);
});
returns 4 empty arrays:
[]
[]
[]
[]
In requireDir(),
it returns on the first conditional: if(!(fs.existsSync(dir) && fs.statSync(dir).isDirectory())) return;
UPDATE:
I think it is actually working as designed when I run dyson configs/ from within my app directory.
I wasn't initially including the trailing slash, then I was trying 'configs', '/configs,' and 'configs/' and comparing the results.
So, when using 'configs/' , it is erroring on var g = require('dyson').generators from within get/dummy.js.
module.js:340
throw err;
^
Error: Cannot find module 'dyson'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/Users/jesse.cravens/Code/static_projects/sp-static/configs/get/dummy.js:1:71)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
So, my app is not a node app. It is just a static ember.js application for now, but I would think that since dyson is installed globally, that require('dyson') would still resolve.
So by hardcoding the dependencies (dyson and lodash) back to the global directories:
/Users/username/nvm/v0.8.14/lib/node_modules/dyson/lib/dyson
/Users/username/nvm/v0.8.14/lib/node_modules/dyson/node_modules/lodash/lodash
everything works.
from dyson.
That is mentioned, yet briefly, in the README:
To use the data generators, dyson needs to be added to the devDependencies.
So you would need to add a package.json and make it a Node project, e.g.:
{
"name": "myProject",
"version" : "0.0.1",
"dependencies": {},
"devDependencies": {
"dyson": "0.0.4",
}
}
And then npm install
. I will think about a better way when I get to it. As you found out, like me before (#2), requiring the global dyson doesn't work.
from dyson.
Ok ... make sense. Thanks a bunch.
from dyson.
OK, I hope things are working out for you now. I updated the README with a note, and you can now include dyson-generators (instead of ('dyson').generators
), as can be found in the examples in both projects.
from dyson.
Related Issues (20)
- Default options not working HOT 7
- How to set options.strict to false HOT 2
- Hi. It is possible to use with webpack-dev-server hooks? HOT 1
- Objects being mutated within template function HOT 3
- Demo site is down HOT 3
- Explicit versions prevent fixing npm vulnerabilities HOT 2
- Query Params HOT 2
- Request is not proxied when form-data is used
- Add support for TypeScript files
- json file and js file in same folder causes problems HOT 2
- Maximum call stack size exceeded HOT 1
- How do I simulate a file upload? HOT 3
- dyson dependencies fail npm security audit HOT 3
- Return return express server instead of express HOT 2
- Sending custom status clears body HOT 5
- Documentation on what params are returned HOT 9
- Recording Mocks HOT 4
- 404 not found HOT 2
- Content-Type is converted to lowercase HOT 1
- Dyson dependencies fail npm security audit - lodash needs updating HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dyson.