nsgm-cli 2.1.24 → 2.1.25

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.
@@ -15,6 +15,7 @@ declare const scriptsPathSource = "../scripts";
15
15
  declare const scriptsPath = "./scripts";
16
16
  declare const typesPathSource = "../types";
17
17
  declare const typesPath = "./types";
18
+ declare const configPath = "./config";
18
19
  declare const reduxPath = "/redux";
19
20
  declare const servicePath = "/service";
20
21
  declare const styledPath = "/styled";
@@ -39,6 +40,7 @@ declare const sourcePagesPath: string;
39
40
  declare const sourcePublicPath: string;
40
41
  declare const sourceScriptsPath: string;
41
42
  declare const sourceTypesPath: string;
43
+ declare const sourceConfigPath: string;
42
44
  declare const destClientPath: string;
43
45
  declare const destClientReduxPath: string;
44
46
  declare const destClientServicePath: string;
@@ -55,9 +57,10 @@ declare const destPagesPath: string;
55
57
  declare const destPublicPath: string;
56
58
  declare const destScriptsPath: string;
57
59
  declare const destTypesPath: string;
60
+ declare const destConfigPath: string;
58
61
  declare const destClientUtilsMenuPath: string;
59
62
  declare const destClientReduxReducersAllPath: string;
60
63
  declare const destPublicHealthCheckPath: string;
61
64
  declare const destPackagePath: string;
62
65
  declare const destServerRestPath: string;
63
- export { sourceFolder, destFolder, isLocal, generationPath, clientPathSource, clientPath, serverPathSource, serverPath, pagesPathSource, pagesPath, publicPathSource, publicPath, scriptsPathSource, scriptsPath, typesPathSource, typesPath, reduxPath, servicePath, styledPath, styledLayoutPath, utilsPath, layoutPath, componentsPath, modulesPath, apisPath, sqlPath, utilsMenuPath, reduxReducersPath, slbHealthCheckPath, packagePath, restPath, sourceGenerationPath, sourceClientPath, sourceClientPathGeneration, sourceServerPath, sourceServerPathGeneration, sourcePagesPath, sourcePublicPath, sourceScriptsPath, sourceTypesPath, destClientPath, destClientReduxPath, destClientServicePath, destClientStyledPath, destClientStyledLayoutPath, destClientUtilsPath, destClientLayoutPath, destServerPath, destServerModulesPath, destServerApisPath, destServerSqlPath, destServerUtilsPath, destPagesPath, destPublicPath, destScriptsPath, destTypesPath, destClientUtilsMenuPath, destClientReduxReducersAllPath, destPublicHealthCheckPath, destPackagePath, destServerRestPath, mysqlUser, mysqlPassword, mysqlHost, mysqlPort, mysqlDatabase, };
66
+ export { sourceFolder, destFolder, isLocal, generationPath, clientPathSource, clientPath, serverPathSource, serverPath, pagesPathSource, pagesPath, publicPathSource, publicPath, scriptsPathSource, scriptsPath, typesPathSource, typesPath, configPath, reduxPath, servicePath, styledPath, styledLayoutPath, utilsPath, layoutPath, componentsPath, modulesPath, apisPath, sqlPath, utilsMenuPath, reduxReducersPath, slbHealthCheckPath, packagePath, restPath, sourceGenerationPath, sourceClientPath, sourceClientPathGeneration, sourceServerPath, sourceServerPathGeneration, sourcePagesPath, sourcePublicPath, sourceScriptsPath, sourceTypesPath, sourceConfigPath, destClientPath, destClientReduxPath, destClientServicePath, destClientStyledPath, destClientStyledLayoutPath, destClientUtilsPath, destClientLayoutPath, destServerPath, destServerModulesPath, destServerApisPath, destServerSqlPath, destServerUtilsPath, destPagesPath, destPublicPath, destScriptsPath, destTypesPath, destConfigPath, destClientUtilsMenuPath, destClientReduxReducersAllPath, destPublicHealthCheckPath, destPackagePath, destServerRestPath, mysqlUser, mysqlPassword, mysqlHost, mysqlPort, mysqlDatabase, };
package/lib/constants.js CHANGED
@@ -36,8 +36,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.destServerApisPath = exports.destServerModulesPath = exports.destServerPath = exports.destClientLayoutPath = exports.destClientUtilsPath = exports.destClientStyledLayoutPath = exports.destClientStyledPath = exports.destClientServicePath = exports.destClientReduxPath = exports.destClientPath = exports.sourceTypesPath = exports.sourceScriptsPath = exports.sourcePublicPath = exports.sourcePagesPath = exports.sourceServerPathGeneration = exports.sourceServerPath = exports.sourceClientPathGeneration = exports.sourceClientPath = exports.sourceGenerationPath = exports.restPath = exports.packagePath = exports.slbHealthCheckPath = exports.reduxReducersPath = exports.utilsMenuPath = exports.sqlPath = exports.apisPath = exports.modulesPath = exports.componentsPath = exports.layoutPath = exports.utilsPath = exports.styledLayoutPath = exports.styledPath = exports.servicePath = exports.reduxPath = exports.typesPath = exports.typesPathSource = exports.scriptsPath = exports.scriptsPathSource = exports.publicPath = exports.publicPathSource = exports.pagesPath = exports.pagesPathSource = exports.serverPath = exports.serverPathSource = exports.clientPath = exports.clientPathSource = exports.generationPath = exports.isLocal = exports.destFolder = exports.sourceFolder = void 0;
40
- exports.mysqlDatabase = exports.mysqlPort = exports.mysqlHost = exports.mysqlPassword = exports.mysqlUser = exports.destServerRestPath = exports.destPackagePath = exports.destPublicHealthCheckPath = exports.destClientReduxReducersAllPath = exports.destClientUtilsMenuPath = exports.destTypesPath = exports.destScriptsPath = exports.destPublicPath = exports.destPagesPath = exports.destServerUtilsPath = exports.destServerSqlPath = void 0;
39
+ exports.destServerPath = exports.destClientLayoutPath = exports.destClientUtilsPath = exports.destClientStyledLayoutPath = exports.destClientStyledPath = exports.destClientServicePath = exports.destClientReduxPath = exports.destClientPath = exports.sourceConfigPath = exports.sourceTypesPath = exports.sourceScriptsPath = exports.sourcePublicPath = exports.sourcePagesPath = exports.sourceServerPathGeneration = exports.sourceServerPath = exports.sourceClientPathGeneration = exports.sourceClientPath = exports.sourceGenerationPath = exports.restPath = exports.packagePath = exports.slbHealthCheckPath = exports.reduxReducersPath = exports.utilsMenuPath = exports.sqlPath = exports.apisPath = exports.modulesPath = exports.componentsPath = exports.layoutPath = exports.utilsPath = exports.styledLayoutPath = exports.styledPath = exports.servicePath = exports.reduxPath = exports.configPath = exports.typesPath = exports.typesPathSource = exports.scriptsPath = exports.scriptsPathSource = exports.publicPath = exports.publicPathSource = exports.pagesPath = exports.pagesPathSource = exports.serverPath = exports.serverPathSource = exports.clientPath = exports.clientPathSource = exports.generationPath = exports.isLocal = exports.destFolder = exports.sourceFolder = void 0;
40
+ exports.mysqlDatabase = exports.mysqlPort = exports.mysqlHost = exports.mysqlPassword = exports.mysqlUser = exports.destServerRestPath = exports.destPackagePath = exports.destPublicHealthCheckPath = exports.destClientReduxReducersAllPath = exports.destClientUtilsMenuPath = exports.destConfigPath = exports.destTypesPath = exports.destScriptsPath = exports.destPublicPath = exports.destPagesPath = exports.destServerUtilsPath = exports.destServerSqlPath = exports.destServerApisPath = exports.destServerModulesPath = void 0;
41
41
  const path_1 = __importStar(require("path"));
