verbose / verb

HEADS UP! Verb is going though a major transition, we've completely refactored everything from the ground up. If you're interested, please see the dev branch.
MIT License
480 stars 32 forks source link

0.9.0: global config logic not working correctly? #93

Open tunnckoCore opened 8 years ago

tunnckoCore commented 8 years ago

I've tried to save to global config some options.

verb --save run:true

for example and it saves it to ~/.data-store/generate.json

{
  "run": true,
  "cwd": "/home/charlike/dev/capture-spawn"
}

it may seems okey in first glance, but here appears two questions/problems:

jonschlinkert commented 8 years ago

I haven't really done much with the global config yet. that's the last thing I plan to work on. honestly the "store" logic has been a pita, mostly b/c of having different versions of stores running in different places. any ideas/suggestions would be great

tunnckoCore commented 8 years ago

I think they (stores) should be per app basis. Verb config in verb.json, Generate in generate.json, Assemble - assemble.json, on ~/.data-store. And they should looks like this

{
  "project-one": {
    "cwd": "path/to/cwd",
    "other": "options here"
  },
  "project-two": {
    "cwd": "path/to/cwd",
    "foo": "bar"
  }
}

So global verb config would looks like

{
  "capture-spawn": {
    "run": false,
    "tasks": ["readme"],
    "layout": "empty"
  },
  "foo-bar": {
    "cwd": "/home/charlike/dev/foo-bar",
    "layout": "empty"
  },
  "layout": "default",
  "run": true
}

But... hm. I'm not sure.

tunnckoCore commented 8 years ago

Or okey, one global config for all, and in it to be as first example. Maybe would make sense to be named generate.json or base.json or config.json.

{
  "verb": {},
  "generate": {},
  "assemble": {}
}

Yea, this looks better. I also think that cwd should point to global modules path or to global verb. I needed something like that before few weeks (when i found the bug in global-prefix).

jonschlinkert commented 8 years ago

I think they (stores) should be per app basis. Verb config in verb.json

stores (persisted)

there are 3 "types" of stores implemented already, each is (should be) persisted to ~/.data-store, and all three have API methods for getting/setting data (I thought I had all of these persisting to ~/.data-store, but a couple are being saved in ~/data-store or something and need to be fixed):

2 bonus types

In addition to the stores exposed on the API, there are two config stores used for defining options/configuration settings.

{
  "data": {
    "fooo": "baaar"
  }
}
tunnckoCore commented 8 years ago

Hm, yea. :+1: Only one thing... I think folders in ~/.data-store should be the same as variable names in app - app.globals -> ~/.data-store/globals/*, app.locals -> ~/.data-store/locals/* :)

jonschlinkert commented 8 years ago

yea I was just about to comment the same thing.

also, I think that project stores should be specific to the app, so:

# verb config
~/.data-store/app/verb.json

# verb project configs
~/.data-store/app/verb/foo.json
~/.data-store/app/verb/bar.json
~/.data-store/app/verb/baz.json
jonschlinkert commented 8 years ago

one more thing, is that we could make changes to be able to use app.project for project stores. currently app.project is a string (getter) that figures out the name of a project (from package.json, directory, or git config).

But we can rename that to app.projectName or something, and it's only used in a handful of places, so it should be easy if I get some help with it ;)

jonschlinkert commented 8 years ago

see https://github.com/verbose/verb/blob/dev/docs/src/content/config.md, rough draft

edit: draft and the wrong one lol.

try this one https://github.com/verbose/verb/blob/dev/docs/src/content/stores.md

tunnckoCore commented 8 years ago

Yea, thanks!

I also noticed today, that there is ~/globals.json created, but I don't know what created it.

jonschlinkert commented 8 years ago

I also noticed today, that there is ~/globals.json created, but I don't know what created it.

yeah that's the globals store, which should be in ~/.data-store/globals.json, but will probably be changed to ~/.data-store/globals/defaults.json or something like that