mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
feat(admin): init project (#7197)
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user