-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "change artifact resolving (#40)"
This reverts commit 03b64ff.
- Loading branch information
Showing
7 changed files
with
117 additions
and
327 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,4 +225,3 @@ examples | |
.idea | ||
lib/* | ||
test.skv | ||
artifacts |
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 @@ | ||
echo -e "import { ConnectionOptions } from \"./lib-src/embedded.js\";\n$(cat index.d.ts)" > index.d.ts |
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
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,55 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const sourceDir = './artifacts'; | ||
const npmDir = './npm'; | ||
|
||
const outDirs = fs.readdirSync(npmDir); | ||
|
||
const binaries = collectNodeBinaries(sourceDir); | ||
console.log(binaries) | ||
|
||
binaries.forEach((file) => { | ||
// console.log(file); | ||
// const sourcePath = path.join(sourceDir, file); | ||
console.log(`moving artifact: ${file}`); | ||
const terms = file.split('.'); | ||
if (terms.pop() !== 'node') { | ||
console.error(`non node file found: ${file}`); | ||
return; | ||
} | ||
const platform = terms.pop() | ||
if (!platform) { | ||
console.error(`can't find platform for: ${file}`); | ||
return; | ||
} | ||
|
||
if (!outDirs.includes(platform)) { | ||
console.error(`invalid platform: ${platform} for file: ${file}`); | ||
return; | ||
} | ||
|
||
const destPath = path.join(npmDir, platform, path.parse(file).base); | ||
|
||
fs.copyFile(file, destPath, (copyErr) => { | ||
if (copyErr) { | ||
console.error(`Could not copy the file: ${copyErr}`); | ||
return; | ||
} | ||
|
||
console.log(`Copied ${file} to ${destPath}`); | ||
}); | ||
}); | ||
|
||
function collectNodeBinaries(root) { | ||
const files = fs.readdirSync(root, { withFileTypes: true }) | ||
const nodeBinaries = files | ||
.filter((file) => file.isFile() && file.name.endsWith('.node')) | ||
.map((file) => path.join(root, file.name)) | ||
|
||
const dirs = files.filter((file) => file.isDirectory()) | ||
for (const dir of dirs) { | ||
nodeBinaries.push(...(collectNodeBinaries(path.join(root, dir.name)))) | ||
} | ||
return nodeBinaries | ||
} |
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
Oops, something went wrong.