-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: publication-script for the node-record-test executable (wip)
- Loading branch information
Showing
4 changed files
with
725 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const find = require('find'); | ||
const os = require('os') | ||
const path = require('path') | ||
const fs = require('fs-extra') | ||
|
||
const arch = os.arch() | ||
const platform = os.platform() | ||
const prebuildType = process.argv[2] || `${platform}-${arch}` | ||
|
||
// function isFileForPlatform(filename) { | ||
// if (filename.indexOf(path.join('prebuilds', prebuildType)) !== -1) { | ||
// return true | ||
// } else { | ||
// return false | ||
// } | ||
// } | ||
|
||
const sourceDirName = path.join(__dirname, '../../../') | ||
// const targetDirName = path.join(__dirname, '../') | ||
|
||
console.log('Copy-Natives --------------') | ||
console.log('Looking for modules in', sourceDirName, 'for', prebuildType) | ||
// console.log('to copy into ', targetDirName) | ||
|
||
const modulesToCopy = new Map() | ||
find.file(/\.node$/, path.join(sourceDirName, 'node_modules'), (files) => { | ||
files.forEach(fullPath => { | ||
console.log(fullPath) | ||
if (fullPath.indexOf(sourceDirName) === 0) { | ||
console.log('a') | ||
const file = fullPath.substr(sourceDirName.length) | ||
|
||
const moduleName = file.match(/node_modules[\/\\]([^\\\/]+)/) | ||
if (moduleName) { | ||
modulesToCopy.set(moduleName[1], true) | ||
} | ||
} | ||
}) | ||
|
||
modulesToCopy.forEach((_, moduleName) => { | ||
console.log('copying', moduleName) | ||
|
||
fs.copySync(path.join(sourceDirName, 'node_modules', moduleName) , path.join('deploy/node_modules/', moduleName )) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.