zarro 1.92.0
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 +10 -0
- package/README.md +260 -0
- package/gulp-tasks/.editorconfig +8 -0
- package/gulp-tasks/.git +1 -0
- package/gulp-tasks/.gitignore +9 -0
- package/gulp-tasks/.gitmodules +0 -0
- package/gulp-tasks/LICENSE +24 -0
- package/gulp-tasks/README.md +144 -0
- package/gulp-tasks/build.js +135 -0
- package/gulp-tasks/clean.js +37 -0
- package/gulp-tasks/cover-dotnet.js +56 -0
- package/gulp-tasks/default-report-generator.js +51 -0
- package/gulp-tasks/default-tools-installer.js +33 -0
- package/gulp-tasks/default.js +17 -0
- package/gulp-tasks/dotnet-publish.js +23 -0
- package/gulp-tasks/generate-reports.js +7 -0
- package/gulp-tasks/get-local-nuget.js +16 -0
- package/gulp-tasks/git-submodules.js +83 -0
- package/gulp-tasks/increment-package-json-version.js +12 -0
- package/gulp-tasks/increment-package-json-version.ts +17 -0
- package/gulp-tasks/install-tools.js +24 -0
- package/gulp-tasks/modules/add-stream-on-any-handler.js +31 -0
- package/gulp-tasks/modules/alter-package-json-version.js +64 -0
- package/gulp-tasks/modules/alter-package-json-version.ts +113 -0
- package/gulp-tasks/modules/are-all-dotnet-core.js +96 -0
- package/gulp-tasks/modules/ask.js +31 -0
- package/gulp-tasks/modules/ask.ts +41 -0
- package/gulp-tasks/modules/collect-files.js +15 -0
- package/gulp-tasks/modules/collect-files.ts +16 -0
- package/gulp-tasks/modules/config-generator.js +10 -0
- package/gulp-tasks/modules/defaults.js +9 -0
- package/gulp-tasks/modules/download-nuget.js +104 -0
- package/gulp-tasks/modules/ensure-folder-exists.js +21 -0
- package/gulp-tasks/modules/env-helpers.js +49 -0
- package/gulp-tasks/modules/env-helpers.ts +67 -0
- package/gulp-tasks/modules/env.js +364 -0
- package/gulp-tasks/modules/exec.js +257 -0
- package/gulp-tasks/modules/exec.ts +346 -0
- package/gulp-tasks/modules/fail-after.js +30 -0
- package/gulp-tasks/modules/fail-after.ts +34 -0
- package/gulp-tasks/modules/fallback.js +6 -0
- package/gulp-tasks/modules/find-dirs.js +39 -0
- package/gulp-tasks/modules/find-local-nuget.js +42 -0
- package/gulp-tasks/modules/find-npm-base.js +42 -0
- package/gulp-tasks/modules/fs.js +79 -0
- package/gulp-tasks/modules/gather-paths.js +23 -0
- package/gulp-tasks/modules/gather-paths.ts +29 -0
- package/gulp-tasks/modules/generate-env-help-for.js +30 -0
- package/gulp-tasks/modules/get-tools-folder.js +12 -0
- package/gulp-tasks/modules/git-push-tags.js +33 -0
- package/gulp-tasks/modules/git-push-tags.ts +42 -0
- package/gulp-tasks/modules/git-push.js +51 -0
- package/gulp-tasks/modules/git-tag.js +36 -0
- package/gulp-tasks/modules/gulp-dotnetcover.js +537 -0
- package/gulp-tasks/modules/gulp-git-tag-from-csproj.js +50 -0
- package/gulp-tasks/modules/gulp-git-tag-from-csproj.ts +71 -0
- package/gulp-tasks/modules/gulp-git-tag-from-package-nuspec.js +55 -0
- package/gulp-tasks/modules/gulp-increment-nuget-package-dependency-version.js +40 -0
- package/gulp-tasks/modules/gulp-increment-nuget-package-version.js +87 -0
- package/gulp-tasks/modules/gulp-increment-nuget-package-version.ts +122 -0
- package/gulp-tasks/modules/gulp-msbuild.js +1 -0
- package/gulp-tasks/modules/gulp-npm-run.js +40 -0
- package/gulp-tasks/modules/gulp-npm-run.ts +52 -0
- package/gulp-tasks/modules/gulp-nuget-pack.js +168 -0
- package/gulp-tasks/modules/gulp-nuget-restore.js +106 -0
- package/gulp-tasks/modules/gulp-nunit-runner/.jshintrc +5 -0
- package/gulp-tasks/modules/gulp-nunit-runner/.npmignore +16 -0
- package/gulp-tasks/modules/gulp-nunit-runner/LICENSE +21 -0
- package/gulp-tasks/modules/gulp-nunit-runner/README.md +300 -0
- package/gulp-tasks/modules/gulp-nunit-runner/index.js +1 -0
- package/gulp-tasks/modules/gulp-nunit-runner/lib/index.js +205 -0
- package/gulp-tasks/modules/gulp-nunit-runner/lib/teamcity.js +86 -0
- package/gulp-tasks/modules/gulp-purge.js +88 -0
- package/gulp-tasks/modules/gulp-util.js +5 -0
- package/gulp-tasks/modules/gulp-version.js +8 -0
- package/gulp-tasks/modules/gulp-with-help.js +1 -0
- package/gulp-tasks/modules/gulp-xbuild.js +62 -0
- package/gulp-tasks/modules/gulp.js +92 -0
- package/gulp-tasks/modules/http-downloader.js +113 -0
- package/gulp-tasks/modules/import-npm-tasks.js +33 -0
- package/gulp-tasks/modules/increment-version-string.js +18 -0
- package/gulp-tasks/modules/increment-version.js +30 -0
- package/gulp-tasks/modules/increment-version.ts +41 -0
- package/gulp-tasks/modules/install-local-tools.js +122 -0
- package/gulp-tasks/modules/load-xml-file.js +12 -0
- package/gulp-tasks/modules/load-xml-file.ts +15 -0
- package/gulp-tasks/modules/log-config.js +31 -0
- package/gulp-tasks/modules/log.js +142 -0
- package/gulp-tasks/modules/longest-string-length.js +13 -0
- package/gulp-tasks/modules/looks-like-a-promise.js +11 -0
- package/gulp-tasks/modules/ls-r.js +52 -0
- package/gulp-tasks/modules/multi-split.js +29 -0
- package/gulp-tasks/modules/net-framework-test-assembly-filter.js +45 -0
- package/gulp-tasks/modules/nuget-push.js +66 -0
- package/gulp-tasks/modules/nuget-update-self.js +9 -0
- package/gulp-tasks/modules/nuget.js +8 -0
- package/gulp-tasks/modules/nuget.ts +14 -0
- package/gulp-tasks/modules/pad-left.js +4 -0
- package/gulp-tasks/modules/pad-right.js +4 -0
- package/gulp-tasks/modules/pad.js +25 -0
- package/gulp-tasks/modules/parse-xml-string.js +5 -0
- package/gulp-tasks/modules/parse-xml-string.ts +6 -0
- package/gulp-tasks/modules/parse-xml.js +14 -0
- package/gulp-tasks/modules/parse-xml.ts +15 -0
- package/gulp-tasks/modules/path-unquote.js +6 -0
- package/gulp-tasks/modules/promisify-function.js +19 -0
- package/gulp-tasks/modules/promisify-function.ts +18 -0
- package/gulp-tasks/modules/promisify-stream.js +73 -0
- package/gulp-tasks/modules/promisify.js +1 -0
- package/gulp-tasks/modules/quote-if-required.js +14 -0
- package/gulp-tasks/modules/read-all-git-branches.js +10 -0
- package/gulp-tasks/modules/read-all-git-branches.ts +13 -0
- package/gulp-tasks/modules/read-all-git-remotes.js +36 -0
- package/gulp-tasks/modules/read-all-git-remotes.ts +44 -0
- package/gulp-tasks/modules/read-csproj-package-version.js +16 -0
- package/gulp-tasks/modules/read-csproj-package-version.ts +26 -0
- package/gulp-tasks/modules/read-csproj-version.js +16 -0
- package/gulp-tasks/modules/read-csproj-version.ts +26 -0
- package/gulp-tasks/modules/read-current-git-branch.js +12 -0
- package/gulp-tasks/modules/read-current-git-branch.ts +16 -0
- package/gulp-tasks/modules/read-git-commit-delta-count.js +21 -0
- package/gulp-tasks/modules/read-git-commit-delta-count.ts +33 -0
- package/gulp-tasks/modules/read-git-info.js +28 -0
- package/gulp-tasks/modules/read-git-info.ts +31 -0
- package/gulp-tasks/modules/read-git-remote.js +17 -0
- package/gulp-tasks/modules/read-git-remote.ts +23 -0
- package/gulp-tasks/modules/read-last-fetch-time.js +21 -0
- package/gulp-tasks/modules/read-last-fetch-time.ts +17 -0
- package/gulp-tasks/modules/read-main-branch-name.js +48 -0
- package/gulp-tasks/modules/read-main-branch-name.ts +76 -0
- package/gulp-tasks/modules/read-nuspec-version.js +14 -0
- package/gulp-tasks/modules/read-nuspec-version.ts +22 -0
- package/gulp-tasks/modules/read-package-json.js +16 -0
- package/gulp-tasks/modules/read-package-json.ts +22 -0
- package/gulp-tasks/modules/read-package-version.js +8 -0
- package/gulp-tasks/modules/read-package-version.ts +10 -0
- package/gulp-tasks/modules/read-text-file.js +14 -0
- package/gulp-tasks/modules/read-text-file.ts +14 -0
- package/gulp-tasks/modules/reduce-gulp-noise.js +34 -0
- package/gulp-tasks/modules/register-environment-variables.js +526 -0
- package/gulp-tasks/modules/require-module.js +28 -0
- package/gulp-tasks/modules/resolve-git-branch.js +11 -0
- package/gulp-tasks/modules/resolve-git-branch.ts +13 -0
- package/gulp-tasks/modules/resolve-git-remote.js +11 -0
- package/gulp-tasks/modules/resolve-git-remote.ts +13 -0
- package/gulp-tasks/modules/resolve-masks.js +47 -0
- package/gulp-tasks/modules/resolve-nuget.js +135 -0
- package/gulp-tasks/modules/resolve-test-masks.js +10 -0
- package/gulp-tasks/modules/rewrite-file.js +26 -0
- package/gulp-tasks/modules/rewrite-file.ts +34 -0
- package/gulp-tasks/modules/rimraf.js +21 -0
- package/gulp-tasks/modules/rimraf.ts +31 -0
- package/gulp-tasks/modules/run-sequence.js +16 -0
- package/gulp-tasks/modules/safe-git.js +23 -0
- package/gulp-tasks/modules/safe-git.ts +23 -0
- package/gulp-tasks/modules/seed.js +12 -0
- package/gulp-tasks/modules/set-task-name.js +9 -0
- package/gulp-tasks/modules/sleep.js +5 -0
- package/gulp-tasks/modules/spawn-nuget.js +13 -0
- package/gulp-tasks/modules/spawn.js +103 -0
- package/gulp-tasks/modules/split-path.js +3 -0
- package/gulp-tasks/modules/stat.js +8 -0
- package/gulp-tasks/modules/status.js +57 -0
- package/gulp-tasks/modules/status.ts +71 -0
- package/gulp-tasks/modules/test-path.js +3 -0
- package/gulp-tasks/modules/testutil-finder.js +176 -0
- package/gulp-tasks/modules/throw-if-no-files.js +15 -0
- package/gulp-tasks/modules/uniq.js +6 -0
- package/gulp-tasks/modules/uniq.ts +5 -0
- package/gulp-tasks/modules/verify-exe.js +17 -0
- package/gulp-tasks/modules/version-reading-shared.js +12 -0
- package/gulp-tasks/modules/version-reading-shared.ts +16 -0
- package/gulp-tasks/modules/write-text-file.js +10 -0
- package/gulp-tasks/modules/zarro-error.js +6 -0
- package/gulp-tasks/nuget-restore.js +57 -0
- package/gulp-tasks/pack.js +118 -0
- package/gulp-tasks/purge.js +94 -0
- package/gulp-tasks/release-npm.js +58 -0
- package/gulp-tasks/release-npm.ts +81 -0
- package/gulp-tasks/start/_package.json +39 -0
- package/gulp-tasks/start/gulpfile.js +204 -0
- package/gulp-tasks/start/update-starter-packages.js +63 -0
- package/gulp-tasks/test-dotnet.js +195 -0
- package/gulp-tasks/update-git-submodules.js +11 -0
- package/gulp-tasks/update-git-submodules.ts +29 -0
- package/gulp-tasks/update-self.js +65 -0
- package/gulp-tasks/update-self.ts +88 -0
- package/gulp-tasks/verify-up-to-date.js +77 -0
- package/gulp-tasks/verify-up-to-date.ts +119 -0
- package/index-modules/contains-any.js +31 -0
- package/index-modules/gather-args.js +21 -0
- package/index-modules/handlers/help.js +17 -0
- package/index-modules/handlers/init.js +57 -0
- package/index-modules/handlers/invoke-gulp.js +111 -0
- package/index-modules/handlers/show-env.js +46 -0
- package/index-modules/is-dir.js +6 -0
- package/index-modules/is-file.js +6 -0
- package/index.js +53 -0
- package/package.json +96 -0
- package/tsconfig.json +66 -0
- package/types.d.ts +753 -0
package/LICENSE
ADDED
|
@@ -0,0 +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
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Zarro
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+

