fix(cli): update dev-core (#3296)

This commit is contained in:
Alex Yang 2023-07-19 10:55:56 +08:00 committed by GitHub
parent 47f12f77f2
commit 1abcdee2f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

11
.env.template Normal file
View File

@ -0,0 +1,11 @@
ENABLE_PLUGIN=
ENABLE_TEST_PROPERTIES=
ENABLE_BC_PROVIDER=
CHANGELOG_URL=
ENABLE_PRELOADING=
ENABLE_NEW_SETTING_MODAL=
ENABLE_SQLITE_PROVIDER=
ENABLE_NEW_SETTING_UNSTABLE_API=
ENABLE_NOTIFICATION_CENTER=
ENABLE_CLOUD=
ENABLE_MOVE_DATABASE=

View File

@ -1,10 +1,24 @@
import { spawn } from 'node:child_process'; import { spawn } from 'node:child_process';
import { existsSync } from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import * as p from '@clack/prompts'; import * as p from '@clack/prompts';
import { config } from 'dotenv';
import { type BuildFlags, projectRoot } from '../config/index.js'; import { type BuildFlags, projectRoot } from '../config/index.js';
const files = ['.env', '.env.local'];
for (const file of files) {
if (existsSync(path.resolve(projectRoot, file))) {
config({
path: path.resolve(projectRoot, file),
});
console.log(`${file} loaded`);
break;
}
}
const cwd = path.resolve(projectRoot, 'apps', 'core'); const cwd = path.resolve(projectRoot, 'apps', 'core');
const flags: BuildFlags = { const flags: BuildFlags = {
@ -16,6 +30,19 @@ const flags: BuildFlags = {
const buildFlags = await p.group( const buildFlags = await p.group(
{ {
distribution: () =>
p.select({
message: 'Distribution',
options: [
{
value: 'browser',
},
{
value: 'desktop',
},
],
initialValue: 'browser',
}),
mode: () => mode: () =>
p.select({ p.select({
message: 'Mode', message: 'Mode',
@ -59,6 +86,7 @@ const buildFlags = await p.group(
} }
); );
flags.distribution = buildFlags.distribution as any;
flags.mode = buildFlags.mode as any; flags.mode = buildFlags.mode as any;
flags.channel = buildFlags.channel as any; flags.channel = buildFlags.channel as any;
flags.coverage = buildFlags.coverage; flags.coverage = buildFlags.coverage;