42
42
  const db_1 = __importDefault(require("./server/db"));
43
43
  const sourceFolder = __dirname;
@@ -80,6 +80,8 @@ const typesPathSource = "../types";
80
80
  exports.typesPathSource = typesPathSource;
81
81
  const typesPath = "./types";
82
82
  exports.typesPath = typesPath;
83
+ const configPath = "./config";
84
+ exports.configPath = configPath;
83
85
  const reduxPath = "/redux";
84
86
  exports.reduxPath = reduxPath;
85
87
  const servicePath = "/service";
@@ -128,6 +130,8 @@ const sourceScriptsPath = path_1.default.join(sourceFolder, scriptsPathSource);
128
130
  exports.sourceScriptsPath = sourceScriptsPath;
129
131
  const sourceTypesPath = path_1.default.join(sourceFolder, typesPathSource);
130
132
  exports.sourceTypesPath = sourceTypesPath;
133
+ const sourceConfigPath = path_1.default.join(sourceGenerationPath, configPath);
134
+ exports.sourceConfigPath = sourceConfigPath;
131
135
  const destClientPath = path_1.default.join(destFolder, clientPath);
132
136
  exports.destClientPath = destClientPath;
133
137
  const destClientReduxPath = (0, path_1.resolve)(destClientPath + reduxPath);
@@ -160,6 +164,8 @@ const destScriptsPath = path_1.default.join(destFolder, scriptsPath);
160
164
  exports.destScriptsPath = destScriptsPath;
