Some more minor updates

master
WolverinDEV 2021-03-16 16:40:17 +01:00
parent 2a24ea68b3
commit 66021b125b
7 changed files with 24 additions and 32 deletions

View File

@ -103,7 +103,7 @@ export async function spawnVideoSourceSelectModal(type: VideoBroadcastType, mode
}); });
} }
modal.events.one(["destroy", "close"], resolve); modal.getEvents().one(["destroy", "close"], resolve);
}); });
controller.destroy(); controller.destroy();

View File

@ -1,6 +1,6 @@
import * as ts from "typescript"; import * as ts from "typescript";
import {SyntaxKind} from "typescript"; import {SyntaxKind} from "typescript";
import * as sha256 from "sha256"; import sha256 from "sha256";
import {TranslationEntry} from "./generator"; import {TranslationEntry} from "./generator";
export function generate(file: ts.SourceFile, config: Configuration) : TranslationEntry[] { export function generate(file: ts.SourceFile, config: Configuration) : TranslationEntry[] {

View File

@ -41,8 +41,7 @@ export default function(program: ts.Program, config?: Config) : (context: ts.Tra
let processed = []; let processed = [];
const translations: TranslationEntry[] = []; const translations: TranslationEntry[] = [];
const transformer = (context: ts.TransformationContext) => const transformer = (context: ts.TransformationContext) => (rootNode: ts.Node) => {
(rootNode: ts.Node) => {
const handler = (rootNode: ts.Node) => { const handler = (rootNode: ts.Node) => {
if(rootNode.kind == ts.SyntaxKind.Bundle) { if(rootNode.kind == ts.SyntaxKind.Bundle) {
const bundle = rootNode as ts.Bundle; const bundle = rootNode as ts.Bundle;

View File

@ -6,7 +6,9 @@
"lib": ["es6"], "lib": ["es6"],
"typeRoots": [], "typeRoots": [],
"types": [] "types": [],
"esModuleInterop": true
}, },
"files": [ "files": [
"generator.ts", "generator.ts",

View File

@ -5,7 +5,8 @@
"module": "commonjs", "module": "commonjs",
"sourceMap": true, "sourceMap": true,
"lib": ["es6", "dom"], "lib": ["es6", "dom"],
"removeComments": false "removeComments": false,
"esModuleInterop": true
}, },
"include": [ "include": [
"webpack.config.ts", "webpack.config.ts",

View File

@ -4,8 +4,6 @@ import "webcrypto-liner";
import "./index.scss"; import "./index.scss";
import "./FileTransfer"; import "./FileTransfer";
import "./legacy/audio-lib";
import "./hooks/ServerConnection"; import "./hooks/ServerConnection";
import "./hooks/ExternalModal"; import "./hooks/ExternalModal";
import "./hooks/AudioRecorder"; import "./hooks/AudioRecorder";

View File

@ -20,23 +20,28 @@ const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
export let isDevelopment = process.env.NODE_ENV === 'development'; export let isDevelopment = process.env.NODE_ENV === 'development';
console.log("Webpacking for %s (%s)", isDevelopment ? "development" : "production", process.env.NODE_ENV || "NODE_ENV not specified"); console.log("Webpacking for %s (%s)", isDevelopment ? "development" : "production", process.env.NODE_ENV || "NODE_ENV not specified");
const generateDefinitions = async (target: string) => { const generateDefinitions = async (target: string) => {
const git_rev = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString(); const gitRevision = fs.readFileSync(path.join(__dirname, ".git", "HEAD")).toString();
let version; let version;
if(git_rev.indexOf("/") === -1) if(gitRevision.indexOf("/") === -1) {
version = (git_rev || "0000000").substr(0, 7); version = (gitRevision || "0000000").substr(0, 7);
else } else {
version = fs.readFileSync(path.join(__dirname, ".git", git_rev.substr(5).trim())).toString().substr(0, 7); version = fs.readFileSync(path.join(__dirname, ".git", gitRevision.substr(5).trim())).toString().substr(0, 7);
}
let timestamp; let timestamp;
try { try {
const { stdout } = await util.promisify(exec)("git show -s --format=%ct"); const { stdout } = await util.promisify(exec)("git show -s --format=%ct");
timestamp = parseInt(stdout.toString()); timestamp = parseInt(stdout.toString());
if(isNaN(timestamp)) throw "failed to parse timestamp '" + stdout.toString() + "'"; if(isNaN(timestamp)) {
throw "failed to parse timestamp '" + stdout.toString() + "'";
}
} catch (error) { } catch (error) {
console.error("Failed to get commit timestamp: %o", error); console.error("Failed to get commit timestamp: %o", error);
throw "failed to get commit timestamp"; throw "failed to get commit timestamp";
} }
return { return {
"__build": { "__build": {
target: JSON.stringify(target), target: JSON.stringify(target),
@ -45,7 +50,7 @@ const generateDefinitions = async (target: string) => {
timestamp: timestamp, timestamp: timestamp,
entry_chunk_name: JSON.stringify(target === "web" ? "shared-app" : "client-app") entry_chunk_name: JSON.stringify(target === "web" ? "shared-app" : "client-app")
} as BuildDefinitions } as BuildDefinitions
} as any; };
}; };
const isLoaderFile = (file: string) => { const isLoaderFile = (file: string) => {
@ -58,11 +63,11 @@ const isLoaderFile = (file: string) => {
return false; return false;
}; };
export const config = async (target: "web" | "client"): Promise<Configuration> => { return { export const config = async (target: "web" | "client"): Promise<Configuration> => ({
entry: { entry: {
"loader": "./loader/app/index.ts", "loader": "./loader/app/index.ts",
"modal-external": "./shared/js/ui/react-elements/external-modal/PopoutEntrypoint.ts", "modal-external": "./shared/js/ui/react-elements/external-modal/PopoutEntrypoint.ts",
"devel-main": "./shared/js/devel_main.ts" //"devel-main": "./shared/js/devel_main.ts"
}, },
devtool: isDevelopment ? "inline-source-map" : undefined, devtool: isDevelopment ? "inline-source-map" : undefined,
@ -133,14 +138,7 @@ export const config = async (target: "web" | "client"): Promise<Configuration> =
test: /\.(s[ac]|c)ss$/, test: /\.(s[ac]|c)ss$/,
loader: [ loader: [
'style-loader', 'style-loader',
/* //MiniCssExtractPlugin.loader,
{
loader: MiniCssExtractPlugin.loader,
options: {
esModule: true,
},
},
*/
{ {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
@ -180,12 +178,6 @@ export const config = async (target: "web" | "client"): Promise<Configuration> =
}, },
transpileOnly: isDevelopment transpileOnly: isDevelopment
} }
},
{
loader: "./webpack/DevelBlocks.js",
options: {
enabled: true
}
} }
] ]
}, },
@ -258,4 +250,4 @@ export const config = async (target: "web" | "client"): Promise<Configuration> =
minimize: !isDevelopment, minimize: !isDevelopment,
minimizer: [new TerserPlugin()] minimizer: [new TerserPlugin()]
} }
}}; });