These are chat archives for NathanBland/hyper-cli

30th
Mar 2016
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:18
I like where this is headed already
Nathan Bland
@NathanBland
Mar 30 2016 19:18
//default model from ember
export default DS.Model.extend({
});
haha
I'm just trying to brainstorm what an express api would look like in its default state...
and how it would be started..
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:19
Ah, I'll be right back
Nathan Bland
@NathanBland
Mar 30 2016 19:19
obviously there would be some generic boilerplate that was applied to each
ok
About halfway down the page with the url conventions is the basic template
Nathan Bland
@NathanBland
Mar 30 2016 19:22
ok
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:23
I do have a repository set up with a basic (and working) json api compliant mongoose express api
Nathan Bland
@NathanBland
Mar 30 2016 19:23
sweet
I think i've seen it
I'll go take a peek
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:23
hd-api
Nathan Bland
@NathanBland
Mar 30 2016 19:23
yep, thought so
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:23
I'm having problems pushing the latest to the repo though
So what's there isn't quite right
I'll try and push in a short while
Nathan Bland
@NathanBland
Mar 30 2016 19:24
haha ok
I'm going to play with vorpal a bit...
while I try to wrap my head around the adapters in ember
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:39
repo updated. As for the routes and what they return, they should be good to go. There are a lot of things I plan on adding in the future, but the current iteration contains the jist of it... I think.
I personally think the cli should work in conjunction with the default serializer/adapter of ember
export default DS.JSONAPISerializer.extend({
primaryKey: '_id',
serializeId: function(id) {
return id.toString();
}
});

import DS from 'ember-data';

export default DS.JSONAPIAdapter.extend({
host: 'http://localhost:3000'
});

That's both my adapters and they work with my backend perfectly now.
which is how I think the cli should be configured by default
but that's just my opinion.
I also need to figure out how to do that fancy code thing
Nathan Bland
@NathanBland
Mar 30 2016 19:41
here is what I'm proposing for commands in hyper so far:
generate Outputs an express API file. init Creates the boilerplate express API. watch Monitors "app/models" for changes and updates API files accordingly
ugh
formatting hates me
generate       Outputs an express API file.
init                    Creates the boilerplate express API.
watch              Monitors "app/models" for changes and updates API
                       files accordingly
that's a little better
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:42
The monitoring may be hard if they make custom changes
Nathan Bland
@NathanBland
Mar 30 2016 19:42
I'm thinking of using nodemon, or watchman, to watch for file changes
then if they save
rerun generate on it
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:42
but what I mean is that you don't want to overwrite some change they make to the api
Nathan Bland
@NathanBland
Mar 30 2016 19:43
ah I see
I see what you are saying..
You could force good practices on them... and do git add <file> git commit -m 'updated from model' after every update...
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:43
I mean it's doable, but you'll have to get pretty fancy
Nathan Bland
@NathanBland
Mar 30 2016 19:43
but I feel like that's a bad idea
yeah
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:45
I mean, unless you cover 98% of the use cases so that modifying the api is unnessary
then you don't really have to worry about it.
or at least putting in a warning of what may happen
Nathan Bland
@NathanBland
Mar 30 2016 19:45
true..
your other option would be to enable an "extends"
so we generate certain things
and also build in hooks
that the user would have to modify themselves
so your typical resource structure could end up looking like

<resource>/crud.js

<resource>/extends.js

or something
and watch would only update crud.js
so any customized contents would remain in extends unmodified
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:48
that's a pretty good idea. I like that
a good question is, once it's completed, how do we get this sort of thing out there in the wild?
Enough so that people are willing to contribute
Nathan Bland
@NathanBland
Mar 30 2016 19:49
npm
twitter, etc.
if it works well
it probably wouldn't take a lot
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:50
I guess it depends on the demand
Nathan Bland
@NathanBland
Mar 30 2016 19:50
if it really took off, probably would get thrown into its own org
and setup a github.io, etc.
However, in the mean time, its something I want because I hate making this stuff manually haha
so
I added a basic boilerplate for vorpal
which, seems to work
obviously the commands do nothing yet though
Colby Rodeheaver
@crodeheaver
Mar 30 2016 19:54
So are you looking at generate as creating one api for one model and init creating the express boilerplate + api's for the models?
Or they'll init and then generte
generate*
Nathan Bland
@NathanBland
Mar 30 2016 19:57
the first
so generate would take a file input
(eventually)
or just the folder
which ever...
while init would take you through a small wizard
Do you need auth? Y/n
use jwt? Y/n
what database (eventually)
etc.
Is my thought anyway
Colby Rodeheaver
@crodeheaver
Mar 30 2016 20:42
makes sense to me.