|
|
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 build",
|
|
62
|
+
"test": "zarro test-dotnet",
|
|
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
|
+
## What's in the box
|
|
72
|
+
There are an array of pre-defined tasks you get out of the box with zarro. I hope to eventually
|
|
73
|
+
provide more documentation for them, but running `zarro --tasks` should tell you something
|
|
74
|
+
similar to:
|
|
75
|
+
|
|
76
|
+
- help
|
|
77
|
+
- shows help / usage
|
|
78
|
+
- help:environment
|
|
79
|
+
- shows help about environment variables zarro observes (same as running with --help)
|
|
80
|
+
- build
|
|
81
|
+
- attempts to build all found .net solutions
|
|
82
|
+
- test-dotnet
|
|
83
|
+
- test .net projects based on conventions
|
|
84
|
+
- test project names should match `*.Tests` or `*.Test` or plain old `Tests`
|
|
85
|
+
- assumes test are nunit
|
|
86
|
+
- cover-dotnet
|
|
87
|
+
- test with coverage
|
|
88
|
+
- can use dotCover or OpenCover
|
|
89
|
+
- generate-reports
|
|
90
|
+
- generate html reports from OpenCover results
|
|
91
|
+
- default-tools-installer
|
|
92
|
+
- installs the default helper tooling from nuget
|
|
93
|
+
- nunit cli
|
|
94
|
+
- dotCover
|
|
95
|
+
- OpenCover
|
|
96
|
+
- ReportGenerator
|
|
97
|
+
- install-tools
|
|
98
|
+
- called before build
|
|
99
|
+
- defaults to install default tools
|
|
100
|
+
- override with an empty task if not useful
|
|
101
|
+
- dotnet-publish
|
|
102
|
+
- runs dotnet cli build with publish options
|
|
103
|
+
- nuget-restor
|
|
104
|
+
- restores nuget packages
|
|
105
|
+
- run automatically as part of build
|
|
106
|
+
- release-npm
|
|
107
|
+
- perform guided release of npm packages
|
|
108
|
+
- can do beta releases
|
|
109
|
+
- will automatically
|
|
110
|
+
- increment version
|
|
111
|
+
- git commit
|
|
112
|
+
- git tag
|
|
113
|
+
- git push
|
|
114
|
+
- update-self
|
|
115
|
+
- updates to zarro@latest
|
|
116
|
+
- update-git-submodules
|
|
117
|
+
- updates all git submodules in the repo
|
|
118
|
+
- pretest
|
|
119
|
+
- place-holder: override this to run something before testing
|
|
120
|
+
- verify-up-to-date
|
|
121
|
+
- verifies that the current branch is up-to-date with the main one
|
|
122
|
+
- will check against {remote}/{main branch} if possible
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
Running the above would also list any custom tasks you have defined
|
|
126
|
+
|
|
127
|
+
## Zarro doesn't do what I want out of the box
|
|
128
|
+
|
|
129
|
+
Zarro is designed to be zero- to low- conf. You can guide many aspects of available
|
|
130
|
+
tasks with environment variables. Running `npm run zarro -- --show-env` will show you
|
|
131
|
+
all observed environment variables and where they are applicable. I suggest using
|
|
132
|
+
`cross-env` and applying these variables in one place, to keep things simpler. For
|
|
133
|
+
example, [NExpect](https://github.com/fluffynuts/NExpect) does the following:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
"scripts": {
|
|
137
|
+
"zarro": "cross-env DOTNET_CORE=1 BUILD_EXCLUDE=src/PeanutButter/**/* PACK_INCLUDE=* PACK_EXCLUDE=*Tests*,CoreConsumer,src/PeanutButter/**/* TEST_EXCLUDE=src/PeanutButter/**/* zarro",
|
|
138
|
+
"build": "run-s \"zarro build\"",
|
|
139
|
+
"test": "run-s \"zarro test-dotnet\""
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
in the above:
|
|
144
|
+
- `DOTNET_CORE=1` instructs zarro to use `dotnet` instead of searching for `msbuild`
|
|
145
|
+
- `BUILD_EXCLUDE=...` instructs zarro to exclude everything under that folder, recursively
|
|
146
|
+
(NExpect imports PeanutButter as a submodule to use some shared code without relying
|
|
147
|
+
on another package dependency)
|
|
148
|
+
- similarly `TEST_EXCLUDE` excludes PeanutButter tests
|
|
149
|
+
- similarly, `PACK_INCLUDE` and `PACK_EXCLUDE` control nuget packing within NExpect
|
|
150
|
+
|
|
151
|
+
## Custom tasks
|
|
152
|
+
|
|
153
|
+
Zarro will also search two folders:
|
|
154
|
+
- local-tasks
|
|
155
|
+
- override-tasks
|
|
156
|
+
in the root of your repo, for extra tasks that you can access from your npm scripts.
|
|
157
|
+
|
|
158
|
+
These can be brand-new functionality you'd like to add to your repo's build system,
|
|
159
|
+
or you can _override existing tasks_, if they don't suit you. For example, if the `pack`
|
|
160
|
+
task doesn't do exactly what you want, copy `pack.js` from `node_modules/zarro/gulp-tasks`
|
|
161
|
+
into your `local-tasks` folder and modify it to suit you. If you find a generic solution
|
|
162
|
+
to the problem you have which others might find useful or fix a bug, I'd like to know
|
|
163
|
+
about it. PRs for fixes and extension tasks which others could use will be appreciated.
|
|
164
|
+
|
|
165
|
+
## Examples of custom tasks that I've written in the past
|
|
166
|
+
- a watcher to automatically recompile scss to .css
|
|
167
|
+
- orchestration of build / test of sub-projects that aren't .NET
|
|
168
|
+
- automatic version incrementing of packages before release
|
|
169
|
+
- committing, tagging and pushing new changes to GitHub
|
|
170
|
+
- I've found that writing a meta task called `release` can make it much
|
|
171
|
+
less painful to perform a release of my nuget packages, for example.
|
|
172
|
+
This meta task would:
|
|
173
|
+
- build
|
|
174
|
+
- test
|
|
175
|
+
- increment package versions
|
|
176
|
+
- pack
|
|
177
|
+
- push packages
|
|
178
|
+
- commit the updates package definitions
|
|
179
|
+
- tag the release
|
|
180
|
+
- push the tag and changes to GitHub
|
|
181
|
+
|
|
182
|
+
## API
|
|
183
|
+
|
|
184
|
+
Zarro provides some convenience functionality from baked-in modules. To access a module,
|
|
185
|
+
the global `requireModule` function will resolve the correct location for you. Modules
|
|
186
|
+
live under the `gulp-tasks/modules` folder. Most modules will return a single function,
|
|
187
|
+
though there are some exceptions. Some modules may be of interest to custom tasks, eg:
|
|
188
|
+
|
|
189
|
+
- `gulp`
|
|
190
|
+
- you should `requireModule("gulp")` wherever you would have normally
|
|
191
|
+
done `require("gulp")`. This gets you the patched version of gulp 4 which
|
|
192
|
+
will happily consume gulp 3 tasks and which has inbuilt support for help
|
|
193
|
+
for your tasks on both gulp 3 and 4. Most importantly, if you _do not_ use this
|
|
194
|
+
export, your tasks may not be correctly registered.
|
|
195
|
+
- `env`
|
|
196
|
+
- provides a utility object to resolve environment variables for you
|
|
197
|
+
- `register` can register an environment variable as known with a default
|
|
198
|
+
value and help. See `register-environment-variables.js` for examples.
|
|
199
|
+
When you use this function, you can have a central configuration for
|
|
200
|
+
a default value for an environment variable and your environment
|
|
201
|
+
variable will be displayed in the `--show-env` output
|
|
202
|
+
- `resolve` resolves environment variables for you. It can be invoked with
|
|
203
|
+
one or more variable names, so can be used to fall back from one variable
|
|
204
|
+
onto another. It will also resolve back values if registered.
|
|
205
|
+
- `associate` associates one or more variables with one or more tasks,
|
|
206
|
+
primarily to show which tasks are affected by which variables when
|
|
207
|
+
running with `--show-env`
|
|
208
|
+
- `resolveArray` can resolve an environment variable to an array for you,
|
|
209
|
+
with an optional `delimiter` parameter, which defaults to comma
|
|
210
|
+
- `resolveNumber` resolves a numeric value from the named environment
|
|
211
|
+
value or throws if the value can't be resolved as a number, effectively
|
|
212
|
+
stopping execution. If you're expecting a number (eg port or max thread
|
|
213
|
+
count) you can simply `resolveNumber` and an invalid value would cause
|
|
214
|
+
execution to stop with a reasonable message
|
|
215
|
+
- `resolveFlag` resolves boolean values from environment variables
|
|
216
|
+
- `true` for: "yes", "true" or "1"
|
|
217
|
+
- `false` for: "no", "false" or "0"
|
|
218
|
+
- throws for unknown values
|
|
219
|
+
- `resolve-masks`
|
|
220
|
+
- single function to resolve an array of masks that could be used in a `gulp.src`
|
|
221
|
+
where those masks can be inclusive or exclusive
|
|
222
|
+
- `find-local-nuget`
|
|
223
|
+
- provides a single function to find a locally-downloaded `nuget.exe`, automatically
|
|
224
|
+
downloading it if required. Use this if you need to use `nuget.exe` operations
|
|
225
|
+
and don't want to set up your build host with a pathed `nuget.exe`
|
|
226
|
+
- git utilities
|
|
227
|
+
- `git-tag`
|
|
228
|
+
- `git-push`
|
|
229
|
+
- `git-push-tags`
|
|
230
|
+
- string padding
|
|
231
|
+
- `pad`
|
|
232
|
+
- `pad-left`
|
|
233
|
+
- `pad-right`
|
|
234
|
+
|
|
235
|
+
There are many more utilities in there, feel free to browse the source.
|
|
236
|
+
|
|
237
|
+
## History
|
|
238
|
+
|
|
239
|
+
If you've made it thus far, some light history might be of interest. Zarro's core
|
|
240
|
+
functionality comes from another repo of mine: [gulp-tasks](https://github.com/fluffynuts/gulp-tasks)
|
|
241
|
+
which was traditionally consumed as a git submodule. However, it seems that a lot
|
|
242
|
+
of people don't really "get" git submodules:
|
|
243
|
+
- people forget (or don't understand that they need to) `git submodule update --init` after
|
|
244
|
+
a `git clone` or a `git pull`. Some modern git clients are doing this for the user,
|
|
245
|
+
but not all of them.
|
|
246
|
+
- people don't seem to understand how submodules are stored (literally just a hash and
|
|
247
|
+
an url), so they don't pay attention when committing them. In particular, I have seen
|
|
248
|
+
my fair share of inadvertent "submodule wars" where changes upstream aren't applied
|
|
249
|
+
after a `pull` (ie, people forget to run `git submodule update --init`), then they
|
|
250
|
+
re-commit back the _old version_ of the module that they have locally. So fixes tend
|
|
251
|
+
to become unfixed
|
|
252
|
+
- in addition, `gulp-tasks` requires dependencies to be installed in the hosting repo's
|
|
253
|
+
package.json, meaning that (a) the hosting repo has to "know too much" about the
|
|
254
|
+
requirements of `gulp-tasks` and (b) upstream changes may require changes to a repo's
|
|
255
|
+
package.json (and an `npm install`). Whilst this was (eventually) automated as part
|
|
256
|
+
of `gulp-tasks`, it seems unnecessarily complex.
|
|
257
|
+
- the solution seemed clear: make `gulp-tasks` available via an npm package
|
|
258
|
+
- the name is inspired from the old bugzilla, which would proudly proclaim "zarro boogs"
|
|
259
|
+
when there were zero bug matches for a query, because (a) names are hard and (b)
|
|
260
|
+
zarro aims to be zero- to low-conf
|
package/gulp-tasks/.git
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gitdir: ../.git/modules/gulp-tasks
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2015, Davyd McColl
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
15
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
16
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
17
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
18
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
20
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
21
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
22
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# gulp-tasks
|
|
2
|
+
### A gulp starter-pack
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Some gulp tasks and utilities for building and testing .net and Javascript projects, favouring convention over configuration.
|
|
8
|
+
* Disclaimer: yes, I realise that this is a very opinionated take on the problem. *
|
|
9
|
+
* Feel free to submit requests (or better yet, pull requests) *
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## How to use this?
|
|
13
|
+
|
|
14
|
+
This is a starting-point which you can use (and track) to get gulp building your project fairly painlessly.
|
|
15
|
+
Here's what you do:
|
|
16
|
+
|
|
17
|
+
1. add this repo as a submodule of your repo, at the root level
|
|
18
|
+
2. copy `start/gulpfile.js` to the root of your repo
|
|
19
|
+
3. run `node gulpfile.js` in the root of your repo. This should guide you through:
|
|
20
|
+
- initializing a `package.json` with your repo's details
|
|
21
|
+
- installing the node modules required by `gulp-tasks` to run
|
|
22
|
+
- setting up two npm scripts:
|
|
23
|
+
- `gulp` which can be used to run gulp commands without a globally-installed gulp. Simply do something like `npm run gulp {taskname}`
|
|
24
|
+
- `test` which will run the `test-dotnet` task from `gulp-tasks`
|
|
25
|
+
4. if you know some gulp, you may augment tasks by creating new tasks in the `local-tasks` folder parallel to the `gulp-tasks` folder
|
|
26
|
+
5. override provided tasks by copying them to the `local-tasks` folder
|
|
27
|
+
- edit them to your heart's content: you only have to edit the ones you want to change.
|
|
28
|
+
6. First time: run `npm install` to install required modules
|
|
29
|
+
7. Either:
|
|
30
|
+
- run `node node_modules/gulp/bin/gulp.js` OR
|
|
31
|
+
- install gulp globally with `npm install -g gulp` and then run `gulp`
|
|
32
|
+
|
|
33
|
+
## Assumptions
|
|
34
|
+
1. You're using MSBuild to build your stuff and Visual Studio for development (at least somewhere, so you get .sln files)
|
|
35
|
+
- You're using NUnit for testing
|
|
36
|
+
- You're using (or capable of installing) dotCover CLI (not required, but used by default)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## What's in the box?
|
|
40
|
+
|
|
41
|
+
Available tasks (at time of writing) include:
|
|
42
|
+
|
|
43
|
+
- default
|
|
44
|
+
- this is the default task invoked if you just run gulp from the commandline. It should just contain a sequence of tasks to run for the default build
|
|
45
|
+
- the default will attempt:
|
|
46
|
+
* purge: remove all binary artifacts in bin and obj folders
|
|
47
|
+
* git-submodules: pull latest for any submodules
|
|
48
|
+
* install nuget packages for all solutions in the repo
|
|
49
|
+
* install tooling required by shell `install-tools` task
|
|
50
|
+
* build: msbuild your solution(s): all .sln files in the repo
|
|
51
|
+
* cover-dotnet: run all NUnit tests through dotCover (searches for dotCover and NUnit in
|
|
52
|
+
expected locations)
|
|
53
|
+
* run shell `generate-reports` task to output pretty reports.
|
|
54
|
+
- build
|
|
55
|
+
- builds all Visual Studio solutions\*
|
|
56
|
+
- clean
|
|
57
|
+
- invokes the 'Clean' target in all Visual Studio solutions\*
|
|
58
|
+
- test-javascript
|
|
59
|
+
- runs karma in a single-run mode, recording coverage\*\*
|
|
60
|
+
- git-submodules
|
|
61
|
+
- attempts to update all git submodules with the latest (HEAD) from the repositories they
|
|
62
|
+
point at. Think along the lines of svn:externals
|
|
63
|
+
- nuget-restore
|
|
64
|
+
- attempts to restore all nuget packages for all solutions\*. Will download it's own
|
|
65
|
+
`nuget.exe` unless you specify otherwise.
|
|
66
|
+
- test-dotnet
|
|
67
|
+
- (currently) attempts to run nunit tests from all Test projects, using a
|
|
68
|
+
convention-over-configuration method: All assemblies that it can find which end in
|
|
69
|
+
.Tests.dll are candidates for testing -- the ones selected must reside in the Debug build
|
|
70
|
+
output of a corresponding project folder, ie
|
|
71
|
+
`SomeProject.Tests/bin/Debug/SomeProject.Tests.dll`. The task will also look one up from
|
|
72
|
+
this if the Debug folder isn't found, so you can use this against test projects which are
|
|
73
|
+
Web projects at heart. \*\*\*
|
|
74
|
+
- cover-dotnet
|
|
75
|
+
- attempts to run tests with coverage on your test assemblies. You will most likely want to
|
|
76
|
+
edit this task to add exclusions for external libraries and such that your test project is
|
|
77
|
+
using, though the defaults are sane. Will attempt to find installed or local dotCover
|
|
78
|
+
or OpenCover to run coverage with
|
|
79
|
+
- install-tools (now a default part of the pipeline - see the `install-tools.js` file for information on how to disable this task, if it's not interesting to you)
|
|
80
|
+
- install local build tools to the tools/ folder in your solution (by default, can be overridden by the BUILD_TOOLS_FOLDER environment variable)
|
|
81
|
+
- depends on `default-tools-installer`, providing:
|
|
82
|
+
- nunit.console
|
|
83
|
+
- opencover
|
|
84
|
+
- reportgenerator
|
|
85
|
+
- shell tasks (have no default behavior, but hook into the build pipeline):
|
|
86
|
+
- generate-reports
|
|
87
|
+
- generate reports after building
|
|
88
|
+
- you can get sane behavior by creating a local task which depends on
|
|
89
|
+
`default-report-generator` which uses reportgenerator to give
|
|
90
|
+
html coverage reports.
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
\* That can be found in the current folder or any descendant folders
|
|
94
|
+
\*\* Looking for (presently) a karma.conf.js in the same folder as the gulpfile. There are plans to make this task also seek out karma.conf.js files in descendant folders but the actual need hasn't arisen yet.
|
|
95
|
+
\*\*\* These tasks attempt to find the highest stable releases of their dependancies (dotcover.exe and nunit-console-{platform}.exe) according to default install paths by default.
|
|
96
|
+
|
|
97
|
+
## Shell tasks
|
|
98
|
+
Shell tasks do nothing out of the box. You have to opt into the default behavior or write your
|
|
99
|
+
own. If you think that the default behavior is what you want, create a task which simply depends
|
|
100
|
+
on the default behavior. For example, if you want local tooling and reports out of the box, you
|
|
101
|
+
could create `local-tasks/use-default-tasks.js` with:
|
|
102
|
+
```
|
|
103
|
+
const gulp = requireModule("gulp");
|
|
104
|
+
gulp.task("generate-reports", "Generate coverage reports", ["default-report-generator"]);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The default behaviors here are left out so as not to interfere with existing users. `install-tools` has been included by default now that I find I need it more often than not. Anyone who updates their reference to `gulp-tasks` and sees extra stuff being done should follow the instructions in `install-tools.js`.
|
|
108
|
+
|
|
109
|
+
## Using modules from `gulp-tasks`
|
|
110
|
+
If you want to use any of the modules found under `gulp-tasks/modules`, make use of the
|
|
111
|
+
globally-available `requireModule` function. Some available modules include:
|
|
112
|
+
- `gulp`
|
|
113
|
+
- uses `gulp-help` (for v3 gulp) to provide a modified `gulp` where a second parameter can
|
|
114
|
+
be provided to give useful help. Read more on the `gulp-help` documentation.
|
|
115
|
+
- `http-downloader`
|
|
116
|
+
- provides a simple async http downloading class
|
|
117
|
+
- `spawn`, `exec`
|
|
118
|
+
- provides fairly safe ways to start processes on Windows
|
|
119
|
+
- others can be seen in use in provided tasks
|
|
120
|
+
|
|
121
|
+
## Convention over configuration
|
|
122
|
+
|
|
123
|
+
These tasks were designed to cater, unedited, for the majority of build requirements\*, for example:
|
|
124
|
+
- One main .sln file (if you have multiple, *all* are built -- override in your own build.js)
|
|
125
|
+
- Test assemblies are named {Project}.Tests.dll (this is important: the test assembly collector will be quite stoic about it)
|
|
126
|
+
- karma.conf.js lives alongside your gulpfile (if running JavaScript tests)
|
|
127
|
+
- msbuild is set to build in x86 output using tools version 4.0 for Mono compatibility
|
|
128
|
+
|
|
129
|
+
However, these (and other) assumptions may not fit your needs. The ethos of the project is that, in
|
|
130
|
+
providing smaller task files, you can select only the ones you want and make changes to them if you
|
|
131
|
+
need to to suit your needs. If you really want to merge in upstream changes, it should be an easy
|
|
132
|
+
task because of the separation. It should also be easy to extend with your own tasks -- just add them
|
|
133
|
+
to the gulp-tasks folder and reference them in your default pipeline to have them run by default.
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## Kudos
|
|
137
|
+
|
|
138
|
+
All of this is only possible because of Node, Gulp and all of the contributions for tasks and modules,
|
|
139
|
+
not to mention NUnit and dotCover (both free and excellent).
|
|
140
|
+
Before attempting to write your own pipelining module for Gulp, look online -- someone has quite
|
|
141
|
+
likely already done it. But if you *must*, then I highly recommend having a look at the
|
|
142
|
+
gulp-nunit-runner module: it was the basis that I ripped off for the gulp-dotnetcover module (which I
|
|
143
|
+
probably should try to get into official npm sources at some point, but for now, it lives
|
|
144
|
+
under gulp-tasks/modules)
|