-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a build script to copy web-workers from the SDK to the app
- Loading branch information
1 parent
5baa8cb
commit d731e26
Showing
3 changed files
with
44 additions
and
2 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,38 @@ | ||
// | ||
// copyWorkers.js | ||
// | ||
// Copy web-worker scripts from the Web SDK to the application. | ||
// This is for static scripts that cannot be included by `import` or `require`. | ||
// | ||
// Created by Giga on 18 September 2023. | ||
// Copyright 2023 Vircadia contributors. | ||
// Copyright 2023 DigiSomni LLC. | ||
// | ||
// Distributed under the Apache License, Version 2.0. | ||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | ||
// | ||
|
||
import { copyFileSync, existsSync, mkdirSync } from "fs"; | ||
|
||
// The workers to copy. | ||
const workers = [ | ||
"vircadia-audio-input.js", | ||
"vircadia-audio-input.js.map", | ||
"vircadia-audio-output.js", | ||
"vircadia-audio-output.js.map" | ||
]; | ||
// The destination for the worker files. | ||
const destination = "public/js/"; | ||
|
||
// Ensure the destination exists. | ||
if (!existsSync(destination)) { | ||
mkdirSync(destination, { recursive: true }); | ||
} | ||
|
||
// Copy the worker files to the destination. | ||
console.log("Copying workers..."); | ||
for (const worker of workers) { | ||
copyFileSync(`node_modules/@vircadia/web-sdk/dist/${worker}`, `${destination}${worker}`); | ||
console.log(" »\x1b[32m", worker, "\x1b[0m"); | ||
} | ||
console.log("Done.\n"); |
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