feat(admin): init project (#7197)

This commit is contained in:
Brooooooklyn
2024-06-18 06:01:13 +00:00
parent d216606193
commit 0fe672efa5
92 changed files with 6392 additions and 175 deletions
+7 -21
View File
@@ -1,14 +1,10 @@
import path from 'node:path';
import webpack from 'webpack';
import { getCwdFromDistribution } from '../config/cwd.cjs';
import type { BuildFlags } from '../config/index.js';
import { projectRoot } from '../config/index.js';
import { buildI18N } from '../util/i18n.js';
import { createWebpackConfig } from '../webpack/webpack.config.js';
let cwd: string;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const buildType = process.env.BUILD_TYPE_OVERRIDE || process.env.BUILD_TYPE;
@@ -37,24 +33,14 @@ let entry: string | undefined;
const { DISTRIBUTION } = process.env;
const getDistribution = () => {
switch (DISTRIBUTION) {
case 'browser':
case undefined:
cwd = path.join(projectRoot, 'packages/frontend/web');
return 'browser';
case 'desktop':
cwd = path.join(projectRoot, 'packages/frontend/electron/renderer');
entry = path.join(cwd, 'index.tsx');
return DISTRIBUTION;
default: {
throw new Error('DISTRIBUTION must be one of browser, desktop');
}
}
};
const cwd = getCwdFromDistribution(DISTRIBUTION);
if (DISTRIBUTION === 'desktop') {
entry = './index.tsx';
}
const flags = {
distribution: getDistribution(),
distribution: DISTRIBUTION as BuildFlags['distribution'],
mode: 'production',
channel: getChannel(),
coverage: process.env.COVERAGE === 'true',