@eclipse-glsp/cli 2.3.0-next.164 → 2.3.0-next.17

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.
Files changed (90) hide show
  1. package/README.md +143 -38
  2. package/dist/cli.js +21959 -0
  3. package/dist/cli.js.map +6 -0
  4. package/package.json +22 -29
  5. package/bin/glsp +0 -2
  6. package/lib/app.d.ts +0 -2
  7. package/lib/app.d.ts.map +0 -1
  8. package/lib/app.js +0 -35
  9. package/lib/app.js.map +0 -1
  10. package/lib/commands/check-header.d.ts +0 -21
  11. package/lib/commands/check-header.d.ts.map +0 -1
  12. package/lib/commands/check-header.js +0 -240
  13. package/lib/commands/check-header.js.map +0 -1
  14. package/lib/commands/coverage-report.d.ts +0 -29
  15. package/lib/commands/coverage-report.d.ts.map +0 -1
  16. package/lib/commands/coverage-report.js +0 -126
  17. package/lib/commands/coverage-report.js.map +0 -1
  18. package/lib/commands/generate-index.d.ts +0 -46
  19. package/lib/commands/generate-index.d.ts.map +0 -1
  20. package/lib/commands/generate-index.js +0 -172
  21. package/lib/commands/generate-index.js.map +0 -1
  22. package/lib/commands/release/common.d.ts +0 -68
  23. package/lib/commands/release/common.d.ts.map +0 -1
  24. package/lib/commands/release/common.js +0 -293
  25. package/lib/commands/release/common.js.map +0 -1
  26. package/lib/commands/release/release-client.d.ts +0 -3
  27. package/lib/commands/release/release-client.d.ts.map +0 -1
  28. package/lib/commands/release/release-client.js +0 -58
  29. package/lib/commands/release/release-client.js.map +0 -1
  30. package/lib/commands/release/release-eclipse-integration.d.ts +0 -18
  31. package/lib/commands/release/release-eclipse-integration.d.ts.map +0 -1
  32. package/lib/commands/release/release-eclipse-integration.js +0 -93
  33. package/lib/commands/release/release-eclipse-integration.js.map +0 -1
  34. package/lib/commands/release/release-java-server.d.ts +0 -3
  35. package/lib/commands/release/release-java-server.d.ts.map +0 -1
  36. package/lib/commands/release/release-java-server.js +0 -71
  37. package/lib/commands/release/release-java-server.js.map +0 -1
  38. package/lib/commands/release/release-server-node.d.ts +0 -18
  39. package/lib/commands/release/release-server-node.d.ts.map +0 -1
  40. package/lib/commands/release/release-server-node.js +0 -54
  41. package/lib/commands/release/release-server-node.js.map +0 -1
  42. package/lib/commands/release/release-theia-integration.d.ts +0 -18
  43. package/lib/commands/release/release-theia-integration.d.ts.map +0 -1
  44. package/lib/commands/release/release-theia-integration.js +0 -54
  45. package/lib/commands/release/release-theia-integration.js.map +0 -1
  46. package/lib/commands/release/release-vscode-integration.d.ts +0 -18
  47. package/lib/commands/release/release-vscode-integration.d.ts.map +0 -1
  48. package/lib/commands/release/release-vscode-integration.js +0 -54
  49. package/lib/commands/release/release-vscode-integration.js.map +0 -1
  50. package/lib/commands/release/release.d.ts +0 -14
  51. package/lib/commands/release/release.d.ts.map +0 -1
  52. package/lib/commands/release/release.js +0 -191
  53. package/lib/commands/release/release.js.map +0 -1
  54. package/lib/commands/update-next.d.ts +0 -20
  55. package/lib/commands/update-next.d.ts.map +0 -1
  56. package/lib/commands/update-next.js +0 -146
  57. package/lib/commands/update-next.js.map +0 -1
  58. package/lib/util/command-util.d.ts +0 -26
  59. package/lib/util/command-util.d.ts.map +0 -1
  60. package/lib/util/command-util.js +0 -56
  61. package/lib/util/command-util.js.map +0 -1
  62. package/lib/util/git-util.d.ts +0 -42
  63. package/lib/util/git-util.d.ts.map +0 -1
  64. package/lib/util/git-util.js +0 -125
  65. package/lib/util/git-util.js.map +0 -1
  66. package/lib/util/logger.d.ts +0 -23
  67. package/lib/util/logger.d.ts.map +0 -1
  68. package/lib/util/logger.js +0 -50
  69. package/lib/util/logger.js.map +0 -1
  70. package/lib/util/validation-util.d.ts +0 -5
  71. package/lib/util/validation-util.d.ts.map +0 -1
  72. package/lib/util/validation-util.js +0 -86
  73. package/lib/util/validation-util.js.map +0 -1
  74. package/src/app.ts +0 -34
  75. package/src/commands/check-header.ts +0 -280
  76. package/src/commands/coverage-report.ts +0 -113
  77. package/src/commands/generate-index.ts +0 -169
  78. package/src/commands/release/common.ts +0 -306
  79. package/src/commands/release/release-client.ts +0 -55
  80. package/src/commands/release/release-eclipse-integration.ts +0 -113
  81. package/src/commands/release/release-java-server.ts +0 -73
  82. package/src/commands/release/release-server-node.ts +0 -61
  83. package/src/commands/release/release-theia-integration.ts +0 -65
  84. package/src/commands/release/release-vscode-integration.ts +0 -67
  85. package/src/commands/release/release.ts +0 -215
  86. package/src/commands/update-next.ts +0 -129
  87. package/src/util/command-util.ts +0 -54
  88. package/src/util/git-util.ts +0 -123
  89. package/src/util/logger.ts +0 -57
  90. package/src/util/validation-util.ts +0 -62
