Skip to content

Commit

Permalink
fix: rebuild:lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Dec 23, 2017
1 parent 64b903d commit 9e48754
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
33 changes: 33 additions & 0 deletions lib/scripts/filter-native-modules.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/scripts/filter-native-modules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node

import path = require('path')
import { getNativeModules } from '../cli/utils'
import { uniqueStrict } from '../utils'

const modules = []
const promiseNative = getNativeModules()

process.stdin
.on('data', paths => {
paths.toString().split('\n').forEach(filePath => {
modules.push(filePath.split('node_modules/').pop())
})
})
.on('end', async () => {
const native = await promiseNative
const prodNative = uniqueStrict(modules).filter(name => {
return native.find(str => str === name)
})

process.stdout.write(prodNative.join(' '))
})

process.on('unhandledRejection', err => {
process.exitCode = 1
console.error(err.stack)
})
8 changes: 3 additions & 5 deletions src/scripts/rebuild-native.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

NATIVE=$(./lib/scripts/get-native-prod-modules.js)
if [ "$?" == "0" ]; then
set -x
npm rebuild $NATIVE
fi
NATIVE=$(npm ls --production --parseable=true --long=false --silent | node ./lib/scripts/filter-native-modules.js)
echo "rebuilding: $NATIVE"
npm rebuild $NATIVE

0 comments on commit 9e48754

Please sign in to comment.