masscom 0.0.1
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/index.js +12 -0
- package/index.js +3 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Timur Bikmuhametov <https://github.com/Timbic>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# masscom
|
|
2
|
+
|
|
3
|
+
Run a shell command in every immediate subdirectory of the current directory.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
The best way to use this package is by installing it globally
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g masscom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
masscom [OPTION]... [COMMAND]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`masscom` loops over the immediate subdirectories of the current directory, changes into each one, and runs the given command with the
|
|
20
|
+
working directory set to that subdirectory.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Run tests in every subproject
|
|
24
|
+
masscom "npm test"
|
|
25
|
+
|
|
26
|
+
# Check git status everywhere
|
|
27
|
+
masscom "git status"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Options
|
|
31
|
+
|
|
32
|
+
| Option | Description |
|
|
33
|
+
| -------------- | ------------------------ |
|
|
34
|
+
| `-h`, `--help` | Display the help message |
|
|
35
|
+
|
|
36
|
+
## How it works
|
|
37
|
+
|
|
38
|
+
- Only **immediate** subdirectories are visited, the walk is not recursive. (for now...)
|
|
39
|
+
- The command is executed once per directory via a shell, with the subdirectory as the working directory.
|
|
40
|
+
- Non-directory entries and the current directory itself are skipped.
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
Released under the [MIT License](./LICENSE).
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import e from"node:child_process";import t from"node:path";import n from"node:fs";function r(e){return e==null?[]:Array.isArray(e)?e:[e]}function i(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}function a(e,t){e||=[],t||={};var n,a,o,s,c,l={_:[]},u=0,d=0,f=0,p=e.length;let m=t.alias!==void 0,h=t.unknown!==void 0,g=t.default!==void 0;if(t.alias=t.alias||{},t.string=r(t.string),t.boolean=r(t.boolean),m)for(n in t.alias)for(a=t.alias[n]=r(t.alias[n]),u=0;u<a.length;u++)(t.alias[a[u]]=a.concat(n)).splice(u,1);for(u=t.boolean.length;u-->0;)for(a=t.alias[t.boolean[u]]||[],d=a.length;d-->0;)t.boolean.push(a[d]);for(u=t.string.length;u-->0;)for(a=t.alias[t.string[u]]||[],d=a.length;d-->0;)t.string.push(a[d]);if(g){for(n in t.default)if(s=typeof t.default[n],a=t.alias[n]=t.alias[n]||[],t[s]!==void 0)for(t[s].push(n),u=0;u<a.length;u++)t[s].push(a[u])}let _=h?Object.keys(t.alias):[];for(u=0;u<p;u++){if(o=e[u],o===`--`){l._=l._.concat(e.slice(++u));break}for(d=0;d<o.length&&o.charCodeAt(d)===45;d++);if(d===0)l._.push(o);else if(o.substring(d,d+3)===`no-`){if(s=o.substring(d+3),h&&!~_.indexOf(s))return t.unknown(o);l[s]=!1}else{for(f=d+1;f<o.length&&o.charCodeAt(f)!==61;f++);for(s=o.substring(d,f),c=o.substring(++f)||u+1===p||(``+e[u+1]).charCodeAt(0)===45||e[++u],a=d===2?[s]:s,f=0;f<a.length;f++){if(s=a[f],h&&!~_.indexOf(s))return t.unknown(`-`.repeat(d)+s);i(l,s,f+1<a.length||c,t)}}}if(g)for(n in t.default)l[n]===void 0&&(l[n]=t.default[n]);if(m)for(n in l)for(a=t.alias[n]||[];a.length>0;)l[a.shift()]=l[n];return l}const o=a(process.argv.slice(2),{boolean:[`help`],alias:{h:`help`}});async function s(){if(o.help){console.log(`Usage: masscom [OPTION]... [COMMAND]
|
|
2
|
+
|
|
3
|
+
Run a shell command in every immediate subdirectory of the current directory.
|
|
4
|
+
The command runs with each subdirectory as the working directory.
|
|
5
|
+
|
|
6
|
+
Options:
|
|
7
|
+
-h, --help display this help message
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
masscom "npm test"
|
|
11
|
+
masscom "git status"
|
|
12
|
+
`);return}let r=String(o._[0]??``);if(!r)throw Error(`No command was provided`);let i=process.cwd();for(let a of n.readdirSync(i)){let o=t.join(i,a);n.statSync(o).isDirectory()&&(process.chdir(o),console.log(`Running in ${o}`),e.execSync(r,{stdio:`inherit`}),process.chdir(i))}}s().catch(e=>{console.error(e)});export{};
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "masscom",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "<YOUR PACKAGE DESCRIPTION>",
|
|
6
|
+
"author": "Timur Bikmuhametov <tim.bic22@gmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"KEYWORD1",
|
|
10
|
+
"KEYWORD2"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/Timbic/masscom.git"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"main": "./dist/index.js",
|
|
20
|
+
"bin": {
|
|
21
|
+
"masscom": "index.js"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"index.js"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.22.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "tsdown --watch",
|
|
35
|
+
"build": "tsdown",
|
|
36
|
+
"execute": "node index.js",
|
|
37
|
+
"fmt": "prettier --cache --write .",
|
|
38
|
+
"fmt:chk": "prettier --check .",
|
|
39
|
+
"lint": "eslint --cache",
|
|
40
|
+
"lint:fix": "eslint --cache --fix",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"release": "bumpp",
|
|
43
|
+
"prepare": "husky"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@timbic/eslint-config": "1.2.1",
|
|
47
|
+
"@timbic/prettier-config": "1.2.2",
|
|
48
|
+
"@types/node": "26.5.1",
|
|
49
|
+
"bumpp": "12.3.0",
|
|
50
|
+
"eslint": "10.10.0",
|
|
51
|
+
"husky": "9.1.7",
|
|
52
|
+
"lint-staged": "17.5.1",
|
|
53
|
+
"mri": "1.2.0",
|
|
54
|
+
"prettier": "3.9.6",
|
|
55
|
+
"tsdown": "0.23.0",
|
|
56
|
+
"typescript": "6.0.3"
|
|
57
|
+
},
|
|
58
|
+
"lint-staged": {
|
|
59
|
+
"*/**/*.{js,ts,md,json}": [
|
|
60
|
+
"pnpm fmt",
|
|
61
|
+
"pnpm lint:fix"
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"packageManager": "pnpm@11.24.0"
|
|
65
|
+
}
|