Update build scripts

This commit is contained in:
Logan Ramos
2021-08-31 10:17:54 -04:00
parent 32ddac99d5
commit d2a8f91fb5
4 changed files with 56 additions and 4 deletions

View File

@@ -345,7 +345,7 @@ export function acquireWebNodePaths() {
const root = path.join(__dirname, '..', '..');
const webPackageJSON = path.join(root, '/remote/web', 'package.json');
const webPackages = JSON.parse(fs.readFileSync(webPackageJSON, 'utf8')).dependencies;
const nodePaths: { [key: string]: string } = {};
const nodePaths: { [key: string]: string } = { };
for (const key of Object.keys(webPackages)) {
const packageJSON = path.join(root, 'node_modules', key, 'package.json');
const packageData = JSON.parse(fs.readFileSync(packageJSON, 'utf8'));
@@ -366,6 +366,23 @@ export function acquireWebNodePaths() {
return nodePaths;
}
export function createExternalLoaderConfig(webEndpoint?: string, commit?: string, quality?: string) {
if (!webEndpoint || !commit || !quality) {
return undefined;
}
webEndpoint = webEndpoint + `/${quality}/${commit}`;
let nodePaths = acquireWebNodePaths();
Object.keys(nodePaths).map(function (key, _) {
nodePaths[key] = `${webEndpoint}/node_modules/${key}/${nodePaths[key]}`;
});
const externalLoaderConfig = {
baseUrl: `${webEndpoint}/out`,
recordStats: true,
paths: nodePaths
};
return externalLoaderConfig;
}
export function buildWebNodePaths(outDir: string) {
const result = () => new Promise<void>((resolve, _) => {
const root = path.join(__dirname, '..', '..');