@eui/tools 6.1.0 → 6.1.2

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.
@@ -29,7 +29,7 @@ module.exports.init = () => {
29
29
  skipAppContainers: skipAppContainers || false
30
30
  }
31
31
 
32
- // checking branch and envTarget types
32
+ // checking branch
33
33
  if (initialResponse.branch && typeof (initialResponse.branch) === 'boolean') {
34
34
  initialResponse.branch = 'develop';
35
35
  }
@@ -65,10 +65,10 @@ module.exports.init = () => {
65
65
  // clone or install linked host package to project if any
66
66
  .then(() => {
67
67
  if (finalResponse.project && !build) {
68
- return initUtils.cloneHostPackage(finalResponse.project);
68
+ return initUtils.packages.cloneHostPackage(finalResponse.project);
69
69
 
70
70
  } else if (finalResponse.project && build) {
71
- return initUtils.installHostPackage(finalResponse.project);
71
+ return initUtils.packages.installHostPackage(finalResponse.project);
72
72
  }
73
73
  })
74
74
 
@@ -86,25 +86,32 @@ module.exports.init = () => {
86
86
 
87
87
  // Importing packages and generating definitions
88
88
  .then(() => {
89
- return initUtils.importPackages(finalResponse);
89
+ return initUtils.packages.importPackages(finalResponse);
90
90
  })
91
91
 
92
92
  // Importing external sources
93
93
  .then(() => {
94
94
  if (finalResponse.project) {
95
- return initUtils.importExternalSources();
95
+ return initUtils.projects.importExternalSources();
96
+ }
97
+ })
98
+
99
+ // Generating virtual remote - experimental
100
+ .then(() => {
101
+ if (finalResponse.pkg && finalResponse.pkgOnly) {
102
+ return initUtils.remotes.generateVirtualRemote(pkg);
96
103
  }
97
104
  })
98
105
 
99
106
  // adapt and inject particular root data/config for eUI version detected on project
100
107
  // if multiple versions of eUI are detected on the same project, an exception is thrown
101
108
  .then(() => {
102
- return initUtils.processLocalEuiVersions();
109
+ return initUtils.global.processLocalEuiVersions();
103
110
  })
104
111
 
105
112
  // specific resolution injection based on NodeJS (recent failure of nodejs10.x for MWP v7)
106
113
  .then(() => {
107
- return initUtils.processResolutionsForNodeVersion();
114
+ return initUtils.global.processResolutionsForNodeVersion();
108
115
  })
109
116
 
110
117
  // Install deps based on current config generated => take last know snapshots
@@ -113,7 +120,7 @@ module.exports.init = () => {
113
120
  // in case of release the initialisation is managed by the application / package themselves
114
121
  if (!build && !skipInstall) {
115
122
  if (finalResponse.pkgOnly) {
116
- return installUtils.localDev.install(pkg);
123
+ return installUtils.localDev.installPackage(pkg);
117
124
  } else {
118
125
  return installUtils.localDev.install();
119
126
  }
@@ -124,7 +131,7 @@ module.exports.init = () => {
124
131
  // Attaching app scripts to root package.json
125
132
  .then(() => {
126
133
  if (finalResponse.project) {
127
- return initUtils.importScripts();
134
+ return initUtils.projects.importScripts();
128
135
  }
129
136
  })
130
137
 
@@ -132,7 +139,7 @@ module.exports.init = () => {
132
139
  // Attaching extra tsconfig from project
133
140
  .then(() => {
134
141
  if (finalResponse.project) {
135
- return initUtils.importExtraTsConfig();
142
+ return initUtils.projects.importExtraTsConfig();
136
143
  }
137
144
  })
138
145
 
@@ -140,7 +147,7 @@ module.exports.init = () => {
140
147
  // Attaching external features from project
141
148
  .then(() => {
142
149
  if (finalResponse.project && !build) {
143
- return initUtils.importExternalFeatures();
150
+ return initUtils.projects.importExternalFeatures();
144
151
  }
145
152
  })
146
153
 
@@ -148,7 +155,7 @@ module.exports.init = () => {
148
155
  // Attaching external mock repo for project
149
156
  .then(() => {
150
157
  if (finalResponse.project && !build && !prjOnly) {
151
- return initUtils.importExternalMock();
158
+ return initUtils.projects.importExternalMock();
152
159
  }
153
160
  })
154
161
 
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ // GLOBAL
4
+ const path = require('path');
5
+
6
+ // LOCAL
7
+ const tools = require('../../utils/tools');
8
+ const configUtils = require('../config/config-utils');
9
+ const gitUtils = require('../../utils/git-utils');
10
+ const installUtils = require('../install/install-utils');
11
+
12
+
13
+
14
+
15
+ const importPackage = (pkg, args) => {
16
+ tools.logTitle(`importing package ${pkg.name}`);
17
+
18
+ if (pkg.parent) {
19
+ tools.logInfo('Parent package ... skipping import');
20
+ return Promise.resolve();
21
+
22
+ } else {
23
+ if (pkg.tsPackage !== false) {
24
+ return Promise.resolve()
25
+ .then(() => {
26
+ if (!pkg.element) {
27
+ return configUtils.angular.registerAngularPackage(pkg, args.reset);
28
+ } else if (pkg.element) {
29
+ return configUtils.angular.registerAngularProjectDef(pkg, args.reset, true);
30
+ } else {
31
+ return configUtils.angular.registerAngularProjectDef(pkg, args.reset);
32
+ }
33
+ })
34
+ .then(() => {
35
+ if (pkg.pathInclude !== false && !pkg.element) {
36
+ return configUtils.angular.registerModulePaths(pkg, args.reset);
37
+ }
38
+ })
39
+
40
+ .then(() => {
41
+ tools.logSuccess('OK => package imported');
42
+ })
43
+
44
+ .catch((e) => {
45
+ throw e;
46
+ })
47
+
48
+ } else {
49
+ tools.logInfo('Non TS package... skipping registration');
50
+ return Promise.resolve();
51
+ }
52
+ }
53
+ }
54
+
55
+
56
+
57
+
58
+
59
+ module.exports.importPackages = (args = {}) => {
60
+
61
+ tools.logTitle('Importing configuration of packages');
62
+
63
+ const packages = configUtils.packages.getPackages();
64
+
65
+ return Promise.resolve()
66
+ .then(() => {
67
+ configUtils.angular.checkConfigFiles(args.reset);
68
+ })
69
+ .then(() => Promise.resolve().then(() => {
70
+ return packages.reduce((promise, pkg) => {
71
+ return promise.then(() => (
72
+ importPackage(pkg, args)
73
+ ));
74
+ }, Promise.resolve());
75
+ }))
76
+
77
+ .then(() => {
78
+ tools.logSuccess('OK => all packages successfully imported');
79
+ })
80
+
81
+ .catch((e) => {
82
+ throw e;
83
+ })
84
+ }
85
+
86
+
87
+ module.exports.cloneHostPackage = (projectName) => {
88
+
89
+ const project = configUtils.projects.getProject(projectName);
90
+
91
+ if (!project.hostPackage) {
92
+ return;
93
+ }
94
+
95
+ tools.logTitle('Installing host package');
96
+
97
+ let pkg;
98
+
99
+ return Promise.resolve()
100
+ .then(() => {
101
+ pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
102
+ if (!pkg) {
103
+ throw new Error('Invalid host package provided / unknown to CSDR config');
104
+ }
105
+ return gitUtils.cloneAndCheckout(pkg.repository, path.join(process.cwd(), 'packages', pkg.name), 'develop');
106
+ })
107
+
108
+ .then(() => {
109
+ const newPackages = [];
110
+ newPackages.push(pkg.name);
111
+ return configUtils.global.updateConfig(null, newPackages);
112
+ })
113
+
114
+ .catch((e) => {
115
+ throw e;
116
+ })
117
+ }
118
+
119
+
120
+ module.exports.installHostPackage = (projectName) => {
121
+ tools.logTitle('Installing host package');
122
+
123
+ return Promise.resolve()
124
+ .then(() => {
125
+ const project = configUtils.projects.getProject(projectName);
126
+
127
+ if (!project.hostPackage) {
128
+ tools.logInfo('project hostPackage not defined...skipping');
129
+
130
+ } else {
131
+ const pkg = configUtils.packages.getPackageByNpmPkg(project.hostPackage, true);
132
+ if (!pkg) {
133
+ throw new Error('Invalid host package provided / unknown to CSDR config');
134
+ }
135
+ return installUtils.projects.installHostPackage(project, pkg.npmPkg);
136
+ }
137
+ })
138
+
139
+ .catch((e) => {
140
+ throw e;
141
+ })
142
+ }
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ // GLOBAL
4
+ const path = require('path');
5
+
6
+ // LOCAL
7
+ const tools = require('../../utils/tools');
8
+ const injectionUtils = require('../../utils/pre-build/injection/injection-utils');
9
+ const configUtils = require('../config/config-utils');
10
+
11
+
12
+
13
+ module.exports.importScripts = () => {
14
+ return Promise.resolve()
15
+ .then(() => {
16
+ tools.logTitle("Init scripts for local projects");
17
+ const projects = configUtils.projects.getProjects();
18
+
19
+ const rootPackageJsonFile = path.join(process.cwd(), 'package.json')
20
+ const rootPackageJson = require(rootPackageJsonFile);
21
+
22
+ projects.forEach((p) => {
23
+ tools.logInfo(`Project : ${p.name}`);
24
+
25
+ const scriptsFile = path.join(process.cwd(), p.folder, 'scripts.json');
26
+ if (!tools.isFileExists(scriptsFile)) {
27
+ tools.logInfo('no scripts.json file found - skipping');
28
+ } else {
29
+ tools.logInfo('Processing scripts.json file');
30
+ const scriptsJson = require(scriptsFile);
31
+ rootPackageJson.scripts = { ...rootPackageJson.scripts, ...scriptsJson };
32
+ }
33
+ });
34
+
35
+ tools.logInfo('Updating root package.json');
36
+ tools.writeJsonFileSync(rootPackageJsonFile, rootPackageJson);
37
+ })
38
+ .catch((e) => {
39
+ throw e;
40
+ })
41
+ }
42
+
43
+
44
+ module.exports.importExternalFeatures = () => {
45
+ return Promise.resolve()
46
+ .then(() => {
47
+ tools.logTitle("Import external features for local projects");
48
+
49
+ return configUtils.projects.getProjects().reduce((promise, prj) => {
50
+ return promise.then(() => (
51
+ injectionUtils.externals.injectExternalFeatures(prj)
52
+ ));
53
+ }, Promise.resolve());
54
+ })
55
+ .catch((e) => {
56
+ throw e;
57
+ })
58
+ }
59
+
60
+
61
+ module.exports.importExternalSources = () => {
62
+ return Promise.resolve()
63
+ .then(() => {
64
+ tools.logTitle("Import external sources for local projects");
65
+
66
+ return configUtils.projects.getProjects().reduce((promise, prj) => {
67
+ return promise.then(() => (
68
+ injectionUtils.externals.injectExternalAppSources(prj)
69
+ ));
70
+ }, Promise.resolve());
71
+ })
72
+ .catch((e) => {
73
+ throw e;
74
+ })
75
+ }
76
+
77
+
78
+
79
+ module.exports.importExternalMock = () => {
80
+ return Promise.resolve()
81
+ .then(() => {
82
+ tools.logTitle("Import external mock for local projects");
83
+
84
+ return configUtils.projects.getProjects().reduce((promise, prj) => {
85
+ return promise.then(() => (
86
+ injectionUtils.externals.injectExternalMock(prj)
87
+ ));
88
+ }, Promise.resolve());
89
+
90
+ })
91
+ .catch((e) => {
92
+ throw e;
93
+ })
94
+ }
95
+
96
+
97
+
98
+ module.exports.importExtraTsConfig = () => {
99
+ tools.logTitle("Init extra ts config for local projects");
100
+
101
+ return Promise.resolve()
102
+ .then(() => {
103
+
104
+ configUtils.projects.getProjects().forEach((p) => {
105
+ tools.logInfo(`Check extra tsconfig for project : ${p.name}`);
106
+ configUtils.angular.registerProjectExtraPaths(p);
107
+ })
108
+ })
109
+ .catch((e) => {
110
+ throw e;
111
+ })
112
+ }
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ // GLOBAL
4
+ const path = require('path');
5
+
6
+ // LOCAL
7
+ const tools = require('../../utils/tools');
8
+ const configUtils = require('../config/config-utils');
9
+
10
+
11
+ module.exports.generateVirtualRemote = (pkgName) => {
12
+ const pkg = configUtils.packages.getPackage(pkgName, true);
13
+
14
+ if (!pkg.remote && !pkg.virtual) {
15
+ return;
16
+ }
17
+
18
+ tools.logTitle('Generate virtual remote');
19
+
20
+ // TODO
21
+ }