zarro 1.121.0 → 1.121.2
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/gulp-tasks/modules/spawn.js +20 -0
- package/package.json +3 -3
- package/gulp-tasks/.editorconfig +0 -8
- package/gulp-tasks/.git +0 -1
- package/gulp-tasks/.gitignore +0 -9
- package/gulp-tasks/.gitmodules +0 -0
- package/gulp-tasks/LICENSE +0 -24
- package/gulp-tasks/README.md +0 -144
- package/gulp-tasks/increment-package-json-version.ts +0 -17
- package/gulp-tasks/modules/alter-package-json-version.ts +0 -117
- package/gulp-tasks/modules/ask.ts +0 -41
- package/gulp-tasks/modules/chalk.ts +0 -17
- package/gulp-tasks/modules/collect-files.ts +0 -16
- package/gulp-tasks/modules/dotnet-cli.ts +0 -56
- package/gulp-tasks/modules/env-helpers.ts +0 -67
- package/gulp-tasks/modules/exec.ts +0 -347
- package/gulp-tasks/modules/fail-after.ts +0 -34
- package/gulp-tasks/modules/gather-paths.ts +0 -29
- package/gulp-tasks/modules/git-push-tags.ts +0 -42
- package/gulp-tasks/modules/gulp-git-tag-from-csproj.ts +0 -71
- package/gulp-tasks/modules/gulp-increment-nuget-package-version.ts +0 -122
- package/gulp-tasks/modules/gulp-npm-run.ts +0 -52
- package/gulp-tasks/modules/gulp-nunit-runner/.editorconfig +0 -16
- package/gulp-tasks/modules/gulp-nunit-runner/.gitignore +0 -59
- package/gulp-tasks/modules/gulp-nunit-runner/.jscsrc +0 -4
- package/gulp-tasks/modules/gulp-nunit-runner/.jshintrc +0 -6
- package/gulp-tasks/modules/gulp-nunit-runner/.npmignore +0 -16
- package/gulp-tasks/modules/gulp-nunit-runner/.travis.yml +0 -7
- package/gulp-tasks/modules/gulp-nunit-runner/LICENSE +0 -21
- package/gulp-tasks/modules/gulp-nunit-runner/README.md +0 -300
- package/gulp-tasks/modules/gulp-nunit-runner/test/teamcity.xml +0 -191
- package/gulp-tasks/modules/increment-version.ts +0 -41
- package/gulp-tasks/modules/load-xml-file.ts +0 -15
- package/gulp-tasks/modules/nuget-push.ts +0 -79
- package/gulp-tasks/modules/nuget.ts +0 -18
- package/gulp-tasks/modules/parse-xml-string.ts +0 -6
- package/gulp-tasks/modules/parse-xml.ts +0 -15
- package/gulp-tasks/modules/path-utils.ts +0 -34
- package/gulp-tasks/modules/promisify-function.ts +0 -18
- package/gulp-tasks/modules/read-all-git-branches.ts +0 -13
- package/gulp-tasks/modules/read-all-git-remotes.ts +0 -44
- package/gulp-tasks/modules/read-csproj-package-version.ts +0 -26
- package/gulp-tasks/modules/read-csproj-version.ts +0 -26
- package/gulp-tasks/modules/read-current-git-branch.ts +0 -16
- package/gulp-tasks/modules/read-git-commit-delta-count.ts +0 -33
- package/gulp-tasks/modules/read-git-info.ts +0 -31
- package/gulp-tasks/modules/read-git-remote.ts +0 -23
- package/gulp-tasks/modules/read-last-fetch-time.ts +0 -17
- package/gulp-tasks/modules/read-main-branch-name.ts +0 -75
- package/gulp-tasks/modules/read-nuspec-version.ts +0 -22
- package/gulp-tasks/modules/read-package-json.ts +0 -22
- package/gulp-tasks/modules/read-package-version.ts +0 -10
- package/gulp-tasks/modules/read-text-file.ts +0 -14
- package/gulp-tasks/modules/resolve-git-branch.ts +0 -13
- package/gulp-tasks/modules/resolve-git-remote.ts +0 -13
- package/gulp-tasks/modules/rewrite-file.ts +0 -34
- package/gulp-tasks/modules/rimraf.ts +0 -31
- package/gulp-tasks/modules/safe-git.ts +0 -25
- package/gulp-tasks/modules/spawn.ts +0 -165
- package/gulp-tasks/modules/status.ts +0 -71
- package/gulp-tasks/modules/test-utils.ts +0 -36
- package/gulp-tasks/modules/try-do.ts +0 -58
- package/gulp-tasks/modules/uniq.ts +0 -5
- package/gulp-tasks/modules/version-reading-shared.ts +0 -16
- package/gulp-tasks/release-npm.ts +0 -82
- package/gulp-tasks/start/_package.json +0 -39
- package/gulp-tasks/update-git-submodules.ts +0 -29
- package/gulp-tasks/update-self.ts +0 -88
- package/gulp-tasks/verify-up-to-date.ts +0 -120
|
@@ -84,6 +84,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
84
84
|
if (exited) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
+
destroyPipesOn(child);
|
|
87
88
|
exited = true;
|
|
88
89
|
debug(`child ${eventName}s: ${code}`);
|
|
89
90
|
result.exitCode = code;
|
|
@@ -131,5 +132,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
131
132
|
stream.on("data", handle);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
135
|
+
function destroyPipesOn(child) {
|
|
136
|
+
for (const pipe of [child.stdout, child.stderr, child.stdin]) {
|
|
137
|
+
if (pipe) {
|
|
138
|
+
try {
|
|
139
|
+
// I've seen times when child processes are dead, but the
|
|
140
|
+
// IO pipes are kept alive, preventing node from exiting.
|
|
141
|
+
// Specifically, when running dotnet test against a certain
|
|
142
|
+
// project - but not in any other project for the same
|
|
143
|
+
// usage. So this is just a bit of paranoia here - explicitly
|
|
144
|
+
// shut down any pipes on the child process - we're done
|
|
145
|
+
// with them anyway
|
|
146
|
+
pipe.destroy();
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
// suppress: if the pipe is already dead, that's fine.
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
134
154
|
module.exports = spawn;
|
|
135
155
|
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zarro",
|
|
3
|
-
"version": "1.121.
|
|
3
|
+
"version": "1.121.2",
|
|
4
4
|
"description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
|
|
5
5
|
"bin": {
|
|
6
6
|
"zarro": "./index.js"
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"yafs": "^1.23.0"
|
|
65
65
|
},
|
|
66
66
|
"files": [
|
|
67
|
-
"gulp-tasks
|
|
68
|
-
"index-modules
|
|
67
|
+
"gulp-tasks/**/*.js",
|
|
68
|
+
"index-modules/**/*.js",
|
|
69
69
|
"types.d.ts",
|
|
70
70
|
"tsconfig.json"
|
|
71
71
|
],
|
package/gulp-tasks/.editorconfig
DELETED
package/gulp-tasks/.git
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
gitdir: ../.git/modules/gulp-tasks
|
package/gulp-tasks/.gitignore
DELETED
package/gulp-tasks/.gitmodules
DELETED
|
File without changes
|
package/gulp-tasks/LICENSE
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
|
package/gulp-tasks/README.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
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)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const
|
|
2
|
-
alterPackageJsonVersion = requireModule<AlterPackageJson>("alter-package-json-version"),
|
|
3
|
-
env = requireModule<Env>("env"),
|
|
4
|
-
gulp = requireModule<GulpWithHelp>("gulp"),
|
|
5
|
-
taskName = "increment-package-json-version";
|
|
6
|
-
|
|
7
|
-
env.associate([
|
|
8
|
-
env.DRY_RUN,
|
|
9
|
-
env.PACKAGE_JSON,
|
|
10
|
-
env.VERSION_INCREMENT_STRATEGY,
|
|
11
|
-
env.VERSION_INCREMENT_ZERO,
|
|
12
|
-
env.INITIAL_RELEASE
|
|
13
|
-
], taskName);
|
|
14
|
-
|
|
15
|
-
gulp.task(taskName, async () => {
|
|
16
|
-
return await alterPackageJsonVersion();
|
|
17
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
export interface AlterPackageJsonVersionOptions {
|
|
2
|
-
packageJsonPath?: string;
|
|
3
|
-
dryRun?: boolean;
|
|
4
|
-
strategy?: string;
|
|
5
|
-
zero?: boolean;
|
|
6
|
-
loadUnsetFromEnvironment?: boolean;
|
|
7
|
-
incrementBy?: number
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface CompleteOptions extends AlterPackageJsonVersionOptions {
|
|
11
|
-
packageJsonPath: string;
|
|
12
|
-
dryRun: boolean;
|
|
13
|
-
strategy: string;
|
|
14
|
-
zero: boolean;
|
|
15
|
-
incrementBy: number
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
(function() {
|
|
19
|
-
const
|
|
20
|
-
gutil = requireModule<GulpUtil>("gulp-util"),
|
|
21
|
-
env = requireModule<Env>("env"),
|
|
22
|
-
{ stat } = require("fs").promises,
|
|
23
|
-
readTextFile = requireModule<ReadTextFile>("read-text-file"),
|
|
24
|
-
writeTextFile = requireModule<WriteTextFile>("write-text-file"),
|
|
25
|
-
incrementVersion = requireModule<IncrementVersion>("increment-version");
|
|
26
|
-
|
|
27
|
-
async function alterPackageJsonVersion(
|
|
28
|
-
inputOpts?: AlterPackageJsonVersionOptions
|
|
29
|
-
) {
|
|
30
|
-
if (env.resolveFlag(env.INITIAL_RELEASE)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
return new Promise<void>(async (resolve, reject) => {
|
|
34
|
-
const
|
|
35
|
-
opts = fillInFromEnvironment(inputOpts),
|
|
36
|
-
st = await stat(opts.packageJsonPath);
|
|
37
|
-
if (!st) {
|
|
38
|
-
return reject(`Can't find file at '${ opts.packageJsonPath }'`);
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
const
|
|
42
|
-
json = await readTextFile(opts.packageJsonPath),
|
|
43
|
-
indent = guessIndent(json),
|
|
44
|
-
index = JSON.parse(json),
|
|
45
|
-
currentVersion = index.version || "0.0.0",
|
|
46
|
-
incremented = incrementVersion(
|
|
47
|
-
currentVersion,
|
|
48
|
-
opts.strategy,
|
|
49
|
-
opts.zero,
|
|
50
|
-
opts.incrementBy
|
|
51
|
-
);
|
|
52
|
-
index.version = incremented;
|
|
53
|
-
const newJson = JSON.stringify(index, null, indent);
|
|
54
|
-
if (opts.dryRun) {
|
|
55
|
-
gutil.log(
|
|
56
|
-
gutil.colors.green(
|
|
57
|
-
`dry run: would increment version in '${ opts.packageJsonPath }' from '${ currentVersion }' to '${ incremented }'`
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
await writeTextFile(opts.packageJsonPath, newJson);
|
|
62
|
-
resolve();
|
|
63
|
-
} catch (e) {
|
|
64
|
-
reject(e);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function shouldFillInFromEnvironment(opts?: AlterPackageJsonVersionOptions) {
|
|
70
|
-
if (!opts) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (opts.loadUnsetFromEnvironment) {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
return (Object.keys(opts).length === 0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function fillInFromEnvironment(opts?: AlterPackageJsonVersionOptions): CompleteOptions {
|
|
80
|
-
if (!shouldFillInFromEnvironment(opts)) {
|
|
81
|
-
return opts as CompleteOptions;
|
|
82
|
-
}
|
|
83
|
-
const result = { ...opts } as CompleteOptions;
|
|
84
|
-
if (result.packageJsonPath === undefined) {
|
|
85
|
-
result.packageJsonPath = env.resolve(env.PACKAGE_JSON);
|
|
86
|
-
}
|
|
87
|
-
if (result.dryRun === undefined) {
|
|
88
|
-
result.dryRun = env.resolveFlag(env.DRY_RUN)
|
|
89
|
-
}
|
|
90
|
-
if (result.strategy === undefined) {
|
|
91
|
-
result.strategy = env.resolve(env.VERSION_INCREMENT_STRATEGY);
|
|
92
|
-
}
|
|
93
|
-
if (result.zero === undefined) {
|
|
94
|
-
result.zero = env.resolveFlag(env.VERSION_INCREMENT_ZERO);
|
|
95
|
-
}
|
|
96
|
-
if (result.incrementBy === undefined) {
|
|
97
|
-
result.incrementBy = env.resolveNumber(env.PACK_INCREMENT_VERSION_BY);
|
|
98
|
-
}
|
|
99
|
-
return result as CompleteOptions;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function guessIndent(text: string) {
|
|
103
|
-
const
|
|
104
|
-
lines = text.split("\n"),
|
|
105
|
-
firstIndented = lines.find(line => line.match(/^\s+/));
|
|
106
|
-
if (!firstIndented) {
|
|
107
|
-
return 2; // guess
|
|
108
|
-
}
|
|
109
|
-
const
|
|
110
|
-
firstMatch = firstIndented.match(/(^\s+)/) || [],
|
|
111
|
-
leadingWhitespace = firstMatch[0] || " ",
|
|
112
|
-
asSpaces = leadingWhitespace.replace(/\t/g, " ");
|
|
113
|
-
return asSpaces.length;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
module.exports = alterPackageJsonVersion;
|
|
117
|
-
})();
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
const
|
|
3
|
-
readline = require("readline");
|
|
4
|
-
|
|
5
|
-
interface AskOptions {
|
|
6
|
-
inputStream: NodeJS.ReadStream,
|
|
7
|
-
outputStream: NodeJS.WriteStream,
|
|
8
|
-
done: ((data: string) => boolean)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const defaultOptions: AskOptions = {
|
|
12
|
-
inputStream: process.stdin,
|
|
13
|
-
outputStream: process.stdout,
|
|
14
|
-
done: (s: string) => true // grab only the first line
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
async function ask(message: string, opts?: AskOptions): Promise<string> {
|
|
18
|
-
opts = Object.assign({}, defaultOptions, opts || {});
|
|
19
|
-
const { done } = opts;
|
|
20
|
-
const rl = readline.createInterface({
|
|
21
|
-
input: opts.inputStream,
|
|
22
|
-
output: opts.outputStream
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const lines: string[] = [];
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
rl.question(message, (line: string) => {
|
|
28
|
-
lines.push(line);
|
|
29
|
-
const all = lines.join("\n");
|
|
30
|
-
if (done(all)) {
|
|
31
|
-
rl.close();
|
|
32
|
-
resolve(all);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = {
|
|
39
|
-
ask
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
const
|
|
3
|
-
env = requireModule<Env>("env"),
|
|
4
|
-
actual = require("ansi-colors"),
|
|
5
|
-
shim = {} as any,
|
|
6
|
-
functions = Object.keys(actual)
|
|
7
|
-
.filter(k => typeof actual[k] === "function");
|
|
8
|
-
for (const fn of functions) {
|
|
9
|
-
shim[fn] = (s: string) => {
|
|
10
|
-
if (env.resolveFlag("NO_COLOR")) {
|
|
11
|
-
return s;
|
|
12
|
-
}
|
|
13
|
-
return actual[fn](s);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
module.exports = shim;
|
|
17
|
-
})();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as vinyl from "vinyl";
|
|
2
|
-
|
|
3
|
-
(function() {
|
|
4
|
-
// collects the files from a gulp stream
|
|
5
|
-
const
|
|
6
|
-
es = require("event-stream");
|
|
7
|
-
module.exports = function collectFiles(target: vinyl.BufferFile[]) {
|
|
8
|
-
const stream = es.through(function data(file: vinyl.BufferFile) {
|
|
9
|
-
target.push(file);
|
|
10
|
-
stream.emit("data", file);
|
|
11
|
-
}, function end() {
|
|
12
|
-
stream.emit("end");
|
|
13
|
-
});
|
|
14
|
-
return stream;
|
|
15
|
-
}
|
|
16
|
-
})();
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
const spawn = requireModule<Spawn>("spawn");
|
|
3
|
-
|
|
4
|
-
async function test(opts: DotNetTestOptions): Promise<SpawnResult | SpawnError> {
|
|
5
|
-
const args = [
|
|
6
|
-
"test",
|
|
7
|
-
opts.target
|
|
8
|
-
];
|
|
9
|
-
pushIfSet(args, opts.verbosity, "-v");
|
|
10
|
-
pushIfSet(args, opts.configuration, "-c");
|
|
11
|
-
pushFlag(args, opts.noBuild, "--no-build");
|
|
12
|
-
pushFlag(args, opts.noRestore, "--no-restore");
|
|
13
|
-
|
|
14
|
-
pushLoggers(args, opts.loggers);
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
return await spawn("dotnet", args, {
|
|
18
|
-
stdout: opts.stdout,
|
|
19
|
-
stderr: opts.stderr
|
|
20
|
-
});
|
|
21
|
-
} catch (e) {
|
|
22
|
-
return e as SpawnError;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function pushLoggers(args: string[], loggers: Optional<DotNetTestLoggers>) {
|
|
27
|
-
if (!loggers) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
for (const loggerName of Object.keys(loggers)) {
|
|
31
|
-
const build = [loggerName];
|
|
32
|
-
const options = loggers[loggerName];
|
|
33
|
-
for (const key of Object.keys(options)) {
|
|
34
|
-
const value = options[key];
|
|
35
|
-
build.push([key, value].join("="));
|
|
36
|
-
}
|
|
37
|
-
args.push("--logger", build.join(";"));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function pushIfSet(args: string[], value: Optional<string>, cliSwitch: string) {
|
|
42
|
-
if (value) {
|
|
43
|
-
args.push(cliSwitch, value);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function pushFlag(args: string[], value: Optional<boolean>, cliSwitch: string) {
|
|
48
|
-
if (value) {
|
|
49
|
-
args.push(cliSwitch);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
module.exports = {
|
|
54
|
-
test
|
|
55
|
-
};
|
|
56
|
-
})();
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
const { ZarroError } = requireModule("zarro-error");
|
|
3
|
-
|
|
4
|
-
function env(name: string, fallback?: string): string {
|
|
5
|
-
const value = process.env[name];
|
|
6
|
-
if (value !== undefined) {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
const argCount = Array.from(arguments).length;
|
|
10
|
-
if (argCount > 1) {
|
|
11
|
-
return fallback as string;
|
|
12
|
-
}
|
|
13
|
-
throw new ZarroError(
|
|
14
|
-
`environment variable '${ name }' is not defined and no fallback provided`
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function envNumber(name: string, fallback?: number): number {
|
|
19
|
-
const
|
|
20
|
-
haveFallback = fallback !== undefined,
|
|
21
|
-
value = haveFallback ? env(name, fallback?.toString()) : env(name),
|
|
22
|
-
parsed = parseInt(value, 10);
|
|
23
|
-
if (!isNaN(parsed)) {
|
|
24
|
-
return parsed;
|
|
25
|
-
}
|
|
26
|
-
throw new ZarroError(
|
|
27
|
-
`environment variable '${ name }' is invalid: expected numeric value but found '${ value }'`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function envFlag(name: string, fallback?: boolean): boolean {
|
|
32
|
-
const
|
|
33
|
-
haveFallback = fallback !== undefined,
|
|
34
|
-
value = haveFallback ? env(name, fallback?.toString()) : env(name);
|
|
35
|
-
return parseBool(name, value);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const truthy = [
|
|
39
|
-
"1",
|
|
40
|
-
"yes",
|
|
41
|
-
"true"
|
|
42
|
-
],
|
|
43
|
-
falsey = [
|
|
44
|
-
"0",
|
|
45
|
-
"no",
|
|
46
|
-
"false"
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
function parseBool(name: string, value: string): boolean {
|
|
50
|
-
if (truthy.indexOf(value?.toString()) > -1) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (falsey.indexOf(value?.toString()) > -1) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
throw new ZarroError(
|
|
57
|
-
`environment variable '${name}' is invalid: could not parse '${value}' as a boolean value`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = {
|
|
62
|
-
env,
|
|
63
|
-
envNumber,
|
|
64
|
-
envFlag
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
})();
|