@eui/tools 6.2.33 → 6.2.35
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 +19 -0
- package/package.json +1 -1
- package/scripts/csdr/cli/constants.js +43 -0
- package/scripts/csdr/cli/package-build-backend.js +70 -0
- package/scripts/csdr/cli/package-build-frontend.js +300 -0
- package/scripts/csdr/cli/package-prompt.js +123 -0
- package/scripts/csdr/cli/package.js +21 -438
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui15/src/app/eui-components.ts +3 -3
- package/scripts/csdr/cli/skeletons/virtual-remote/15.x/angular-config.json +8 -0
- package/scripts/csdr/cli/skeletons/virtual-remote/15.x/dependencies.json +20 -0
- package/scripts/csdr/config/config-utils.js +1 -0
- package/scripts/csdr/config/global.js +0 -170
- package/scripts/csdr/config/packages.js +3 -3
- package/scripts/csdr/config/register.js +166 -0
- package/scripts/csdr/init/remotes.js +4 -2
- package/scripts/index.js +5 -0
- package/scripts/utils/build/package/element.js +7 -4
- package/scripts/utils/pre-build/injection/routes-replacement.js +22 -2
- package/scripts/csdr/cli/skeletons/package/frontend/assets/i18n/en.json +0 -3
- package/scripts/csdr/cli/skeletons/package/frontend/assets/i18n/fr.json +0 -3
- package/scripts/csdr/cli/skeletons/package/frontend/gitignore_TO_REPLACE +0 -46
- package/scripts/csdr/cli/skeletons/package/frontend/karma.conf.js +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend/ng-package.json +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend/package.json +0 -4
- package/scripts/csdr/cli/skeletons/package/frontend/src/index.ts +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/components/cmp1/cmp1.component.html +0 -1
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/components/cmp1/cmp1.component.spec.ts.TO_REPLACE +0 -25
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/components/cmp1/cmp1.component.ts +0 -14
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/core/module.service.spec.ts.TO_REPLACE +0 -12
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/core/module.service.ts +0 -8
- package/scripts/csdr/cli/skeletons/package/frontend/src/lib/module.module.ts +0 -14
- package/scripts/csdr/cli/skeletons/package/frontend/src/test.ts.TO_REPLACE +0 -22
- package/scripts/csdr/cli/skeletons/package/frontend/tsconfig.lib.json +0 -32
- package/scripts/csdr/cli/skeletons/package/frontend/tsconfig.spec.json +0 -17
- package/scripts/csdr/cli/skeletons/package/frontend/tslint.json +0 -17
- package/scripts/csdr/cli/skeletons/package/frontend-eui14/dependencies-composite.json +0 -3
- package/scripts/csdr/cli/skeletons/package/frontend-remote/angular.json +0 -76
- package/scripts/csdr/cli/skeletons/package/frontend-remote/browserslist +0 -10
- package/scripts/csdr/cli/skeletons/package/frontend-remote/dependencies-base.json +0 -2
- package/scripts/csdr/cli/skeletons/package/frontend-remote/dependencies-composite.json +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend-remote/gitignore_TO_REPLACE +0 -64
- package/scripts/csdr/cli/skeletons/package/frontend-remote/karma.conf.js +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend-remote/package.json_TO_REPLACE +0 -8
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/dummy.scss +0 -3
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/dummy.spec.ts +0 -6
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/module.component.ts +0 -84
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/module.ts +0 -167
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/reducers/custom-route-serializer.ts +0 -28
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/reducers/index.ts +0 -42
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/app/routing.module.ts +0 -54
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/assets/.gitkeep +0 -0
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/assets/i18n-compiled/en.json +0 -1
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/assets/i18n-compiled/fr.json +0 -1
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/config/global.ts +0 -8
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/config/index.ts +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/config/modules.ts +0 -12
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/environments/environment.prod.ts +0 -3
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/environments/environment.ts +0 -15
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/favicon.ico +0 -0
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/index.html +0 -10
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/main.ts +0 -12
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/polyfills.ts +0 -86
- package/scripts/csdr/cli/skeletons/package/frontend-remote/src/test.ts.TO_REPLACE +0 -20
- package/scripts/csdr/cli/skeletons/package/frontend-remote/tsconfig.app.json +0 -20
- package/scripts/csdr/cli/skeletons/package/frontend-remote/tsconfig.spec.json +0 -18
- package/scripts/csdr/cli/skeletons/package/frontend-remote/tslint-remote.json +0 -7
- package/scripts/csdr/cli/skeletons/package/frontend-remote/tslint.json +0 -17
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui14/angular.json +0 -84
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui14/dependencies-composite.json +0 -8
- package/scripts/csdr/cli/skeletons/package/frontend-remote-eui14/src/app/eui-components.ts +0 -9
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.2.
|
|
1
|
+
6.2.35
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
## 6.2.35 (2022-11-17)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* remote init wrong function call - MWP-9039 [MWP-9039](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9039) ([ce68b425](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/ce68b425f9880f74e180a65c541ed18522d6c7a6))
|
|
7
|
+
* element v15+ default configuration production build - added routes overrides per env for v7 opsys t3 test alt env - MWP-9040 [MWP-9040](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9040) ([13770348](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/1377034823b8dbad818bdf32edb50c3c20f73a45))
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
* * *
|
|
11
|
+
## 6.2.34 (2022-11-16)
|
|
12
|
+
|
|
13
|
+
##### Chores
|
|
14
|
+
|
|
15
|
+
* **cli:**
|
|
16
|
+
* generation of virtual remotes v15 - cleanup and refactoring for v10 v15 - EUI-6825 [EUI-6825](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-6825) ([33e1ba9f](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/33e1ba9f838aafdde78ba8d0cdad44ed72e196c3))
|
|
17
|
+
|
|
18
|
+
* * *
|
|
19
|
+
* * *
|
|
1
20
|
## 6.2.33 (2022-11-16)
|
|
2
21
|
|
|
3
22
|
##### Chores
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
module.exports.TARGET_ROOT_PATH = path.join(process.cwd(), 'packages');
|
|
6
|
+
module.exports.TARGET_ROOT_REMOTES_PATH = path.join(process.cwd(), 'remotes');
|
|
7
|
+
module.exports.SKELETONS_ROOT_PATH = path.join(__dirname, 'skeletons', 'package');
|
|
8
|
+
module.exports.FRONTEND_SKELETON_EUI10_PATH = path.join(this.SKELETONS_ROOT_PATH, 'frontend-eui10');
|
|
9
|
+
module.exports.FRONTEND_SKELETON_EUI15_PATH = path.join(this.SKELETONS_ROOT_PATH, 'frontend-eui15');
|
|
10
|
+
module.exports.FRONTEND_SKELETON_REMOTE_EUI10_PATH = path.join(this.SKELETONS_ROOT_PATH, 'frontend-remote-eui10');
|
|
11
|
+
module.exports.FRONTEND_SKELETON_REMOTE_EUI15_PATH = path.join(this.SKELETONS_ROOT_PATH, 'frontend-remote-eui15');
|
|
12
|
+
module.exports.FRONTEND_OPTION_ROUTE_PATH = path.join(this.SKELETONS_ROOT_PATH, 'frontend-option-route');
|
|
13
|
+
module.exports.BACKEND_SKELETON_PATH = path.join(this.SKELETONS_ROOT_PATH, 'backend');
|
|
14
|
+
module.exports.VIRTUAL_REMOTE_SKELETON_ROOT_PATH = path.join(__dirname, 'skeletons', 'virtual-remote');
|
|
15
|
+
|
|
16
|
+
module.exports.CONFIG_OPTIONS = {
|
|
17
|
+
pkgType: {
|
|
18
|
+
FRONTEND: 'frontend',
|
|
19
|
+
BACKEND: 'backend'
|
|
20
|
+
},
|
|
21
|
+
pkgFrontendType: {
|
|
22
|
+
DEFAULT: 'default',
|
|
23
|
+
REMOTE: 'remote'
|
|
24
|
+
},
|
|
25
|
+
pkgFrontendVersion: {
|
|
26
|
+
EUI10: '10',
|
|
27
|
+
EUI15: '15',
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports.DEFAULT_CONFIG = {
|
|
32
|
+
pkgType: this.CONFIG_OPTIONS.pkgType.FRONTEND,
|
|
33
|
+
pkgFrontendType: this.CONFIG_OPTIONS.pkgFrontendType.DEFAULT,
|
|
34
|
+
pkgFrontendVersion: this.CONFIG_OPTIONS.pkgFrontendVersion.EUI10,
|
|
35
|
+
pkgName: 'my-package',
|
|
36
|
+
pkgScope: '@zzz',
|
|
37
|
+
isRouteModule: true,
|
|
38
|
+
isCsdrRepo: true,
|
|
39
|
+
isEnvTargetRemote: true,
|
|
40
|
+
isVirtualRemote: false,
|
|
41
|
+
externalRepoName: null,
|
|
42
|
+
pkgGroupId: 'eu.europa.ec.cc'
|
|
43
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// LOCAL
|
|
7
|
+
const tools = require('../../../scripts/utils/tools');
|
|
8
|
+
|
|
9
|
+
// CONSTANTS
|
|
10
|
+
const constants = require('./constants');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
module.exports.generate = (name, scope, groupId) => {
|
|
15
|
+
|
|
16
|
+
tools.logTitle('Generating package');
|
|
17
|
+
|
|
18
|
+
const artifactId = scope.substr(1, scope.length) + '-' + name + '-backend';
|
|
19
|
+
|
|
20
|
+
const targetPath = path.join(constants.TARGET_ROOT_PATH, artifactId);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
return Promise.resolve()
|
|
24
|
+
|
|
25
|
+
// CLEANING TARGET
|
|
26
|
+
.then(() => {
|
|
27
|
+
tools.logInfo('Cleaning target');
|
|
28
|
+
return tools.rimraf(targetPath + '/**/*');
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// COPY TO TARGET
|
|
33
|
+
.then(() => {
|
|
34
|
+
tools.logInfo('Copying skeleton to target');
|
|
35
|
+
return tools.copydir(constants.BACKEND_SKELETON_PATH, targetPath, true);
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// REPLACING PLACEHOLDERS
|
|
40
|
+
.then(() => {
|
|
41
|
+
tools.logInfo('Replacing placeholders');
|
|
42
|
+
|
|
43
|
+
return Promise.resolve()
|
|
44
|
+
.then(() => {
|
|
45
|
+
return tools.replaceInPath(targetPath, '@groupId@', groupId);
|
|
46
|
+
})
|
|
47
|
+
.then(() => {
|
|
48
|
+
return tools.replaceInPath(targetPath, '@artifactId@', artifactId);
|
|
49
|
+
})
|
|
50
|
+
.catch((e) => {
|
|
51
|
+
throw e;
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
.then(() => {
|
|
56
|
+
tools.logInfo('Executing post build operations');
|
|
57
|
+
return tools.move(path.join(targetPath, 'gitignore_TO_REPLACE'), path.join(targetPath, '.gitignore'));
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
.then(() => {
|
|
61
|
+
tools.logSuccess();
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
.catch((e) => {
|
|
65
|
+
throw e;
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
// LOCAL
|
|
7
|
+
const tools = require('../../../scripts/utils/tools');
|
|
8
|
+
const configUtils = require('../config/config-utils');
|
|
9
|
+
const initUtils = require('../init/init-utils');
|
|
10
|
+
|
|
11
|
+
// CONSTANTS
|
|
12
|
+
const constants = require('./constants');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const init = (frontendType, rootPackagePath, targetPath) => {
|
|
18
|
+
return Promise.resolve()
|
|
19
|
+
|
|
20
|
+
// CHECKING presence of UI package supporting the remote
|
|
21
|
+
.then(() => {
|
|
22
|
+
if (frontendType === constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE && !tools.isDirExists(rootPackagePath)) {
|
|
23
|
+
tools.logError(`${rootPackagePath} NOT FOUND, you must mount the root package ui before creating the remote`);
|
|
24
|
+
throw new Error('ROOT_PACKAGE_NOT_FOUND');
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// CLEANING TARGET
|
|
29
|
+
.then(() => {
|
|
30
|
+
tools.logInfo('Cleaning target');
|
|
31
|
+
return tools.rimraf(targetPath + '/**/*');
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
.catch((e) => {
|
|
35
|
+
throw e;
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const replaceExtensions = (targetPath) => {
|
|
41
|
+
return Promise.resolve()
|
|
42
|
+
|
|
43
|
+
.then(() => {
|
|
44
|
+
tools.logInfo('Executing post generation operations');
|
|
45
|
+
tools.move(path.join(targetPath, 'gitignore_TO_REPLACE'), path.join(targetPath, '.gitignore'));
|
|
46
|
+
if (tools.isFileExists(path.join(targetPath, 'package.json_TO_REPLACE'))) {
|
|
47
|
+
tools.move(path.join(targetPath, 'package.json_TO_REPLACE'), path.join(targetPath, 'package.json'));
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.then(() => {
|
|
51
|
+
tools.logInfo('Replace extensions');
|
|
52
|
+
return tools.removeFilesExtension(targetPath, '.TO_REPLACE');
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
.catch((e) => {
|
|
56
|
+
throw e;
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const replaceContent = (targetPath, name, scope, fullName) => {
|
|
61
|
+
tools.replaceInPath(targetPath, '@module.name@', name);
|
|
62
|
+
tools.replaceInPath(targetPath, '@module.full.name@', fullName);
|
|
63
|
+
tools.replaceInPath(targetPath, '@module.scope@', scope);
|
|
64
|
+
tools.replaceInPath(targetPath, '@module.scope-name@', `${scope.substr(1)}-${name}`);
|
|
65
|
+
tools.replaceInPath(targetPath, '@module.scope.string@', scope.substr(1));
|
|
66
|
+
tools.replaceInPath(targetPath, '@module.class.name@', tools.camelCaseString(name, '-', true));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
const generateVirtualRemote = ({fullName, targetPath, rootPackagePath, pkg, args = constants.DEFAULT_CONFIG}) => {
|
|
73
|
+
|
|
74
|
+
tools.logInfo('Generate virtual remote');
|
|
75
|
+
|
|
76
|
+
const remoteTargetPath = path.join(process.cwd(), 'packages', 'csdr-remotes-config', 'assets', fullName);
|
|
77
|
+
|
|
78
|
+
return Promise.resolve()
|
|
79
|
+
// INIT and cleanup
|
|
80
|
+
.then(() => {
|
|
81
|
+
return init(args.pkgFrontendType, rootPackagePath, targetPath);
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// COPY FIRST THE REMOTE SKELETON TO TARGET
|
|
85
|
+
.then(() => {
|
|
86
|
+
tools.logInfo('Copying skeleton to target');
|
|
87
|
+
|
|
88
|
+
// for the moment the virtual remotes are only activated for v15+
|
|
89
|
+
if (args.pkgFrontendVersion == constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15) {
|
|
90
|
+
tools.copydir(constants.FRONTEND_SKELETON_REMOTE_EUI10_PATH, targetPath, true);
|
|
91
|
+
tools.copydir(constants.FRONTEND_SKELETON_REMOTE_EUI15_PATH, targetPath, true);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// REPLACING PLACEHOLDERS
|
|
95
|
+
tools.logInfo('Replace sources content');
|
|
96
|
+
replaceContent(targetPath, args.pkgName, args.pkgScope, fullName);
|
|
97
|
+
|
|
98
|
+
// ADDING CONFIG ENTRY - specific csdr-remotes as of v15+
|
|
99
|
+
tools.logInfo('Adding CSDR config entry');
|
|
100
|
+
configUtils.register.registerCsdrPackage(
|
|
101
|
+
pkg, args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE,
|
|
102
|
+
args.pkgScope, args.pkgName, args.pkgFrontendVersion
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// REPLACE EXTENSIONS (package.json, .gitignore as the interfere with build of tools if release without name changes)
|
|
106
|
+
replaceExtensions(targetPath);
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
// ENV TARGET / a-la-carte specific (always true as of v15+ remotes) - TRANSFER The sources from current remote sources
|
|
110
|
+
.then(() => {
|
|
111
|
+
// envTarget remote type specific
|
|
112
|
+
if (args.isEnvTargetRemote) {
|
|
113
|
+
tools.logInfo('Moving sources from remote to root package for envTarget remote type');
|
|
114
|
+
return tools.move(path.join(targetPath, 'src'), path.join(rootPackagePath, 'assets', 'remote-sources'));
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// CLEANING REMOTES CONFIG ENTRY
|
|
119
|
+
.then(() => {
|
|
120
|
+
tools.logInfo('Cleaning csdr-remotes-config target entry');
|
|
121
|
+
return tools.rimraf(remoteTargetPath + '/**/*');
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// REPLACING CONTENT FOR VIRTUAL REMOTE CONFIG SKELETON
|
|
125
|
+
.then(() => {
|
|
126
|
+
tools.copy(
|
|
127
|
+
path.join(constants.VIRTUAL_REMOTE_SKELETON_ROOT_PATH, `${args.pkgFrontendVersion}.x`),
|
|
128
|
+
remoteTargetPath
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
tools.logInfo('Replace sources content in csdr-remotes-config target entry');
|
|
132
|
+
replaceContent(remoteTargetPath, args.pkgName, args.pkgScope, fullName);
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
// CLEANING REMOTE CURRENT TARGET as this is completetely re-generated by the generateVirtualRemotes() function (same as init)
|
|
136
|
+
.then(() => {
|
|
137
|
+
return tools.rimraf(targetPath + '/**/*');
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// GENERATE THE VIRTUAL REMOTE (as it's dynamically generated, we use here the same fn call as the init)
|
|
141
|
+
.then(() => {
|
|
142
|
+
return initUtils.remotes.generateVirtualRemote(fullName, false);
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
.then(() => {
|
|
146
|
+
tools.logSuccess();
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
.catch((e) => {
|
|
150
|
+
throw e;
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
const generateDefault = ({fullName, targetPath, rootPackagePath, pkg, args = constants.DEFAULT_CONFIG}) => {
|
|
158
|
+
|
|
159
|
+
return Promise.resolve()
|
|
160
|
+
// INIT and cleanup
|
|
161
|
+
.then(() => {
|
|
162
|
+
return init(args.pkgFrontendType, rootPackagePath, targetPath);
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
// COPY TO TARGET
|
|
166
|
+
.then(() => {
|
|
167
|
+
tools.logInfo('Copying skeleton to target');
|
|
168
|
+
if (args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE) {
|
|
169
|
+
if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI10) {
|
|
170
|
+
tools.copydir(constants.FRONTEND_SKELETON_REMOTE_EUI10_PATH, targetPath, true);
|
|
171
|
+
|
|
172
|
+
} else if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15) {
|
|
173
|
+
tools.copydir(constants.FRONTEND_SKELETON_REMOTE_EUI10_PATH, targetPath, true);
|
|
174
|
+
tools.copydir(constants.FRONTEND_SKELETON_REMOTE_EUI15_PATH, targetPath, true);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
} else {
|
|
178
|
+
if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI10) {
|
|
179
|
+
tools.copydir(constants.FRONTEND_SKELETON_EUI10_PATH, targetPath, true);
|
|
180
|
+
|
|
181
|
+
} else if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15) {
|
|
182
|
+
tools.copydir(constants.FRONTEND_SKELETON_EUI10_PATH, targetPath, true);
|
|
183
|
+
tools.copydir(constants.FRONTEND_SKELETON_EUI15_PATH, targetPath, true);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (args.isRouteModule) {
|
|
188
|
+
tools.copydir(constants.FRONTEND_OPTION_ROUTE_PATH, targetPath, true);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// REPLACING PLACEHOLDERS
|
|
192
|
+
tools.logInfo('Replace sources content');
|
|
193
|
+
replaceContent(targetPath, args.pkgName, args.pkgScope, fullName);
|
|
194
|
+
|
|
195
|
+
// REGISTERING PACKAGE in CSDR GLOBAL CONFIG
|
|
196
|
+
tools.logInfo('Registering package');
|
|
197
|
+
|
|
198
|
+
tools.logInfo('Adding CSDR config entry');
|
|
199
|
+
configUtils.register.registerCsdrPackage(
|
|
200
|
+
pkg, args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE,
|
|
201
|
+
args.pkgScope, args.pkgName, args.pkgFrontendVersion
|
|
202
|
+
);
|
|
203
|
+
|
|
204
|
+
if (args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.DEFAULT) {
|
|
205
|
+
configUtils.angular.registerAngularPackage(pkg);
|
|
206
|
+
configUtils.angular.registerModulePaths(pkg);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
replaceExtensions(targetPath);
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
.then(() => {
|
|
213
|
+
if (args.isEnvTargetRemote) {
|
|
214
|
+
tools.logInfo('Moving sources from remote to root package for envTarget remote type');
|
|
215
|
+
return tools.move(path.join(targetPath, 'src'), path.join(rootPackagePath, 'assets', 'remote-sources'));
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
.then(() => {
|
|
220
|
+
tools.logSuccess();
|
|
221
|
+
})
|
|
222
|
+
.catch((e) => {
|
|
223
|
+
throw e;
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
module.exports.generate = (args = constants.DEFAULT_CONFIG) => {
|
|
230
|
+
tools.logTitle('Generating frontend package');
|
|
231
|
+
|
|
232
|
+
let npmPkgName, repoName;
|
|
233
|
+
let fullName = args.pkgScope.substring(1) + '-' + args.pkgName;
|
|
234
|
+
|
|
235
|
+
if (args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.DEFAULT) {
|
|
236
|
+
fullName += '-ui';
|
|
237
|
+
npmPkgName = `${args.pkgScope}/${args.pkgName}`;
|
|
238
|
+
|
|
239
|
+
} else if (args.pkgFrontendType === constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE) {
|
|
240
|
+
if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI10) {
|
|
241
|
+
fullName += '-eui10-remote-el-ui';
|
|
242
|
+
npmPkgName = `${args.pkgScope}/${args.pkgName}-eui10-remote-el`;
|
|
243
|
+
|
|
244
|
+
} else if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15) {
|
|
245
|
+
fullName += '-eui15-remote-el-ui';
|
|
246
|
+
npmPkgName = `${args.pkgScope}/${args.pkgName}-eui15-remote-el`;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// generating default git repo
|
|
251
|
+
if (args.isCsdrRepo) {
|
|
252
|
+
repoName = `${fullName}.git`;
|
|
253
|
+
} else {
|
|
254
|
+
repoName = `${args.externalRepoName}/${fullName}.git`;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// generating target paths
|
|
258
|
+
let targetPath, rootPackagePath;
|
|
259
|
+
|
|
260
|
+
if (args.isVirtualRemote) {
|
|
261
|
+
// virtual remotes are generated into /remotes root folder
|
|
262
|
+
targetPath = path.join(constants.TARGET_ROOT_REMOTES_PATH, fullName);
|
|
263
|
+
} else {
|
|
264
|
+
// normal remote / packages are generated into /packages root folder
|
|
265
|
+
targetPath = path.join(constants.TARGET_ROOT_PATH, fullName);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// generating rootPackagePath : the linked package with the envTarget/a-la-carte remote setup (now default)
|
|
269
|
+
rootPackagePath = path.join(constants.TARGET_ROOT_PATH, `${args.pkgScope.substring(1)}-${args.pkgName}-ui`);
|
|
270
|
+
|
|
271
|
+
// generating default package entries
|
|
272
|
+
const pkg = {
|
|
273
|
+
name: fullName,
|
|
274
|
+
repoName: repoName,
|
|
275
|
+
npmPkgName: npmPkgName,
|
|
276
|
+
paths: {
|
|
277
|
+
root: rootPackagePath
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
return Promise.resolve()
|
|
282
|
+
.then(() => {
|
|
283
|
+
if (args.pkgFrontendVersion === constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15 && args.isVirtualRemote) {
|
|
284
|
+
return generateVirtualRemote({fullName, targetPath, rootPackagePath, pkg, args});
|
|
285
|
+
} else {
|
|
286
|
+
return generateDefault({fullName, targetPath, rootPackagePath, pkg, args});
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
.catch((e) => {
|
|
291
|
+
throw e;
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// GLOBAL
|
|
4
|
+
const inquirer = require('inquirer');
|
|
5
|
+
|
|
6
|
+
// CONSTANTS
|
|
7
|
+
const constants = require('./constants');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
module.exports.prompt = () => {
|
|
11
|
+
|
|
12
|
+
return Promise.resolve()
|
|
13
|
+
.then(() => {
|
|
14
|
+
return inquirer.prompt([
|
|
15
|
+
{
|
|
16
|
+
type: 'list',
|
|
17
|
+
name: 'pkgType',
|
|
18
|
+
message: 'Select a package type :',
|
|
19
|
+
choices: [
|
|
20
|
+
{ name: 'Frontend - Angular library', value: constants.CONFIG_OPTIONS.pkgType.FRONTEND },
|
|
21
|
+
{ name: 'Backend - SpringBoot micro-service', value: constants.CONFIG_OPTIONS.pkgType.BACKEND },
|
|
22
|
+
],
|
|
23
|
+
default: constants.DEFAULT_CONFIG.pkgType,
|
|
24
|
+
validate: function (value) {
|
|
25
|
+
if (value.length) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'pkgGroupId',
|
|
32
|
+
type: 'input',
|
|
33
|
+
message: 'Enter the Maven groupId :',
|
|
34
|
+
default: constants.DEFAULT_CONFIG.pkgGroupId,
|
|
35
|
+
when: function (answers) {
|
|
36
|
+
return (answers.pkgType === constants.CONFIG_OPTIONS.pkgType.BACKEND);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'list',
|
|
41
|
+
name: 'pkgFrontendType',
|
|
42
|
+
message: 'Select a frontend type :',
|
|
43
|
+
choices: [
|
|
44
|
+
{ name: 'Default Angular library', value: constants.CONFIG_OPTIONS.pkgFrontendType.DEFAULT },
|
|
45
|
+
{ name: 'Remote element micro-frontend', value: constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE },
|
|
46
|
+
],
|
|
47
|
+
default: constants.DEFAULT_CONFIG.pkgFrontendType,
|
|
48
|
+
when: function (answers) {
|
|
49
|
+
return (answers.pkgType === constants.CONFIG_OPTIONS.pkgType.FRONTEND);
|
|
50
|
+
},
|
|
51
|
+
validate: function (value) {
|
|
52
|
+
if (value.length) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'list',
|
|
59
|
+
name: 'pkgFrontendVersion',
|
|
60
|
+
message: 'Select eUI version target :',
|
|
61
|
+
choices: [
|
|
62
|
+
{ name: 'v10', value: constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI10 },
|
|
63
|
+
{ name: 'v15', value: constants.CONFIG_OPTIONS.pkgFrontendVersion.EUI15 },
|
|
64
|
+
],
|
|
65
|
+
default: constants.DEFAULT_CONFIG.pkgFrontendType,
|
|
66
|
+
when: function (answers) {
|
|
67
|
+
return (answers.pkgType === constants.CONFIG_OPTIONS.pkgType.FRONTEND);
|
|
68
|
+
},
|
|
69
|
+
validate: function (value) {
|
|
70
|
+
if (value.length) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'pkgScope',
|
|
77
|
+
type: 'input',
|
|
78
|
+
message: 'Enter the package scope :',
|
|
79
|
+
default: constants.DEFAULT_CONFIG.pkgScope
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'pkgName',
|
|
83
|
+
type: 'input',
|
|
84
|
+
message: 'Enter the package name :',
|
|
85
|
+
default: constants.DEFAULT_CONFIG.pkgName
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'isRouteModule',
|
|
89
|
+
type: 'confirm',
|
|
90
|
+
message: 'Is this a ROUTE package ?',
|
|
91
|
+
default: constants.DEFAULT_CONFIG.isRouteModule,
|
|
92
|
+
when: function (answers) {
|
|
93
|
+
return (
|
|
94
|
+
answers.pkgType === constants.CONFIG_OPTIONS.pkgType.FRONTEND &&
|
|
95
|
+
answers.pkgFrontendType !== constants.CONFIG_OPTIONS.pkgFrontendType.REMOTE
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'isCsdrRepo',
|
|
101
|
+
type: 'confirm',
|
|
102
|
+
message: 'Is the repository within CSDR git project ?',
|
|
103
|
+
default: constants.DEFAULT_CONFIG.isCsdrRepo
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'externalRepoName',
|
|
107
|
+
type: 'input',
|
|
108
|
+
message: 'Enter the project CITnet project name where the repository is located :',
|
|
109
|
+
default: constants.DEFAULT_CONFIG.externalRepoName,
|
|
110
|
+
when: function (answers) {
|
|
111
|
+
return (
|
|
112
|
+
answers.isCsdrRepo === false
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
]);
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
.catch((e) => {
|
|
120
|
+
throw e;
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|