zarro 1.186.0 → 1.187.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.
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
  (function () {
3
3
  const { currentShortSHA } = requireModule("git-sha");
4
- function timestamp() {
5
- const now = new Date(Date.now()), year = `${now.getFullYear()}`.substring(2), month = zeroPad(now.getMonth() + 1), day = zeroPad(now.getDate()), hour = zeroPad(now.getHours()), minute = zeroPad(now.getMinutes());
6
- return [
7
- year,
8
- month,
9
- day,
10
- hour,
11
- minute
12
- ].join("");
13
- }
14
- function zeroPad(i) {
15
- return i < 10 ? `0${i}` : `${i}`;
16
- }
4
+ const { timestamp } = requireModule("timestamp");
5
+ const options = {
6
+ fullYear: false,
7
+ includeSeconds: false
8
+ };
17
9
  module.exports = function generateVersionSuffix() {
18
- return `${timestamp()}.${currentShortSHA()}`;
10
+ return `${timestamp(options)}.${currentShortSHA()}`;
19
11
  };
20
12
  })();
@@ -1,53 +1,53 @@
1
- (function () {
2
- const
3
- gitFactory = require("simple-git"),
4
- resolveGitBranch = requireModule("resolve-git-branch"),
5
- resolveGitRemote = requireModule("resolve-git-remote"),
6
- gutil = requireModule("gulp-util");
7
-
8
- async function gitPush(
9
- dryRun,
10
- quiet,
11
- where
12
- ) {
13
- if (dryRun === undefined) {
14
- dryRun = {};
15
- }
16
- if (typeof dryRun === "object") {
17
- quiet = dryRun.quiet || false;
18
- where = dryRun.where || ".";
19
- dryRun = dryRun.dryRun || false;
20
- } else if (quiet !== undefined) {
21
- gutil.log.warn(
22
- gutil.colors.red(
23
- "depreciation warning: options for git-push should be sent via an object"
24
- )
25
- );
26
- }
27
- where = where || ".";
28
- quiet = !!quiet;
29
- const
30
- git = gitFactory(where),
31
- more = (where && where !== ".") ? ` (${ where })` : "";
32
- if (dryRun) {
33
- gutil.log(gutil.colors.green(`dry run: whould push local commits now${ more }...`));
34
- return Promise.resolve();
35
- }
36
- if (!quiet) {
37
- gutil.log(gutil.colors.green(`pushing local commits${ more }...`));
38
- }
39
- const
40
- remote = await resolveGitRemote(),
41
- branch = await resolveGitBranch();
42
- if (remote && branch) {
43
- await git.push(
44
- remote,
45
- branch, [
46
- "-u" // we're probably already tracking, but this will help a new branch
47
- ]
48
- );
49
- }
50
- }
51
-
52
- module.exports = gitPush;
53
- })();
1
+ (function () {
2
+ const
3
+ gitFactory = require("simple-git"),
4
+ resolveGitBranch = requireModule("resolve-git-branch"),
5
+ resolveGitRemote = requireModule("resolve-git-remote"),
6
+ gutil = requireModule("gulp-util");
7
+
8
+ async function gitPush(
9
+ dryRun,
10
+ quiet,
11
+ where
12
+ ) {
13
+ if (dryRun === undefined) {
14
+ dryRun = {};
15
+ }
16
+ if (typeof dryRun === "object") {
17
+ quiet = dryRun.quiet || false;
18
+ where = dryRun.where || ".";
19
+ dryRun = dryRun.dryRun || false;
20
+ } else if (quiet !== undefined) {
21
+ gutil.log.warn(
22
+ gutil.colors.red(
23
+ "depreciation warning: options for git-push should be sent via an object"
24
+ )
25
+ );
26
+ }
27
+ where = where || ".";
28
+ quiet = !!quiet;
29
+ const
30
+ git = gitFactory(where),
31
+ more = (where && where !== ".") ? ` (${ where })` : "";
32
+ if (dryRun) {
33
+ gutil.log(gutil.colors.green(`dry run: whould push local commits now${ more }...`));
34
+ return Promise.resolve();
35
+ }
36
+ if (!quiet) {
37
+ gutil.log(gutil.colors.green(`pushing local commits${ more }...`));
38
+ }
39
+ const
40
+ remote = await resolveGitRemote(),
41
+ branch = await resolveGitBranch();
42
+ if (remote && branch) {
43
+ await git.push(
44
+ remote,
45
+ branch, [
46
+ "-u" // we're probably already tracking, but this will help a new branch
47
+ ]
48
+ );
49
+ }
50
+ }
51
+
52
+ module.exports = gitPush;
53
+ })();
@@ -33,12 +33,12 @@
33
33
  for (const item of negatives) {
34
34
  possibleNegatives.push(item);
35
35
  }
