zarro 1.196.0 → 1.197.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,10 +1,10 @@
1
- Copyright (c) 2013, Davyd McColl. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
-
5
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7
- 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8
-
9
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10
-
1
+ Copyright (c) 2013, Davyd McColl. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
8
+
9
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10
+
package/README.md CHANGED
@@ -1,308 +1,308 @@
1
- # Zarro
2
- ![Test](https://github.com/fluffynuts/zarro/workflows/Tests/badge.svg)
3
-
4
- ![npm](https://img.shields.io/npm/v/zarro)
5
-
6
- ## What is this?
7
-
8
- Standing on the shoulders of giants, zarro is a zero- or low-conf orchestration for
9
- (primarily) dotnet/.NET build and test (eg at CI), but it's also so much more - since
10
- it's easy to add your own tasks, you can use zarro for whatever you like, but if you're
11
- looking for CI build / test / coverage* for dotnet/.NET, this might be what you're looking
12
- for.
13
-
14
- _(* coverage works well for NUnit / .NET Framework, but I haven't found a nice process
15
- for dotnet core - yet)_
16
-
17
- ## Why not just use `msbuild`?
18
-
19
- Zarro wraps msbuild, using `gulp` orchestration under the hood. It does, however,
20
- take away the pain of:
21
- - knowing _where_ msbuild lives (since it consumes [gulp-msbuild](https://www.npmjs.com/package/gulp-msbuild)
22
- - being able to use a specific version of msbuild (again, thanks to `gulp-msbuild`)
23
- - running tests via `dotnet test` or via the NUnit CLI runner, as appropriate
24
- - running coverage reporting (.NET Framework) via OpenCover
25
- - downloading local variants of tooling required for the above so that your CI server
26
- doesn't have to have them installed, or kept up to date
27
- - note: zarro will not download msbuild tooling, but should work fine with any
28
- installed version of:
29
- - VS Community / Professional / Enterprise
30
- - VS Build Tools
31
- - dotnet sdk (dotnet kindly adds itself to the path)
32
- - packing nuget packages, either from .nuspecs (.NET Framework) or directly
33
- from the .csproj (dotnet core)
34
-
35
- ## Fine, but I can do all of that with a batch file?
36
-
37
- Perhaps (though the msbuild discovery is a bit of a PITA, especially since Microsoft
38
- likes to keep us on our toes, mixing up exactly _where_ that's installed to, eg in
39
- vs2019. The real win comes from:
40
- - out of the box, on a simple-ish repo, zarro should be able to build and test,
41
- as long as you use the naming convention of `{Assembly}.Tests` for test projects
42
- (though it will also find `Test.{Assembly}` and an ubiquitous `Tests` assembluy)
43
- - it's easy to add more tasks to your pipeline for further processing
44
- - use the `gulp` orchestration framework to extend or override available tasks
45
-
46
- ## _Which_ `gulp`? 3 or 4? They don't play well together!
47
-
48
- Zarro has you covered here. The heart of Zarro was originally built for gulp 3.
49
- Version 4 came out and broke _everything_. I didn't feel like rewriting perfectly
50
- acceptable tasks, but I did want to keep up with the latest version of `gulp` and
51
- the speed advantages that were promised. As such, Zarro can consume and adapt
52
- gulp 3 tasks to run under gulp 4.
53
-
54
- ## Getting started
55
-
56
- 1. `npm init -y` (if you don't already have a `package.json`
57
- 2. `npm install --save-dev zarro`
58
- 3. start adding scripts! for example:
59
- ```json
60
- "scripts": {
61
- "build": "zarro @",
62
- "test": "zarro @",
63
- "zarro": "zarro"
64
- }
65
- ```
66
- (the `test-dotnet` task should invoke zarro's inbuilt `build` task (and some earlier
67
- ones to download tooling, as required) so that when test-time comes, assemblies
68
- are already built (required for .NET Framework / NUnit runner, and optimised for
69
- `dotnet` by performing the build and testing without rebuild)).
70
-
71
- Add new custom tasks by invoking `zarro --create-task` to guide you through
72
- the process. This will create a skeleton task file for you under `local-tasks`
73
- with some of the boiler-plating already done.
74
-
75
- ## What's in the box
76
-
77
- ### Direct invocations
78
- | command-line switch | action |
79
- |---------------------|---------------------------------------------------------------------|
80
- | --create-task | guids you through creating a new local task written in typescript |
81
- | --help | shows how to use zarro |
82
- | --init | adds a "zarro" npm script to make zarro invocations easier |
83
- | --show-env | shows the observed environment variables and what tasks they affect |
84
- | --tasks | lists the task tree (built-in and yours |
85
-
86
- ### Built-in tasks
87
- There are an array of pre-defined tasks you get out of the box with zarro. I hope to eventually
88
- provide more documentation for them, but running `zarro --tasks` should tell you something
89
- similar to:
90
-
91
- - help
92
- - shows help / usage
93
- - help:environment
94
- - shows help about environment variables zarro observes (same as running with --help)
95
- - build
96
- - attempts to build all found .net solutions
97
- - test-dotnet
98
- - test .net projects based on conventions
99
- - test project names should match `*.Tests` or `*.Test` or plain old `Tests`
100
- - assumes test are nunit
101
- - cover-dotnet
102
- - test with coverage
103
- - can use dotCover or OpenCover
104
- - generate-reports
105
- - generate html reports from OpenCover results
106
- - default-tools-installer
107
- - installs the default helper tooling from nuget
108
- - nunit cli
109
- - dotCover
110
- - OpenCover
111
- - ReportGenerator
112
- - install-tools
113
- - called before build
114
- - defaults to install default tools
115
- - override with an empty task if not useful
116
- - dotnet-publish
117
- - runs dotnet cli build with publish options
118
- - nuget-restor
119
- - restores nuget packages
120
- - run automatically as part of build
121
- - release-npm
122
- - perform guided release of npm packages
123
- - can do beta releases
124
- - will automatically
125
- - increment version
126
- - git commit
127
- - git tag
128
- - git push
129
- - update-self
130
- - updates to zarro@latest
131
- - update-git-submodules
132
- - updates all git submodules in the repo
133
- - pretest
134
- - place-holder: override this to run something before testing
135
- - verify-up-to-date
136
- - verifies that the current branch is up-to-date with the main one
137
- - will check against {remote}/{main branch} if possible
138
-
139
-
140
-
141
- ## Zarro doesn't do what I want out of the box
142
-
143
- Zarro is designed to be zero- to low- conf. You can guide many aspects of available
144
- tasks with environment variables. Running `npm run zarro -- --show-env` will show you
145
- all observed environment variables and where they are applicable. I suggest using
146
- `cross-env` and applying these variables in one place, to keep things simpler. For
147
- example, [NExpect](https://github.com/fluffynuts/NExpect) does the following:
148
-
149
- ### Traditional configuration via environment variables
150
-
151
- ```json
152
- "scripts": {
153
- "zarro": "cross-env DOTNET_CORE=1 BUILD_EXCLUDE=src/PeanutButter/**/* PACK_INCLUDE=* PACK_EXCLUDE=*Tests*,CoreConsumer,src/PeanutButter/**/* TEST_EXCLUDE=src/PeanutButter/**/* zarro",
154
- "build": "run-s \"zarro build\"",
155
- "test": "run-s \"zarro test-dotnet\""
156
- }
157
- ```
158
-
159
- in the above:
160
- - `DOTNET_CORE=1` instructs zarro to use `dotnet` instead of searching for `msbuild`
161
- - `BUILD_EXCLUDE=...` instructs zarro to exclude everything under that folder, recursively
162
- (NExpect imports PeanutButter as a submodule to use some shared code without relying
163
- on another package dependency)
164
- - similarly `TEST_EXCLUDE` excludes PeanutButter tests
165
- - similarly, `PACK_INCLUDE` and `PACK_EXCLUDE` control nuget packing within NExpect
166
-
167
- ### Updated configuration
168
- Zarro will automatically create a `.zarro-defaults` next to your `package.json` if it
169
- is not found. In here, we can add key-value-pairs of environment variables to set
170
- when running zarro. These values will be overridden by any existing environment variables,
171
- so if you need to override a variable which is set on the hosting system, you should
172
- use `cross-env` as above. However, for many situations, specifying environment variables
173
- in `.zarro-defaults` makes npm script setup a lot easier. For example, if we use `.zarro-defaults`,
174
- we can modify the example above:
175
-
176
-
177
- Update package.json with:
178
- ```json
179
- "scripts": {
180
- "build": "zarro @",
181
- "test": "zarro test-dotnet"
182
- }
183
- ```
184
- Update .zarro-defaults to contain:
185
- ```
186
- DOTNET_CORE=1
187
- BUILD_EXCLUDE=src/PeanutButter/**/*
188
- PACK_INCLUDE=*
189
- PACK_EXCLUDE=*Tests*,CoreConsumer,src/PeanutButter/**/*
190
- TEST_EXCLUDE=src/PeanutButter/**/*
191
- ```
192
-
193
- Note also here the shorthand of `@` - if a task has the same name as the npm script
194
- used to invoke it, this is a quick way to surface that task to `npm run` -space.
195
-
196
- ## Custom tasks
197
-
198
- Zarro will also search two folders:
199
- - local-tasks
200
- - override-tasks
201
- in the root of your repo, for extra tasks that you can access from your npm scripts.
202
-
203
- These can be brand-new functionality you'd like to add to your repo's build system,
204
- or you can _override existing tasks_, if they don't suit you. For example, if the `pack`
205
- task doesn't do exactly what you want, copy `pack.js` from `node_modules/zarro/gulp-tasks`
206
- into your `local-tasks` folder and modify it to suit you. If you find a generic solution
207
- to the problem you have which others might find useful or fix a bug, I'd like to know
208
- about it. PRs for fixes and extension tasks which others could use will be appreciated.
209
-
210
- ## Examples of custom tasks that I've written in the past
211
- - a watcher to automatically recompile scss to .css
212
- - orchestration of build / test of sub-projects that aren't .NET
213
- - automatic version incrementing of packages before release
214
- - committing, tagging and pushing new changes to GitHub
215
- - I've found that writing a meta task called `release` can make it much
216
- less painful to perform a release of my nuget packages, for example.
217
- This meta task would:
218
- - build
219
- - test
220
- - increment package versions
221
- - pack
222
- - push packages
223
- - commit the updates package definitions
224
- - tag the release
225
- - push the tag and changes to GitHub
226
-
227
- ## API
228
-
229
- Zarro provides some convenience functionality from baked-in modules. To access a module,
230
- the global `requireModule` function will resolve the correct location for you. Modules
231
- live under the `gulp-tasks/modules` folder. Most modules will return a single function,
232
- though there are some exceptions. Some modules may be of interest to custom tasks, eg:
233
-
234
- - `gulp`
235
- - you should `requireModule("gulp")` wherever you would have normally
236
- done `require("gulp")`. This gets you the patched version of gulp 4 which
237
- will happily consume gulp 3 tasks and which has inbuilt support for help
238
- for your tasks on both gulp 3 and 4. Most importantly, if you _do not_ use this
239
- export, your tasks may not be correctly registered.
240
- - `env`
241
- - provides a utility object to resolve environment variables for you
242
- - `register` can register an environment variable as known with a default
243
- value and help. See `register-environment-variables.ts` for examples.
244
- When you use this function, you can have a central configuration for
245
- a default value for an environment variable and your environment
246
- variable will be displayed in the `--show-env` output
247
- - `resolve` resolves environment variables for you. It can be invoked with
248
- one or more variable names, so can be used to fall back from one variable
249
- onto another. It will also resolve back values if registered.
250
- - `associate` associates one or more variables with one or more tasks,
251
- primarily to show which tasks are affected by which variables when
252
- running with `--show-env`
253
- - `resolveArray` can resolve an environment variable to an array for you,
254
- with an optional `delimiter` parameter, which defaults to comma
255
- - `resolveNumber` resolves a numeric value from the named environment
256
- value or throws if the value can't be resolved as a number, effectively
257
- stopping execution. If you're expecting a number (eg port or max thread
258
- count) you can simply `resolveNumber` and an invalid value would cause
259
- execution to stop with a reasonable message
260
- - `resolveFlag` resolves boolean values from environment variables
261
- - `true` for: "yes", "true" or "1"
262
- - `false` for: "no", "false" or "0"
263
- - throws for unknown values
264
- - `system`
265
- - function to run other process and get back stdio results from said processes
266
- - `resolve-masks`
267
- - single function to resolve an array of masks that could be used in a `gulp.src`
268
- where those masks can be inclusive or exclusive
269
- - `find-local-nuget`
270
- - provides a single function to find a locally-downloaded `nuget.exe`, automatically
271
- downloading it if required. Use this if you need to use `nuget.exe` operations
272
- and don't want to set up your build host with a pathed `nuget.exe`
273
- - git utilities
274
- - `git-tag`
275
- - `git-push`
276
- - `git-push-tags`
277
- - string padding
278
- - `pad`
279
- - `pad-left`
280
- - `pad-right`
281
-
282
- There are many more utilities in there, feel free to browse the source.
283
-
284
- ## History
285
-
286
- If you've made it thus far, some light history might be of interest. Zarro's core
287
- functionality comes from another repo of mine: [gulp-tasks](https://github.com/fluffynuts/gulp-tasks)
288
- which was traditionally consumed as a git submodule. However, it seems that a lot
289
- of people don't really "get" git submodules:
290
- - people forget (or don't understand that they need to) `git submodule update --init` after
291
- a `git clone` or a `git pull`. Some modern git clients are doing this for the user,
292
- but not all of them.
293
- - people don't seem to understand how submodules are stored (literally just a hash and
294
- an url), so they don't pay attention when committing them. In particular, I have seen
295
- my fair share of inadvertent "submodule wars" where changes upstream aren't applied
296
- after a `pull` (ie, people forget to run `git submodule update --init`), then they
297
- re-commit back the _old version_ of the module that they have locally. So fixes tend
298
- to become unfixed
299
- - in addition, `gulp-tasks` requires dependencies to be installed in the hosting repo's
300
- package.json, meaning that (a) the hosting repo has to "know too much" about the
301
- requirements of `gulp-tasks` and (b) upstream changes may require changes to a repo's
302
- package.json (and an `npm install`). Whilst this was (eventually) automated as part
303
- of `gulp-tasks`, it seems unnecessarily complex.
304
- - the solution seemed clear: make `gulp-tasks` available via an npm package
305
- - the name is inspired from the old bugzilla, which would proudly proclaim "zarro boogs"
306
- when there were zero bug matches for a query, because (a) names are hard and (b)
307
- zarro aims to be zero- to low-conf
308
-
1
+ # Zarro
2
+ ![Test](https://github.com/fluffynuts/zarro/workflows/Tests/badge.svg)
3
+
4
+ ![npm](https://img.shields.io/npm/v/zarro)
5
+
6
+ ## What is this?
7
+
8
+ Standing on the shoulders of giants, zarro is a zero- or low-conf orchestration for
9
+ (primarily) dotnet/.NET build and test (eg at CI), but it's also so much more - since
10
+ it's easy to add your own tasks, you can use zarro for whatever you like, but if you're
11
+ looking for CI build / test / coverage* for dotnet/.NET, this might be what you're looking
12
+ for.
13
+
14
+ _(* coverage works well for NUnit / .NET Framework, but I haven't found a nice process
15
+ for dotnet core - yet)_
16
+
17
+ ## Why not just use `msbuild`?
18
+
19
+ Zarro wraps msbuild, using `gulp` orchestration under the hood. It does, however,
20
+ take away the pain of:
21
+ - knowing _where_ msbuild lives (since it consumes [gulp-msbuild](https://www.npmjs.com/package/gulp-msbuild)
22
+ - being able to use a specific version of msbuild (again, thanks to `gulp-msbuild`)
23
+ - running tests via `dotnet test` or via the NUnit CLI runner, as appropriate
24
+ - running coverage reporting (.NET Framework) via OpenCover
25
+ - downloading local variants of tooling required for the above so that your CI server
26
+ doesn't have to have them installed, or kept up to date
27
+ - note: zarro will not download msbuild tooling, but should work fine with any
28
+ installed version of:
29
+ - VS Community / Professional / Enterprise
30
+ - VS Build Tools
31
+ - dotnet sdk (dotnet kindly adds itself to the path)
32
+ - packing nuget packages, either from .nuspecs (.NET Framework) or directly
33
+ from the .csproj (dotnet core)
34
+
35
+ ## Fine, but I can do all of that with a batch file?
36
+
37
+ Perhaps (though the msbuild discovery is a bit of a PITA, especially since Microsoft
38
+ likes to keep us on our toes, mixing up exactly _where_ that's installed to, eg in
39
+ vs2019. The real win comes from:
40
+ - out of the box, on a simple-ish repo, zarro should be able to build and test,
41
+ as long as you use the naming convention of `{Assembly}.Tests` for test projects
42
+ (though it will also find `Test.{Assembly}` and an ubiquitous `Tests` assembluy)
43
+ - it's easy to add more tasks to your pipeline for further processing
44
+ - use the `gulp` orchestration framework to extend or override available tasks
45
+
46
+ ## _Which_ `gulp`? 3 or 4? They don't play well together!
47
+
48
+ Zarro has you covered here. The heart of Zarro was originally built for gulp 3.
49
+ Version 4 came out and broke _everything_. I didn't feel like rewriting perfectly
50
+ acceptable tasks, but I did want to keep up with the latest version of `gulp` and
51
+ the speed advantages that were promised. As such, Zarro can consume and adapt
52
+ gulp 3 tasks to run under gulp 4.
53
+
54
+ ## Getting started
55
+
56
+ 1. `npm init -y` (if you don't already have a `package.json`
57
+ 2. `npm install --save-dev zarro`
58
+ 3. start adding scripts! for example:
59
+ ```json
60
+ "scripts": {
61
+ "build": "zarro @",
62
+ "test": "zarro @",
63
+ "zarro": "zarro"
64
+ }
65
+ ```
66
+ (the `test-dotnet` task should invoke zarro's inbuilt `build` task (and some earlier
67
+ ones to download tooling, as required) so that when test-time comes, assemblies
68
+ are already built (required for .NET Framework / NUnit runner, and optimised for
69
+ `dotnet` by performing the build and testing without rebuild)).
70
+
71
+ Add new custom tasks by invoking `zarro --create-task` to guide you through
72
+ the process. This will create a skeleton task file for you under `local-tasks`
73
+ with some of the boiler-plating already done.
74
+
75
+ ## What's in the box
76
+
77
+ ### Direct invocations
78
+ | command-line switch | action |
79
+ |---------------------|---------------------------------------------------------------------|
80
+ | --create-task | guids you through creating a new local task written in typescript |
81
+ | --help | shows how to use zarro |
82
+ | --init | adds a "zarro" npm script to make zarro invocations easier |
83
+ | --show-env | shows the observed environment variables and what tasks they affect |
84
+ | --tasks | lists the task tree (built-in and yours |
85
+
86
+ ### Built-in tasks
87
+ There are an array of pre-defined tasks you get out of the box with zarro. I hope to eventually
88
+ provide more documentation for them, but running `zarro --tasks` should tell you something
89
+ similar to:
90
+
91
+ - help
92
+ - shows help / usage
93
+ - help:environment
94
+ - shows help about environment variables zarro observes (same as running with --help)
95
+ - build
96
+ - attempts to build all found .net solutions
97
+ - test-dotnet
98
+ - test .net projects based on conventions
99
+ - test project names should match `*.Tests` or `*.Test` or plain old `Tests`
100
+ - assumes test are nunit
101
+ - cover-dotnet
102
+ - test with coverage
103
+ - can use dotCover or OpenCover
104
+ - generate-reports
105
+ - generate html reports from OpenCover results
106
+ - default-tools-installer
107
+ - installs the default helper tooling from nuget
108
+ - nunit cli
109
+ - dotCover
110
+ - OpenCover
111
+ - ReportGenerator
112
+ - install-tools
113
+ - called before build
114
+ - defaults to install default tools
115
+ - override with an empty task if not useful
116
+ - dotnet-publish
117
+ - runs dotnet cli build with publish options
118
+ - nuget-restor
119
+ - restores nuget packages
120
+ - run automatically as part of build
121
+ - release-npm
122
+ - perform guided release of npm packages
123
+ - can do beta releases
124
+ - will automatically
125
+ - increment version
126
+ - git commit
127
+ - git tag
128
+ - git push
129
+ - update-self
130
+ - updates to zarro@latest
131
+ - update-git-submodules
132
+ - updates all git submodules in the repo
133
+ - pretest
134
+ - place-holder: override this to run something before testing
135
+ - verify-up-to-date
136
+ - verifies that the current branch is up-to-date with the main one
137
+ - will check against {remote}/{main branch} if possible
138
+
139
+
140
+
141
+ ## Zarro doesn't do what I want out of the box
142
+
143
+ Zarro is designed to be zero- to low- conf. You can guide many aspects of available
144
+ tasks with environment variables. Running `npm run zarro -- --show-env` will show you
145
+ all observed environment variables and where they are applicable. I suggest using
146
+ `cross-env` and applying these variables in one place, to keep things simpler. For
147
+ example, [NExpect](https://github.com/fluffynuts/NExpect) does the following:
148
+
149
+ ### Traditional configuration via environment variables
150
+
151
+ ```json
152
+ "scripts": {
153
+ "zarro": "cross-env DOTNET_CORE=1 BUILD_EXCLUDE=src/PeanutButter/**/* PACK_INCLUDE=* PACK_EXCLUDE=*Tests*,CoreConsumer,src/PeanutButter/**/* TEST_EXCLUDE=src/PeanutButter/**/* zarro",
154
+ "build": "run-s \"zarro build\"",
155
+ "test": "run-s \"zarro test-dotnet\""
156
+ }
157
+ ```
158
+
159
+ in the above:
160
+ - `DOTNET_CORE=1` instructs zarro to use `dotnet` instead of searching for `msbuild`
161
+ - `BUILD_EXCLUDE=...` instructs zarro to exclude everything under that folder, recursively
162
+ (NExpect imports PeanutButter as a submodule to use some shared code without relying
163
+ on another package dependency)
164
+ - similarly `TEST_EXCLUDE` excludes PeanutButter tests
165
+ - similarly, `PACK_INCLUDE` and `PACK_EXCLUDE` control nuget packing within NExpect
166
+
167
+ ### Updated configuration
168
+ Zarro will automatically create a `.zarro-defaults` next to your `package.json` if it
169
+ is not found. In here, we can add key-value-pairs of environment variables to set
170
+ when running zarro. These values will be overridden by any existing environment variables,
171
+ so if you need to override a variable which is set on the hosting system, you should
172
+ use `cross-env` as above. However, for many situations, specifying environment variables
173
+ in `.zarro-defaults` makes npm script setup a lot easier. For example, if we use `.zarro-defaults`,
174
+ we can modify the example above:
175
+
176
+
177
+ Update package.json with:
178
+ ```json
179
+ "scripts": {
180
+ "build": "zarro @",
181
+ "test": "zarro test-dotnet"
182
+ }
183
+ ```
184
+ Update .zarro-defaults to contain:
185
+ ```
186
+ DOTNET_CORE=1
187
+ BUILD_EXCLUDE=src/PeanutButter/**/*
188
+ PACK_INCLUDE=*
189
+ PACK_EXCLUDE=*Tests*,CoreConsumer,src/PeanutButter/**/*
190
+ TEST_EXCLUDE=src/PeanutButter/**/*
191
+ ```
192
+
193
+ Note also here the shorthand of `@` - if a task has the same name as the npm script
194
+ used to invoke it, this is a quick way to surface that task to `npm run` -space.
195
+
196
+ ## Custom tasks
197
+
198
+ Zarro will also search two folders:
199
+ - local-tasks
200
+ - override-tasks
201
+ in the root of your repo, for extra tasks that you can access from your npm scripts.
202
+
203
+ These can be brand-new functionality you'd like to add to your repo's build system,
204
+ or you can _override existing tasks_, if they don't suit you. For example, if the `pack`
205
+ task doesn't do exactly what you want, copy `pack.js` from `node_modules/zarro/gulp-tasks`
206
+ into your `local-tasks` folder and modify it to suit you. If you find a generic solution
207
+ to the problem you have which others might find useful or fix a bug, I'd like to know
208
+ about it. PRs for fixes and extension tasks which others could use will be appreciated.
209
+
210
+ ## Examples of custom tasks that I've written in the past
211
+ - a watcher to automatically recompile scss to .css
212
+ - orchestration of build / test of sub-projects that aren't .NET
213
+ - automatic version incrementing of packages before release
214
+ - committing, tagging and pushing new changes to GitHub
215
+ - I've found that writing a meta task called `release` can make it much
216
+ less painful to perform a release of my nuget packages, for example.
217
+ This meta task would:
218
+ - build
219
+ - test
220
+ - increment package versions
221
+ - pack
222
+ - push packages
223
+ - commit the updates package definitions
224
+ - tag the release
225
+ - push the tag and changes to GitHub
226
+
227
+ ## API
228
+
229
+ Zarro provides some convenience functionality from baked-in modules. To access a module,
230
+ the global `requireModule` function will resolve the correct location for you. Modules
231
+ live under the `gulp-tasks/modules` folder. Most modules will return a single function,
232
+ though there are some exceptions. Some modules may be of interest to custom tasks, eg:
233
+
234
+ - `gulp`
235
+ - you should `requireModule("gulp")` wherever you would have normally
236
+ done `require("gulp")`. This gets you the patched version of gulp 4 which
237
+ will happily consume gulp 3 tasks and which has inbuilt support for help
238
+ for your tasks on both gulp 3 and 4. Most importantly, if you _do not_ use this
239
+ export, your tasks may not be correctly registered.
240
+ - `env`
241
+ - provides a utility object to resolve environment variables for you
242
+ - `register` can register an environment variable as known with a default
243
+ value and help. See `register-environment-variables.ts` for examples.
244
+ When you use this function, you can have a central configuration for
245
+ a default value for an environment variable and your environment
246
+ variable will be displayed in the `--show-env` output
247
+ - `resolve` resolves environment variables for you. It can be invoked with
248
+ one or more variable names, so can be used to fall back from one variable
249
+ onto another. It will also resolve back values if registered.
250
+ - `associate` associates one or more variables with one or more tasks,
251
+ primarily to show which tasks are affected by which variables when
252
+ running with `--show-env`
253
+ - `resolveArray` can resolve an environment variable to an array for you,
254
+ with an optional `delimiter` parameter, which defaults to comma
255
+ - `resolveNumber` resolves a numeric value from the named environment
256
+ value or throws if the value can't be resolved as a number, effectively
257
+ stopping execution. If you're expecting a number (eg port or max thread
258
+ count) you can simply `resolveNumber` and an invalid value would cause
259
+ execution to stop with a reasonable message
260
+ - `resolveFlag` resolves boolean values from environment variables
261
+ - `true` for: "yes", "true" or "1"
262
+ - `false` for: "no", "false" or "0"
263
+ - throws for unknown values
264
+ - `system`
265
+ - function to run other process and get back stdio results from said processes
266
+ - `resolve-masks`
267
+ - single function to resolve an array of masks that could be used in a `gulp.src`
268
+ where those masks can be inclusive or exclusive
269
+ - `find-local-nuget`
270
+ - provides a single function to find a locally-downloaded `nuget.exe`, automatically
271
+ downloading it if required. Use this if you need to use `nuget.exe` operations
272
+ and don't want to set up your build host with a pathed `nuget.exe`
273
+ - git utilities
274
+ - `git-tag`
275
+ - `git-push`
276
+ - `git-push-tags`
277
+ - string padding
278
+ - `pad`
279
+ - `pad-left`
280
+ - `pad-right`
281
+
282
+ There are many more utilities in there, feel free to browse the source.
283
+
284
+ ## History
285
+
286
+ If you've made it thus far, some light history might be of interest. Zarro's core
287
+ functionality comes from another repo of mine: [gulp-tasks](https://github.com/fluffynuts/gulp-tasks)
288
+ which was traditionally consumed as a git submodule. However, it seems that a lot
289
+ of people don't really "get" git submodules:
290
+ - people forget (or don't understand that they need to) `git submodule update --init` after
291
+ a `git clone` or a `git pull`. Some modern git clients are doing this for the user,
292
+ but not all of them.
293
+ - people don't seem to understand how submodules are stored (literally just a hash and
294
+ an url), so they don't pay attention when committing them. In particular, I have seen
295
+ my fair share of inadvertent "submodule wars" where changes upstream aren't applied
296
+ after a `pull` (ie, people forget to run `git submodule update --init`), then they
297
+ re-commit back the _old version_ of the module that they have locally. So fixes tend
298
+ to become unfixed
299
+ - in addition, `gulp-tasks` requires dependencies to be installed in the hosting repo's
300
+ package.json, meaning that (a) the hosting repo has to "know too much" about the
301
+ requirements of `gulp-tasks` and (b) upstream changes may require changes to a repo's
302
+ package.json (and an `npm install`). Whilst this was (eventually) automated as part
303
+ of `gulp-tasks`, it seems unnecessarily complex.
304
+ - the solution seemed clear: make `gulp-tasks` available via an npm package
305
+ - the name is inspired from the old bugzilla, which would proudly proclaim "zarro boogs"
306
+ when there were zero bug matches for a query, because (a) names are hard and (b)
307
+ zarro aims to be zero- to low-conf
308
+