binary-collections 2.0.2 → 2.0.3

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/bin/kill-process CHANGED
@@ -28,4 +28,7 @@ if [ -f ".env" ]; then
28
28
  export $(egrep -v '^#' .env | xargs)
29
29
  fi
30
30
 
31
- ps -W | grep "$1" | awk '{print $1}' | xargs kill -f;
31
+ # ps -W | grep "$1" | awk '{print $1}' | xargs kill -f;
32
+
33
+ set -e;
34
+ ps -aux | grep "$1" | awk '{print $1}' | xargs killall -9;
@@ -0,0 +1,39 @@
1
+ #!/bin/bash -e
2
+
3
+ # token remover from url repo
4
+
5
+ export SCRIPT=$(realpath "$0")
6
+ export ROOT="$(git rev-parse --show-toplevel)"
7
+
8
+ git -C "${REPO_PATH}" config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
9
+ while read -r KEY MODULE_PATH
10
+ do
11
+ # relative module path from root
12
+ RELATIVE_MODULE_PATH="${ROOT}/${MODULE_PATH}"
13
+ # cd git root dir
14
+ cd ${ROOT}
15
+
16
+ NAME="$(echo "${KEY}" | sed 's/^submodule\.\(.*\)\.path$/\1/')"
17
+
18
+ url_key="$(echo "${KEY}" | sed 's/\.path$/.url/')"
19
+ branch_key="$(echo "${KEY}" | sed 's/\.path$/.branch/')"
20
+
21
+ URL="$(git config -f .gitmodules --get "${url_key}")"
22
+ BRANCH="$(git config -f .gitmodules --get "${branch_key}" || echo "master")"
23
+
24
+ repo=${URL#"https://github.com/"}
25
+ NEW_URL="https://github.com/${repo}"
26
+
27
+ # cd and update url
28
+ cd $RELATIVE_MODULE_PATH
29
+ git remote set-url origin "$NEW_URL"
30
+ cd $ROOT
31
+
32
+ GIT_MODULES="${RELATIVE_MODULE_PATH}/.gitmodules"
33
+ if [ -f "${GIT_MODULES}" ];
34
+ then
35
+ echo "${MODULE_PATH} has submodules"
36
+ cd "${RELATIVE_MODULE_PATH}"
37
+ sh "${SCRIPT}" -cwd ${RELATIVE_MODULE_PATH}
38
+ fi
39
+ done
@@ -0,0 +1,52 @@
1
+ const glob = require('glob');
2
+ const { fs, path } = require('sbg-utility');
3
+ // process.cwd = () => path.resolve(__dirname + '/../../../Repositories');
4
+
5
+ const globalIgnore = [
6
+ // ignore .git .github folder
7
+ '**/.git*',
8
+ // ignore composer folder
9
+ '**/vendor/**'
10
+ ];
11
+
12
+ console.log('cleaning node_modules in', process.cwd());
13
+
14
+ const g3 = new glob.Glob('**/node_modules', {
15
+ withFileTypes: false,
16
+ cwd: process.cwd(),
17
+ ignore: globalIgnore
18
+ });
19
+ streamDel(g3);
20
+
21
+ /**
22
+ * glob stream handler
23
+ * @param {glob.Glob} globStream
24
+ */
25
+ function streamDel(globStream) {
26
+ globStream.stream().on('data', (result) => {
27
+ const fullPath = path.resolve(process.cwd(), result);
28
+ console.log('deleting', fullPath);
29
+ if (fs.statSync(fullPath).isDirectory()) {
30
+ // delete all files each package directory
31
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
32
+ for (let i = 0; i < subdir.length; i++) {
33
+ const dir = subdir[i];
34
+ del(dir);
35
+ }
36
+ }
37
+ del(fullPath);
38
+ });
39
+ }
40
+
41
+ /**
42
+ * delete file recursive
43
+ * @param {string} fullPath
44
+ */
45
+ function del(fullPath) {
46
+ try {
47
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7000 });
48
+ console.log('deleted', fullPath);
49
+ } catch (_) {
50
+ console.log('failed delete', fullPath);
51
+ }
52
+ }
@@ -0,0 +1,13 @@
1
+ const glob = require('glob');
2
+ const path = require('path');
3
+ // process.cwd = () => path.resolve(__dirname + '/../../../Repositories');
4
+
5
+ const g3 = new glob.Glob('**/node_modules', {
6
+ withFileTypes: false,
7
+ cwd: process.cwd(),
8
+ ignore: ['**/.git*', '**/vendor/**']
9
+ });
10
+ g3.stream().on('data', (result) => {
11
+ const fullPath = path.resolve(process.cwd(), result);
12
+ console.log(fullPath);
13
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binary-collections",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "binary helper collections by L3n4r0x",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -18,30 +18,40 @@
18
18
  "build": "node -r ts-node/register -r dotenv/config build.js && yarn run pack",
19
19
  "test": "cd test && npm install -D file:../ &&",
20
20
  "test:nrs": "npm test -- nrs build:**",
21
- "pack": "node packer.js --yarn --filename=bin"
21
+ "pack": "node packer.js --yarn --filename=bin",
22
+ "update:ncu": "npx npm-check-updates -u -x jsdom,chalk,hexo,deepmerge-ts --enginesNode --root"
22
23
  },
23
24
  "keywords": [],
24
25
  "author": "",
25
- "license": "ISC",
26
+ "license": "MIT",
26
27
  "dependencies": {
27
- "execa": "^7.1.1",
28
- "fs-extra": "^11.1.1",
29
- "glob": "^10.2.2",
30
- "minimatch": "^9.0.0",
28
+ "execa": "^8.0.1",
29
+ "fs-extra": "^11.2.0",
30
+ "glob": "^10.3.10",
31
+ "minimatch": "^9.0.3",
31
32
  "minimist": "^1.2.8",
33
+ "sbg-utility": "^1.1.6",
32
34
  "upath": "^2.0.1",
33
- "yaml": "^2.3.1"
35
+ "yaml": "^2.3.4"
34
36
  },
35
37
  "packageManager": "yarn@3.6.1",
36
38
  "devDependencies": {
39
+ "@types/eslint": "^8",
37
40
  "@types/minimist": "^1",
38
- "@types/node": "^18.16.3",
41
+ "@types/node": "^20.11.16",
42
+ "@types/prettier": "^3",
39
43
  "@types/yargs": "^17",
44
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
45
+ "@typescript-eslint/parser": "^6.20.0",
40
46
  "cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/ff4b648/release/cross-spawn.tgz",
41
- "dotenv": "^16.3.1",
42
- "git-command-helper": "^2.0.1",
43
- "ts-node": "^10.9.1",
44
- "typescript": "^5.2.2"
47
+ "dotenv": "^16.4.1",
48
+ "eslint": "^8.56.0",
49
+ "eslint-config-prettier": "^9.1.0",
50
+ "eslint-plugin-prettier": "^5.1.3",
51
+ "git-command-helper": "^2.0.2",
52
+ "prettier": "^3.2.4",
53
+ "ts-node": "^10.9.2",
54
+ "typescript": "^5.3.3"
45
55
  },
46
56
  "optionalDependencies": {
47
57
  "ansi-colors": "^4.1.3"
@@ -49,8 +59,10 @@
49
59
  "bin": {
50
60
  "clean-nodemodule": "bin/clean-nodemodule",
51
61
  "clean-nodemodules": "bin/clean-nodemodules",
62
+ "del-nodemodules": "lib/del-nodemodules.js",
52
63
  "dev": "bin/dev",
53
64
  "empty": "bin/empty",
65
+ "find-nodemodules": "lib/find-nodemodules.js",
54
66
  "git-fix-encoding": "bin/git-fix-encoding",
55
67
  "git-fix-encoding-cmd": "bin/git-fix-encoding.cmd",
56
68
  "git-reduce-size": "bin/git-reduce-size",
@@ -69,6 +81,7 @@
69
81
  "run-series": "lib/npm-run-series.js",
70
82
  "submodule": "bin/submodule",
71
83
  "submodule-install": "bin/submodule-install",
72
- "submodule-remove": "bin/submodule-remove"
84
+ "submodule-remove": "bin/submodule-remove",
85
+ "submodule-token": "bin/submodule-token"
73
86
  }
74
87
  }