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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const alterPackageJsonVersion = requireModule("alter-package-json-version"), env = requireModule("env"), gulp = requireModule("gulp"), taskName = "increment-package-json-version";
|
|
3
|
+
env.associate([
|
|
4
|
+
env.DRY_RUN,
|
|
5
|
+
env.PACKAGE_JSON,
|
|
6
|
+
env.VERSION_INCREMENT_STRATEGY,
|
|
7
|
+
env.VERSION_INCREMENT_ZERO,
|
|
8
|
+
env.INITIAL_RELEASE
|
|
9
|
+
], taskName);
|
|
10
|
+
gulp.task(taskName, async () => {
|
|
11
|
+
return await alterPackageJsonVersion();
|
|
12
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var gulp = requireModule("gulp");
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Installs tooling into the solution folder, into the `tools` folder, or, if specified
|
|
5
|
+
by the BUILD_TOOLS_FOLDER environment variable, there instead (in case you already have
|
|
6
|
+
a `tools` folder which would cause confusion).
|
|
7
|
+
|
|
8
|
+
If you don't need this step at all, copy this to your `local-tasks` folder and remove
|
|
9
|
+
the dependency on "default-tools-installer".
|
|
10
|
+
|
|
11
|
+
If you want the default functionality in addition to other functionality, have a look
|
|
12
|
+
at how `default-tools-installer` works and implement your own custom logic inside the
|
|
13
|
+
body of this task, copied off to your `local-tasks` folder
|
|
14
|
+
*/
|
|
15
|
+
gulp.task(
|
|
16
|
+
"install-tools",
|
|
17
|
+
"Installs the default tools for dotnet development",
|
|
18
|
+
[ "default-tools-installer" ],
|
|
19
|
+
() => {
|
|
20
|
+
// replace this line with custom tooling installation
|
|
21
|
+
return Promise.resolve();
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// import to patch streams to have an .onAny handler where you can spy on all
|
|
2
|
+
// events from the stream
|
|
3
|
+
function patchEventEmitters() {
|
|
4
|
+
var EventEmitter = require("events");
|
|
5
|
+
var origemit = EventEmitter.prototype.emit;
|
|
6
|
+
Object.assign(EventEmitter.prototype, {
|
|
7
|
+
emit: function() {
|
|
8
|
+
if (this._onAnyListeners) {
|
|
9
|
+
this._onAnyListeners.forEach(listener =>
|
|
10
|
+
listener.apply(this, arguments)
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return origemit.apply(this, arguments);
|
|
14
|
+
},
|
|
15
|
+
onAny: function(func) {
|
|
16
|
+
if (typeof func !== "function") {
|
|
17
|
+
throw new Error("Invalid type");
|
|
18
|
+
}
|
|
19
|
+
if (!this._onAnyListeners) this._onAnyListeners = [];
|
|
20
|
+
this._onAnyListeners.push(func);
|
|
21
|
+
},
|
|
22
|
+
removeOnAny: function(func) {
|
|
23
|
+
const index = this._onAnyListeners.indexOf(func);
|
|
24
|
+
if (index === -1) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this._onAnyListeners.splice(index, 1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
patchEventEmitters();
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
(function () {
|
|
4
|
+
const gutil = requireModule("gulp-util"), env = requireModule("env"), { stat } = require("fs").promises, readTextFile = requireModule("read-text-file"), writeTextFile = requireModule("write-text-file"), incrementVersion = requireModule("increment-version");
|
|
5
|
+
async function alterPackageJsonVersion(inputOpts) {
|
|
6
|
+
if (env.resolveFlag(env.INITIAL_RELEASE)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
return new Promise(async (resolve, reject) => {
|
|
10
|
+
const opts = fillInFromEnvironment(inputOpts), st = await stat(opts.packageJsonPath);
|
|
11
|
+
if (!st) {
|
|
12
|
+
return reject(`Can't find file at '${opts.packageJsonPath}'`);
|
|
13
|
+
}
|
|
14
|
+
const json = await readTextFile(opts.packageJsonPath), indent = guessIndent(json), index = JSON.parse(json), currentVersion = index.version || "0.0.0", incremented = incrementVersion(currentVersion, opts.strategy, opts.zero, opts.incrementBy);
|
|
15
|
+
index.version = incremented;
|
|
16
|
+
const newJson = JSON.stringify(index, null, indent);
|
|
17
|
+
if (opts.dryRun) {
|
|
18
|
+
gutil.log(gutil.colors.green(`dry run: would increment version in '${opts.packageJsonPath}' from '${currentVersion}' to '${incremented}'`));
|
|
19
|
+
}
|
|
20
|
+
await writeTextFile(opts.packageJsonPath, newJson);
|
|
21
|
+
resolve();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function shouldFillInFromEnvironment(opts) {
|
|
25
|
+
if (!opts) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (opts.loadUnsetFromEnvironment) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return (Object.keys(opts).length === 0);
|
|
32
|
+
}
|
|
33
|
+
function fillInFromEnvironment(opts) {
|
|
34
|
+
if (!shouldFillInFromEnvironment(opts)) {
|
|
35
|
+
return opts;
|
|
36
|
+
}
|
|
37
|
+
const result = Object.assign({}, opts);
|
|
38
|
+
if (result.packageJsonPath === undefined) {
|
|
39
|
+
result.packageJsonPath = env.resolve(env.PACKAGE_JSON);
|
|
40
|
+
}
|
|
41
|
+
if (result.dryRun === undefined) {
|
|
42
|
+
result.dryRun = env.resolveFlag(env.DRY_RUN);
|
|
43
|
+
}
|
|
44
|
+
if (result.strategy === undefined) {
|
|
45
|
+
result.strategy = env.resolve(env.VERSION_INCREMENT_STRATEGY);
|
|
46
|
+
}
|
|
47
|
+
if (result.zero === undefined) {
|
|
48
|
+
result.zero = env.resolveFlag(env.VERSION_INCREMENT_ZERO);
|
|
49
|
+
}
|
|
50
|
+
if (result.incrementBy === undefined) {
|
|
51
|
+
result.incrementBy = env.resolveNumber(env.PACK_INCREMENT_VERSION_BY);
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
function guessIndent(text) {
|
|
56
|
+
const lines = text.split("\n"), firstIndented = lines.find(line => line.match(/^\s+/));
|
|
57
|
+
if (!firstIndented) {
|
|
58
|
+
return 2; // guess
|
|
59
|
+
}
|
|
60
|
+
const firstMatch = firstIndented.match(/(^\s+)/) || [], leadingWhitespace = firstMatch[0] || " ", asSpaces = leadingWhitespace.replace(/\t/g, " ");
|
|
61
|
+
return asSpaces.length;
|
|
62
|
+
}
|
|
63
|
+
module.exports = alterPackageJsonVersion;
|
|
64
|
+
})();
|
|
@@ -0,0 +1,113 @@
|
|
|
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(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
|
+
const
|
|
41
|
+
json = await readTextFile(opts.packageJsonPath),
|
|
42
|
+
indent = guessIndent(json),
|
|
43
|
+
index = JSON.parse(json),
|
|
44
|
+
currentVersion = index.version || "0.0.0",
|
|
45
|
+
incremented = incrementVersion(
|
|
46
|
+
currentVersion,
|
|
47
|
+
opts.strategy,
|
|
48
|
+
opts.zero,
|
|
49
|
+
opts.incrementBy
|
|
50
|
+
);
|
|
51
|
+
index.version = incremented;
|
|
52
|
+
const newJson = JSON.stringify(index, null, indent);
|
|
53
|
+
if (opts.dryRun) {
|
|
54
|
+
gutil.log(
|
|
55
|
+
gutil.colors.green(
|
|
56
|
+
`dry run: would increment version in '${ opts.packageJsonPath }' from '${ currentVersion }' to '${ incremented }'`
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
await writeTextFile(opts.packageJsonPath, newJson);
|
|
61
|
+
resolve();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function shouldFillInFromEnvironment(opts?: AlterPackageJsonVersionOptions) {
|
|
66
|
+
if (!opts) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
if (opts.loadUnsetFromEnvironment) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return (Object.keys(opts).length === 0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function fillInFromEnvironment(opts?: AlterPackageJsonVersionOptions): CompleteOptions {
|
|
76
|
+
if (!shouldFillInFromEnvironment(opts)) {
|
|
77
|
+
return opts as CompleteOptions;
|
|
78
|
+
}
|
|
79
|
+
const result = { ...opts } as CompleteOptions;
|
|
80
|
+
if (result.packageJsonPath === undefined) {
|
|
81
|
+
result.packageJsonPath = env.resolve(env.PACKAGE_JSON);
|
|
82
|
+
}
|
|
83
|
+
if (result.dryRun === undefined) {
|
|
84
|
+
result.dryRun = env.resolveFlag(env.DRY_RUN)
|
|
85
|
+
}
|
|
86
|
+
if (result.strategy === undefined) {
|
|
87
|
+
result.strategy = env.resolve(env.VERSION_INCREMENT_STRATEGY);
|
|
88
|
+
}
|
|
89
|
+
if (result.zero === undefined) {
|
|
90
|
+
result.zero = env.resolveFlag(env.VERSION_INCREMENT_ZERO);
|
|
91
|
+
}
|
|
92
|
+
if (result.incrementBy === undefined) {
|
|
93
|
+
result.incrementBy = env.resolveNumber(env.PACK_INCREMENT_VERSION_BY);
|
|
94
|
+
}
|
|
95
|
+
return result as CompleteOptions;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function guessIndent(text: string) {
|
|
99
|
+
const
|
|
100
|
+
lines = text.split("\n"),
|
|
101
|
+
firstIndented = lines.find(line => line.match(/^\s+/));
|
|
102
|
+
if (!firstIndented) {
|
|
103
|
+
return 2; // guess
|
|
104
|
+
}
|
|
105
|
+
const
|
|
106
|
+
firstMatch = firstIndented.match(/(^\s+)/) || [],
|
|
107
|
+
leadingWhitespace = firstMatch[0] || " ",
|
|
108
|
+
asSpaces = leadingWhitespace.replace(/\t/g, " ");
|
|
109
|
+
return asSpaces.length;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = alterPackageJsonVersion;
|
|
113
|
+
})();
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const
|
|
2
|
+
gulp = requireModule("gulp"),
|
|
3
|
+
fs = require("fs"),
|
|
4
|
+
xml2js = require("xml2js"),
|
|
5
|
+
throwIfNoFiles = requireModule("throw-if-no-files"),
|
|
6
|
+
path = require("path"),
|
|
7
|
+
env = require("./env"),
|
|
8
|
+
debug = require("debug")(path.basename(__filename.replace(/\.js$/, ""))),
|
|
9
|
+
es = require("event-stream");
|
|
10
|
+
|
|
11
|
+
module.exports = async function areAllDotnetCore(
|
|
12
|
+
gulpSrcSpecs
|
|
13
|
+
)
|
|
14
|
+
{
|
|
15
|
+
if (process.env.DOTNETCORE !== undefined) {
|
|
16
|
+
return env.resolveFlag("DOTNET_CORE");
|
|
17
|
+
}
|
|
18
|
+
return await new Promise(async (resolve, reject) => {
|
|
19
|
+
const projFiles = [];
|
|
20
|
+
gulp
|
|
21
|
+
.src(gulpSrcSpecs, { allowEmpty: true })
|
|
22
|
+
.pipe(throwIfNoFiles())
|
|
23
|
+
.pipe(
|
|
24
|
+
(() => {
|
|
25
|
+
return es.through(
|
|
26
|
+
function write(file) {
|
|
27
|
+
if (!file) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
projFiles.push(file.path);
|
|
31
|
+
},
|
|
32
|
+
async function end() {
|
|
33
|
+
if (projFiles.length === 0) {
|
|
34
|
+
return resolve(false);
|
|
35
|
+
}
|
|
36
|
+
for (const proj of projFiles) {
|
|
37
|
+
const isCoreOrStandard = await allTargetsAreCoreOrFramework(
|
|
38
|
+
proj
|
|
39
|
+
);
|
|
40
|
+
if (!isCoreOrStandard) {
|
|
41
|
+
resolve(false);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
resolve(true);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
})()
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function allTargetsAreCoreOrFramework(csproj) {
|
|
53
|
+
return new Promise(async (resolve, reject) => {
|
|
54
|
+
try {
|
|
55
|
+
debug(`testing for netcore/netstandard: ${csproj}`);
|
|
56
|
+
const contents = fs.readFileSync(csproj, { encoding: "utf-8" }),
|
|
57
|
+
parser = new xml2js.Parser();
|
|
58
|
+
parser.parseString(contents, (err, data) => {
|
|
59
|
+
if (err) {
|
|
60
|
+
return reject(err);
|
|
61
|
+
}
|
|
62
|
+
if (!data.Project) {
|
|
63
|
+
resolve(false);
|
|
64
|
+
}
|
|
65
|
+
let foundTargetFrameworksNode = false;
|
|
66
|
+
const allCoreOrStandard = (data.Project.PropertyGroup || []).reduce(
|
|
67
|
+
(acc, cur) => {
|
|
68
|
+
const targetFrameworksNode =
|
|
69
|
+
cur.TargetFramework || cur.TargetFrameworks;
|
|
70
|
+
if (!targetFrameworksNode) {
|
|
71
|
+
return acc;
|
|
72
|
+
}
|
|
73
|
+
foundTargetFrameworksNode = true;
|
|
74
|
+
const targetFrameworks = targetFrameworksNode.join("").split(";");
|
|
75
|
+
debug(`have target framework(s): ${targetFrameworks}`);
|
|
76
|
+
return (
|
|
77
|
+
acc &&
|
|
78
|
+
targetFrameworks.reduce((acc2, cur2) => {
|
|
79
|
+
return (
|
|
80
|
+
acc2 &&
|
|
81
|
+
(cur2.indexOf("netstandard") === 0 ||
|
|
82
|
+
cur2.indexOf("netcoreapp") === 0)
|
|
83
|
+
);
|
|
84
|
+
}, true)
|
|
85
|
+
);
|
|
86
|
+
},
|
|
87
|
+
true
|
|
88
|
+
) && foundTargetFrameworksNode;
|
|
89
|
+
debug(`all targets are core/standard: ${allCoreOrStandard}`);
|
|
90
|
+
resolve(allCoreOrStandard);
|
|
91
|
+
});
|
|
92
|
+
} catch (e) {
|
|
93
|
+
reject(e);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function () {
|
|
3
|
+
const readline = require("readline");
|
|
4
|
+
const defaultOptions = {
|
|
5
|
+
inputStream: process.stdin,
|
|
6
|
+
outputStream: process.stdout,
|
|
7
|
+
done: (s) => true // grab only the first line
|
|
8
|
+
};
|
|
9
|
+
async function ask(message, opts) {
|
|
10
|
+
opts = Object.assign({}, defaultOptions, opts || {});
|
|
11
|
+
const { done } = opts;
|
|
12
|
+
const rl = readline.createInterface({
|
|
13
|
+
input: opts.inputStream,
|
|
14
|
+
output: opts.outputStream
|
|
15
|
+
});
|
|
16
|
+
const lines = [];
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
rl.question(message, (line) => {
|
|
19
|
+
lines.push(line);
|
|
20
|
+
const all = lines.join("\n");
|
|
21
|
+
if (done(all)) {
|
|
22
|
+
rl.close();
|
|
23
|
+
resolve(all);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
module.exports = {
|
|
29
|
+
ask
|
|
30
|
+
};
|
|
31
|
+
})();
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
})();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
(function () {
|
|
4
|
+
// collects the files from a gulp stream
|
|
5
|
+
const es = require("event-stream");
|
|
6
|
+
module.exports = function collectFiles(target) {
|
|
7
|
+
const stream = es.through(function data(file) {
|
|
8
|
+
target.push(file);
|
|
9
|
+
stream.emit("data", file);
|
|
10
|
+
}, function end() {
|
|
11
|
+
stream.emit("end");
|
|
12
|
+
});
|
|
13
|
+
return stream;
|
|
14
|
+
};
|
|
15
|
+
})();
|