161
165
  const destTypesPath = path_1.default.join(destFolder, typesPath);
162
166
  exports.destTypesPath = destTypesPath;
167
+ const destConfigPath = path_1.default.join(destFolder, configPath);
168
+ exports.destConfigPath = destConfigPath;
163
169
  const destClientUtilsMenuPath = (0, path_1.resolve)(destClientUtilsPath + utilsMenuPath);
164
170
  exports.destClientUtilsMenuPath = destClientUtilsMenuPath;
165
171
  const destClientReduxReducersAllPath = (0, path_1.resolve)(destClientReduxPath + reduxReducersPath);
package/lib/generate.js CHANGED
@@ -74,6 +74,7 @@ const initFiles = (dictionary, upgradeFlag = false, projectConfig) => {
74
74
  const { destPackagePath } = (0, generate_init_1.initRootFiles)(normalizedDictionary, newDestFolder);
75
75
  (0, generate_init_1.initTestFiles)(normalizedDictionary, newDestFolder);
76
76
  (0, generate_init_1.initTypesFiles)(normalizedDictionary, newDestFolder);
77
+ (0, generate_init_1.initConfigFiles)(normalizedDictionary, newDestFolder);
77
78
  // 如果提供了项目配置,应用到生成的文件中
78
79
  if (projectConfig) {
79
80
  console.log("应用项目配置...");
@@ -53,4 +53,10 @@ export declare const initTypesFiles: (dictionary: string, newDestFolder: string)
53
53
  * @param newDestFolder 新的目标文件夹路径
54
54
  */
55
55
  export declare const initTestFiles: (dictionary: string, newDestFolder: string) => void;
56
+ /**
57
+ * 初始化配置文件和目录
58
+ * @param dictionary 目标目录名称
59
+ * @param newDestFolder 新的目标文件夹路径
60
+ */
61
+ export declare const initConfigFiles: (dictionary: string, newDestFolder: string) => void;
56
62
  export {};
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.initTestFiles = exports.initTypesFiles = exports.initRootFiles = exports.initScriptsFiles = exports.initPublicFiles = exports.initServerFiles = exports.initPagesFiles = exports.initClientFiles = void 0;
36
+ exports.initConfigFiles = exports.initTestFiles = exports.initTypesFiles = exports.initRootFiles = exports.initScriptsFiles = exports.initPublicFiles = exports.initServerFiles = exports.initPagesFiles = exports.initClientFiles = void 0;
37
37
  const path_1 = __importStar(require("path"));
38
38
  const constants_1 = require("./constants");
39
39
  const utils_1 = require("./utils");
@@ -616,3 +616,43 @@ const initTestFiles = (dictionary, newDestFolder) => {
616
616
  }
617
617
  };
618
618
  exports.initTestFiles = initTestFiles;
619
+ /**
620
+ * 初始化配置文件和目录
621
+ * @param dictionary 目标目录名称
622
+ * @param newDestFolder 新的目标文件夹路径
623
+ */
624
+ const initConfigFiles = (dictionary, newDestFolder) => {
625
+ console.log("Initializing config files...");
626
+ try {
627
+ // 1. 确定目标路径
628
+ const baseDestPath = dictionary === "" ? constants_1.destFolder : newDestFolder;
629
+ const configDestPath = path_1.default.join(baseDestPath, constants_1.configPath);
630
+ // 2. 创建配置目录
631
+ createDirectoryStructure([configDestPath]);
632
+ // 3. 复制 config 目录下的所有文件
633
+ const sourceConfigDir = (0, path_1.resolve)(constants_1.sourceConfigPath);
634
+ if ((0, fs_1.existsSync)(sourceConfigDir)) {
635
+ const copyConfigRecursive = (sourceDir, destDir) => {
636
+ const items = (0, fs_1.readdirSync)(sourceDir, { withFileTypes: true });
637
+ items.forEach((item) => {
638
+ const sourcePath = (0, path_1.resolve)(sourceDir, item.name);
639
+ const destPath = (0, path_1.resolve)(destDir, item.name);
640
+ if (item.isDirectory()) {
641
+ (0, utils_1.mkdirSync)(destPath);
642
+ copyConfigRecursive(sourcePath, destPath);
643
+ }
644
+ else {
645
+ (0, utils_1.copyFileSync)(sourcePath, destPath, false);
646
+ }
647
+ });
648
+ };
649
+ copyConfigRecursive(sourceConfigDir, configDestPath);
650
+ }
651
+ console.log("Config files initialization completed");
652
+ }
653
+ catch (error) {
654
+ console.error("Failed to initialize config files:", error);
655
+ throw error;
656
+ }
657
+ };
658
+ exports.initConfigFiles = initConfigFiles;