node-power-user 1.0.11 → 1.0.12

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/TODO.md ADDED
@@ -0,0 +1 @@
1
+ Use "keychain" for something?
@@ -18,23 +18,50 @@ module.exports = async function (options) {
18
18
  return false;
19
19
  }
20
20
 
21
- // Collect answers using the new @inquirer/prompts methods
22
- const message = await ask({
23
- message: 'Enter a commit message',
24
- default: 'Update',
25
- value: options.message,
26
- multiline: false,
27
- });
28
-
29
- // Define cleanup command
30
- const command = `git pull && git add . && git commit -m "${message}" && git push origin`;
31
-
32
21
  // Log initial state
33
22
  logger.log(`Syncing repo...`);
34
23
 
35
24
  try {
36
- // Run cleanup commands with the repository root as the working directory
37
- await execute(command, {
25
+ // First, pull changes from remote
26
+ logger.log('Pulling changes from remote...');
27
+ const pullResult = await execute('git pull', {
28
+ log: false,
29
+ config: {cwd: repoRoot},
30
+ });
31
+
32
+ // Check if there were any changes pulled
33
+ const pullOutput = pullResult.stdout || '';
34
+ if (pullOutput.includes('Already up to date') || pullOutput.includes('Already up-to-date')) {
35
+ logger.log('Already up to date - no changes pulled');
36
+ } else {
37
+ // Try to extract the number of files changed
38
+ const filesChangedMatch = pullOutput.match(/(\d+) file[s]? changed/);
39
+ const insertionsMatch = pullOutput.match(/(\d+) insertion[s]?/);
40
+ const deletionsMatch = pullOutput.match(/(\d+) deletion[s]?/);
41
+
42
+ if (filesChangedMatch) {
43
+ const filesChanged = filesChangedMatch[1];
44
+ const insertions = insertionsMatch ? insertionsMatch[1] : '0';
45
+ const deletions = deletionsMatch ? deletionsMatch[1] : '0';
46
+ logger.log(logger.format.green(`Pulled changes: ${filesChanged} file(s) changed, ${insertions} insertion(s), ${deletions} deletion(s)`));
47
+ } else {
48
+ logger.log(logger.format.green('Changes pulled successfully'));
49
+ }
50
+ }
51
+
52
+ // Collect answers using the new @inquirer/prompts methods
53
+ const message = await ask({
54
+ message: 'Enter a commit message',
55
+ default: 'Update',
56
+ value: options.message,
57
+ multiline: false,
58
+ });
59
+
60
+ // Then, add, commit, and push changes
61
+ logger.log('Committing and pushing changes...');
62
+ const pushCommand = `git add . && git commit -m "${message}" && git push origin`;
63
+
64
+ await execute(pushCommand, {
38
65
  log: true,
39
66
  config: {cwd: repoRoot},
40
67
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-power-user",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Easy tools for every Node.js developer!",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
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
- "prepare:watch": "nodemon -w ./src -e '*' --exec 'npm run prepare'"
11
+ "prepare:watch": "node -e \"require('prepare-package/watch')()\""
12
12
  },
13
13
  "bin": {
14
14
  "npu": "bin/node-power-user",
@@ -36,16 +36,12 @@
36
36
  "replace": {}
37
37
  },
38
38
  "dependencies": {
39
- "@inquirer/prompts": "^7.4.1",
39
+ "@inquirer/prompts": "^7.9.0",
40
40
  "chalk": "^4.1.2",
41
41
  "cli-progress": "^3.12.0",
42
- "fs-jetpack": "^4.3.1",
43
- "inquirer": "^8.2.6",
42
+ "fs-jetpack": "^5.1.0",
44
43
  "itwcw-package-analytics": "^1.0.6",
45
- "json5": "^2.2.3",
46
- "keychain": "^1.5.0",
47
- "lodash": "^4.17.21",
48
- "node-powertools": "^2.2.0",
44
+ "node-powertools": "^2.3.1",
49
45
  "npm-api": "^1.0.1",
50
46
  "table": "^6.9.0",
51
47
  "wonderful-version": "^1.3.2",
@@ -53,6 +49,6 @@
53
49
  },
54
50
  "devDependencies": {
55
51
  "mocha": "^8.4.0",
56
- "prepare-package": "^1.1.14"
52
+ "prepare-package": "^1.2.5"
57
53
  }
58
54
  }