@@ -1,191 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.release = exports.ReleaseCommand = void 0;
30
- const commander_1 = require("commander");
31
- const process_1 = require("process");
32
- const readline_1 = require("readline");
33
- const readline = __importStar(require("readline-sync"));
34
- const semver = __importStar(require("semver"));
35
- const shelljs_1 = __importDefault(require("shelljs"));
36
- const command_util_1 = require("../../util/command-util");
37
- const logger_1 = require("../../util/logger");
38
- const validation_util_1 = require("../../util/validation-util");
39
- const common_js_1 = require("./common.js");
40
- const release_client_1 = require("./release-client");
41
- const release_eclipse_integration_1 = require("./release-eclipse-integration");
42
- const release_java_server_1 = require("./release-java-server");
43
- const release_server_node_1 = require("./release-server-node");
44
- const release_theia_integration_1 = require("./release-theia-integration");
45
- const release_vscode_integration_1 = require("./release-vscode-integration");
46
- exports.ReleaseCommand = (0, command_util_1.baseCommand)()
47
- .name('release')
48
- .description('Prepare & publish a new release for a glsp component')
49
- .addArgument(new commander_1.Argument('<component>', 'The glsp component to be released').choices(common_js_1.Component.CLI_CHOICES).argParser(common_js_1.Component.parse))
50
- .addArgument(new commander_1.Argument('<releaseType>', 'The release type').choices(common_js_1.ReleaseType.CLI_CHOICES))
51
- .argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validation_util_1.validateVersion)
52
- .option('-f, --force', 'Enable force mode', false)
53
- .option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validation_util_1.validateDirectory, process.cwd())
54
- .option('-b, --branch <branch>', 'The git branch to checkout', 'master')
55
- .option('-v, --verbose', 'Enable verbose (debug) log output', false)
56
- .option('--no-publish', 'Only prepare release but do not publish to github', true)
57
- .option('--draft', 'Publish github releases as drafts', false)
58
- .option('--npm-dryRun', 'Execute a npm dry-run for inspection. Publishes to the local npm registry and does not publish to github', false)
59
- .action(release);
60
- let verdaccioChildProcess = undefined;
61
- async function release(component, releaseType, customVersion, cliOptions) {
62
- try {
63
- (0, logger_1.configureLogger)(cliOptions.verbose);
64
- logger_1.LOGGER.debug('Cli options:', cliOptions);
65
- (0, command_util_1.configureShell)({ silent: !cliOptions.verbose });
66
- checkGHCli();
67
- const version = deriveVersion(releaseType, customVersion);
68
- const options = Object.assign(Object.assign({}, cliOptions), { component, releaseType, version });
69
- if (cliOptions.npmDryRun && options.component.releaseRepo === 'npm') {
70
- await launchVerdaccio().catch(error => logger_1.LOGGER.error('Error occurred during verdaccio launch', error));
71
- }
72
- switch (component.type) {
73
- case 'server-java':
74
- (0, common_js_1.checkIfMavenVersionExists)('org.eclipse.glsp', 'org.eclipse.glsp.server', (0, common_js_1.asMvnVersion)(version));
75
- return (0, release_java_server_1.releaseJavaServer)(options);
76
- case 'server-node':
77
- await (0, common_js_1.checkIfNpmVersionIsNew)('@eclipse-glsp/server-node', version);
78
- return (0, release_server_node_1.releaseServerNode)(options);
79
- case 'client':
80
- await (0, common_js_1.checkIfNpmVersionIsNew)('@eclipse-glsp/client', version);
81
- return (0, release_client_1.releaseClient)(options);
82
- case 'theia-integration':
83
- await (0, common_js_1.checkIfNpmVersionIsNew)('@eclipse-glsp/theia-integration', version);
84
- return (0, release_theia_integration_1.releaseTheiaIntegration)(options);
85
- case 'vscode-integration':
86
- await (0, common_js_1.checkIfNpmVersionIsNew)('@eclipse-glsp/vscode-integration', version);
87
- return (0, release_vscode_integration_1.releaseVscodeIntegration)(options);
88
- case 'eclipse-integration':
89
- await (0, common_js_1.checkIfNpmVersionIsNew)('@eclipse-glsp/ide', version);
90
- return (0, release_eclipse_integration_1.releaseEclipseIntegration)(options);
91
- }
92
- }
93
- catch (err) {
94
- console.error('An error occurred during command execution:', err);
95
- (0, process_1.exit)(1);
96
- }
97
- finally {
98
- if (verdaccioChildProcess) {
99
- verdaccioChildProcess.kill();
100
- }
101
- }
102
- }
103
- exports.release = release;
104
- function checkGHCli() {
105
- logger_1.LOGGER.debug('Verify that Github CLI is configured correctly');
106
- if (!isGithubCLIAuthenticated()) {
107
- throw new Error("Github CLI is not configured properly. No user is logged in for host 'github.com'");
108
- }
109
- }
110
- function isGithubCLIAuthenticated() {
111
- logger_1.LOGGER.debug('Verify that Github CLI is installed');
112
- (0, command_util_1.fatalExec)('which gh', 'Github CLI is not installed!');
113
- const status = shelljs_1.default.exec('gh auth status', (0, command_util_1.getShellConfig)());
114
- if (status.code !== 0) {
115
- if (status.stderr.includes('You are not logged into any GitHub hosts')) {
116
- return false;
117
- }
118
- throw new Error(status.stderr);
119
- }
120
- if (!status.stdout.trim().includes('Logged in to github.com')) {
121
- logger_1.LOGGER.debug("No user is logged in for host 'github.com'");
122
- return false;
123
- }
124
- logger_1.LOGGER.debug('Github CLI is authenticated and ready to use');
125
- return true;
126
- }
127
- function launchVerdaccio() {
128
- logger_1.LOGGER.debug('Verify that verdaccio is installed and start if necessary');
129
- (0, command_util_1.fatalExec)('which verdaccio', 'Verdaccio is not installed!');
130
- // Check if verdaccio is alreaddy running
131
- const result = shelljs_1.default.exec(`curl -i ${common_js_1.VERDACCIO_REGISTRY}`, (0, command_util_1.getShellConfig)());
132
- if (result.code !== 0) {
133
- logger_1.LOGGER.info('Starting local verdaccio registry');
134
- verdaccioChildProcess = shelljs_1.default.exec('verdaccio', { async: true, silent: true });
135
- return new Promise(resolve => {
136
- (0, readline_1.createInterface)(verdaccioChildProcess.stdout).on('line', line => {
137
- if (line.includes(`http address - ${common_js_1.VERDACCIO_REGISTRY}`)) {
138
- resolve();
139
- }
140
- });
141
- });
142
- }
143
- return Promise.resolve();
144
- }
145
- function deriveVersion(releaseType, customVersion) {
146
- logger_1.LOGGER.debug(`Derive version from release type: ${release}`);
147
- switch (releaseType) {
148
- case 'custom':
149
- return getCustomVersion(customVersion);
150
- case 'rc':
151
- return getRCVersion();
152
- case 'patch':
153
- case 'major':
154
- case 'minor':
155
- return semverInc(releaseType);
156
- }
157
- }
158
- const REFERENCE_NPM_PACKAGE = '@eclipse-glsp/ide';
159
- function getRCVersion() {
160
- logger_1.LOGGER.debug('Retrieve and new RC version');
161
- const newBaseVersion = semverInc('minor');
162
- const currentRcVersion = shelljs_1.default.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.rc`, (0, command_util_1.getShellConfig)()).stdout.trim();
163
- const currentRcBaseVersion = currentRcVersion.split('-')[0];
164
- if (currentRcBaseVersion !== newBaseVersion) {
165
- return `${newBaseVersion}-RC01`;
166
- }
167
- let rcNumber = Number.parseInt(currentRcVersion.replace(`${currentRcBaseVersion}-RC`, ''), 10);
168
- rcNumber++;
169
- return `${newBaseVersion}-RC` + `${rcNumber}`.padStart(2, '0');
170
- }
171
- function getCustomVersion(customVersion) {
172
- logger_1.LOGGER.debug('Retrieve and validate custom version');
173
- logger_1.LOGGER.debug(customVersion ? `Custom version has been passed as argument: ${customVersion}` : 'Prompt custom version from user');
174
- const version = customVersion !== null && customVersion !== void 0 ? customVersion : readline.question('> Please enter the new version');
175
- return (0, validation_util_1.validateVersion)(version);
176
- }
177
- function getCurrentVersion() {
178
- logger_1.LOGGER.debug('Retrieve base version by querying the latest tag of the reference npm package');
179
- const version = shelljs_1.default.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.latest`, (0, command_util_1.getShellConfig)()).stdout.trim();
180
- return (0, validation_util_1.validateVersion)(version);
181
- }
182
- function semverInc(releaseType, identifier) {
183
- const currentVersion = getCurrentVersion();
184
- logger_1.LOGGER.debug(`Execute: semver.inc("${currentVersion}", ${releaseType}, ${identifier})`);
185
- const newVersion = semver.inc(currentVersion, releaseType, identifier);
186
- if (!newVersion) {
187
- throw new Error(`Could not increment version: ${currentVersion} `);
188
- }
189
- return newVersion;
190
- }
191
- //# sourceMappingURL=release.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"release.js","sourceRoot":"","sources":["../../../src/commands/release/release.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,yCAAqC;AACrC,qCAA+B;AAC/B,uCAA2C;AAC3C,wDAA0C;AAC1C,+CAAiC;AACjC,sDAAyB;AACzB,0DAAiG;AACjG,8CAA4D;AAC5D,gEAAgF;AAChF,2CAQqB;AACrB,qDAAiD;AACjD,+EAA0E;AAC1E,+DAA0D;AAC1D,+DAA0D;AAC1D,2EAAsE;AACtE,6EAAwE;AAY3D,QAAA,cAAc,GAAG,IAAA,0B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C,+EAA+E,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,iBAAE,CAAC,IAAI,CAAC,YAAY,qBAAqB,mBAAmB,EAAE,IAAA,6BAAc,GAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9G,OAAO,IAAA,iCAAe,EAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,SAAS,CAAC,WAA+B,EAAE,UAAmB;IACnE,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,eAAM,CAAC,KAAK,CAAC,wBAAwB,cAAc,MAAM,WAAW,KAAK,UAAU,GAAG,CAAC,CAAC;IACxF,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACvE,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,gCAAgC,cAAc,GAAG,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,UAAU,CAAC;AACtB,CAAC"}
@@ -1,20 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2024 EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- export declare const UpdateNextCommand: import("commander").Command;
17
- export declare function updateNext(rootDir: string, options: {
18
- verbose: boolean;
19
- }): Promise<void>;
20
- //# sourceMappingURL=update-next.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-next.d.ts","sourceRoot":"","sources":["../../src/commands/update-next.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAYlF,eAAO,MAAM,iBAAiB,6BAMP,CAAC;AAExB,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgC9F"}
@@ -1,146 +0,0 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (c) 2024 EclipseSource and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.updateNext = exports.UpdateNextCommand = void 0;
45
- const fs = __importStar(require("fs"));
46
- const glob_1 = require("glob");
47
- const jq = __importStar(require("node-jq"));
48
- const path = __importStar(require("path"));
49
- const shelljs_1 = __importDefault(require("shelljs"));
50
- const command_util_1 = require("../util/command-util");
51
- const git_util_1 = require("../util/git-util");
52
- const logger_1 = require("../util/logger");
53
- const validation_util_1 = require("../util/validation-util");
54
- exports.UpdateNextCommand = (0, command_util_1.baseCommand)()
55
- .name('updateNext')
56
- .alias('u')
57
- .description('Updates all `next` dependencies in GLSP project to the latest version')
58
- .argument('[rootDir]', 'The repository root', validation_util_1.validateGitDirectory, process.cwd())
59
- .option('-v, --verbose', 'Enable verbose (debug) log output', false)
60
- .action(updateNext);
61
- async function updateNext(rootDir, options) {
62
- (0, logger_1.configureLogger)(options.verbose);
63
- (0, command_util_1.configureShell)({ silent: true, fatal: true });
64
- const rootPackage = path.join(rootDir, 'package.json');
65
- if ((0, git_util_1.getUncommittedChanges)(rootDir).includes(rootPackage)) {
66
- logger_1.LOGGER.warn('Uncommitted changes in root `package.json`. Please commit or stash them before running this command.');
67
- return;
68
- }
69
- (0, command_util_1.configureShell)({ silent: false, fatal: true });
70
- logger_1.LOGGER.info('Updating next dependencies ...');
71
- rootDir = path.resolve(rootDir);
72
- const packages = await getWorkspacePackages(rootDir);
73
- logger_1.LOGGER.debug(`Scanning ${packages.length} packages to derive resolutions`, packages);
74
- const resolutions = await getResolutions(packages);
75
- if (Object.keys(resolutions).length === 0) {
76
- logger_1.LOGGER.info('No next dependencies found');
77
- return;
78
- }
79
- logger_1.LOGGER.info('Upgrade and rebuild packages ...');
80
- const packageJson = fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8');
81
- logger_1.LOGGER.debug('Updating package.json with resolutions', resolutions);
82
- fs.writeFileSync(path.join(rootDir, 'package.json'), JSON.stringify(Object.assign(Object.assign({}, JSON.parse(packageJson)), { resolutions }), undefined, 2));
83
- logger_1.LOGGER.debug('Running yarn install');
84
- shelljs_1.default.exec('yarn install --ignore-scripts');
85
- logger_1.LOGGER.debug('Reverting package.json');
86
- shelljs_1.default.exec('git checkout HEAD -- package.json');
87
- logger_1.LOGGER.debug('Rebuild to update yarn.lock');
88
- shelljs_1.default.exec('yarn');
89
- logger_1.LOGGER.info('Upgrade successfully completed');
90
- }
91
- exports.updateNext = updateNext;
92
- async function getWorkspacePackages(rootDir) {
93
- const rootPackage = path.join(rootDir, 'package.json');
94
- const packages = [rootPackage];
95
- if (!fs.existsSync(rootPackage)) {
96
- logger_1.LOGGER.error('No package.json found in root directory');
97
- process.exit(1);
98
- }
99
- const workspaces = await getWorkspaceConfig(rootPackage);
100
- if (workspaces) {
101
- workspaces
102
- .map(workspace => `${workspace}/**/package.json`)
103
- .forEach(pattern => {
104
- glob_1.glob.sync(pattern, {
105
- cwd: rootDir,
106
- ignore: ['**/node_modules/**']
107
- }).forEach(packageJson => packages.push(path.join(rootDir, packageJson)));
108
- });
109
- }
110
- return [...new Set(packages)];
111
- }
112
- async function getResolutions(packages) {
113
- let dependencies = [];
114
- for (const pkg of packages) {
115
- const deps = await jq.run('.dependencies //{} + .devDependencies + .peerDependencies | with_entries(select(.value == "next")) | keys', pkg, {
116
- output: 'json'
117
- });
118
- if (Array.isArray(deps)) {
119
- dependencies.push(...deps);
120
- }
121
- }
122
- dependencies = [...new Set(dependencies)];
123
- logger_1.LOGGER.debug(`Found ${dependencies.length} 'next' dependencies`, dependencies);
124
- logger_1.LOGGER.info('Retrieve next versions ... ');
125
- const resolutions = {};
126
- [...new Set(dependencies)].forEach(dep => {
127
- logger_1.LOGGER.info(`Retrieving next version for ${dep}`);
128
- const version = shelljs_1.default.exec(`npm view ${dep}@next version`, { silent: true }).stdout.trim();
129
- resolutions[`**/${dep}`] = version;
130
- });
131
- return resolutions;
132
- }
133
- async function getWorkspaceConfig(rootPackage) {
134
- const result = await jq.run('.workspaces', rootPackage, { output: 'json' });
135
- if (!result) {
136
- return undefined;
137
- }
138
- if (Array.isArray(result)) {
139
- return result;
140
- }
141
- if (typeof result === 'object' && 'packages' in result && Array.isArray(result.packages)) {
142
- return result.packages;
143
- }
144
- return undefined;
145
- }
146
- //# sourceMappingURL=update-next.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-next.js","sourceRoot":"","sources":["../../src/commands/update-next.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAElF,uCAAyB;AACzB,+BAA4B;AAC5B,4CAA8B;AAC9B,2CAA6B;AAC7B,sDAAyB;AACzB,uDAAmE;AACnE,+CAAyD;AACzD,2CAAyD;AACzD,6DAA+D;AAElD,QAAA,iBAAiB,GAAG,IAAA,0BAAW,GAAE;KACzC,IAAI,CAAC,YAAY,CAAC;KAClB,KAAK,CAAC,GAAG,CAAC;KACV,WAAW,CAAC,uEAAuE,CAAC;KACpF,QAAQ,CAAC,WAAW,EAAE,qBAAqB,EAAE,sCAAoB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KACjF,MAAM,CAAC,eAAe,EAAE,mCAAmC,EAAE,KAAK,CAAC;KACnE,MAAM,CAAC,UAAU,CAAC,CAAC;AAEjB,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,OAA6B;IAC3E,IAAA,wBAAe,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,IAAA,6BAAc,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE9C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACvD,IAAI,IAAA,gCAAqB,EAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,eAA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AC,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,UAAU,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvF,OAAO,MAAM,CAAC,QAAQ,CAAC;IAC3B,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -1,26 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2024 EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- import { Command } from 'commander';
17
- import sh from 'shelljs';
18
- export declare function baseCommand(cmd?: Command): Command;
19
- export type ShellConfig = sh.ExecOptions & {
20
- async: false;
21
- };
22
- export declare const SH_CONFIG: ShellConfig;
23
- export declare function getShellConfig(options?: Partial<Omit<ShellConfig, 'async'>>): ShellConfig;
24
- export declare function configureShell(config: Partial<sh.ShellConfig>): void;
25
- export declare function fatalExec(command: string, fatalErrorMessage: string, options?: Partial<Omit<ShellConfig, 'async'>>): sh.ShellString;
26
- //# sourceMappingURL=command-util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-util.d.ts","sourceRoot":"","sources":["../../src/util/command-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,wBAAgB,WAAW,CAAC,GAAG,UAAgB,GAAG,OAAO,CAKxD;AAED,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC,WAAW,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAC5D,eAAO,MAAM,SAAS,EAAE,WAIvB,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAM,GAAG,WAAW,CAK7F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,IAAI,CAKpE;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,OAAO,GAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAM,GAAG,EAAE,CAAC,WAAW,CAMvI"}
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.fatalExec = exports.configureShell = exports.getShellConfig = exports.SH_CONFIG = exports.baseCommand = void 0;
7
- /********************************************************************************
8
- * Copyright (c) 2022-2024 EclipseSource and others.
9
- *
10
- * This program and the accompanying materials are made available under the
11
- * terms of the Eclipse Public License v. 2.0 which is available at
12
- * http://www.eclipse.org/legal/epl-2.0.
13
- *
14
- * This Source Code may also be made available under the following Secondary
15
- * Licenses when the conditions for such availability set forth in the Eclipse
16
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
17
- * with the GNU Classpath Exception which is available at
18
- * https://www.gnu.org/software/classpath/license.html.
19
- *
20
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
21
- ********************************************************************************/
22
- const commander_1 = require("commander");
23
- const shelljs_1 = __importDefault(require("shelljs"));
24
- // Commander.js utils
25
- function baseCommand(cmd = new commander_1.Command()) {
26
- return cmd //
27
- .showSuggestionAfterError(true)
28
- .showHelpAfterError(true)
29
- .allowUnknownOption(false);
30
- }
31
- exports.baseCommand = baseCommand;
32
- exports.SH_CONFIG = {
33
- async: false,
34
- fatal: true,
35
- silent: false
36
- };
37
- function getShellConfig(options = {}) {
38
- return Object.assign(Object.assign({}, exports.SH_CONFIG), options);
39
- }
40
- exports.getShellConfig = getShellConfig;
41
- function configureShell(config) {
42
- shelljs_1.default.config.reset();
43
- getShellConfig({});
44
- exports.SH_CONFIG.silent = config.silent;
45
- exports.SH_CONFIG.fatal = config.fatal;
46
- }
47
- exports.configureShell = configureShell;
48
- function fatalExec(command, fatalErrorMessage, options = {}) {
49
- const result = shelljs_1.default.exec(command, getShellConfig(options));
50
- if (result.code !== 0) {
51
- throw new Error(fatalErrorMessage);
52
- }
53
- return result;
54
- }
55
- exports.fatalExec = fatalExec;
56
- //# sourceMappingURL=command-util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-util.js","sourceRoot":"","sources":["../../src/util/command-util.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAoC;AACpC,sDAAyB;AAEzB,qBAAqB;AACrB,SAAgB,WAAW,CAAC,GAAG,GAAG,IAAI,mBAAO,EAAE;IAC3C,OAAO,GAAG,CAAC,EAAE;SACR,wBAAwB,CAAC,IAAI,CAAC;SAC9B,kBAAkB,CAAC,IAAI,CAAC;SACxB,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AALD,kCAKC;AAGY,QAAA,SAAS,GAAgB;IAClC,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,KAAK;CAChB,CAAC;AAEF,SAAgB,cAAc,CAAC,UAA+C,EAAE;IAC5E,uCACO,iBAAS,GACT,OAAO,EACZ;AACN,CAAC;AALD,wCAKC;AAED,SAAgB,cAAc,CAAC,MAA+B;IAC1D,iBAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,CAAC,CAAC;IACnB,iBAAS,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,iBAAS,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;AACnC,CAAC;AALD,wCAKC;AAED,SAAgB,SAAS,CAAC,OAAe,EAAE,iBAAyB,EAAE,UAA+C,EAAE;IACnH,MAAM,MAAM,GAAG,iBAAE,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAND,8BAMC"}
@@ -1,42 +0,0 @@
1
- /********************************************************************************
2
- * Copyright (c) 2022-2024 EclipseSource and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- export declare function isGitRepository(path?: string): boolean;
17
- export declare function getGitRoot(path?: string): string;
18
- export declare function hasGitChanges(path?: string): boolean;
19
- /**
20
- * Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository.
21
- * Filepaths are absolute.
22
- */
23
- export declare function getUncommittedChanges(path?: string): string[];
24
- /**
25
- * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
26
- * Filepaths are absolute.
27
- */
28
- export declare function getChangesOfLastCommit(path?: string): string[];
29
- /**
30
- * Returns the last modification date of a file (or the last commit) in a git repo.
31
- * @param filePath The file. If undefined the modification date of the last commit will be returned
32
- * @param repoRoot The path to the repo root. If undefined the current working directory is used.
33
- * @param excludeMessage Only consider commits that don`t match the excludeMessage
34
- * @returns The date or undefined if the file is outside of the git repo.
35
- */
36
- export declare function getLastModificationDate(filePath?: string, repoRoot?: string, excludeMessage?: string): Date | undefined;
37
- export declare function getFilesOfCommit(commitHash: string, repoRoot?: string): string[];
38
- export declare function getLatestGithubRelease(path?: string): string;
39
- export declare function getLatestTag(path?: string): string;
40
- export declare function hasBranch(branch: string, path?: string): boolean;
41
- export declare function getRemoteUrl(path?: string): string;
42
- //# sourceMappingURL=git-util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-util.d.ts","sourceRoot":"","sources":["../../src/util/git-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAMlF,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAQtD;AAED,wBAAgB,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAW7D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAO9D;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAQvH;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAQhF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED,wBAAgB,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAGlD"}
@@ -1,125 +0,0 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (c) 2022-2024 EclipseSource and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.getRemoteUrl = exports.hasBranch = exports.getLatestTag = exports.getLatestGithubRelease = exports.getFilesOfCommit = exports.getLastModificationDate = exports.getChangesOfLastCommit = exports.getUncommittedChanges = exports.hasGitChanges = exports.getGitRoot = exports.isGitRepository = void 0;
22
- const path_1 = require("path");
23
- const shelljs_1 = __importDefault(require("shelljs"));
24
- const command_util_1 = require("./command-util");
25
- function isGitRepository(path) {
26
- cdIfPresent(path);
27
- const isGitRepo = shelljs_1.default
28
- .exec('git rev-parse --is-inside-work-tree', (0, command_util_1.getShellConfig)({ silent: true }))
29
- .stdout.trim()
30
- .toLocaleLowerCase() === 'true';
31
- return isGitRepo;
32
- }
33
- exports.isGitRepository = isGitRepository;
34
- function getGitRoot(path) {
35
- cdIfPresent(path);
36
- const fileString = shelljs_1.default.exec('git rev-parse --show-toplevel', (0, command_util_1.getShellConfig)()).stdout.trim();
37
- return (0, path_1.resolve)(fileString);
38
- }
39
- exports.getGitRoot = getGitRoot;
40
- function hasGitChanges(path) {
41
- return getUncommittedChanges(path).length > 0;
42
- }
43
- exports.hasGitChanges = hasGitChanges;
44
- /**
45
- * Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository.
46
- * Filepaths are absolute.
47
- */
48
- function getUncommittedChanges(path) {
49
- cdIfPresent(path);
50
- return shelljs_1.default
51
- .exec('git status --porcelain', (0, command_util_1.getShellConfig)())
52
- .stdout.trim()
53
- .split('\n')
54
- .filter(value => value.trim().length !== 0)
55
- .map(fileInfo => { var _a;
56
- // Extract relative file path from the info string and convert to absolute path
57
- return (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); });
58
- }
59
- exports.getUncommittedChanges = getUncommittedChanges;
60
- /**
61
- * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes)
62
- * Filepaths are absolute.
63
- */
64
- function getChangesOfLastCommit(path) {
65
- cdIfPresent(path);
66
- return shelljs_1.default
67
- .exec('git diff --name-only HEAD^', (0, command_util_1.getShellConfig)())
68
- .stdout.trim()
69
- .split('\n')
70
- .map(file => (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), file));
71
- }
72
- exports.getChangesOfLastCommit = getChangesOfLastCommit;
73
- /**
74
- * Returns the last modification date of a file (or the last commit) in a git repo.
75
- * @param filePath The file. If undefined the modification date of the last commit will be returned
76
- * @param repoRoot The path to the repo root. If undefined the current working directory is used.
77
- * @param excludeMessage Only consider commits that don`t match the excludeMessage
78
- * @returns The date or undefined if the file is outside of the git repo.
79
- */
80
- function getLastModificationDate(filePath, repoRoot, excludeMessage) {
81
- cdIfPresent(repoRoot);
82
- const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : '';
83
- const result = shelljs_1.default.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, (0, command_util_1.getShellConfig)());
84
- if (result.code !== 0) {
85
- return undefined;
86
- }
87
- return new Date(result.stdout.trim());
88
- }
89
- exports.getLastModificationDate = getLastModificationDate;
90
- function getFilesOfCommit(commitHash, repoRoot) {
91
- cdIfPresent(repoRoot);
92
- const result = shelljs_1.default.exec(`git show --pretty="" --name-only ${commitHash}`, (0, command_util_1.getShellConfig)());
93
- if (result.code !== 0) {
94
- return [];
95
- }
96
- return result.stdout.trim().split('\n');
97
- }
98
- exports.getFilesOfCommit = getFilesOfCommit;
99
- function getLatestGithubRelease(path) {
100
- cdIfPresent(path);
101
- const release = shelljs_1.default.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t');
102
- return release[release.length - 2];
103
- }
104
- exports.getLatestGithubRelease = getLatestGithubRelease;
105
- function getLatestTag(path) {
106
- cdIfPresent(path);
107
- return shelljs_1.default.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim();
108
- }
109
- exports.getLatestTag = getLatestTag;
110
- function hasBranch(branch, path) {
111
- cdIfPresent(path);
112
- return shelljs_1.default.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0;
113
- }
114
- exports.hasBranch = hasBranch;
115
- function getRemoteUrl(path) {
116
- cdIfPresent(path);
117
- return shelljs_1.default.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim();
118
- }
119
- exports.getRemoteUrl = getRemoteUrl;
120
- function cdIfPresent(path) {
121
- if (path) {
122
- shelljs_1.default.cd(path);
123
- }
124
- }
125
- //# sourceMappingURL=git-util.js.map