oak-domain 5.1.26 → 5.1.27
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.
|
@@ -749,7 +749,7 @@ function injectDataIndexFile(dataIndexFile, briefNames, printer) {
|
|
|
749
749
|
* @param fromDir 依赖项目的目录
|
|
750
750
|
* @param toDir 当前项目的目录
|
|
751
751
|
*/
|
|
752
|
-
function tryCopyFilesRecursively(fromDir, toDir) {
|
|
752
|
+
function tryCopyFilesRecursively(fromDir, toDir, rebuild) {
|
|
753
753
|
const files = (0, fs_1.readdirSync)(fromDir);
|
|
754
754
|
files.forEach((file) => {
|
|
755
755
|
const fromFile = join(fromDir, file);
|
|
@@ -757,7 +757,12 @@ function tryCopyFilesRecursively(fromDir, toDir) {
|
|
|
757
757
|
const stat = (0, fs_1.statSync)(fromFile);
|
|
758
758
|
if (stat.isFile()) {
|
|
759
759
|
if ((0, fs_1.existsSync)(join(toDir, file))) {
|
|
760
|
-
|
|
760
|
+
if (rebuild) {
|
|
761
|
+
console.log(`覆盖文件${toFile}`);
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
console.log(`忽略文件${toFile}`);
|
|
765
|
+
}
|
|
761
766
|
}
|
|
762
767
|
else {
|
|
763
768
|
console.log(`拷贝文件${toFile}`);
|
|
@@ -771,7 +776,7 @@ function tryCopyFilesRecursively(fromDir, toDir) {
|
|
|
771
776
|
console.log(`创建文件夹${toFile}`);
|
|
772
777
|
(0, fs_extra_1.mkdirSync)(toFile);
|
|
773
778
|
}
|
|
774
|
-
tryCopyFilesRecursively(fromFile, toFile);
|
|
779
|
+
tryCopyFilesRecursively(fromFile, toFile, rebuild);
|
|
775
780
|
}
|
|
776
781
|
});
|
|
777
782
|
}
|
|
@@ -781,7 +786,7 @@ function tryCopyFilesRecursively(fromDir, toDir) {
|
|
|
781
786
|
* @param dependencies
|
|
782
787
|
* @param briefNames
|
|
783
788
|
*/
|
|
784
|
-
function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer) {
|
|
789
|
+
function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild) {
|
|
785
790
|
const injectDataIndexFileDependencies = [];
|
|
786
791
|
const injectDataIndexFileBriefNames = [];
|
|
787
792
|
dependencies.forEach((dep, idx) => {
|
|
@@ -792,7 +797,7 @@ function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer) {
|
|
|
792
797
|
const dataFile = join(moduleTemplateDir, 'data.ts');
|
|
793
798
|
if ((0, fs_1.existsSync)(dataFile)) {
|
|
794
799
|
const prjDataFile = join(cwd, 'src', 'data', `${briefNames[idx]}Data.ts`);
|
|
795
|
-
if (!(0, fs_1.existsSync)(prjDataFile)) {
|
|
800
|
+
if (!(0, fs_1.existsSync)(prjDataFile) || rebuild) {
|
|
796
801
|
console.log(`拷贝${dataFile}到${prjDataFile}中`);
|
|
797
802
|
(0, fs_extra_1.copySync)(dataFile, prjDataFile);
|
|
798
803
|
injectDataIndexFileDependencies.push(dep);
|
|
@@ -802,7 +807,7 @@ function tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer) {
|
|
|
802
807
|
// src下面的文件是可以拷贝到项目中的
|
|
803
808
|
const srcDir = join(moduleTemplateDir, 'src');
|
|
804
809
|
if ((0, fs_1.existsSync)(srcDir)) {
|
|
805
|
-
tryCopyFilesRecursively(srcDir, join(cwd, 'src'));
|
|
810
|
+
tryCopyFilesRecursively(srcDir, join(cwd, 'src'), rebuild);
|
|
806
811
|
}
|
|
807
812
|
}
|
|
808
813
|
});
|
|
@@ -1020,7 +1025,7 @@ function buildDependency(rebuild) {
|
|
|
1020
1025
|
}
|
|
1021
1026
|
// 把各个依赖项目的一些初始化的文件拷贝过去
|
|
1022
1027
|
if (!isModule) {
|
|
1023
|
-
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer);
|
|
1028
|
+
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild);
|
|
1024
1029
|
}
|
|
1025
1030
|
}
|
|
1026
1031
|
exports.default = buildDependency;
|