node-power-user 1.0.9 → 1.0.10
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/dist/commands/sync.js
CHANGED
|
@@ -11,6 +11,13 @@ const project = jetpack.read(path.join(process.cwd(), 'package.json'), 'json');
|
|
|
11
11
|
|
|
12
12
|
// Module
|
|
13
13
|
module.exports = async function (options) {
|
|
14
|
+
// Find the repository root by locating the .git folder
|
|
15
|
+
const repoRoot = findGitRoot(process.cwd());
|
|
16
|
+
if (!repoRoot) {
|
|
17
|
+
logger.error('Could not find the .git folder. Are you inside a Git repository?');
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
// Collect answers using the new @inquirer/prompts methods
|
|
15
22
|
const message = await ask({
|
|
16
23
|
message: 'Enter a commit message',
|
|
@@ -26,8 +33,11 @@ module.exports = async function (options) {
|
|
|
26
33
|
logger.log(`Syncing repo...`);
|
|
27
34
|
|
|
28
35
|
try {
|
|
29
|
-
// Run cleanup commands
|
|
30
|
-
await execute(command, {
|
|
36
|
+
// Run cleanup commands with the repository root as the working directory
|
|
37
|
+
await execute(command, {
|
|
38
|
+
log: true,
|
|
39
|
+
config: {cwd: repoRoot},
|
|
40
|
+
});
|
|
31
41
|
|
|
32
42
|
// Log success
|
|
33
43
|
logger.log(logger.format.green('Sync completed successfully!'));
|
|
@@ -62,3 +72,16 @@ function ask(options) {
|
|
|
62
72
|
default: options.default,
|
|
63
73
|
});
|
|
64
74
|
}
|
|
75
|
+
|
|
76
|
+
function findGitRoot(startPath) {
|
|
77
|
+
let currentPath = startPath;
|
|
78
|
+
|
|
79
|
+
while (currentPath !== path.parse(currentPath).root) {
|
|
80
|
+
if (jetpack.exists(path.join(currentPath, '.git')) === 'dir') {
|
|
81
|
+
return currentPath;
|
|
82
|
+
}
|
|
83
|
+
currentPath = path.dirname(currentPath);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return null;
|
|
87
|
+
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-power-user",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Easy tools for every Node.js developer!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "npm run prepare && ./node_modules/mocha/bin/mocha test/ --recursive --timeout=10000",
|
|
8
|
-
"start": "npm run prepare && ./bin/
|
|
8
|
+
"start": "npm run prepare && ./bin/node-power-user",
|
|
9
9
|
"help": "echo 'npm start -- -v'",
|
|
10
10
|
"prepare": "node -e \"require('prepare-package')()\"",
|
|
11
11
|
"prepare:watch": "nodemon -w ./src -e '*' --exec 'npm run prepare'"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"npu": "bin/
|
|
15
|
-
"node-power-user": "bin/
|
|
16
|
-
"nodepoweruser": "bin/
|
|
14
|
+
"npu": "bin/node-power-user",
|
|
15
|
+
"node-power-user": "bin/node-power-user",
|
|
16
|
+
"nodepoweruser": "bin/node-power-user"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"replace": {}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@inquirer/prompts": "^7.
|
|
39
|
+
"@inquirer/prompts": "^7.4.1",
|
|
40
40
|
"chalk": "^4.1.2",
|
|
41
41
|
"cli-progress": "^3.12.0",
|
|
42
42
|
"fs-jetpack": "^4.3.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"json5": "^2.2.3",
|
|
46
46
|
"keychain": "^1.5.0",
|
|
47
47
|
"lodash": "^4.17.21",
|
|
48
|
-
"node-powertools": "^2.
|
|
48
|
+
"node-powertools": "^2.2.0",
|
|
49
49
|
"npm-api": "^1.0.1",
|
|
50
50
|
"table": "^6.9.0",
|
|
51
51
|
"wonderful-version": "^1.3.2",
|
|
File without changes
|