bradcypert / ignite

A fiery JSON-based scaffolding tool for Node.js

Home Page:https://www.npmjs.com/package/bc-ignite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Link to file content

DavidFrahm opened this issue · comments

I love the way that ignite scaffolds structure, but I do wish that I could somehow direct users to content if they want it. Even on an individual file basis, such as allowing a URL to be the only content in a file created by ignite templates.

For example, in an AngularJS or Ionic scaffold, there would be a karma.conf.js file. This is not app logic, only the configuration for running tests. As such it is very closely related to the structure, which was provided by the template.

I'd like to give the user a URL they can use to go get a typical boilerplate version of that file, if they want to.

Something as simple as this would be enough for me:

"some-folder": {
    "_files": [{file: "karma.conf.js", url: "http://github.com/some-org/some-repo/some-file"}]
}

Or maybe link them to a repo where they can see the same structure as the template, but with content?

That could even just be a link in a template README somewhere.

commented

A solution for that right now would be implementing it as the description for your template. Currently, it's only logged whenever you ignite describe a template, but maybe it should describe the template before/after scaffolding too.

I like this idea.

@bradcypert solution is currently the best option. If you check out the 'es6-api' branch you'll see we have begun to introduced a way to do http requests.

One issue that will need to be considered is offline support, as I feel this is a very important feature.

commented

I agree. Deviating from offline support is deviating from the vision of this project.

I attempted some of this idea here I'll revisit once I get some more time / think about more.

I would like to look into the idea of dropping the json files into their own directories, where the directories themselves could contain files for templates. If the file exists, it would simply copy the contents to the file.

Directory

templates/
 express/
   lib/
     controllers.js
   express.json
   app.js

Schema

"dir":{
  "lib":{
   "_files":['controller.js']
  },
  "_files":['app.js', '.gitignore']
}

While I played with the idea of http requests, I feel like local file storage would be the way to go. This also keeps older schemas and versions from breaking.

commented

Personally, I'm against adding content to the files at all. Unless we can find a way to meet everyone's needs with code structure, content, etc, I'm very opposed to this.

commented

That being said, I thought about it some more and if we added a flag --dry or something that just scaffolded out structure, I think that'd be fine.