Open tunnckoCore opened 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
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.
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).
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 something2 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
etcapp.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"
}
}
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/*
:)
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
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 ;)
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
Yea, thanks!
I also noticed today, that there is ~/globals.json
created, but I don't know what created it.
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
I've tried to save to global config some options.
for example and it saves it to
~/.data-store/generate.json
it may seems okey in first glance, but here appears two questions/problems:
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 removingrun
from local config and try running verb and it not works as if it is in local config.