easy-soft-develop 2.1.224 → 2.1.229

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-soft-develop",
3
- "version": "2.1.224",
3
+ "version": "2.1.229",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/kityandhero/easy-soft-develop#readme",
6
6
  "bugs": {
@@ -9,8 +9,9 @@ const developUpdateProjectFromRepository = {
9
9
  repository: '',
10
10
  sourcePath: '',
11
11
  targetPath: '',
12
- folders: [],
13
- files: [],
12
+ syncFolders: [],
13
+ syncFiles: [],
14
+ ignoreSyncWhenExistFiles: [],
14
15
  };
15
16
 
16
17
  const developUpdateProjectFromRepositoryConfigFilePath =
@@ -15,6 +15,8 @@ const {
15
15
  copyFileSync,
16
16
  copyFolderSync,
17
17
  promptTip,
18
+ existFileSync,
19
+ promptEmptyLine,
18
20
  } = require('./meta');
19
21
 
20
22
  const {
@@ -44,8 +46,9 @@ function handlePackage({
44
46
  zipPath,
45
47
  sourcePath,
46
48
  targetPath,
47
- folders,
48
- files,
49
+ syncFolders,
50
+ syncFiles,
51
+ ignoreSyncWhenExistFiles,
49
52
  }) {
50
53
  const unzipPath = resolvePath(`./temp/source/`);
51
54
 
@@ -63,7 +66,16 @@ function handlePackage({
63
66
 
64
67
  promptLine();
65
68
 
66
- for (const itemFolder of folders) {
69
+ promptTip('*', 'sync folders.');
70
+ promptEmptyLine();
71
+
72
+ if (syncFolders.length === 0) {
73
+ promptWarn(
74
+ 'none folders will sync, if need, please set "syncFolders" in "develop.update.project.from.repository.json".',
75
+ );
76
+ }
77
+
78
+ for (const itemFolder of syncFolders) {
67
79
  copyFolderSync({
68
80
  sourceMainPath,
69
81
  targetMainPath,
@@ -71,7 +83,16 @@ function handlePackage({
71
83
  });
72
84
  }
73
85
 
74
- for (const itemFile of files) {
86
+ promptTip('*', 'sync files.');
87
+ promptEmptyLine();
88
+
89
+ if (syncFiles.length === 0) {
90
+ promptWarn(
91
+ 'none file will force sync, if need, please set "syncFiles" in "develop.update.project.from.repository.json".',
92
+ );
93
+ }
94
+
95
+ for (const itemFile of syncFiles) {
75
96
  copyFileSync({
76
97
  sourceMainPath,
77
98
  targetMainPath,
@@ -79,6 +100,32 @@ function handlePackage({
79
100
  });
80
101
  }
81
102
 
103
+ promptTip('*', 'sync files when not exist.');
104
+ promptEmptyLine();
105
+
106
+ if (ignoreSyncWhenExistFiles.length === 0) {
107
+ promptWarn(
108
+ 'none file will sync when it not exist, if need, please set "ignoreSyncWhenExistFiles" in "develop.update.project.from.repository.json".',
109
+ );
110
+ }
111
+
112
+ for (const itemFile of ignoreSyncWhenExistFiles) {
113
+ if (existFileSync(`./${targetMainPath}/${itemFile}`)) {
114
+ promptInfo(`ignore copy file: "${itemFile}".`);
115
+
116
+ continue;
117
+ }
118
+
119
+ copyFileSync({
120
+ sourceMainPath,
121
+ targetMainPath,
122
+ filepath: itemFile,
123
+ });
124
+ }
125
+
126
+ promptTip('*', 'clear resource.');
127
+ promptEmptyLine();
128
+
82
129
  clearResource();
83
130
  });
84
131
  }
@@ -138,14 +185,16 @@ async function updateProjectFromRepository({ projectPath = '.', agent }) {
138
185
  repository = '',
139
186
  sourcePath = '',
140
187
  targetPath = '',
141
- folders = [],
142
- files = [],
188
+ syncFolders = [],
189
+ syncFiles = [],
190
+ ignoreSyncWhenExistFiles = [],
143
191
  } = {
144
192
  repository: '',
145
193
  sourcePath: '',
146
194
  targetPath: '',
147
- folders: [],
148
- files: [],
195
+ syncFolders: [],
196
+ syncFiles: [],
197
+ ignoreSyncWhenExistFiles: [],
149
198
  ...getDevelopUpdateProjectFromRepositoryConfig(),
150
199
  };
151
200
 
@@ -188,8 +237,9 @@ async function updateProjectFromRepository({ projectPath = '.', agent }) {
188
237
  zipPath,
189
238
  sourcePath,
190
239
  targetPath,
191
- folders,
192
- files,
240
+ syncFolders,
241
+ syncFiles,
242
+ ignoreSyncWhenExistFiles,
193
243
  });
194
244
  }
195
245