-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdfca55
commit 521ce79
Showing
4 changed files
with
34 additions
and
22 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,8 @@ | ||
// copy some files from /src to /dist/node that tsc doesn't copy because we have .d.ts files for them | ||
import { copyFromTo } from './utils.js'; | ||
|
||
await copyFromTo( | ||
['src/bindings/compiled/node_bindings/'], | ||
'node_bindings', | ||
'_node_bindings' | ||
); |
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 |
---|---|---|
@@ -1,22 +1,8 @@ | ||
// copy some files from /src to /dist/node that tsc doesn't copy because | ||
// we have .d.ts files for them | ||
import fse from 'fs-extra'; | ||
// copy some files from /src to /dist/node that tsc doesn't copy because we have .d.ts files for them | ||
import { copyFromTo } from './utils.js'; | ||
|
||
let files = ['src/snarky.d.ts', 'src/bindings/compiled/_node_bindings']; | ||
|
||
await copyToDist(files); | ||
|
||
async function copyToDist(files) { | ||
let promises = []; | ||
for (let source of files) { | ||
let target = source.replace('src/', 'dist/node/'); | ||
promises.push( | ||
fse.copy(source, target, { | ||
recursive: true, | ||
overwrite: true, | ||
dereference: true, | ||
}) | ||
); | ||
} | ||
await Promise.all(promises); | ||
} | ||
await copyFromTo( | ||
['src/snarky.d.ts', 'src/bindings/compiled/_node_bindings'], | ||
'src', | ||
'dist/node' | ||
); |
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,18 @@ | ||
import fse from 'fs-extra'; | ||
|
||
export { copyFromTo }; | ||
|
||
async function copyFromTo(files, srcDir = undefined, targetDir = undefined) { | ||
let promises = []; | ||
for (let source of files) { | ||
let target = source.replace(`${srcDir}/`, `${targetDir}/`); | ||
promises.push( | ||
fse.copy(source, target, { | ||
recursive: true, | ||
overwrite: true, | ||
dereference: true, | ||
}) | ||
); | ||
} | ||
await Promise.all(promises); | ||
} |