gant-core 0.1.30 → 0.1.32

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/lib/cli/index.js CHANGED
@@ -6006,10 +6006,10 @@ const defineConfig = (config = defaultConfig) => {
6006
6006
  };
6007
6007
 
6008
6008
  const DEFAULT_CONFIG_FILES = [
6009
- 'config/config.ts',
6010
- 'config/config.js',
6011
- 'config.ts',
6012
- 'config.js',
6009
+ "config/config.ts",
6010
+ "config/config.js",
6011
+ "config.ts",
6012
+ "config.js",
6013
6013
  ];
6014
6014
  class Config {
6015
6015
  opts;
@@ -6030,10 +6030,10 @@ class Config {
6030
6030
  });
6031
6031
  this.mainConfigFile && this.configFiles.push(this.mainConfigFile);
6032
6032
  const fileArray = [this.opts.cwd];
6033
- const packages = get$3(userConfig, 'packages', {});
6033
+ const packages = get$3(userConfig, "packages", {});
6034
6034
  const alias = {
6035
- '@gant': path$5.resolve(this.opts.cwd, 'src/.gant'),
6036
- [userConfig.name || '@@']: path$5.resolve(this.opts.cwd),
6035
+ "@gant": path$5.resolve(this.opts.cwd, "src/.gant"),
6036
+ [userConfig.name || "@@"]: path$5.resolve(this.opts.cwd),
6037
6037
  ...packages,
6038
6038
  };
6039
6039
  let tempConfig = {
@@ -6057,7 +6057,12 @@ class Config {
6057
6057
  cwd: packagePath,
6058
6058
  mainConfigFile: configFile,
6059
6059
  });
6060
- tempConfig = mergeConfig$1(tempConfig, packageConfig);
6060
+ tempConfig = mergeConfig$1(tempConfig, pick(packageConfig, [
6061
+ "routes",
6062
+ "microServiceMap",
6063
+ "setting",
6064
+ "define",
6065
+ ]));
6061
6066
  });
6062
6067
  }
6063
6068
  return {
@@ -6083,7 +6088,7 @@ class Config {
6083
6088
  config = getJavascriptfile(getAbsFile(opts.mainConfigFile, opts.cwd));
6084
6089
  }
6085
6090
  catch (error) {
6086
- console.log('getUserConfig Error :', error);
6091
+ console.log("getUserConfig Error :", error);
6087
6092
  }
6088
6093
  return config;
6089
6094
  }
@@ -6175,7 +6180,7 @@ const generateRoutes = (rootPath, _routes, mpas) => {
6175
6180
  };
6176
6181
 
