File tree 6 files changed +58
-9
lines changed
6 files changed +58
-9
lines changed Original file line number Diff line number Diff line change 21
21
"lint" : " eslint '*.js' 'dists/*.js' '**/*.js' '**/*.mjs' -c .eslintrc" ,
22
22
"dist" : " ./packages/run-all-the-things/bin/index.js webpack babel" ,
23
23
"webpack" : " webpack --config webpack.config.js" ,
24
- "babel" : " ./scripts/foreach .sh '[ \" null\" == \" $(cat package.json | jq '.scripts.dist')\" ] && echo \" no dist script\" || npm run dist'" ,
24
+ "babel" : " ./packages/dirdo/bin .sh packages '[ \" null\" == \" $(cat package.json | jq '.scripts.dist')\" ] && echo \" no dist script\" || npm run dist'" ,
25
25
"postdist" : " mocha dists/test.js" ,
26
26
"publish-packages" : " ./scripts/foreach.js \" published\" " ,
27
27
"predoc" : " ./scripts/doc.sh" ,
28
28
"doc" : " node ./scripts/homepage.js" ,
29
29
"postdoc" : " cat ./src/styles.scss | node-sass --output-style compressed > ./docs/styles.css" ,
30
30
"readme" : " node ./scripts/readme.js" ,
31
- "update" : " ./scripts/foreach .sh '../../node_modules/.bin/npm-check -u'" ,
32
- "autoupdate" : " ./scripts/foreach .sh 'npm update'"
31
+ "update" : " ./packages/dirdo/bin .sh packages '../../node_modules/.bin/npm-check -u'" ,
32
+ "autoupdate" : " ./packages/dirdo/bin .sh packages 'npm update'"
33
33
},
34
34
"devDependencies" : {
35
35
"@babel/cli" : " ^7.4.4" ,
Original file line number Diff line number Diff line change
1
+ . *
2
+ * .log
3
+ spec.js
Original file line number Diff line number Diff line change
1
+ package-lock = false
2
+ access = public
Original file line number Diff line number Diff line change
1
+ # dirdo [ ![ ] ( https://img.shields.io/npm/v/dirdo.svg )] ( https://www.npmjs.com/package/dirdo ) [ ![ ] ( https://img.shields.io/badge/source--000000.svg?logo=github&style=social )] ( https://github.com/omrilotan/mono/tree/master/packages/dirdo )
2
+
3
+ ## π Execute command in all nested directories
4
+
5
+ Will iterate over all ** directories** nested under the target directory and execute given command
6
+
7
+ ![ ] ( https://user-images.githubusercontent.com/516342/59059060-b7233f80-88a6-11e9-93ff-9a8039950eca.gif )
8
+
9
+ Install
10
+ ```
11
+ npm i -g dirdo
12
+ ```
13
+
14
+ Example
15
+ ``` bash
16
+ dirdo packages ' npm update'
17
+ ```
18
+
19
+ Or use straight out of NPM (good for CI tools)
20
+ ```
21
+ npx dirdo packages 'npm i'
22
+ ```
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- ACTION=$1
3
+ DIRECTORY=$1
4
+ shift
5
+ ACTION=$@
4
6
5
- function search {
7
+ function iterate {
6
8
for FILE in ` ls -l ${1} `
7
9
do
8
10
if test -d " ${1} /${FILE} " ; then
@@ -12,12 +14,10 @@ function search {
12
14
}
13
15
14
16
function execute {
15
- echo -e " \033[1mExecuting ${1} \033[0m"
17
+ echo -e " \033[1mExecuting in ${1} \033[0m"
16
18
cd $1
17
19
eval $ACTION
18
20
cd -
19
- echo -e " \n"
20
21
}
21
22
22
-
23
- search " packages"
23
+ iterate $DIRECTORY
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " dirdo" ,
3
+ "version" : " 0.1.0" ,
4
+ "description" : " π Execute command in all nested directories" ,
5
+ "keywords" : [
6
+ " foreach" ,
7
+ " dir" ,
8
+ " exec" ,
9
+ " cli" ,
10
+ " directory" ,
11
+ " do" ,
12
+ " π"
13
+ ],
14
+ "author" : " omrilotan" ,
15
+ "license" : " MIT" ,
16
+ "repository" : {
17
+ "type" : " git" ,
18
+ "url" : " git+https://github.com/omrilotan/mono.git"
19
+ },
20
+ "homepage" : " https://omrilotan.com/mono/dirdo/" ,
21
+ "bin" : " ./bin.sh"
22
+ }
You canβt perform that action at this time.
0 commit comments