You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can activate any of them by adding "`dk use:`*modules...*" to your `.dkrc`, then defining any needed variable or function overrides. (Typically, you override variables by defining them *before* the `dk use:` line(s), and functions by defining them *after*.)
138
139
139
-
Note that these modules are not specially privileged in any way: you are not *required* to use them to obtain the specified functionality. They are simply defaults and examples.
140
+
Note that these modules are not specially privileged in any way: you are not *required* to use them to obtain the specified functionality. They are simply defaults and examples. You can write your own modules and put them in a `.devkit-modules` subdirectory of your project root, and `dk use:` will look for modules there before searching .devkit's bundled modules.
140
141
141
-
So, for example, if you don't like how devkit's `entr-watch` module works, you can write your own functions in `.dkrc` or in a package that you load as a development dependency (e.g. with `require mycommand github mygithubaccount/mycommand mycommand; source "$(command -v mycommand)"`).
142
+
#### External Modules
142
143
143
-
You can also place your own devkit modules under a `.devkit-modules` directory in your project root, and `dk use:` will look for modules there before searching .devkit's bundled modules. You can also access modules from your `.deps` subdirectories by adding symlinks to them from your project's `.devkit-modules`. (Just make sure your `.dkrc` installs those dependencies *before*`dk use:`-ing them, if they're not there yet.)
144
+
You can also load basically any file from github as a .devkit module, by specifying a module name of the form:
145
+
146
+
`+`*org*`/`*repo [*`@`*ref ][*`:`*module-path ]*
147
+
148
+
That is, doing e.g. `dk use: +foo/bar@baz:spam` will check out the `baz` branch or tag of `foo/bar` from github into your `.deps` directory (if there's not already a repo there), and then search for one of these files:
149
+
150
+
*`.deps/foo/bar/.devkit-modules/spam`
151
+
*`.deps/foo/bar/bin/spam/`
152
+
*`.deps/foo/bar/spam/`
153
+
154
+
Both the `@`*ref* and `:`*module-path* parts are optional, defaulting to `master` and `.devkit-module` respectively, with `dk use: +foo/bar` checking out the master branch of `foo/bar` and searching for one of these files:
155
+
156
+
*`.deps/foo/bar/.devkit-modules/default`
157
+
*`.deps/foo/bar/.devkit-module`
158
+
159
+
This means that projects that want to provide .devkit support can include a `.devkit-modules/default` or `.devkit-module` file, allowing others to use it with `dk use: +some/project`, automatically including the repo at build time, and adding its executables to `.deps/bin`. A project can also be created to just publish a bunch of `.devkit-modules`, or you can just literally source any file you like from any project on github by using an explicit *module-path* in the module name.
Copy file name to clipboardexpand all lines: dk.md
+20-7
Original file line number
Diff line number
Diff line change
@@ -236,16 +236,29 @@ relative-symlink() {
236
236
237
237
## `dk use:`
238
238
239
-
devkit modules are loaded using the `dk use` command, which loads modules from `.devkit/modules` a maximum of once.
239
+
devkit modules are loaded using the `dk use:` command, which loads modules a maximum of once.
240
+
241
+
A module name of the form `+`*org*`/`*repo [*`@`*ref ][*`:`*module ]* is loaded from the specified github repository (and possible reference), using the `github` function. (i.e., it is cached as a dependency in `.deps`, and not refetched unless a `clean` is run).
242
+
243
+
If the *module* part is given, it is searched for in that repo's `.devkit-modules/`, `bin/`, and root directories; otherwise the module is exected to be named `.devkit-modules/default `, or `.devkit-module` in the repo's root.
244
+
245
+
Module names *not* beginning with `+` are searched for in the project's own `.devkit-modules` directory, then in `.devkit/modules`.
0 commit comments