Skip to content

Commit

Permalink
feat: yarn up command
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 13, 2023
1 parent c122769 commit 89998dc
Show file tree
Hide file tree
Showing 4 changed files with 178 additions and 196 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"stylelint-all": "tsn ./src/bin/stylelint-all.ts",
"lint-all": "tsn ./src/bin/lint-all.ts",
"eslint-all": "tsn ./src/bin/eslint-all.ts",
"up": "tsn ./src/bin/up.ts",
"eslint-print-config": "eslint --print-config src/index.ts > tmp/eslint.config.json",
"update-from-dev-lib": "tsn ./src/bin/update-from-dev-lib.ts"
},
Expand Down Expand Up @@ -92,6 +93,7 @@
"test-manual": "dist/bin/test-manual.js",
"tsc-prod": "dist/bin/tsc-prod.js",
"tsc-scripts": "dist/bin/tsc-scripts.js",
"up": "dist/bin/up.js",
"update-from-dev-lib": "dist/bin/update-from-dev-lib.js"
},
"engines": {
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ Install it **locally** in you project by adding

#### Other commands

- `up`: shortcut for `yarn upgrade` && `yarn patch-package` (if `patch-package` exists in the
project).
- `init-from-dev-lib`: copy config files from `dev-lib/cfg/init` to the project
- `update-from-dev-lib`: copy config files from `dev-lib/cfg/overwrite` to the project

Expand Down
13 changes: 13 additions & 0 deletions src/bin/up.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env node

import * as fs from 'node:fs'
import { execVoidCommandSync } from '@naturalcycles/nodejs-lib'
import { runScript } from '@naturalcycles/nodejs-lib/dist/script'

runScript(async () => {
execVoidCommandSync('yarn', ['upgrade'])

if (fs.existsSync(`node_modules/patch-package`)) {
execVoidCommandSync('patch-package')
}
})
Loading

0 comments on commit 89998dc

Please sign in to comment.