flightjs / generator-flight Goto Github PK
View Code? Open in Web Editor NEWA Yeoman generator for scaffolding out a FlightJS web app
Home Page: http://flightjs.github.io
License: MIT License
A Yeoman generator for scaffolding out a FlightJS web app
Home Page: http://flightjs.github.io
License: MIT License
I'm guessing I'm doing something silly here but I keep getting the following error when I create a new flight app with a new component (both using the generator):
ReferenceError: Can't find variable: describeComponent
I'm assuming that my test (untouched after being generated by generator-flight) simply cannot find this method in Jasmine-Flight (line 18). The thing I can't figure out though is the requireJS config in the Karma config looks correct (and is actually unchanged from how the generator generates it).
Am I missing something simple? any help here would be awesome because I'm really stuck.
Per the note here:
https://github.com/flightjs/flight/blob/master/doc/base_api.md#thisattributesobject
Is there a reason to keep the old defaultAttrs call in the template for backward compatibility? If not, I'll submit a pull request with the change.
Currently all the generators install to hard-coded locations, i.e., the component generator does this:
this.template('component.js', 'app/js/component/' + this.name + '.js');
this.template('spec.js', 'test/spec/component/' + this.name + '.spec.js',
It would be useful to allow a second parameter to the generator to choose another folder:
yo flight:component my_amazing_component component/ui
My thinking is it would be okay to force the parent paths to app/js
and test/spec
but to then allow a subfolder path, so the above would result in:
app/js/component/ui/my_amazing_component.js'
test/spec/component/ui/my_amazing_component.spec.js'
In larger apps it quickly becomes cumbersome to dump all created components into a single folder. It's easy enough to generate and move them, but a look at various implementations suggests few are following the fixed generator locations (I'm not assuming they use the generators, just that this feature would facilitate real-world use):
js/component_data
and js/component_ui
js/data
and js/ui
.js/component
.ui
, data
and util
, and probably othersI was trying to use the generator-flight 0.7.2 tonight and kept coming across this error when invoking it:
npm ERR! peerinvalid The package karma-requirejs does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma-requirejs@~0.2.0
npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git://github.com/flightjs/generator-flight.git"
npm ERR! cwd /source/flight-app
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.10
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /source/flight-app/npm-debug.log
npm ERR! not ok code 0
I started poking around and saw that there is already a fix for this on master that was merged in March, but it was just never released it seems. The 0.7.2 tag doesn't contain the changes at least.
I installed the master branch of the generator-flight and everything seems to install as expected now.
So just wondering if we could get a point release for the fixes that are already on master?
Wondering if there is a recommending build process to bundle up flight apps. Looks like the pattern for requiring dependencies in the scaffolding is the var myDep = require('path/to/dep');
method which isn't compatible with the rjs optimizer as far as I can tell.
Is there a way around this which I'm missing? or better to do the array of strings method?
I'm getting the following error when running yo flight
npm ERR! peerinvalid The package karma-requirejs does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants karma-requirejs@~0.2.0
npm ERR! System Linux 3.8.0-41-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/msecret/Development/flight-yql
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/msecret/Development/flight-yql/npm-debug.log
npm ERR! not ok code 0
I've fixed by changing version of karam-requirejs to 0.2.0 in package.json such as follows:
"karma-requirejs": "~0.2.0",
We should publish generator-flight
A new generator that scaffolds a standalone Flight component that can be registered with Bower and installed in Flight applications. Imagining:
yo flight:package
Name could be package
or module
or standalone
or something else. Open to suggestions.
Base it on the setup that Cameron and I have put together for https://github.com/cameronhunter/flight-storage
Replace css
, js
, test
directories with a more self-contained directory of files for each component.
All event triggers are being logged twice. I'm guessing this is due to a change in Flight - it looks like line 23 of main.js is no longer required.
Just use MIT by default.
Now that there are extensions to Mocha for Flight - https://github.com/naoina/flight-mocha - it should be an option in the generator. Perhaps even the default.
Running
yo flight
or
yo flight:app
gives
Error flight
You don't seem to have a generator with the name flight installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 8 registered generators run yo with the `--help` option.
But when I go to check out the generators I have installed I can see all the flight targets
Please choose a generator below.
Flight
flight:lib:generators:all
flight:lib:generators:app
flight:lib:generators:component
flight:lib:generators:mixin
flight:lib:generators:page
Mocha
mocha:app
mocha:generator
Webapp
webapp:app
My other generators work fine.
I ran the generator in a clean directory then npm run server
. I hit http://127.0.0.1:8080 in a browser. The server serves the page as expected but then the server dies hard:
┌─(~/workspace/flight-app-demo-2)───>npm run server
[email protected] server /Users/ben/workspace/flight-app-demo-2
static app
serving "app" at http://127.0.0.1:8080
fs.js:1475
throw new Error('start must be <= end');
^
Error: start must be <= end
at new ReadStream (fs.js:1475:13)
at Object.fs.createReadStream (fs.js:1436:10)
at streamFile (/Users/ben/workspace/flight-app-demo-2/node_modules/node-static/lib/node-static.js:360:16)
at Server.stream (/Users/ben/workspace/flight-app-demo-2/node_modules/node-static/lib/node-static.js:382:7)
at Server.respondNoGzip (/Users/ben/workspace/flight-app-demo-2/node_modules/node-static/lib/node-static.js:332:14)
at Server.respond (/Users/ben/workspace/flight-app-demo-2/node_modules/node-static/lib/node-static.js:347:14)
at /Users/ben/workspace/flight-app-demo-2/node_modules/node-static/lib/node-static.js:144:22
at Object.oncomplete (fs.js:107:15)
npm ERR! [email protected] server: static app
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] server script.
npm ERR! This is most likely a problem with the behave-please package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! static app
npm ERR! You can get their info via:
npm ERR! npm owner ls behave-please
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.3.0
npm ERR! command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/bin/npm" "run" "server"
npm ERR! cwd /Users/ben/workspace/flight-app-demo-2
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/ben/workspace/flight-app-demo-2/npm-debug.log
npm ERR! not ok code 0
npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.10.24/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'server' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preserver', 'server', 'postserver' ]
5 info preserver [email protected]
6 info server [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec server script
9 error [email protected] server: static app
9 error Exit status 8
10 error Failed at the [email protected] server script.
10 error This is most likely a problem with the behave-please package,
10 error not with npm itself.
10 error Tell the author that this fails on your system:
10 error static app
10 error You can get their info via:
10 error npm owner ls behave-please
10 error There is likely additional logging output above.
11 error System Darwin 13.3.0
12 error command "/usr/local/Cellar/node/0.10.24/bin/node" "/usr/local/bin/npm" "run" "server"
13 error cwd /Users/ben/workspace/flight-app-demo-2
14 error node -v v0.10.24
15 error npm -v 1.3.21
16 error code ELIFECYCLE
17 verbose exit [ 1, true ]
Reproduced a bunch of times.
If you try to run yo flight:component
then it will actually invoke yo flight:all
. @passy, have you guys made any changes to yo
that could have introduced this bug? This generator hasn't changed for a while and used to work. Any idea how to fix this?
Is there a reason these scripts are loaded directly on the page? I can see why for ES shim, but jQuery could probably be loaded via AMD?
If I have a dir named 'flight-foo', then yo flight:package
will create a component called 'flight-flight-foo', so probably just require a name is passed for the generator to run.
getting this error when calling
yo flight
Freshly installed on
node-0.10.17
npm-1.3.8
via
npm install -g generator-flight
Thanks for your help
Will need to rewrite things to deal with the API change in yeoman-generator
0.16 - http://yeoman.io/blog/cleanup.html
FFS, jasmine-jquery made a breaking change to their API in a minor bump. Probably fix this by updating jasmine-flight to work with j-jquery 1.7.x.
ATM the require.js config is repeat in the tests and in the app.
In Backbone boilerplate we reuse the same config and run tests with Karma too.
Node-static as npm run server
…or gulp stuff maybe
The generator does not appear in the Yeoman Generators list. Are we OK with this? I think it would be nice to show up there.
Provide a way for people to automate the creation of a production-optimized build, and do things like run lint tasks. I have some thoughts:
@cameronhunter, are you interested in doing this? I've hardly started on it and what I have is completely disposable. So if you want to start this afresh, that would be awesome.
I think it'd be good to include a Gruntfile.
It could handle the basic task like RJS minification you'll end up writing anyway.
Also, it'd be nice to have a server you can launch straight up so the app can run as soon as it is generated. Right now you must setup a server. (Ok, I just ran python simple http server, but it is not really great and don't support SVG)
Also take the chance to clarify in the README that this is for scaffolding an app, whereas the package generator is what you want for standalone components/mixins.
There's a default pages/default.js
and a generator for new pages, but no documentation about what exactly "pages" are supposed to do or how they're used. It's not a term that comes up in the Flight documentation either.
Take the latest from HTML5 Boilerplate; Google have a new snippet.
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.