diff options
| author | otofune <otofune@gmail.com> | 2018-06-11 06:40:27 +0900 |
|---|---|---|
| committer | otofune <otofune@gmail.com> | 2018-06-11 08:08:52 +0900 |
| commit | 7518e30dcf73ee9b7b385eb4f5878b77d3ea3cc4 (patch) | |
| tree | 52335a6e1e57ebb726b39a1ea64f56488eba3467 /src | |
| parent | Update example.yml (diff) | |
| download | sharkey-7518e30dcf73ee9b7b385eb4f5878b77d3ea3cc4.tar.gz sharkey-7518e30dcf73ee9b7b385eb4f5878b77d3ea3cc4.tar.bz2 sharkey-7518e30dcf73ee9b7b385eb4f5878b77d3ea3cc4.zip | |
:up: move some packages to devDependencies that non required by server
presumed by:
- move-to-devdependencies.fish
```fish
set targets (ls src | grep -v client | xargs -I'%' echo "src/%")
alias from_import="git grep 'import ' $targets | grep -v 'from \'\.' | grep -v 'from \"\.' | cut -d: -f2 | cut -d\; -f1 | rev | cut -d' ' -f1 | rev | cut -d\' -f2 | sort | uniq | grep -v '^readline\$' | grep -v '^zlib\$' | grep -v '^os\$' | grep -v '^http\$' | grep -v '^fs\$' | grep -v '^events\$' | grep -v '^crypto\$' | grep -v '^child_process\$' | grep -v '^cluster\$'`"
alias from_require="git grep 'require(' $targets | grep -v '(\'\.' | cut -d= -f2 | grep -v '__dirname' | grep require | cut -d' ' -f2 | cut -d')' -f1 | cut -d'(' -f2 | cut -d'\'' -f2 | sort | uniq | grep -v '^readline\$' | grep -v '^zlib\$' | grep -v '^os\$' | grep -v '^http\$' | grep -v '^fs\$' | grep -v '^events\$' | grep -v '^crypto\$' | grep -v '^child_process\$' | grep -v '^cluster\$'"
from_import | xargs npm uninstall --save-dev
from_require | xargs npm uninstall --save-dev
from_import | xargs npm install --save
from_require | xargs npm install --save
git show HEAD:require | node revert-pinning-dependencies.js
```
- revert-pinning-dependencies.js
```js
const readFromStdin = () => new Promise((resolve, reject) => {
const chunks = []
process.stdin.setEncoding('utf8')
process.stdin.on('readable', () => {
const chunk = process.stdin.read()
if (chunk == null) return
chunks.push(chunk)
})
process.stdin.on('end', () => {
return resolve(chunks.join('\n'))
})
})
async function main () {
const fs = require('fs')
const raw = await readFromStdin()
const head = JSON.parse(raw)
const now = JSON.parse(fs.readFileSync('package.json'))
Object.keys(now.dependencies).forEach(key => {
now.dependencies[key] = head.dependencies[key]
})
fs.writeFileSync('package.json', JSON.stringify(now,null,'\t'))
}
main().catch(console.error)
```
Diffstat (limited to 'src')
0 files changed, 0 insertions, 0 deletions