@eui/tools 6.1.0 → 6.1.1
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 +15 -0
- package/bin/eui-scripts.js +2 -0
- package/bin/scripts/audit-package.js +10 -0
- package/bin/scripts/csdr-upgrade-deps.js +1 -4
- package/package.json +1 -1
- package/sandbox.js +137 -18
- package/scripts/csdr/audit/audit-utils.js +3 -98
- package/scripts/csdr/audit/deps.js +89 -0
- package/scripts/csdr/audit/styles.js +457 -0
- package/scripts/csdr/audit/yarn.js +105 -0
- package/scripts/csdr/config/global.js +17 -17
- package/scripts/csdr/config/packages.js +67 -5
- package/scripts/csdr/config/projects.js +14 -4
- package/scripts/csdr/config/sync.js +0 -1
- package/scripts/csdr/init/global.js +122 -0
- package/scripts/csdr/init/init-utils.js +8 -358
- package/scripts/csdr/init/init.js +19 -12
- package/scripts/csdr/init/packages.js +142 -0
- package/scripts/csdr/init/projects.js +112 -0
- package/scripts/csdr/init/remotes.js +21 -0
- package/scripts/csdr/install/common.js +26 -391
- package/scripts/csdr/install/local-dev.js +54 -50
- package/scripts/csdr/install/packages.js +183 -3
- package/scripts/csdr/install/projects.js +198 -9
- package/scripts/csdr/release/package/ui.js +6 -85
- package/scripts/csdr/sync/sync-utils.js +8 -8
|
@@ -13,6 +13,186 @@ const metadataUtils = require('../metadata/metadata-utils');
|
|
|
13
13
|
const innerCommon = require('./common');
|
|
14
14
|
const innerProjects = require('./projects');
|
|
15
15
|
|
|
16
|
+
// FETCH ARGS
|
|
17
|
+
const { skipLocalPackagesDeps } = tools.getArgs();
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const getLocalPackageDeps = (pkg) => {
|
|
23
|
+
let pkgJsonFile;
|
|
24
|
+
|
|
25
|
+
if (pkg.parent) {
|
|
26
|
+
return {};
|
|
27
|
+
} else {
|
|
28
|
+
if (pkg.child) {
|
|
29
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'package.json');
|
|
30
|
+
} else {
|
|
31
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'package.json');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return tools.getJsonFileContent(pkgJsonFile).dependencies || {};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const getLocalPackagesDeps = module.exports.getLocalPackagesDeps = () => {
|
|
40
|
+
const packages = configUtils.packages.getPackages();
|
|
41
|
+
let deps = {};
|
|
42
|
+
|
|
43
|
+
packages.forEach(p => {
|
|
44
|
+
const pkgDeps = getLocalPackageDeps(p);
|
|
45
|
+
|
|
46
|
+
tools.logInfo(`Getting local dependencies for ${p.name}`);
|
|
47
|
+
console.log(JSON.stringify(pkgDeps, null, 2));
|
|
48
|
+
|
|
49
|
+
const pdeps = Object.keys(pkgDeps)
|
|
50
|
+
.reduce((acc, k) => {
|
|
51
|
+
if (k.indexOf('@eui') !== -1 ) {
|
|
52
|
+
if (k.indexOf('@eui/ecl') !== -1 ||
|
|
53
|
+
k.indexOf('@eui/styles-base') !== -1
|
|
54
|
+
) {
|
|
55
|
+
acc[k] = pkgDeps[k];
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
acc[k] = pkgDeps[k];
|
|
59
|
+
}
|
|
60
|
+
return acc;
|
|
61
|
+
}, {});
|
|
62
|
+
|
|
63
|
+
deps = { ...deps, ...pdeps };
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
return deps;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
const getLocalPackageCompositeDeps = (pkg) => {
|
|
71
|
+
let pkgJsonFile;
|
|
72
|
+
|
|
73
|
+
if (!skipLocalPackagesDeps) {
|
|
74
|
+
if (pkg.child) {
|
|
75
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'dependencies-composite.json');
|
|
76
|
+
} else {
|
|
77
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'dependencies-composite.json');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (tools.isFileExists(pkgJsonFile)) {
|
|
81
|
+
tools.logInfo(`found ${pkgJsonFile}, parsing...`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return tools.getJsonFileContent(pkgJsonFile) || {};
|
|
85
|
+
|
|
86
|
+
} else {
|
|
87
|
+
tools.logInfo('Skipping gathering local packages composite deps');
|
|
88
|
+
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
const getLocalPackagesCompositeDeps = module.exports.getLocalPackagesCompositeDeps = () => {
|
|
95
|
+
tools.logTitle('Parsing composite deps for local packages');
|
|
96
|
+
|
|
97
|
+
let deps = {};
|
|
98
|
+
|
|
99
|
+
// getting locally mounted packages, don't take into account remotely installed packages (elements remote)
|
|
100
|
+
const packages = configUtils.packages.getPackages().filter((p) => {
|
|
101
|
+
return !p.paths.remoteNodeModules;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
packages.forEach(p => {
|
|
105
|
+
tools.logInfo(`Parsing package : ${p.name}`);
|
|
106
|
+
|
|
107
|
+
// getting the package composite if any
|
|
108
|
+
const compositeDeps = getLocalPackageCompositeDeps(p);
|
|
109
|
+
|
|
110
|
+
deps = { ...deps, ...compositeDeps };
|
|
111
|
+
|
|
112
|
+
tools.logInfo('Deps found : ');
|
|
113
|
+
console.log(deps);
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
return deps;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
const getLocalPackageBaseDeps = (pkg) => {
|
|
121
|
+
let pkgJsonFile;
|
|
122
|
+
|
|
123
|
+
if (!skipLocalPackagesDeps) {
|
|
124
|
+
if (pkg.child) {
|
|
125
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.parentPkg, 'packages', pkg.folder || pkg.name, 'dependencies-base.json');
|
|
126
|
+
} else {
|
|
127
|
+
pkgJsonFile = path.join(process.cwd(), 'packages', pkg.name, 'dependencies-base.json');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (tools.isFileExists(pkgJsonFile)) {
|
|
131
|
+
tools.logInfo(`found ${pkgJsonFile}, parsing...`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return tools.getJsonFileContent(pkgJsonFile) || {};
|
|
135
|
+
|
|
136
|
+
} else {
|
|
137
|
+
tools.logInfo('Skipping gathering local packages base deps');
|
|
138
|
+
|
|
139
|
+
return {};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
const getLocalPackagesBaseDeps = module.exports.getLocalPackagesBaseDeps = () => {
|
|
146
|
+
tools.logTitle('Parsing base deps for local packages');
|
|
147
|
+
|
|
148
|
+
let deps = {};
|
|
149
|
+
|
|
150
|
+
// getting locally mounted packages, don't take into account remotely installed packages (elements remote)
|
|
151
|
+
const packages = configUtils.packages.getPackages().filter((p) => {
|
|
152
|
+
return !p.paths.remoteNodeModules;
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
packages.forEach(p => {
|
|
156
|
+
tools.logInfo(`Parsing package : ${p.name}`);
|
|
157
|
+
|
|
158
|
+
// getting the package base if any
|
|
159
|
+
const baseDeps = getLocalPackageBaseDeps(p);
|
|
160
|
+
|
|
161
|
+
deps = { ...deps, ...baseDeps };
|
|
162
|
+
|
|
163
|
+
tools.logInfo('Deps found : ');
|
|
164
|
+
console.log(deps);
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
return deps;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
module.exports.getLocalPackagesCompositeDepsRemapped = () => {
|
|
172
|
+
return Promise.resolve()
|
|
173
|
+
.then(() => {
|
|
174
|
+
return metadataUtils.package.getPackagesDeps('packages');
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
.then((depsMetadata) => {
|
|
178
|
+
const compositeDeps = getLocalPackagesCompositeDeps();
|
|
179
|
+
|
|
180
|
+
return innerCommon.getRemappedDeps(depsMetadata, compositeDeps, false);
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
.then((remappedDeps) => {
|
|
184
|
+
tools.logInfo('Remapped deps : ');
|
|
185
|
+
|
|
186
|
+
console.log(remappedDeps);
|
|
187
|
+
|
|
188
|
+
return remappedDeps;
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
.catch((e) => {
|
|
192
|
+
throw e;
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
16
196
|
|
|
17
197
|
module.exports.installDeps = (prj, pkg, isMaster) => {
|
|
18
198
|
let compositeDeps, localPkgDeps, localPkgCompositeDeps, remappedDeps, localPkgBaseDeps;
|
|
@@ -38,7 +218,7 @@ module.exports.installDeps = (prj, pkg, isMaster) => {
|
|
|
38
218
|
console.log(JSON.stringify(compositeDeps, null, 2));
|
|
39
219
|
|
|
40
220
|
// fetching package own deps
|
|
41
|
-
return
|
|
221
|
+
return getLocalPackagesDeps();
|
|
42
222
|
})
|
|
43
223
|
|
|
44
224
|
|
|
@@ -50,7 +230,7 @@ module.exports.installDeps = (prj, pkg, isMaster) => {
|
|
|
50
230
|
console.log(JSON.stringify(localPkgDeps, null, 2));
|
|
51
231
|
|
|
52
232
|
// fetching local package composite
|
|
53
|
-
return
|
|
233
|
+
return getLocalPackagesCompositeDeps();
|
|
54
234
|
})
|
|
55
235
|
|
|
56
236
|
// Get last known working build dependencies from DEVOPS metadata, including snapshot releases
|
|
@@ -69,7 +249,7 @@ module.exports.installDeps = (prj, pkg, isMaster) => {
|
|
|
69
249
|
// storing
|
|
70
250
|
remappedDeps = remappedDepsIn;
|
|
71
251
|
|
|
72
|
-
return
|
|
252
|
+
return getLocalPackagesBaseDeps();
|
|
73
253
|
})
|
|
74
254
|
|
|
75
255
|
.then((localPkgBaseDepsIn) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// GLOBAL
|
|
4
|
-
const execa = require('execa');
|
|
5
4
|
const path = require('path');
|
|
6
5
|
|
|
7
6
|
// LOCAL
|
|
@@ -14,7 +13,7 @@ const innerCommon = require('./common');
|
|
|
14
13
|
const innerCompositeCore = require('./composite-core');
|
|
15
14
|
|
|
16
15
|
// FETCH ARGS
|
|
17
|
-
const {
|
|
16
|
+
const { remotesImport } = tools.getArgs();
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
@@ -38,6 +37,101 @@ const getDeps = module.exports.getDeps = (prj, envTarget, compositeType) => {
|
|
|
38
37
|
})
|
|
39
38
|
}
|
|
40
39
|
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const getLocalProjectDeps = (prj, snapshotsMetadata) => {
|
|
44
|
+
tools.logInfo(`Getting deps for ${prj.name}`);
|
|
45
|
+
|
|
46
|
+
// check dependencies file - default
|
|
47
|
+
const prjJsonFile = path.join(process.cwd(), prj.folder, 'dependencies-base.json');
|
|
48
|
+
const prjDeps = tools.getJsonFileContent(prjJsonFile) || {};
|
|
49
|
+
|
|
50
|
+
// check dependencies composite file - default
|
|
51
|
+
const prjCompJsonFile = path.join(process.cwd(), prj.folder, 'dependencies-composite.json');
|
|
52
|
+
|
|
53
|
+
const depsJson = tools.getJsonFileContent(prjCompJsonFile);
|
|
54
|
+
let prjCompDeps;
|
|
55
|
+
if (depsJson.dependencies) {
|
|
56
|
+
prjCompDeps = depsJson.dependencies || {};
|
|
57
|
+
} else {
|
|
58
|
+
prjCompDeps = depsJson || {}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return { ...prjDeps, ...prjCompDeps };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
module.exports.getLocalProjectsDeps = () => {
|
|
66
|
+
tools.logTitle('Getting project dependencies');
|
|
67
|
+
|
|
68
|
+
const projects = configUtils.projects.getProjects();
|
|
69
|
+
let deps = {};
|
|
70
|
+
|
|
71
|
+
projects.forEach(p => {
|
|
72
|
+
if (p) {
|
|
73
|
+
const prjDeps = getLocalProjectDeps(p);
|
|
74
|
+
deps = { ...deps, ...prjDeps };
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
return deps;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
const getLocalProjectFixedDeps = (prj) => {
|
|
83
|
+
tools.logTitle('Getting project fixed dependencies - not part of the composite');
|
|
84
|
+
|
|
85
|
+
return Promise.resolve()
|
|
86
|
+
.then(() => {
|
|
87
|
+
return metadataUtils.package.getPackagesDeps('packages');
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
// extracting the fixed deps versions from metadata
|
|
91
|
+
.then((pkgDeps) => {
|
|
92
|
+
let deps = {};
|
|
93
|
+
|
|
94
|
+
if (prj.fixedDependencies) {
|
|
95
|
+
tools.logInfo('Project fixed dependencies found...processing');
|
|
96
|
+
console.log(prj.fixedDependencies);
|
|
97
|
+
|
|
98
|
+
prj.fixedDependencies.forEach((dep) => {
|
|
99
|
+
const newDep = { [dep]: pkgDeps[dep] };
|
|
100
|
+
deps = { ...deps, ...newDep }
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
tools.logInfo('Project fixed dependencies remapped : ');
|
|
105
|
+
console.log(deps);
|
|
106
|
+
|
|
107
|
+
return deps;
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
.catch((e) => {
|
|
111
|
+
throw e;
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
module.exports.getLocalProjectsFixedDeps = async _ => {
|
|
117
|
+
const projects = configUtils.projects.getProjects();
|
|
118
|
+
let deps = {};
|
|
119
|
+
|
|
120
|
+
const promises = projects.map(async prj => {
|
|
121
|
+
const prjDeps = await getLocalProjectFixedDeps(prj)
|
|
122
|
+
deps = { ...deps, ...prjDeps};
|
|
123
|
+
return deps;
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
await Promise.all(promises);
|
|
127
|
+
return deps;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
41
135
|
module.exports.installDeps = (prj, envTarget, compositeType) => {
|
|
42
136
|
let finalDeps, compositeDeps;
|
|
43
137
|
|
|
@@ -87,13 +181,108 @@ module.exports.installDepsStandalone = (prj) => {
|
|
|
87
181
|
})
|
|
88
182
|
}
|
|
89
183
|
|
|
90
|
-
module.exports.installPackage = (prj, npmPkg) => {
|
|
91
|
-
return Promise.resolve()
|
|
92
|
-
.then(() => {
|
|
93
|
-
return innerCommon.executeInstallPackage(process.cwd(), npmPkg);
|
|
94
|
-
})
|
|
95
184
|
|
|
96
|
-
|
|
97
|
-
|
|
185
|
+
|
|
186
|
+
const getLocalProjectRemoteDeps = module.exports.getLocalProjectRemoteDeps = (prj) => {
|
|
187
|
+
|
|
188
|
+
if (prj.initRemoteDependencies && remotesImport) {
|
|
189
|
+
|
|
190
|
+
tools.logTitle('Importing remotes deps');
|
|
191
|
+
|
|
192
|
+
return Promise.resolve()
|
|
193
|
+
.then(() => {
|
|
194
|
+
return metadataUtils.package.getPackagesDeps('packages');
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
.then((snapshotsMetadata) => {
|
|
198
|
+
let remoteDeps = {};
|
|
199
|
+
|
|
200
|
+
const euiVersion = configUtils.projects.getProjectEuiVersion(prj).split('.')[0];
|
|
201
|
+
const remotes = configUtils.packages.getCsdrRemotePackages(euiVersion, prj.hostName);
|
|
202
|
+
|
|
203
|
+
remotes
|
|
204
|
+
.map((p) => {
|
|
205
|
+
return { npmgPkg: p.npmPkg, version: snapshotsMetadata[p.npmPkg] }
|
|
206
|
+
})
|
|
207
|
+
.forEach((r) => {
|
|
208
|
+
if (!r.version) {
|
|
209
|
+
tools.logInfo(`${r.npmgPkg} => no version found, probably the remote hasn't been released yet...skipping`)
|
|
210
|
+
} else {
|
|
211
|
+
remoteDeps[r.npmgPkg] = r.version;
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
tools.logInfo('Remotes found :');
|
|
216
|
+
console.log(remoteDeps);
|
|
217
|
+
|
|
218
|
+
return remoteDeps;
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
module.exports.getLocalProjectsRemoteDeps = async _ => {
|
|
224
|
+
const projects = configUtils.projects.getProjects();
|
|
225
|
+
let deps = {};
|
|
226
|
+
|
|
227
|
+
const promises = projects.map(async prj => {
|
|
228
|
+
const prjDeps = await getLocalProjectRemoteDeps(prj)
|
|
229
|
+
deps = { ...deps, ...prjDeps};
|
|
230
|
+
return deps;
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
await Promise.all(promises);
|
|
234
|
+
return deps;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
module.exports.importLocalProjectRemotes = (prj, remoteDeps) => {
|
|
240
|
+
if (prj.initRemoteDependencies) {
|
|
241
|
+
tools.logInfo(`Import remotes for project : ${prj.name}`);
|
|
242
|
+
|
|
243
|
+
remoteDeps = Object.keys(remoteDeps);
|
|
244
|
+
|
|
245
|
+
if (remoteDeps.length === 0) {
|
|
246
|
+
tools.logWarning('Remotes dependencies not found for project...skipping');
|
|
247
|
+
|
|
248
|
+
} else {
|
|
249
|
+
tools.logInfo(`Initializing ${remoteDeps.length} remotes`);
|
|
250
|
+
|
|
251
|
+
remoteDeps.forEach((remoteNpmPkg) => {
|
|
252
|
+
tools.logInfo(`Checking import for : ${remoteNpmPkg}`);
|
|
253
|
+
|
|
254
|
+
// check if package has been installed locally
|
|
255
|
+
if (configUtils.packages.isLocalPackage(remoteNpmPkg)) {
|
|
256
|
+
tools.logInfo('remote is installed locally...skipping import');
|
|
257
|
+
|
|
258
|
+
} else {
|
|
259
|
+
const pkg = configUtils.packages.getPackageByNpmPkg(remoteNpmPkg, true);
|
|
260
|
+
const projectElementsPath = path.join(process.cwd(), prj.folder, 'src', 'assets', 'elements', pkg.name, 'bundles');
|
|
261
|
+
|
|
262
|
+
const npmPkgScope = remoteNpmPkg.substr(0, remoteNpmPkg.indexOf('/'));
|
|
263
|
+
const npmPkgName = remoteNpmPkg.substr(remoteNpmPkg.indexOf('/') + 1);
|
|
264
|
+
const remoteNmPath = path.join(process.cwd(), 'node_modules', npmPkgScope, npmPkgName, 'bundles');
|
|
265
|
+
|
|
266
|
+
tools.logInfo(`${remoteNpmPkg} - injecting in ${projectElementsPath}`);
|
|
267
|
+
tools.copydir(remoteNmPath, projectElementsPath);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
module.exports.importLocalProjectsRemotes = (deps) => {
|
|
276
|
+
const projects = configUtils.projects.getProjects();
|
|
277
|
+
|
|
278
|
+
tools.logTitle('Importing local projects remotes');
|
|
279
|
+
|
|
280
|
+
if (remotesImport) {
|
|
281
|
+
projects.forEach(p => {
|
|
282
|
+
if (p) {
|
|
283
|
+
this.importLocalProjectRemotes(p, deps);
|
|
284
|
+
}
|
|
98
285
|
})
|
|
286
|
+
}
|
|
99
287
|
}
|
|
288
|
+
|
|
@@ -8,7 +8,6 @@ const glob = require('glob');
|
|
|
8
8
|
const installUtils = require('../../install/install-utils');
|
|
9
9
|
const configUtils = require('../../config/config-utils');
|
|
10
10
|
const auditUtils = require('../../audit/audit-utils');
|
|
11
|
-
const notificationUtils = require('../../../utils/notification/notification-utils');
|
|
12
11
|
const tools = require('../../../utils/tools');
|
|
13
12
|
|
|
14
13
|
|
|
@@ -26,16 +25,19 @@ module.exports.install = (pkg, isMaster) => {
|
|
|
26
25
|
return installUtils.buildPackage.installPackage(prj, pkg, isMaster);
|
|
27
26
|
})
|
|
28
27
|
|
|
29
|
-
|
|
30
28
|
// CHECK INTERNAL DEPENDENCIES
|
|
31
29
|
.then(() => {
|
|
32
|
-
return
|
|
30
|
+
return auditUtils.deps.audit(pkg);
|
|
33
31
|
})
|
|
34
32
|
|
|
33
|
+
// CHECK STYLES USAGE
|
|
34
|
+
.then(() => {
|
|
35
|
+
return auditUtils.styles.audit(pkg);
|
|
36
|
+
})
|
|
35
37
|
|
|
36
38
|
// AUDIT DEPENDENCIES
|
|
37
39
|
.then(() => {
|
|
38
|
-
return auditUtils.audit(pkg);
|
|
40
|
+
return auditUtils.yarn.audit(pkg);
|
|
39
41
|
})
|
|
40
42
|
|
|
41
43
|
|
|
@@ -63,84 +65,3 @@ module.exports.installOnly = (pkg) => {
|
|
|
63
65
|
throw e;
|
|
64
66
|
})
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const checkDeps = (pkg) => {
|
|
70
|
-
tools.logTitle('Checking package internal dependencies');
|
|
71
|
-
|
|
72
|
-
return Promise.resolve()
|
|
73
|
-
.then(() => {
|
|
74
|
-
var depsFound = [];
|
|
75
|
-
var files = glob.sync('**/*.ts', { cwd: pkg.paths.pkgLibFolder, nodir: true, follow: true, dot: true });
|
|
76
|
-
files.forEach(file => {
|
|
77
|
-
const filePath = path.join(pkg.paths.pkgLibFolder, file);
|
|
78
|
-
const fileContent = tools.getFileContent(filePath);
|
|
79
|
-
var regex = /@cc\/|@mywp\/|@opsys\/|@sfc\//gi, result, indices = [];
|
|
80
|
-
while ( (result = regex.exec(fileContent)) ) {
|
|
81
|
-
indices.push(result.index);
|
|
82
|
-
}
|
|
83
|
-
if (indices.length !== 0) {
|
|
84
|
-
// tools.logInfo(`Number of occurences found : ${indices.length}`);
|
|
85
|
-
indices.forEach((i) => {
|
|
86
|
-
const endPos = fileContent.substr(i, 40).indexOf("'");
|
|
87
|
-
const dep = fileContent.substr(i, endPos);
|
|
88
|
-
if (endPos > -1) {
|
|
89
|
-
// tools.logInfo(`dep found on : ${dep}`);
|
|
90
|
-
depsFound.push(dep);
|
|
91
|
-
|
|
92
|
-
} else {
|
|
93
|
-
tools.logInfo(`Potential wrong import detected on file : ${file}`);
|
|
94
|
-
const subContent = fileContent.substr(i, 40);
|
|
95
|
-
const detectMultiSlashes = subContent.match(/\//g);
|
|
96
|
-
if (detectMultiSlashes.length > 0) {
|
|
97
|
-
tools.logError('Multislashes on import : ');
|
|
98
|
-
console.log(subContent);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
depsFound = tools.removeArrayDuplicates(depsFound);
|
|
105
|
-
tools.logWarning(`Dependencies found : ${depsFound.length}`);
|
|
106
|
-
console.log(depsFound);
|
|
107
|
-
|
|
108
|
-
return depsFound;
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
.then((depsFound) => {
|
|
112
|
-
var depsLevel;
|
|
113
|
-
|
|
114
|
-
switch(true) {
|
|
115
|
-
case (depsFound.length === 1):
|
|
116
|
-
depsLevel = 'LOW (1)';
|
|
117
|
-
break;
|
|
118
|
-
case (depsFound.length > 1 && depsFound.length <= 3):
|
|
119
|
-
depsLevel = 'MEDIUM (between 1 and 3)';
|
|
120
|
-
break;
|
|
121
|
-
case (depsFound.length > 3 && depsFound.length <= 5):
|
|
122
|
-
depsLevel = 'HIGH (between 3 and 5)';
|
|
123
|
-
break;
|
|
124
|
-
case (depsFound.length > 5):
|
|
125
|
-
depsLevel = 'VERY HIGH (>5)';
|
|
126
|
-
break;
|
|
127
|
-
default:
|
|
128
|
-
depsLevel = 'NONE';
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
var message = `Internal dependencies detected : ${depsFound.length} - deps level: ${depsLevel}\n`;
|
|
132
|
-
message += depsFound.join('\n');
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return notificationUtils.package.sendPackageMessage({
|
|
136
|
-
package: pkg,
|
|
137
|
-
text: message
|
|
138
|
-
});
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
.catch((e) => {
|
|
142
|
-
console.log(e);
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
@@ -36,31 +36,31 @@ module.exports.sync = () => {
|
|
|
36
36
|
return configUtils.sync.run();
|
|
37
37
|
})
|
|
38
38
|
.then(() => {
|
|
39
|
-
return initUtils.
|
|
39
|
+
return initUtils.packages.importPackages({reset: true});
|
|
40
40
|
})
|
|
41
41
|
.then(() => {
|
|
42
|
-
return initUtils.
|
|
42
|
+
return initUtils.projects.importScripts();
|
|
43
43
|
})
|
|
44
44
|
.then(() => {
|
|
45
|
-
return initUtils.importExtraTsConfig();
|
|
45
|
+
return initUtils.projects.importExtraTsConfig();
|
|
46
46
|
})
|
|
47
47
|
.then(() => {
|
|
48
|
-
return initUtils.importExternalFeatures();
|
|
48
|
+
return initUtils.projects.importExternalFeatures();
|
|
49
49
|
})
|
|
50
50
|
.then(() => {
|
|
51
|
-
return initUtils.importExternalSources();
|
|
51
|
+
return initUtils.projects.importExternalSources();
|
|
52
52
|
})
|
|
53
53
|
.then(() => {
|
|
54
|
-
return initUtils.importExternalMock();
|
|
54
|
+
return initUtils.projects.importExternalMock();
|
|
55
55
|
})
|
|
56
56
|
.then(() => {
|
|
57
57
|
return initUtils.meta.init();
|
|
58
58
|
})
|
|
59
59
|
.then(() => {
|
|
60
|
-
return initUtils.processLocalEuiVersions();
|
|
60
|
+
return initUtils.global.processLocalEuiVersions();
|
|
61
61
|
})
|
|
62
62
|
.then(() => {
|
|
63
|
-
return initUtils.processResolutionsForNodeVersion();
|
|
63
|
+
return initUtils.global.processResolutionsForNodeVersion();
|
|
64
64
|
})
|
|
65
65
|
.catch((e) => {
|
|
66
66
|
throw e;
|