vona-core 5.1.6 → 5.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2344,7 +2344,7 @@ class AppMeta extends BeanSimple {
2344
2344
  this.metadata = appMetadata;
2345
2345
  }
2346
2346
  _prepareEnv() {
2347
- const mode = this.app.configMeta.mode;
2347
+ const mode = this.env.META_MODE;
2348
2348
  this.isProd = mode === 'prod';
2349
2349
  this.isTest = mode === 'test';
2350
2350
  this.isDev = mode === 'dev';
@@ -2458,9 +2458,6 @@ class VonaApplication extends KoaApplication {
2458
2458
  get projectPath() {
2459
2459
  return this.options.projectPath;
2460
2460
  }
2461
- get configMeta() {
2462
- return this.options.configMeta;
2463
- }
2464
2461
  get ctx() {
2465
2462
  return this.currentContext;
2466
2463
  }
@@ -2507,7 +2504,7 @@ class VonaApplication extends KoaApplication {
2507
2504
 
2508
2505
  async function combineConfigDefault(app, configDefault, configDev, configProd, configTest) {
2509
2506
  let config = await configDefault(app);
2510
- const mode = app.config.meta.mode;
2507
+ const mode = app.meta.env.META_MODE;
2511
2508
  if (mode === 'dev' && configDev) {
2512
2509
  config = deepExtend(config, await configDev(app));
2513
2510
  } else if (mode === 'prod' && configProd) {
@@ -2518,7 +2515,7 @@ async function combineConfigDefault(app, configDefault, configDev, configProd, c
2518
2515
  return config;
2519
2516
  }
2520
2517
  function getLoggerPathPhysicalRoot(app) {
2521
- const mode = app.configMeta.mode;
2518
+ const mode = app.meta.env.META_MODE;
2522
2519
  let loggerDir;
2523
2520
  if (mode === 'test' || mode === 'dev') {
2524
2521
  loggerDir = path.join(app.projectPath, '.app/logs');
@@ -2529,7 +2526,7 @@ function getLoggerPathPhysicalRoot(app) {
2529
2526
  return loggerDir;
2530
2527
  }
2531
2528
  function getPublicPathPhysicalRoot(app) {
2532
- const mode = app.configMeta.mode;
2529
+ const mode = app.meta.env.META_MODE;
2533
2530
  let publicDir;
2534
2531
  if (mode === 'test' || mode === 'dev') {
2535
2532
  publicDir = path.join(app.projectPath, '.app/public');
@@ -2540,7 +2537,7 @@ function getPublicPathPhysicalRoot(app) {
2540
2537
  return publicDir;
2541
2538
  }
2542
2539
  function getRuntimePathPhysicalRoot(app) {
2543
- const mode = app.config.meta.mode;
2540
+ const mode = app.meta.env.META_MODE;
2544
2541
  let runtimeDir;
2545
2542
  if (mode === 'test' || mode === 'dev') {
2546
2543
  runtimeDir = path.join(app.options.projectPath, '.app/runtime');
@@ -2754,7 +2751,7 @@ async function loadConfig (app, modules) {
2754
2751
  const module = modules[key];
2755
2752
  // module config
2756
2753
  if (module.resource.config) {
2757
- const configModule = await module.resource.config(app, app.options.env);
2754
+ const configModule = await module.resource.config(app);
2758
2755
  // configNew is not used by now
2759
2756
  await app.util.monkeyModule(app.meta.appMonkey, app.meta.modulesMonkey, true, 'configLoaded', module, configModule);
2760
2757
  app.config.modules[module.info.relativeName] = deepExtend({}, configModule, app.config.modules[module.info.relativeName]);
@@ -2981,7 +2978,7 @@ async function __prepareConfig(app) {
2981
2978
  const configItems = (await app.options.config()).default;
2982
2979
  const configItemsPromise = [];
2983
2980
  for (const configItem of configItems) {
2984
- configItemsPromise.push(configItem(app, app.options.env));
2981
+ configItemsPromise.push(configItem(app));
2985
2982
  }
2986
2983
  const configItemsRes = await Promise.all(configItemsPromise);
2987
2984
  for (const configItem of configItemsRes) {
@@ -3058,7 +3055,6 @@ function __createApp({
3058
3055
  const options = {
3059
3056
  name: appInfo.name,
3060
3057
  projectPath: appInfo.projectPath,
3061
- configMeta: appInfo.configMeta,
3062
3058
  modulesMeta,
3063
3059
  locales,
3064
3060
  config,
@@ -3070,11 +3066,7 @@ function __createApp({
3070
3066
  function prepareAppInfo(env) {
3071
3067
  return {
3072
3068
  name: env.APP_NAME,
3073
- projectPath: process.cwd(),
3074
- configMeta: {
3075
- flavor: cast(env).META_FLAVOR,
3076
- mode: cast(env).META_MODE
3077
- }
3069
+ projectPath: process.cwd()
3078
3070
  };
3079
3071
  }
3080
3072
 
@@ -3305,7 +3297,7 @@ async function retry(options, fn) {
3305
3297
  }
3306
3298
 
3307
3299
  function getSqlite3DatabaseNameDefault(app) {
3308
- const mode = app.configMeta.mode;
3300
+ const mode = app.meta.env.META_MODE;
3309
3301
  if (mode !== 'prod') return '';
3310
3302
  const dbPath = path.join(os.homedir(), 'vona', app.name, 'sqlite3');
3311
3303
  fse.ensureDirSync(dbPath);