ump 3.0.1 → 3.1.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/lib/commands.js +1 -1
- package/lib/utils.js +31 -5
- package/package.json +2 -2
package/lib/commands.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import childProcess from 'child_process';
|
|
5
5
|
import Promises from 'bluebird';
|
|
6
|
-
import fs from 'fs
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import util from 'util';
|
|
7
8
|
import glob from 'glob';
|
|
8
9
|
import chalk from 'chalk';
|
|
9
10
|
import rc from 'rc';
|
|
@@ -11,7 +12,9 @@ import semver from 'semver';
|
|
|
11
12
|
import {config} from './config.js';
|
|
12
13
|
import {log} from './log.js';
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const readFile = util.promisify(fs.readFile);
|
|
16
|
+
const writeFile = util.promisify(fs.writeFile);
|
|
17
|
+
const stat = util.promisify(fs.stat);
|
|
15
18
|
|
|
16
19
|
const utils = {
|
|
17
20
|
getDirName(url) {
|
|
@@ -27,6 +30,24 @@ const utils = {
|
|
|
27
30
|
return str;
|
|
28
31
|
|
|
29
32
|
},
|
|
33
|
+
async checkGitConfig(gitPath) {
|
|
34
|
+
const gitDirOrFile = await stat(gitPath);
|
|
35
|
+
|
|
36
|
+
if (gitDirOrFile.isDirectory()) {
|
|
37
|
+
await readFile(`${gitPath}/config`);
|
|
38
|
+
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// If we're in a submodule, the .git path will be a file that contains a 'gitdir: …' entry
|
|
43
|
+
const contents = await readFile(gitPath, 'utf8');
|
|
44
|
+
const content = contents.split(/\n/)[0];
|
|
45
|
+
const gitdir = content.replace(/^\s*gitdir:\s*(.+)$/, '$1');
|
|
46
|
+
|
|
47
|
+
const gitConfig = path.resolve(`${gitdir}/config`);
|
|
48
|
+
|
|
49
|
+
await readFile(gitConfig);
|
|
50
|
+
},
|
|
30
51
|
|
|
31
52
|
getFiles(items) {
|
|
32
53
|
const files = items ? [].concat(items) : ['package.json'];
|
|
@@ -49,12 +70,17 @@ const utils = {
|
|
|
49
70
|
},
|
|
50
71
|
|
|
51
72
|
async readJSON(file) {
|
|
73
|
+
const filePath = path.resolve(process.cwd(), file);
|
|
74
|
+
|
|
52
75
|
try {
|
|
53
|
-
const
|
|
76
|
+
const str = await readFile(filePath, 'utf8');
|
|
77
|
+
const json = JSON.parse(str);
|
|
54
78
|
|
|
55
79
|
return json;
|
|
56
80
|
} catch (err) {
|
|
57
|
-
|
|
81
|
+
console.log(err);
|
|
82
|
+
|
|
83
|
+
return {error: true};
|
|
58
84
|
}
|
|
59
85
|
},
|
|
60
86
|
|
|
@@ -115,7 +141,7 @@ const utils = {
|
|
|
115
141
|
const debugOutput = JSON.stringify(obj, null, 2);
|
|
116
142
|
const file = '.ump.debug.json';
|
|
117
143
|
|
|
118
|
-
return
|
|
144
|
+
return writeFile(file, debugOutput)
|
|
119
145
|
.then(() => {
|
|
120
146
|
log.color(`\n**DEBUG ONLY! Writing the following to ${file}:**`, 'cyan');
|
|
121
147
|
console.log(debugOutput);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ump",
|
|
3
3
|
"title": "ump",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"description": "Bump without the B",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "npm run test:clean && npm run test:pre && npm run test:run",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"rc": "^1.2.8",
|
|
40
40
|
"semver": "^7.3.5",
|
|
41
41
|
"snyk": "^1.812.0",
|
|
42
|
-
"update-notifier": "^
|
|
42
|
+
"update-notifier": "^6.0.2",
|
|
43
43
|
"yargs": "^17.3.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|