6177
6182
  const generateTsConfig = (rootPath, options) => {
6178
- const { packages, name, cwd, vue } = options;
6183
+ const { packages = {}, name, cwd, vue } = options;
6179
6184
  const currentPath = path$5.resolve(cwd);
6180
6185
  const paths = {
6181
6186
  [`${name}/*`]: [`${currentPath}/*`],
@@ -6183,7 +6188,7 @@ const generateTsConfig = (rootPath, options) => {
6183
6188
  "@gant": [path$5.resolve(currentPath, "src/.gant")],
6184
6189
  };
6185
6190
  const includes = [currentPath];
6186
- Object.keys(packages).map((name) => {
6191
+ keys$6(packages).map((name) => {
6187
6192
  includes.push(packages[name]);
6188
6193
  paths[`${name}/*`] = [`${packages[name]}/*`];
6189
6194
  paths[`${name}`] = [`${packages[name]}`];
@@ -6216,15 +6221,20 @@ const generateTsConfig = (rootPath, options) => {
6216
6221
  jsonObj.include = include;
6217
6222
  writeFileToJSON(path$5.resolve(rootPath, "tsconfig.json"), JSON.stringify(jsonObj));
6218
6223
  writeFileToJS(path$5.resolve(rootPath, "types.d.ts"), typesString);
6219
- Object.keys(packages).map((name) => {
6220
- const itemDirPath = path$5.resolve(packages[name], "src/.gant");
6221
- if (fs$6.existsSync(itemDirPath)) {
6222
- fs$6.rmdirSync(itemDirPath, { recursive: true });
6223
- }
6224
- fs$6.mkdirSync(itemDirPath, { recursive: true });
6225
- writeFileToJSON(path$5.resolve(itemDirPath, "tsconfig.json"), JSON.stringify(jsonObj));
6226
- writeFileToJS(path$5.resolve(itemDirPath, "types.d.ts"), typesString);
6227
- });
6224
+ try {
6225
+ Object.keys(packages).map((name) => {
6226
+ const itemDirPath = path$5.resolve(packages[name], "src/.gant");
6227
+ if (fs$6.existsSync(itemDirPath)) {
6228
+ fs$6.rmdirSync(itemDirPath, { recursive: true });
6229
+ }
6230
+ fs$6.mkdirSync(itemDirPath, { recursive: true });
6231
+ writeFileToJSON(path$5.resolve(itemDirPath, "tsconfig.json"), JSON.stringify(jsonObj));
6232
+ writeFileToJS(path$5.resolve(itemDirPath, "types.d.ts"), typesString);
6233
+ });
6234
+ }
6235
+ catch (error) {
6236
+ console.error("创建配置文件错误:", error);
6237
+ }
6228
6238
  };
6229
6239
 
6230
6240
  var generateI18n = (userConfig, cwd) => {
@@ -6252,9 +6262,9 @@ var generateI18n = (userConfig, cwd) => {
6252
6262
 
6253
6263
  const generateGant = (userConfig, cwd, vue) => {
6254
6264
  // 不是库模式,创建.gant临时文件
6255
- const tempPath = path$5.resolve(cwd, 'src/.gant');
6256
- let content = '';
6257
- let AppContent = '';
6265
+ const tempPath = path$5.resolve(cwd, "src/.gant");
6266
+ let content = "";
6267
+ let AppContent = "";
6258
6268
  generateDir(tempPath);
6259
6269
  //生成路由文件
6260
6270
  const resRoutes = generateRoutes(tempPath, userConfig.routes, userConfig.mpas);
@@ -6263,7 +6273,7 @@ const generateGant = (userConfig, cwd, vue) => {
6263
6273
  packages: userConfig.packages,
6264
6274
  name: userConfig.name,
6265
6275
  cwd,
6266
- vue
6276
+ vue,
6267
6277
  });
6268
6278
  //生成index.ts
6269
6279
  if (resRoutes) {
@@ -6272,12 +6282,12 @@ const generateGant = (userConfig, cwd, vue) => {
6272
6282
  // 生成 I18n
6273
6283
  generateI18n(userConfig, cwd);
6274
6284
  //app复制到前置执行
6275
- let indexString = fs$6.readFileSync(path$5.resolve(__dirname, './template/core.txt'), 'utf-8');
6285
+ let indexString = fs$6.readFileSync(path$5.resolve(__dirname, "./template/core.txt"), "utf-8");
6276
6286
  const packagesPaths = [...values(userConfig.packages), cwd];
6277
6287
  //复制public 并前置项目模块中的app文件
6278
- const APP_CONFIG_FILES = ['app.ts', 'app.tsx', 'app.js'];
6288
+ const APP_CONFIG_FILES = ["app.ts", "app.tsx", "app.js"];
6279
6289
  packagesPaths.map((packagePath) => {
6280
- copyFolder(path$5.resolve(packagePath, 'public'), path$5.resolve(tempPath, 'public'));
6290
+ copyFolder(path$5.resolve(packagePath, "public"), path$5.resolve(tempPath, "public"));
6281
6291
  for (const fileName of APP_CONFIG_FILES) {
6282
6292
  const appPath = path$5.resolve(packagePath, fileName);
6283
6293
  if (fs$6.existsSync(appPath))
@@ -6286,9 +6296,9 @@ const generateGant = (userConfig, cwd, vue) => {
6286
6296
  return packagePath;
6287
6297
  });
6288
6298
  content += indexString;
6289
- writeFileToJS(path$5.resolve(tempPath, 'index.ts'), content);
6299
+ writeFileToJS(path$5.resolve(tempPath, "index.ts"), content);
6290
6300
  if (!!AppContent)
6291
- writeFileToJS(path$5.resolve(tempPath, 'app.ts'), AppContent);
6301
+ writeFileToJS(path$5.resolve(tempPath, "app.ts"), AppContent);
6292
6302
  };
6293
6303
 
6294
6304
  class CopyFolderPlugin {
@@ -48723,7 +48733,7 @@ const createCwdConfig = (cwd, name, vue) => {
48723
48733
  };
48724
48734
 
48725
48735
  var name = "gant-core";
48726
- var version = "0.1.30";
48736
+ var version = "0.1.31";
48727
48737
  var description = "";
48728
48738
  var main = "lib/index.js";
48729
48739
  var bin = {