@eui/tools 4.21.10 → 5.0.0-rc.12
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/.version.properties +1 -1
- package/CHANGELOG.md +26 -0
- package/global.test.js +60 -40
- package/package.json +7 -7
- package/sandbox.js +50 -6
- package/scripts/csdr/config/global.js +9 -0
- package/scripts/csdr/config/packages.js +2 -0
- package/scripts/csdr/config/projects.test.js +11 -9
- package/scripts/csdr/install/build-app.js +6 -38
- package/scripts/csdr/install/build-package.js +12 -77
- package/scripts/csdr/install/composite-core.js +256 -0
- package/scripts/csdr/install/install-utils.js +8 -4
- package/scripts/csdr/install/local-dev.js +2 -2
- package/scripts/csdr/install/packages.js +90 -0
- package/scripts/csdr/install/projects.js +76 -0
- package/scripts/csdr/install/{remote.js → remotes.js} +46 -55
- package/scripts/csdr/metadata/app-envs.js +0 -39
- package/scripts/csdr/metadata/app-history.js +0 -66
- package/scripts/csdr/metadata/app-versions.js +2 -12
- package/scripts/csdr/metadata/app.js +2 -2
- package/scripts/csdr/metadata/metadata-utils.js +2 -0
- package/scripts/csdr/metadata/package-envs.js +71 -0
- package/scripts/csdr/metadata/package-versions.js +79 -0
- package/scripts/csdr/metadata/package.js +13 -50
- package/scripts/csdr/release/package/backend.js +2 -2
- package/scripts/csdr/release/package/common.js +59 -16
- package/scripts/csdr/release/package/release-package.js +10 -7
- package/scripts/csdr/release/package/remote.js +2 -2
- package/scripts/csdr/release/package/ui.js +2 -2
- package/scripts/csdr/version/app-common.js +32 -0
- package/scripts/csdr/version/app-env-target.js +5 -295
- package/scripts/csdr/version/app.js +5 -3
- package/scripts/csdr/version/{app-env-target.test.js → common..test.js} +32 -31
- package/scripts/csdr/version/common.js +277 -0
- package/scripts/csdr/version/package-common.js +158 -0
- package/scripts/csdr/version/package-default.js +144 -0
- package/scripts/csdr/version/package-remote.js +51 -0
- package/scripts/csdr/version/package.js +16 -275
- package/scripts/utils/api-utils.js +90 -0
- package/scripts/utils/build/package/nodeJs.js +2 -1
- package/scripts/utils/pre-build/elements.js +8 -8
- package/scripts/utils/pre-build/injection/config.js +1 -1
- package/scripts/utils/pre-build/injection/externals.js +16 -6
- package/scripts/utils/test/test-utils.js +39 -1
- package/scripts/csdr/install/composite-utils.js +0 -305
- package/scripts/csdr/jira/jira-utils.js +0 -169
- package/scripts/csdr/jira/update.js +0 -153
|
@@ -1,288 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// constants
|
|
16
|
-
const RELEASE_TYPES = ['major', 'minor', 'patch'];
|
|
17
|
-
|
|
18
|
-
const { dryRun, nexusUser, nexusPassword } = tools.getArgs();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const getCurrentVersion = (pkg) => {
|
|
22
|
-
return Promise.resolve()
|
|
23
|
-
.then(() => {
|
|
24
|
-
let currentVersion;
|
|
25
|
-
|
|
26
|
-
tools.logTitle('Extracting current version');
|
|
27
|
-
|
|
28
|
-
if (pkg.backend) {
|
|
29
|
-
// if nodejs backend, explicitely declared
|
|
30
|
-
if (pkg.build && pkg.build.nodejs) {
|
|
31
|
-
tools.logInfo('UI package => extracting from package.json');
|
|
32
|
-
|
|
33
|
-
const pathPkgJson = path.resolve(pkg.paths.pkgDirectory, 'package.json');
|
|
34
|
-
const pkgJson = require(pathPkgJson);
|
|
35
|
-
currentVersion = pkgJson.version;
|
|
36
|
-
|
|
37
|
-
// by default maven java backend is taken into account
|
|
38
|
-
} else {
|
|
39
|
-
tools.logInfo('Backend => extracting pom.xml');
|
|
40
|
-
const xmlContent = tools.getXMLJsContent(path.join(pkg.paths.pkgDirectory, 'pom.xml'));
|
|
41
|
-
|
|
42
|
-
tools.logInfo('Content found:');
|
|
43
|
-
console.log(xmlContent);
|
|
44
|
-
|
|
45
|
-
currentVersion = xmlContent.project.version.toString();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
} else {
|
|
49
|
-
tools.logInfo('UI package => extracting from package.json');
|
|
50
|
-
|
|
51
|
-
const pathPkgJson = path.resolve(pkg.paths.pkgDirectory, 'package.json');
|
|
52
|
-
const pkgJson = require(pathPkgJson);
|
|
53
|
-
currentVersion = pkgJson.version;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
tools.logSuccess('Current version found : ' + currentVersion);
|
|
57
|
-
return currentVersion;
|
|
58
|
-
})
|
|
59
|
-
.catch((e) => {
|
|
60
|
-
throw e;
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const writePackageJsonCore = (newVersion, folder, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch) => {
|
|
66
|
-
return Promise.resolve()
|
|
67
|
-
.then(() => {
|
|
68
|
-
const pkgJsonFile = path.resolve(folder, 'package.json');
|
|
69
|
-
const pkgJson = require(pkgJsonFile);
|
|
70
|
-
|
|
71
|
-
let tag = 'latest';
|
|
72
|
-
|
|
73
|
-
if (isSnapshot) {
|
|
74
|
-
tag = 'snapshot';
|
|
75
|
-
}
|
|
76
|
-
if (isNextBranch) {
|
|
77
|
-
tag = 'next';
|
|
78
|
-
}
|
|
79
|
-
if (isSupportBranch) {
|
|
80
|
-
tag = 'prev';
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
pkgJson.version = newVersion;
|
|
84
|
-
pkgJson.tag = tag;
|
|
85
|
-
|
|
86
|
-
tools.logInfo(`Updating package version : ${newVersion} / tag: ${tag} for ${pkgJsonFile}`);
|
|
87
|
-
tools.writeJsonFileSync(pkgJsonFile, pkgJson);
|
|
88
|
-
})
|
|
89
|
-
.catch((e) => {
|
|
90
|
-
throw e;
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const writePackageJson = (pkg, newVersion, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch) => {
|
|
3
|
+
// inner modules
|
|
4
|
+
const packageDefault = require('./package-default');
|
|
5
|
+
const packageRemote = require('./package-remote');
|
|
6
|
+
const packageCommon = require('./package-common');
|
|
7
|
+
|
|
8
|
+
// public methods
|
|
9
|
+
module.exports.getNewVersion = (
|
|
10
|
+
pkg,
|
|
11
|
+
commits,
|
|
12
|
+
isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch,
|
|
13
|
+
envTarget
|
|
14
|
+
) => {
|
|
95
15
|
return Promise.resolve()
|
|
96
16
|
.then(() => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!pkg.parent) {
|
|
100
|
-
return Promise.resolve()
|
|
101
|
-
.then(() => {
|
|
102
|
-
return writePackageJsonCore(newVersion, pkg.paths.pkgDirectory, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch);
|
|
103
|
-
})
|
|
104
|
-
.then(() => {
|
|
105
|
-
if (!pkg.element && !pkg.config) {
|
|
106
|
-
return writePackageJsonCore(newVersion, pkg.paths.pkgPublish, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch);
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
.catch((e) => {
|
|
110
|
-
throw e;
|
|
111
|
-
})
|
|
112
|
-
|
|
17
|
+
if (pkg.remote && pkg.build && pkg.build.envTargetActive) {
|
|
18
|
+
return packageRemote.getNewVersion(pkg, envTarget);
|
|
113
19
|
} else {
|
|
114
|
-
return
|
|
115
|
-
.then(() => {
|
|
116
|
-
return writePackageJsonCore(newVersion, pkg.paths.pkgDirectory, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch);
|
|
117
|
-
})
|
|
118
|
-
.then(() => {
|
|
119
|
-
let linkedPackages = Object.keys(pkg.packages)
|
|
120
|
-
.map(p => {
|
|
121
|
-
const pkg = configUtils.packages.getPackage(p);
|
|
122
|
-
return pkg;
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
return tools.removeArrayDuplicates(linkedPackages, 'name');
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
.then((linkedPackages) => Promise.resolve().then(() => {
|
|
129
|
-
return linkedPackages.reduce((promise, pkg) => {
|
|
130
|
-
return promise.then(() => (
|
|
131
|
-
writePackageJsonCore(newVersion, pkg.paths.pkgPublish, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch)
|
|
132
|
-
));
|
|
133
|
-
}, Promise.resolve());
|
|
134
|
-
}))
|
|
135
|
-
|
|
136
|
-
.catch((e) => {
|
|
137
|
-
throw e;
|
|
138
|
-
})
|
|
139
|
-
}
|
|
140
|
-
})
|
|
141
|
-
.then(() => {
|
|
142
|
-
tools.logSuccess();
|
|
143
|
-
})
|
|
144
|
-
.catch((e) => {
|
|
145
|
-
throw e;
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const writePomXml = (pkg, newVersion, isSnapshot, isForceTimestamp = true) => {
|
|
152
|
-
|
|
153
|
-
tools.logTitle(`updating project pom.xml version: ${newVersion}`);
|
|
154
|
-
|
|
155
|
-
return Promise.resolve()
|
|
156
|
-
.then(() => {
|
|
157
|
-
return templateUtils.generateMavenSettings(nexusUser, nexusPassword);
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
.then((mavenSettingsFile) => {
|
|
161
|
-
|
|
162
|
-
tools.logInfo(`Executing mvn versions on : ${pkg.paths.pkgDirectory}`);
|
|
163
|
-
|
|
164
|
-
execa.shellSync('mvn versions:set -T1 -DnewVersion=' + newVersion + ' -s ' + mavenSettingsFile, { cwd: pkg.paths.pkgDirectory });
|
|
165
|
-
execa.shellSync('mvn versions:commit -T1' + ' -s ' + mavenSettingsFile, { cwd: pkg.paths.pkgDirectory });
|
|
166
|
-
|
|
167
|
-
if (isForceTimestamp) {
|
|
168
|
-
// timestamp file is forced to have at least one file to commit, as snapshot release
|
|
169
|
-
// for backend can keep the same version until its latest
|
|
170
|
-
const tsversionFile = path.resolve(pkg.paths.pkgDirectory, '.tsversion');
|
|
171
|
-
fs.writeFileSync(tsversionFile, Date.now());
|
|
172
|
-
|
|
173
|
-
const versionFile = path.resolve(pkg.paths.pkgDirectory, '.version.properties');
|
|
174
|
-
fs.writeFileSync(versionFile, newVersion);
|
|
20
|
+
return packageDefault.getNewVersion(pkg, commits, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch);
|
|
175
21
|
}
|
|
176
22
|
})
|
|
177
|
-
.then(() => {
|
|
178
|
-
tools.logSuccess();
|
|
179
|
-
})
|
|
180
|
-
.catch((e) => {
|
|
181
|
-
throw e;
|
|
182
|
-
})
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
// PUBLIC METHODS
|
|
190
|
-
|
|
191
|
-
module.exports.getNewVersion = (pkg, commits, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch) => {
|
|
192
|
-
return Promise.resolve()
|
|
193
|
-
.then(() => {
|
|
194
|
-
return getCurrentVersion(pkg);
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
.then((currentVersion) => {
|
|
198
|
-
tools.logTitle('Extracting recommended version');
|
|
199
|
-
|
|
200
|
-
tools.logInfo(`Current version found : ${currentVersion}`);
|
|
201
|
-
|
|
202
|
-
let newVersion = '1.0.0';
|
|
203
|
-
|
|
204
|
-
if (commits) {
|
|
205
|
-
|
|
206
|
-
tools.logInfo('Commits found for processing version, extracting...');
|
|
207
|
-
|
|
208
|
-
let level = 2;
|
|
209
|
-
let breakings = 0;
|
|
210
|
-
let features = 0;
|
|
211
|
-
|
|
212
|
-
commits.forEach((commit) => {
|
|
213
|
-
if (commit.breakingChange) {
|
|
214
|
-
breakings += commit.body;
|
|
215
|
-
level = 1; // no major bump on "breaking changes"
|
|
216
|
-
} else if (commit.type === 'feat') {
|
|
217
|
-
features += 1;
|
|
218
|
-
if (level === 2) {
|
|
219
|
-
level = 1;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
const release = {
|
|
225
|
-
level: level,
|
|
226
|
-
reason: 'There are ' + breakings + ' BREAKING CHANGES and ' + features + ' features',
|
|
227
|
-
releaseType: RELEASE_TYPES[level]
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
tools.logInfo('release info found : ' + JSON.stringify(release));
|
|
231
|
-
|
|
232
|
-
if (isNextBranch) {
|
|
233
|
-
newVersion = semver.inc(currentVersion, 'prerelease');
|
|
234
|
-
} else {
|
|
235
|
-
newVersion = semver.valid(release.releaseType) || semver.inc(currentVersion, release.releaseType)
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
} else {
|
|
240
|
-
tools.logInfo('No commits found for version processing...applying minor version upgrade');
|
|
241
23
|
|
|
242
|
-
if (isNextBranch) {
|
|
243
|
-
newVersion = semver.inc(currentVersion, 'prerelease');
|
|
244
|
-
} else {
|
|
245
|
-
newVersion = semver.inc(currentVersion, 'minor');
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
tools.logInfo('probable new version : ' + newVersion);
|
|
250
|
-
|
|
251
|
-
if (isSnapshot) {
|
|
252
|
-
if (pkg.backend) {
|
|
253
|
-
if (pkg.build && pkg.build.nodejs) {
|
|
254
|
-
newVersion += '-snapshot-' + Date.now();
|
|
255
|
-
} else {
|
|
256
|
-
newVersion += '-SNAPSHOT';
|
|
257
|
-
}
|
|
258
|
-
} else {
|
|
259
|
-
newVersion += '-snapshot-' + Date.now();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (isSupportBranch && pkg.backend) {
|
|
264
|
-
newVersion = semver.inc(currentVersion, 'prerelease');
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
if (isHotfixBranch) {
|
|
268
|
-
newVersion = semver.inc(currentVersion, 'prerelease');
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
tools.logSuccess('new version generated : ' + newVersion);
|
|
272
|
-
|
|
273
|
-
return newVersion;
|
|
274
|
-
})
|
|
275
24
|
.catch((e) => {
|
|
276
25
|
throw e;
|
|
277
26
|
})
|
|
278
27
|
}
|
|
279
28
|
|
|
280
|
-
|
|
281
|
-
module.exports.updateVersion = (pkg, newVersion, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch) => {
|
|
282
|
-
if (pkg.backend) {
|
|
283
|
-
return writePomXml(pkg, newVersion, isSnapshot);
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
return writePackageJson(pkg, newVersion, isSnapshot, isNextBranch, isSupportBranch, isHotfixBranch);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
29
|
+
module.exports.updateVersion = packageCommon.updateVersion;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBALS
|
|
4
|
+
const fetch = require('node-fetch');
|
|
5
|
+
|
|
6
|
+
// LOCAL
|
|
7
|
+
const tools = require('./tools');
|
|
8
|
+
const configUtils = require('../csdr/config/config-utils');
|
|
9
|
+
|
|
10
|
+
// FETCH OPTIONS
|
|
11
|
+
const { API_HOST } = configUtils.global.getConfigOptions();
|
|
12
|
+
|
|
13
|
+
// FETCH ARGS
|
|
14
|
+
const { apiUserId, apiPassword } = tools.getArgs();
|
|
15
|
+
|
|
16
|
+
// GLOBALS
|
|
17
|
+
let authToken;
|
|
18
|
+
|
|
19
|
+
module.exports.login = () => {
|
|
20
|
+
return Promise.resolve()
|
|
21
|
+
.then(() => {
|
|
22
|
+
return fetch(`${API_HOST}/auth`, {
|
|
23
|
+
method: 'post',
|
|
24
|
+
headers: { 'content-type': 'application/json' },
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
"userid": apiUserId,
|
|
27
|
+
"password": apiPassword
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
.then((res) => {
|
|
32
|
+
return res.json();
|
|
33
|
+
})
|
|
34
|
+
.then((response) => {
|
|
35
|
+
authToken = response.token;
|
|
36
|
+
return response;
|
|
37
|
+
})
|
|
38
|
+
.catch(e => {
|
|
39
|
+
throw e;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module.exports.get = (scope) => {
|
|
45
|
+
return Promise.resolve()
|
|
46
|
+
.then(() => {
|
|
47
|
+
return fetch(`${API_HOST}/${scope}`, {
|
|
48
|
+
method: 'get',
|
|
49
|
+
headers: {
|
|
50
|
+
'content-type': 'application/json',
|
|
51
|
+
'x-auth-token': authToken
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
.then((res) => {
|
|
56
|
+
return res.json();
|
|
57
|
+
})
|
|
58
|
+
.then((response) => {
|
|
59
|
+
return response;
|
|
60
|
+
})
|
|
61
|
+
.catch(e => {
|
|
62
|
+
throw e;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports.post = (scope, body) => {
|
|
67
|
+
return Promise.resolve()
|
|
68
|
+
.then(() => {
|
|
69
|
+
return fetch(`${API_HOST}/${scope}`, {
|
|
70
|
+
method: 'post',
|
|
71
|
+
headers: {
|
|
72
|
+
'content-type': 'application/json',
|
|
73
|
+
'x-auth-token': authToken
|
|
74
|
+
},
|
|
75
|
+
body: JSON.stringify(body)
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
.then((res) => {
|
|
79
|
+
return res.json();
|
|
80
|
+
})
|
|
81
|
+
.then((response) => {
|
|
82
|
+
return response;
|
|
83
|
+
})
|
|
84
|
+
.catch(e => {
|
|
85
|
+
throw e;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
@@ -6,7 +6,7 @@ const tools = require('../tools');
|
|
|
6
6
|
|
|
7
7
|
const translationUtils = require('./translations/translation-utils');
|
|
8
8
|
const configUtils = require('../../csdr/config/config-utils');
|
|
9
|
-
|
|
9
|
+
const injectionUtils = require('./injection/injection-utils');
|
|
10
10
|
|
|
11
11
|
module.exports.preBuild = (pkg, build = false) => {
|
|
12
12
|
return Promise.resolve()
|
|
@@ -19,6 +19,13 @@ module.exports.preBuild = (pkg, build = false) => {
|
|
|
19
19
|
return configUtils.angular.registerAngularProjectDef(pkg);
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
+
// inject external app sources declaration
|
|
23
|
+
.then(() => {
|
|
24
|
+
if (pkg.externalSources) {
|
|
25
|
+
return injectionUtils.externals.injectElementExternalSources(pkg);
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
22
29
|
.then(() => {
|
|
23
30
|
tools.logInfo('Checking compiled translations');
|
|
24
31
|
if (pkg.build && pkg.build.compiledTranslations) {
|
|
@@ -34,13 +41,6 @@ module.exports.preBuild = (pkg, build = false) => {
|
|
|
34
41
|
}
|
|
35
42
|
})
|
|
36
43
|
|
|
37
|
-
// inject external app sources declaration
|
|
38
|
-
.then(() => {
|
|
39
|
-
if (pkg.externalSources) {
|
|
40
|
-
return injectionUtils.externals.injectElementExternalSources(pkg);
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
44
|
.catch((e) => {
|
|
45
45
|
throw e;
|
|
46
46
|
})
|
|
@@ -70,7 +70,7 @@ const injectPackagesConfig = (project) => {
|
|
|
70
70
|
|
|
71
71
|
// fetching current project linked composite packages dependencies
|
|
72
72
|
.then(() => {
|
|
73
|
-
return installUtils.
|
|
73
|
+
return installUtils.common.getLocalProjectsDeps(project);
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
|
|
@@ -107,10 +107,18 @@ module.exports.injectExternalAppSources = (project) => {
|
|
|
107
107
|
|
|
108
108
|
} else {
|
|
109
109
|
tools.logInfo(`Removing ${projectSrcPath} content`);
|
|
110
|
-
tools.rmdirFull(projectSrcPath, false);
|
|
111
110
|
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
return Promise.resolve()
|
|
112
|
+
.then(() => {
|
|
113
|
+
return tools.rmdirFull(projectSrcPath, false);
|
|
114
|
+
})
|
|
115
|
+
.then(() => {
|
|
116
|
+
tools.logInfo(`${appSourcesSrcPath} injecting in ${projectSrcPath}`);
|
|
117
|
+
return tools.copydir(appSourcesSrcPath, projectSrcPath, true);
|
|
118
|
+
})
|
|
119
|
+
.catch((e) => {
|
|
120
|
+
throw e;
|
|
121
|
+
})
|
|
114
122
|
}
|
|
115
123
|
}
|
|
116
124
|
})
|
|
@@ -142,7 +150,7 @@ module.exports.injectElementExternalSources = (pkg) => {
|
|
|
142
150
|
})[0];
|
|
143
151
|
|
|
144
152
|
let externalSourcesSrcPath;
|
|
145
|
-
const pkgSrcPath = path.join(
|
|
153
|
+
const pkgSrcPath = path.join(pkg.paths.pkgRootDirectory, 'src');
|
|
146
154
|
|
|
147
155
|
// if local package is found
|
|
148
156
|
if (localPackage) {
|
|
@@ -163,8 +171,10 @@ module.exports.injectElementExternalSources = (pkg) => {
|
|
|
163
171
|
throw new Error('External sources not found');
|
|
164
172
|
|
|
165
173
|
} else {
|
|
166
|
-
tools.
|
|
167
|
-
|
|
174
|
+
if (tools.isDirExists(pkgSrcPath)) {
|
|
175
|
+
tools.logInfo(`Removing ${pkgSrcPath} content`);
|
|
176
|
+
tools.rmdirFull(pkgSrcPath, false);
|
|
177
|
+
}
|
|
168
178
|
|
|
169
179
|
tools.logInfo(`${externalSourcesSrcPath} injecting in ${pkgSrcPath}`);
|
|
170
180
|
return tools.copydir(externalSourcesSrcPath, pkgSrcPath, true);
|
|
@@ -9,7 +9,7 @@ const tools = require('../tools');
|
|
|
9
9
|
const configUtils = require('../../csdr/config/config-utils');
|
|
10
10
|
|
|
11
11
|
// FETCH ARGS
|
|
12
|
-
const { watch, skipCoverage } = tools.getArgs();
|
|
12
|
+
const { watch, skipCoverage, timeout, build } = tools.getArgs();
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -84,3 +84,41 @@ module.exports.runJest = (pkg) => {
|
|
|
84
84
|
throw e;
|
|
85
85
|
})
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
module.exports.runMocha = (pkg) => {
|
|
90
|
+
return Promise.resolve()
|
|
91
|
+
.then(() => {
|
|
92
|
+
tools.logTitle(`Executing Mocha test for pkg: ${pkg.name}`);
|
|
93
|
+
|
|
94
|
+
// set jest binary
|
|
95
|
+
const mocha = path.resolve(process.cwd(), 'node_modules', 'mocha', 'bin', 'mocha');
|
|
96
|
+
const nyc = path.resolve(process.cwd(), 'node_modules', 'nyc', 'bin', 'nyc');
|
|
97
|
+
|
|
98
|
+
// default arguments
|
|
99
|
+
let args;
|
|
100
|
+
|
|
101
|
+
if (!skipCoverage && !build) {
|
|
102
|
+
args = [nyc, '--reporter=text', mocha, pkg.paths.pkgFromRoot + '/**/*.test.js'];
|
|
103
|
+
} else {
|
|
104
|
+
args = [mocha, pkg.paths.pkgFromRoot + '/**/*.test.js'];
|
|
105
|
+
}
|
|
106
|
+
if (watch) {
|
|
107
|
+
args.push('--watch');
|
|
108
|
+
}
|
|
109
|
+
if (timeout) {
|
|
110
|
+
args.push(`--timeout ${timeout}`);
|
|
111
|
+
} else {
|
|
112
|
+
args.push('--timeout 5000');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return execa('node', args, { cwd: process.cwd(), stdio: 'inherit' });
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
.catch((e) => {
|
|
119
|
+
throw e;
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|