36
- throw new Error(`${value} is not a valid flag value.
37
- Try one of:
38
- - accepted truthy values:
39
- ${possiblePositives.join(", ")}
40
- - accepted falsey values:
41
- ${possibleNegatives.join(", ")}
36
+ throw new Error(`${value} is not a valid flag value.
37
+ Try one of:
38
+ - accepted truthy values:
39
+ ${possiblePositives.join(", ")}
40
+ - accepted falsey values:
41
+ ${possibleNegatives.join(", ")}
42
42
  `);
43
43
  }
44
44
  module.exports = {
@@ -99,7 +99,7 @@
99
99
  throw new ZarroError("MONO is required to run nuget restore on this platform");
100
100
  }
101
101
  const baseFolder = findNpmBase();
102
- const script = `#!/bin/sh
102
+ const script = `#!/bin/sh
103
103
  mono ${path.resolve(nugetPath)} $@`;
104
104
  const scriptPath = path.join(baseFolder, "node_modules", ".bin", "mono-nuget");
105
105
  writeFileSync(scriptPath, script, { encoding: "utf-8" });
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ (function () {
3
+ function timestamp(opts) {
4
+ var _a;
5
+ opts = opts || {};
6
+ if (!opts.delimiter) {
7
+ opts.delimiter = "";
8
+ }
9
+ if (opts.includeSeconds === undefined) {
10
+ opts.includeSeconds = true;
11
+ }
12
+ if (opts.includeMilliseconds === undefined) {
13
+ opts.includeMilliseconds = false;
14
+ }
15
+ if (opts.fullYear === undefined) {
16
+ opts.fullYear = true;
17
+ }
18
+ const now = (_a = opts.forDate) !== null && _a !== void 0 ? _a : new Date();
19
+ let yearString = `${now.getFullYear()}`;
20
+ if (!opts.fullYear) {
21
+ yearString = yearString.substring(2, 4);
22
+ }
23
+ const parts = [
24
+ yearString,
25
+ `${now.getMonth() + 1}`.padStart(2, "0"),
26
+ `${now.getDate()}`.padStart(2, "0"),
27
+ `${now.getHours()}`.padStart(2, "0"),
28
+ `${now.getMinutes()}`.padStart(2, "0")
29
+ ];
30
+ if (opts.includeSeconds) {
31
+ parts.push(`${now.getSeconds()}`.padStart(2, "0"));
32
+ }
33
+ if (opts.includeMilliseconds) {
34
+ parts.push(`${now.getMilliseconds()}`.padStart(3, "0"));
35
+ }
36
+ return parts.join(opts.delimiter);
37
+ }
38
+ module.exports = {
39
+ timestamp
40
+ };
41
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.186.0",
3
+ "version": "1.187.0",
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"
package/types.d.ts CHANGED
@@ -2201,5 +2201,16 @@ declare global {
2201
2201
  forget(key: string): void;
2202
2202
  clear(): void;
2203
2203
  }
2204
+
2205
+ export interface TimestampOptions {
2206
+ delimiter?: string;
2207
+ includeSeconds?: boolean;
2208
+ includeMilliseconds?: boolean;
2209
+ fullYear?: boolean;
2210
+ forDate?: Date;
2211
+ }
2212
+ interface Timestamp {
2213
+ timestamp: (opts?: TimestampOptions) => string;
2214
+ }
2204
2215
  }
2205
2216