easy-soft-develop 2.1.224 → 2.1.227

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.227",
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,37 @@ 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) {
96
+ copyFileSync({
97
+ sourceMainPath,
98
+ targetMainPath,
99
+ filepath: itemFile,
100
+ });
101
+ }
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
+ continue;
115
+ }
116
+
75
117
  copyFileSync({
76
118
  sourceMainPath,
77
119
  targetMainPath,
@@ -79,6 +121,9 @@ function handlePackage({
79
121
  });
80
122
  }
81
123
 
124
+ promptTip('*', 'clear resource.');
125
+ promptEmptyLine();
126
+
82
127
  clearResource();
83
128
  });
84
129
  }
@@ -138,14 +183,16 @@ async function updateProjectFromRepository({ projectPath = '.', agent }) {
138
183
  repository = '',
139
184
  sourcePath = '',
140
185
  targetPath = '',
141
- folders = [],
142
- files = [],
186
+ syncFolders = [],
187
+ syncFiles = [],
188
+ ignoreSyncWhenExistFiles = [],
143
189
  } = {
144
190
  repository: '',
145
191
  sourcePath: '',
146
192
  targetPath: '',
147
- folders: [],
148
- files: [],
193
+ syncFolders: [],
194
+ syncFiles: [],
195
+ ignoreSyncWhenExistFiles: [],
149
196
  ...getDevelopUpdateProjectFromRepositoryConfig(),
150
197
  };
151
198
 
@@ -188,8 +235,9 @@ async function updateProjectFromRepository({ projectPath = '.', agent }) {
188
235
  zipPath,
189
236
  sourcePath,
190
237
  targetPath,
191
- folders,
192
- files,
238
+ syncFolders,
239
+ syncFiles,
240
+ ignoreSyncWhenExistFiles,
193
241
  });
194
242
  }
195
243