Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.0: global config logic not working correctly? #93

Open
tunnckoCore opened this issue Mar 20, 2016 · 10 comments
Open

0.9.0: global config logic not working correctly? #93

tunnckoCore opened this issue Mar 20, 2016 · 10 comments

Comments

@tunnckoCore
Copy link

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:

  • why and what is this cwd? What if i want run:true to be for all projects? I guess this cwd will be changed if i'm in another project?
  • run:true seems not works - i've tested it by removing run from local config and try running verb and it not works as if it is in local config.
@jonschlinkert
Copy link
Member

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
Copy link
Author

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
Copy link
Author

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
Copy link
Member

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):

  • app.globals: globally stored defaults. persisted to ~/.data-store/defaults.json. This should be moved into a directory to keep it clean. like ~/.data-store/defaults/*
  • app.store: app-specific stores, persisted to app-specific files like ~/.data-store/assemble.json, ~/.data-store/verb.json. These should really be in ~/.data-store/app/*
  • app.locals project specific, persisted to files like ~/.data-store/foo-bar.json. These should be in ~/.data-store/project/* or something

2 bonus types

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

  • package.json: config object with the name of the "app". verb, assemble etc
  • app.json: where app is the name of the app. You should be able to use verb.json, this was implemented a while ago. For example, the following will add fooo to the context:
{
  "data": {
    "fooo": "baaar"
  }
}

@tunnckoCore
Copy link
Author

Hm, yea. 👍 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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Author

Yea, thanks!

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

@jonschlinkert
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants