@eui/tools 6.1.8 → 6.2.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 +18 -0
- package/bin/eui-scripts.js +4 -0
- package/bin/scripts/build-remote.js +20 -0
- package/bin/scripts/serve-remote.js +12 -0
- package/package.json +1 -1
- package/scripts/csdr/config/angular.js +7 -3
- package/scripts/csdr/config/config-utils.js +1 -0
- package/scripts/csdr/config/packages.js +2 -1
- package/scripts/csdr/config/remotes.js +76 -0
- package/scripts/csdr/init/init.js +34 -16
- package/scripts/csdr/init/remotes/15.x/package.json +8 -0
- package/scripts/csdr/init/remotes.js +102 -6
- package/scripts/csdr/install/local-dev.js +18 -0
- package/scripts/csdr/install/projects.js +8 -0
- package/scripts/csdr/install/remotes.js +5 -5
- package/scripts/utils/build/package/element.js +22 -15
- package/scripts/utils/pre-build/injection/externals.js +2 -2
- package/scripts/utils/serve/element.js +22 -9
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.1
|
|
1
|
+
6.2.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 6.2.1 (2022-11-09)
|
|
2
|
+
|
|
3
|
+
##### Chores
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* patch project fetch base deps - EUI-6448 [EUI-6448](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6448) ([578739c3](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/578739c338a2b5521fb924cbdd0b4d25e9cbc4e3))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.2.0 (2022-11-09)
|
|
11
|
+
|
|
12
|
+
##### New Features
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* virtual remote feature implementation - add remote build and serve script - remote root skeleton for 15.x - MWP-8946 [MWP-8946](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-8946) ([784f9019](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/784f90194305e6ecb9a4ffb1c0d4b74efaf363dd))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 6.1.8 (2022-11-08)
|
|
2
20
|
|
|
3
21
|
##### Bug Fixes
|
package/bin/eui-scripts.js
CHANGED
|
@@ -13,11 +13,13 @@ const scriptIndex = args.findIndex(
|
|
|
13
13
|
x === 'build-package-pr-scan' ||
|
|
14
14
|
x === 'build-package-sub' ||
|
|
15
15
|
x === 'build-element' ||
|
|
16
|
+
x === 'build-remote' ||
|
|
16
17
|
x === 'build-deps' ||
|
|
17
18
|
x === 'build-all' ||
|
|
18
19
|
x === 'build-app' ||
|
|
19
20
|
x === 'serve-app' ||
|
|
20
21
|
x === 'serve-element' ||
|
|
22
|
+
x === 'serve-remote' ||
|
|
21
23
|
x === 'serve-mock' ||
|
|
22
24
|
x === 'start-symfony' ||
|
|
23
25
|
x === 'a11y-app' ||
|
|
@@ -53,11 +55,13 @@ switch (script) {
|
|
|
53
55
|
case 'build-package-pr-scan':
|
|
54
56
|
case 'build-package-sub':
|
|
55
57
|
case 'build-element':
|
|
58
|
+
case 'build-remote':
|
|
56
59
|
case 'build-deps':
|
|
57
60
|
case 'build-all':
|
|
58
61
|
case 'build-app':
|
|
59
62
|
case 'serve-app':
|
|
60
63
|
case 'serve-element':
|
|
64
|
+
case 'serve-remote':
|
|
61
65
|
case 'serve-mock':
|
|
62
66
|
case 'start-symfony':
|
|
63
67
|
case 'a11y-app':
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const tools = require('../../scripts/utils/tools');
|
|
4
|
+
const configUtils = require('../../scripts/csdr/config/config-utils');
|
|
5
|
+
const buildPackageUtils = require('../../scripts/utils/build/package/build-package-utils');
|
|
6
|
+
|
|
7
|
+
Promise.resolve()
|
|
8
|
+
.then(() => {
|
|
9
|
+
const remote = configUtils.remotes.getRemote();
|
|
10
|
+
return buildPackageUtils.build(remote);
|
|
11
|
+
})
|
|
12
|
+
.then(() => {
|
|
13
|
+
tools.logSuccess();
|
|
14
|
+
})
|
|
15
|
+
.catch((e) => {
|
|
16
|
+
tools.logError('ERROR detected during build process');
|
|
17
|
+
console.error(e);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
});
|
|
20
|
+
|
package/package.json
CHANGED
|
@@ -170,12 +170,16 @@ module.exports.registerAngularProjectDef = (project, build = false, element = fa
|
|
|
170
170
|
// checking if root angular.json exists, create if not
|
|
171
171
|
const file = path.join(process.cwd(), 'angular.json');
|
|
172
172
|
|
|
173
|
-
// getting the eUI version of the project
|
|
173
|
+
// getting the eUI version of the project and setting path
|
|
174
174
|
let euiVersion;
|
|
175
|
+
let angularRootPath;
|
|
176
|
+
|
|
175
177
|
if (element) {
|
|
176
178
|
euiVersion = innerPackages.getRemoteEuiVersion(project);
|
|
179
|
+
angularRootPath = project.paths.root;
|
|
177
180
|
} else {
|
|
178
181
|
euiVersion = innerProjects.getProjectEuiVersion(project);
|
|
182
|
+
angularRootPath = project.paths.angularPath;
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
|
|
@@ -188,9 +192,9 @@ module.exports.registerAngularProjectDef = (project, build = false, element = fa
|
|
|
188
192
|
// injecting angular project definition
|
|
189
193
|
let angularConfigFile;
|
|
190
194
|
|
|
191
|
-
if (tools.isFileExists(path.join(
|
|
195
|
+
if (tools.isFileExists(path.join(angularRootPath, 'angular-config.json'))) {
|
|
192
196
|
tools.logInfo(`Registering project angular config...`);
|
|
193
|
-
const angularConfigFilePath = path.join(
|
|
197
|
+
const angularConfigFilePath = path.join(angularRootPath, 'angular-config.json');
|
|
194
198
|
delete require.cache[angularConfigFilePath];
|
|
195
199
|
angularConfigFile = require(angularConfigFilePath);
|
|
196
200
|
}
|
|
@@ -190,6 +190,7 @@ module.exports.getPackagePaths = (pkg) => {
|
|
|
190
190
|
remoteNodeModules: remoteNodeModules,
|
|
191
191
|
packages: resolvePath(packagesBasePath),
|
|
192
192
|
root: resolvePath(packagesPath + '/' + folder),
|
|
193
|
+
fromRoot: packagesPath + '/' + folder,
|
|
193
194
|
dist: resolvePath(packagesPath + '/' + folder + '/dist'),
|
|
194
195
|
publish: resolvePath(packagesPath + '/' + folder + publishFolder),
|
|
195
196
|
src: resolvePath(packagesPath + '/' + folder + '/src'),
|
|
@@ -316,7 +317,7 @@ module.exports.getDepGraph = () => {
|
|
|
316
317
|
const getEuiVersionCore = (pkg) => {
|
|
317
318
|
let version;
|
|
318
319
|
|
|
319
|
-
const depsCompositeFile = path.join(pkg.paths.
|
|
320
|
+
const depsCompositeFile = path.join(pkg.paths.root, 'dependencies-composite.json');
|
|
320
321
|
tools.logInfo(`---- Try fetching version from ${depsCompositeFile}`);
|
|
321
322
|
|
|
322
323
|
if (!tools.isFileExists(depsCompositeFile)) {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// LOCAL
|
|
7
|
+
const tools = require('../../utils/tools');
|
|
8
|
+
|
|
9
|
+
module.exports.getRemote = (remoteName, euiVersion) => {
|
|
10
|
+
|
|
11
|
+
if (!remoteName) {
|
|
12
|
+
remoteName = tools.getArgs().root;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (!euiVersion) {
|
|
16
|
+
euiVersion = tools.getArgs().euiVersion;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
tools.logTitle(`Getting remote config for ${remoteName} version ${euiVersion}`);
|
|
20
|
+
|
|
21
|
+
if (!euiVersion) {
|
|
22
|
+
throw new error('euiVersion should be provided as parameter');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const remotesConfig = require(path.join(process.cwd(), '.csdr', '.euirc-csdr-remotes.json'));
|
|
26
|
+
const remoteConfig = remotesConfig[remoteName];
|
|
27
|
+
|
|
28
|
+
if (!remoteConfig.supportedVersions && !remoteConfig.supportedVersions.includes(euiVersion)) {
|
|
29
|
+
throw new Error(`Version ${euiVersion} cannot be found in the global config of ${remoteName}`);
|
|
30
|
+
|
|
31
|
+
} else {
|
|
32
|
+
tools.logInfo('Global config found');
|
|
33
|
+
console.log(remoteConfig);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const remotePath = path.join(process.cwd(), 'packages', 'csdr-remotes-config', 'assets', remoteName, euiVersion);
|
|
37
|
+
|
|
38
|
+
tools.logInfo(`Getting remote information from ${remotePath}`);
|
|
39
|
+
|
|
40
|
+
if (!tools.isDirExists(remotePath)) {
|
|
41
|
+
throw new Error(`Remote ${remoteName} cannot be found in the remotes config global `);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const euiVersionNumber = euiVersion.split('.')[0];
|
|
46
|
+
|
|
47
|
+
const fullName = `${remoteName}-eui${euiVersionNumber}`;
|
|
48
|
+
const remoteRootPath = path.join(process.cwd(), 'remotes', fullName);
|
|
49
|
+
|
|
50
|
+
const remote = {
|
|
51
|
+
name: remoteName,
|
|
52
|
+
version: euiVersion,
|
|
53
|
+
fullName: fullName,
|
|
54
|
+
element: true,
|
|
55
|
+
remote: true,
|
|
56
|
+
virtual: true,
|
|
57
|
+
angularConfig: tools.getJsonFileContent(path.join(remotePath, 'angular-config.json')),
|
|
58
|
+
dependencies: tools.getJsonFileContent(path.join(remotePath, 'dependencies.json')),
|
|
59
|
+
paths: {
|
|
60
|
+
root: remoteRootPath,
|
|
61
|
+
fromRoot: `remotes/${fullName}`,
|
|
62
|
+
repoNodeModules: path.join(remoteRootPath, 'node_modules'),
|
|
63
|
+
},
|
|
64
|
+
devopsMetadataFile: `${fullName}-build-metadata.json`,
|
|
65
|
+
devopsVersionsMetadataFile: `${fullName}-versions-metadata.json`,
|
|
66
|
+
devopsHistoryMetadataFile: `${fullName}-history-metadata.json`,
|
|
67
|
+
devopsEnvsMetadataFile: `${fullName}-envs-metadata.json`,
|
|
68
|
+
...remoteConfig,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!remote.dependencies.composite) {
|
|
72
|
+
throw new Error('The remote config does not contains the manadatory "composite" dependencies');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return remote;
|
|
76
|
+
}
|
|
@@ -8,22 +8,25 @@ const configUtils = require('../config/config-utils');
|
|
|
8
8
|
// Getting arguments if they are provided for the CI/CD pipeline
|
|
9
9
|
const {
|
|
10
10
|
project, team, pkg, branch, configOnly, skipClone, skipInstall, reset, pkgOnly, prjOnly,
|
|
11
|
-
build, containerOnly, skipAppContainers
|
|
11
|
+
build, containerOnly, skipAppContainers, remote, euiVersion, remoteOnly
|
|
12
12
|
} = tools.getArgs();
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
module.exports.init = () => {
|
|
16
16
|
// Initializing a common response
|
|
17
17
|
const initialResponse = {
|
|
18
|
-
project: project,
|
|
18
|
+
project: project || null,
|
|
19
19
|
team: team || 'all',
|
|
20
20
|
pkg: pkg || null,
|
|
21
|
+
remote: remote || null,
|
|
22
|
+
euiVersion: euiVersion || null,
|
|
21
23
|
branch: branch || 'develop',
|
|
22
24
|
configOnly: configOnly || false,
|
|
23
25
|
skipClone: skipClone || false,
|
|
24
26
|
reset: reset || false,
|
|
25
|
-
pkgOnly: pkgOnly ||
|
|
27
|
+
pkgOnly: pkgOnly || true,
|
|
26
28
|
prjOnly: prjOnly || false,
|
|
29
|
+
remoteOnly: remoteOnly || true,
|
|
27
30
|
build: build || false,
|
|
28
31
|
containerOnly: containerOnly || false,
|
|
29
32
|
skipAppContainers: skipAppContainers || false
|
|
@@ -47,7 +50,7 @@ module.exports.init = () => {
|
|
|
47
50
|
.then(() => {
|
|
48
51
|
|
|
49
52
|
// if no project has been provided we prompt for project and team selection
|
|
50
|
-
if (!project && !pkg) {
|
|
53
|
+
if (!project && !pkg && !remote) {
|
|
51
54
|
return initUtils.prompt.start();
|
|
52
55
|
|
|
53
56
|
// if provided, we are on automated mode, we use the initialized response
|
|
@@ -64,7 +67,9 @@ module.exports.init = () => {
|
|
|
64
67
|
// Initializing .euirc.json local file - the core of CSDR operations
|
|
65
68
|
.then(() => {
|
|
66
69
|
// Initialize config
|
|
67
|
-
|
|
70
|
+
if (!remote) {
|
|
71
|
+
return configUtils.init.run(finalResponse);
|
|
72
|
+
}
|
|
68
73
|
})
|
|
69
74
|
|
|
70
75
|
// clone or install linked host package to project if any
|
|
@@ -79,19 +84,23 @@ module.exports.init = () => {
|
|
|
79
84
|
|
|
80
85
|
// Initializing .meta based on .euirc.json for local respoisitories cloning
|
|
81
86
|
.then(() => {
|
|
82
|
-
|
|
87
|
+
if (!remote) {
|
|
88
|
+
return initUtils.meta.init();
|
|
89
|
+
}
|
|
83
90
|
})
|
|
84
91
|
|
|
85
92
|
// Cloning repositories based on the .meta file generated
|
|
86
93
|
.then(() => {
|
|
87
|
-
if (!skipClone) {
|
|
94
|
+
if (!skipClone && !remote) {
|
|
88
95
|
return initUtils.repos.init(finalResponse);
|
|
89
96
|
}
|
|
90
97
|
})
|
|
91
98
|
|
|
92
99
|
// Importing packages and generating definitions
|
|
93
100
|
.then(() => {
|
|
94
|
-
|
|
101
|
+
if (!remote) {
|
|
102
|
+
return initUtils.packages.importPackages(finalResponse);
|
|
103
|
+
}
|
|
95
104
|
})
|
|
96
105
|
|
|
97
106
|
// Importing external sources
|
|
@@ -101,12 +110,17 @@ module.exports.init = () => {
|
|
|
101
110
|
}
|
|
102
111
|
})
|
|
103
112
|
|
|
104
|
-
// Generating virtual remote - experimental
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
// Generating virtual remote - experimental
|
|
114
|
+
.then(() => {
|
|
115
|
+
if (finalResponse.remote) {
|
|
116
|
+
if (finalResponse.euiVersion) {
|
|
117
|
+
return initUtils.remotes.generateVirtualRemote(remote, euiVersion);
|
|
118
|
+
} else {
|
|
119
|
+
tools.logError('When a remote is initialized, an "euiVersion" parameter must be specified');
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
110
124
|
|
|
111
125
|
// adapt and inject particular root data/config for eUI version detected on project
|
|
112
126
|
// if multiple versions of eUI are detected on the same project, an exception is thrown
|
|
@@ -124,8 +138,12 @@ module.exports.init = () => {
|
|
|
124
138
|
// this is only executed for local dev installation,
|
|
125
139
|
// in case of release the initialisation is managed by the application / package themselves
|
|
126
140
|
if (!build && !skipInstall) {
|
|
127
|
-
if (finalResponse.pkgOnly) {
|
|
128
|
-
|
|
141
|
+
if (finalResponse.pkgOnly || finalResponse.remoteOnly) {
|
|
142
|
+
if (finalResponse.remote) {
|
|
143
|
+
return installUtils.localDev.installRemote(remote);
|
|
144
|
+
} else {
|
|
145
|
+
return installUtils.localDev.installPackage(pkg);
|
|
146
|
+
}
|
|
129
147
|
} else {
|
|
130
148
|
return installUtils.localDev.install();
|
|
131
149
|
}
|
|
@@ -6,16 +6,112 @@ const path = require('path');
|
|
|
6
6
|
// LOCAL
|
|
7
7
|
const tools = require('../../utils/tools');
|
|
8
8
|
const configUtils = require('../config/config-utils');
|
|
9
|
+
const gitUtils = require('../../utils/git-utils');
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
module.exports.generateVirtualRemote = (pkgName) => {
|
|
12
|
-
const pkg = configUtils.packages.getPackage(pkgName, true);
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
13
|
+
const cloneRemotesConfig = module.exports.cloneRemotesConfig = () => {
|
|
17
14
|
|
|
15
|
+
tools.logTitle('Cloning global remotes config');
|
|
16
|
+
|
|
17
|
+
let pkg;
|
|
18
|
+
|
|
19
|
+
return Promise.resolve()
|
|
20
|
+
.then(() => {
|
|
21
|
+
pkg = configUtils.packages.getPackageByNpmPkg('@csdr/remotes-config', true);
|
|
22
|
+
return gitUtils.cloneAndCheckout(pkg.repository, path.join(process.cwd(), 'packages', pkg.name), 'master');
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
.then(() => {
|
|
26
|
+
const newPackages = [];
|
|
27
|
+
newPackages.push(pkg.name);
|
|
28
|
+
return configUtils.global.updateConfig(null, newPackages);
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
.catch((e) => {
|
|
32
|
+
throw e;
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
module.exports.generateVirtualRemote = (remoteName, euiVersion) => {
|
|
18
39
|
tools.logTitle('Generate virtual remote');
|
|
19
40
|
|
|
20
|
-
|
|
41
|
+
return Promise.resolve()
|
|
42
|
+
|
|
43
|
+
// clone remotes config if first init
|
|
44
|
+
.then(() => {
|
|
45
|
+
return cloneRemotesConfig();
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
.then(() => {
|
|
49
|
+
// getting the remote config
|
|
50
|
+
const remote = configUtils.remotes.getRemote(remoteName, euiVersion);
|
|
51
|
+
|
|
52
|
+
if (!remote) {
|
|
53
|
+
throw new Error(`Remote ${remoteName} can't be found in the remotes CSDR configuration OR the remotes configs of the project`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
tools.logInfo('Remote config gathered:')
|
|
57
|
+
console.log(remote);
|
|
58
|
+
|
|
59
|
+
// constructing the remote folder
|
|
60
|
+
const remotePath = path.join(process.cwd(), 'remotes', remote.fullName);
|
|
61
|
+
const remoteSkeletonPath = path.join(__dirname, 'remotes', euiVersion);
|
|
62
|
+
|
|
63
|
+
tools.copy(remoteSkeletonPath, remotePath);
|
|
64
|
+
|
|
65
|
+
// adding the dependendies files
|
|
66
|
+
tools.writeJsonFileSync(path.join(remotePath, 'dependencies-composite.json'), remote.dependencies.composite);
|
|
67
|
+
if (remote.dependencies.base) {
|
|
68
|
+
tools.writeJsonFileSync(path.join(remotePath, 'dependencies-base.json'), remote.dependencies.base);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// adding dependencies per env
|
|
72
|
+
const envs = ['INT', 'ACC', 'DLT', 'TRN', 'PROD'];
|
|
73
|
+
|
|
74
|
+
envs.forEach((env) => {
|
|
75
|
+
if (remote.dependencies[env]) {
|
|
76
|
+
tools.writeJsonFileSync(path.join(remotePath, `dependencies-composite-${env}.json`), remote.dependencies[env]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// generating angular json
|
|
81
|
+
const angularJsonPath = path.join(remotePath, 'angular.json');
|
|
82
|
+
let angularJson = tools.getJsonFileContent(angularJsonPath);
|
|
83
|
+
|
|
84
|
+
let angularContent = JSON.stringify(angularJson);
|
|
85
|
+
angularContent = angularContent.replace('@remote.name@', remote.fullName);
|
|
86
|
+
|
|
87
|
+
angularJson = JSON.parse(angularContent);
|
|
88
|
+
angularJson.projects[remote.fullName].architect.build.options.styles = remote.angularConfig.styles;
|
|
89
|
+
|
|
90
|
+
if (remote.angularConfig.scripts) {
|
|
91
|
+
angularJson.projects[remote.fullName].architect.build.options.scripts = [
|
|
92
|
+
...angularJson.projects[remote.fullName].architect.build.options.scripts,
|
|
93
|
+
...remote.angularConfig.scripts
|
|
94
|
+
];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
tools.writeJsonFileSync(angularJsonPath, angularJson);
|
|
98
|
+
|
|
99
|
+
tools.logSuccess('OK => angular.json generated');
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
// generating package.json
|
|
103
|
+
const packageJsonPath = path.join(remotePath, 'package.json');
|
|
104
|
+
let packageJson = tools.getJsonFileContent(packageJsonPath);
|
|
105
|
+
|
|
106
|
+
packageJson.name = remote.npmPkg;
|
|
107
|
+
|
|
108
|
+
tools.writeJsonFileSync(packageJsonPath, packageJson);
|
|
109
|
+
|
|
110
|
+
tools.logSuccess('OK => package.json generated');
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
.catch((e) => {
|
|
115
|
+
throw e;
|
|
116
|
+
})
|
|
21
117
|
}
|
|
@@ -34,6 +34,24 @@ module.exports.installPackage = (pkgName) => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
module.exports.installRemote = (remoteName) => {
|
|
38
|
+
|
|
39
|
+
const remote = configUtils.remotes.getRemote(remoteName);
|
|
40
|
+
|
|
41
|
+
return Promise.resolve()
|
|
42
|
+
.then(() => {
|
|
43
|
+
return metadataUtils.common.cloneMetadataRepo(true);
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
.then(() => {
|
|
47
|
+
return innerRemotes.installDeps(remote);
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
.catch((e) => {
|
|
51
|
+
throw e;
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
|
|
37
55
|
|
|
38
56
|
module.exports.install = () => {
|
|
39
57
|
let finalDeps = {}, resolvedDeps = {}, remoteDeps = {};
|
|
@@ -154,7 +154,15 @@ module.exports.installDeps = (prj, envTarget, compositeType) => {
|
|
|
154
154
|
|
|
155
155
|
// fetching extra dependencies on project
|
|
156
156
|
const prjBaseJsonFile = path.join(process.cwd(), prj.folder, 'dependencies-base.json');
|
|
157
|
+
|
|
158
|
+
tools.logInfo(`Getting base dependencies from : ${prjBaseJsonFile}`);
|
|
159
|
+
console.log(tools.getJsonFileContent(prjBaseJsonFile));
|
|
160
|
+
|
|
157
161
|
const prjBaseDeps = tools.getJsonFileContent(prjBaseJsonFile) || {};
|
|
162
|
+
|
|
163
|
+
tools.logInfo('Found base dependencies:');
|
|
164
|
+
console.log(prjBaseDeps);
|
|
165
|
+
|
|
158
166
|
const fixedDeps = configUtils.global.getConfig().npm.fixedDependencies;
|
|
159
167
|
|
|
160
168
|
return innerCommon.installDeps({ ...prjBaseDeps, ...compositeDeps, ...prjFixedDeps, ...fixedDeps });
|
|
@@ -62,7 +62,7 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
|
|
|
62
62
|
// getting base deps (3rd parties)
|
|
63
63
|
let baseDeps = {}, deps;
|
|
64
64
|
|
|
65
|
-
const depsBaseJsonFile = path.join(pkg.paths.
|
|
65
|
+
const depsBaseJsonFile = path.join(pkg.paths.root, 'dependencies-base.json');
|
|
66
66
|
if (tools.isFileExists(depsBaseJsonFile)) {
|
|
67
67
|
baseDeps = tools.getJsonFileContent(depsBaseJsonFile);
|
|
68
68
|
}
|
|
@@ -71,7 +71,7 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
|
|
|
71
71
|
deps = { ...baseDeps, ...compositeDeps };
|
|
72
72
|
|
|
73
73
|
// updating package json file before installation
|
|
74
|
-
const pkgJsonFile = path.resolve(pkg.paths.
|
|
74
|
+
const pkgJsonFile = path.resolve(pkg.paths.root, 'package.json');
|
|
75
75
|
const pkgJson = require(pkgJsonFile);
|
|
76
76
|
|
|
77
77
|
pkgJson.dependencies = deps;
|
|
@@ -87,7 +87,7 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
|
|
|
87
87
|
tools.logInfo('installing dependencies');
|
|
88
88
|
console.log(pkgJson.dependencies);
|
|
89
89
|
|
|
90
|
-
return innerCommon.executeInstall(pkg.paths.
|
|
90
|
+
return innerCommon.executeInstall(pkg.paths.root);
|
|
91
91
|
|
|
92
92
|
} else {
|
|
93
93
|
tools.logWarning('No dependencies found to install');
|
|
@@ -107,7 +107,7 @@ const pkgInstall = (pkg, envTarget, compositeType) => {
|
|
|
107
107
|
// reseting package.json
|
|
108
108
|
.finally(() => {
|
|
109
109
|
if (!dryRun) {
|
|
110
|
-
const pkgJsonFile = path.resolve(pkg.paths.
|
|
110
|
+
const pkgJsonFile = path.resolve(pkg.paths.root, 'package.json');
|
|
111
111
|
const pkgJson = require(pkgJsonFile);
|
|
112
112
|
|
|
113
113
|
pkgJson.dependencies = {};
|
|
@@ -126,7 +126,7 @@ const getDeps = module.exports.getDeps = (pkg, envTarget, compositeType) => {
|
|
|
126
126
|
})
|
|
127
127
|
.then((envsMetadata) => {
|
|
128
128
|
return innerCompositeCore.getCompositeDeps(
|
|
129
|
-
pkg.paths.
|
|
129
|
+
pkg.paths.fromRoot,
|
|
130
130
|
envTarget,
|
|
131
131
|
compositeType,
|
|
132
132
|
pkg.build && pkg.build.prevSnapshotEnabled,
|
|
@@ -21,10 +21,17 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
21
21
|
|
|
22
22
|
const remoteEuiVersion = configUtils.packages.getRemoteEuiVersion(pkg);
|
|
23
23
|
|
|
24
|
+
let pkgName;
|
|
25
|
+
if (pkg.remote && pkg.virtual) {
|
|
26
|
+
pkgName = pkg.fullName;
|
|
27
|
+
} else {
|
|
28
|
+
pkgName = pkg.name;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
return Promise.resolve()
|
|
25
32
|
|
|
26
33
|
.then(() => {
|
|
27
|
-
tools.logTitle(`Building element : ${
|
|
34
|
+
tools.logTitle(`Building element : ${pkgName}...`);
|
|
28
35
|
|
|
29
36
|
// force skipLint and skipTest on element
|
|
30
37
|
skipLint = true;
|
|
@@ -41,13 +48,13 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
41
48
|
|
|
42
49
|
const tslint = path.resolve(pkg.paths.repoNodeModules, 'tslint', 'bin', 'tslint');
|
|
43
50
|
|
|
44
|
-
const tsLintPath = path.join(pkg.paths.
|
|
45
|
-
const tsConfigPath = path.join(pkg.paths.
|
|
51
|
+
const tsLintPath = path.join(pkg.paths.root, 'tslint.json');
|
|
52
|
+
const tsConfigPath = path.join(pkg.paths.root, 'tsconfig.app.json');
|
|
46
53
|
tools.logInfo(`running tslint -c ${tsLintPath} -p ${tsConfigPath}`);
|
|
47
54
|
// return tools.runScript(`tslint -c ${tsLintPath} -p ${tsConfigPath}`);
|
|
48
55
|
|
|
49
56
|
const args = [tslint, '-c', tsLintPath, '-p', tsConfigPath];
|
|
50
|
-
return execa('node', args, { cwd: pkg.paths.
|
|
57
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
51
58
|
}
|
|
52
59
|
})
|
|
53
60
|
|
|
@@ -61,9 +68,9 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
61
68
|
|
|
62
69
|
// return tools.runScript(`stylelint ${pkg.paths.pkgRootDirectory}/src/app/**/*.scss`);
|
|
63
70
|
const stylelint = path.resolve(pkg.paths.repoNodeModules, 'stylelint', 'bin', 'stylelint');
|
|
64
|
-
const args = [stylelint, `${pkg.paths.
|
|
71
|
+
const args = [stylelint, `${pkg.paths.root}/src/app/**/*.scss`];
|
|
65
72
|
|
|
66
|
-
return execa('node', args, { cwd: pkg.paths.
|
|
73
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
67
74
|
}
|
|
68
75
|
})
|
|
69
76
|
|
|
@@ -78,9 +85,9 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
78
85
|
let args;
|
|
79
86
|
|
|
80
87
|
if (maxSpaceSize) {
|
|
81
|
-
args = ['--max_old_space_size=4096', ng, 'test',
|
|
88
|
+
args = ['--max_old_space_size=4096', ng, 'test', pkgName];
|
|
82
89
|
} else {
|
|
83
|
-
args = [ng, 'test',
|
|
90
|
+
args = [ng, 'test', pkgName];
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
if (watch) {
|
|
@@ -94,10 +101,10 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
94
101
|
tools.logInfo(`ng test : watching = ${watch || false}`);
|
|
95
102
|
|
|
96
103
|
tools.logInfo(`running Angular TEST with args: ${args} on`);
|
|
97
|
-
console.log(pkg.paths.
|
|
104
|
+
console.log(pkg.paths.root);
|
|
98
105
|
|
|
99
106
|
if (!dryRun) {
|
|
100
|
-
return execa('node', args, { cwd: pkg.paths.
|
|
107
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
})
|
|
@@ -115,9 +122,9 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
115
122
|
let args;
|
|
116
123
|
|
|
117
124
|
if (versionNumber <= 10) {
|
|
118
|
-
args = ['--max_old_space_size=8096', ng, 'build',
|
|
125
|
+
args = ['--max_old_space_size=8096', ng, 'build', pkgName, '--prod'];
|
|
119
126
|
} else {
|
|
120
|
-
args = ['--max_old_space_size=8096', ng, 'build',
|
|
127
|
+
args = ['--max_old_space_size=8096', ng, 'build', pkgName];
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
if (statsJson) {
|
|
@@ -132,7 +139,7 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
132
139
|
args.push(`--base-href=${baseHref}`);
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
const webpackExtraFile = path.join(pkg.paths.
|
|
142
|
+
const webpackExtraFile = path.join(pkg.paths.root, 'webpack.extra.js');
|
|
136
143
|
if (tools.isFileExists(webpackExtraFile)) {
|
|
137
144
|
args.push(`--extra-webpack-config=${webpackExtraFile}`);
|
|
138
145
|
}
|
|
@@ -156,10 +163,10 @@ module.exports.build = (pkg, isMaster) => {
|
|
|
156
163
|
tools.logInfo(`ng build for configuration : ${configuration || 'production'}`);
|
|
157
164
|
|
|
158
165
|
tools.logInfo(`running Angular BUILD with args: ${args} on`);
|
|
159
|
-
console.log(pkg.paths.
|
|
166
|
+
console.log(pkg.paths.root);
|
|
160
167
|
|
|
161
168
|
if (!dryRun) {
|
|
162
|
-
return execa('node', args, { cwd: pkg.paths.
|
|
169
|
+
return execa('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
163
170
|
}
|
|
164
171
|
})
|
|
165
172
|
|
|
@@ -279,7 +279,7 @@ module.exports.injectElementExternalSources = (pkg) => {
|
|
|
279
279
|
})[0];
|
|
280
280
|
|
|
281
281
|
let externalSourcesSrcPath;
|
|
282
|
-
const pkgSrcPath = path.join(pkg.paths.
|
|
282
|
+
const pkgSrcPath = path.join(pkg.paths.root, 'src');
|
|
283
283
|
|
|
284
284
|
// if local package is found
|
|
285
285
|
if (localPackage) {
|
|
@@ -292,7 +292,7 @@ module.exports.injectElementExternalSources = (pkg) => {
|
|
|
292
292
|
const npmPkgScope = pkg.externalSources.npmPkg.substr(0, pkg.externalSources.npmPkg.indexOf('/'));
|
|
293
293
|
const npmPkgName = pkg.externalSources.npmPkg.substr(pkg.externalSources.npmPkg.indexOf('/') + 1);
|
|
294
294
|
|
|
295
|
-
externalSourcesSrcPath = path.join(pkg.paths.
|
|
295
|
+
externalSourcesSrcPath = path.join(pkg.paths.root, 'node_modules', npmPkgScope, npmPkgName, pkg.externalSources.folder);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
if (!tools.isDirExists(externalSourcesSrcPath)) {
|
|
@@ -10,11 +10,24 @@ const preBuildUtils = require('../pre-build/pre-build-utils');
|
|
|
10
10
|
const configUtils = require('../../csdr/config/config-utils');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
module.exports.serve = () => {
|
|
13
|
+
module.exports.serve = (remote = false) => {
|
|
14
14
|
|
|
15
15
|
let { project, configuration, baseHref, host, proxyConfig, maxSpaceSize, port } = tools.getArgs();
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
let pkg;
|
|
18
|
+
if (remote) {
|
|
19
|
+
pkg = configUtils.remotes.getRemote();
|
|
20
|
+
} else {
|
|
21
|
+
pkg = configUtils.packages.getPackage();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let pkgName;
|
|
25
|
+
if (pkg.remote && pkg.virtual) {
|
|
26
|
+
pkgName = pkg.fullName;
|
|
27
|
+
} else {
|
|
28
|
+
pkgName = pkg.name;
|
|
29
|
+
}
|
|
30
|
+
|
|
18
31
|
|
|
19
32
|
const remoteEuiVersion = configUtils.packages.getRemoteEuiVersion(pkg);
|
|
20
33
|
|
|
@@ -30,7 +43,7 @@ module.exports.serve = () => {
|
|
|
30
43
|
|
|
31
44
|
return Promise.resolve()
|
|
32
45
|
.then(() => {
|
|
33
|
-
tools.logTitle(`Serving element : ${
|
|
46
|
+
tools.logTitle(`Serving element : ${pkgName}...`);
|
|
34
47
|
})
|
|
35
48
|
|
|
36
49
|
.then(() => {
|
|
@@ -41,17 +54,17 @@ module.exports.serve = () => {
|
|
|
41
54
|
var args;
|
|
42
55
|
|
|
43
56
|
if (maxSpaceSize) {
|
|
44
|
-
args = ['--max_old_space_size=4096', ng, 'build',
|
|
57
|
+
args = ['--max_old_space_size=4096', ng, 'build', pkgName];
|
|
45
58
|
} else {
|
|
46
|
-
args = [ng, 'build',
|
|
59
|
+
args = [ng, 'build', pkgName];
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
const projectConfig = configUtils.projects.getProject(project);
|
|
50
63
|
|
|
51
64
|
if (projectConfig.host && projectConfig.virtual) {
|
|
52
|
-
destPath = path.join(process.cwd(), 'hosts', project, 'src', 'assets', 'elements',
|
|
65
|
+
destPath = path.join(process.cwd(), 'hosts', project, 'src', 'assets', 'elements', pkgName, 'bundles');
|
|
53
66
|
} else {
|
|
54
|
-
destPath = path.join(process.cwd(), 'apps', project, 'src', 'assets', 'elements',
|
|
67
|
+
destPath = path.join(process.cwd(), 'apps', project, 'src', 'assets', 'elements', pkgName, 'bundles');
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
const versionNumber = remoteEuiVersion.split('.')[0];
|
|
@@ -70,7 +83,7 @@ module.exports.serve = () => {
|
|
|
70
83
|
args.push(`--configuration=${configuration || 'production'}`);
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
const webpackExtraFile = path.join(pkg.paths.
|
|
86
|
+
const webpackExtraFile = path.join(pkg.paths.root, 'webpack.extra.js');
|
|
74
87
|
if (tools.isFileExists(webpackExtraFile)) {
|
|
75
88
|
args.push(`--extra-webpack-config=${webpackExtraFile}`);
|
|
76
89
|
}
|
|
@@ -78,7 +91,7 @@ module.exports.serve = () => {
|
|
|
78
91
|
tools.logInfo(`ng build with args ${args}`);
|
|
79
92
|
|
|
80
93
|
const spawnSync = require('child_process').spawnSync;
|
|
81
|
-
const output = spawnSync('node', args, { cwd: pkg.paths.
|
|
94
|
+
const output = spawnSync('node', args, { cwd: pkg.paths.root, stdio: 'inherit' });
|
|
82
95
|
|
|
83
96
|
if (output.error) {
|
|
84
97
|
throw new Error(JSON.stringify(output));
|