contensis-cli 1.0.12-beta.8 → 1.1.1-beta.0

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/localisation/en-GB.js +5 -3
  3. package/dist/localisation/en-GB.js.map +2 -2
  4. package/dist/mappers/DevInit-to-CIWorkflow.js +6 -8
  5. package/dist/mappers/DevInit-to-CIWorkflow.js.map +2 -2
  6. package/dist/mappers/DevInit-to-RolePermissions.js +4 -4
  7. package/dist/mappers/DevInit-to-RolePermissions.js.map +2 -2
  8. package/dist/services/ContensisAuthService.js.map +2 -2
  9. package/dist/services/ContensisCliService.js +24 -18
  10. package/dist/services/ContensisCliService.js.map +2 -2
  11. package/dist/services/ContensisDevService.js +51 -56
  12. package/dist/services/ContensisDevService.js.map +3 -3
  13. package/dist/shell.js +2 -0
  14. package/dist/shell.js.map +2 -2
  15. package/dist/util/csv.formatter.js +3 -11
  16. package/dist/util/csv.formatter.js.map +3 -3
  17. package/dist/util/diff.js +1 -1
  18. package/dist/util/diff.js.map +2 -2
  19. package/dist/util/git.js +1 -0
  20. package/dist/util/git.js.map +2 -2
  21. package/dist/util/json.formatter.js +35 -3
  22. package/dist/util/json.formatter.js.map +3 -3
  23. package/dist/version.js +1 -1
  24. package/dist/version.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/localisation/en-GB.ts +6 -3
  27. package/src/mappers/DevInit-to-CIWorkflow.ts +8 -8
  28. package/src/mappers/DevInit-to-RolePermissions.ts +5 -2
  29. package/src/models/Cache.d.ts +2 -1
  30. package/src/services/ContensisAuthService.ts +1 -1
  31. package/src/services/ContensisCliService.ts +26 -28
  32. package/src/services/ContensisDevService.ts +76 -70
  33. package/src/shell.ts +4 -0
  34. package/src/util/csv.formatter.ts +1 -4
  35. package/src/util/diff.ts +1 -1
  36. package/src/util/git.ts +2 -1
  37. package/src/util/json.formatter.ts +32 -1
  38. package/src/version.ts +1 -1
package/src/shell.ts CHANGED
@@ -152,6 +152,8 @@ class ContensisShell {
152
152
  'get nodes',
153
153
  'get model',
154
154
  'get project',
155
+ 'get proxy',
156
+ 'get renderer',
155
157
  'get role',
156
158
  'get token',
157
159
  'get version',
@@ -303,3 +305,5 @@ process.stdin.on('data', key => {
303
305
  shell().quit();
304
306
  }
305
307
  });
308
+
309
+ // process.env.http_proxy = 'http://127.0.0.1:8888';
@@ -1,8 +1,5 @@
1
- import { flatten } from 'flat';
2
1
  import { Parser } from 'json2csv';
3
- import cleaner from 'deep-cleaner';
4
-
5
- const flattenObject = (obj: any) => flatten(cleaner(obj, ['workflow']));
2
+ import { flattenObject } from './json.formatter';
6
3
 
7
4
  export const csvFormatter = <T>(entries: T | T[]) => {
8
5
  // Flatten the passed in object
package/src/util/diff.ts CHANGED
@@ -70,7 +70,7 @@ export const diffFileContent = (
70
70
  } else needsNewLine = true;
71
71
  }
72
72
 
73
- return output.join('');
73
+ return output.join('').replaceAll('\n\n\n', '\n\n');
74
74
  };
75
75
 
76
76
  const addDiffPositionInfo = (diff: Change[]) => {
package/src/util/git.ts CHANGED
@@ -75,7 +75,7 @@ export class GitHelper {
75
75
  }
76
76
  gitcwd = () => path.join(this.gitRepoPath);
77
77
  gitInfo = (url: string = this.originUrl) => hostedGitInfo.fromUrl(url);
78
- hostType = (url: string = this.originUrl): GitTypes => {
78
+ hostType = (url: string = this.originUrl): GitTypes | undefined => {
79
79
  if (url) {
80
80
  if (url.includes('github.com')) return 'github';
81
81
  else return 'gitlab';
@@ -87,6 +87,7 @@ export class GitHelper {
87
87
  gitConfig = (cwd = this.gitRepoPath) => {
88
88
  // Find .git/config in project cwd
89
89
  const config = parseGitConfig.sync({
90
+ cwd,
90
91
  path: '.git/config',
91
92
  expandKeys: true,
92
93
  });
@@ -1 +1,32 @@
1
- export const jsonFormatter = <T>(obj: T) => JSON.stringify(obj, null, 2);
1
+ import { flatten, unflatten } from 'flat';
2
+ import cleaner from 'deep-cleaner';
3
+
4
+ // Format a JSON object for a nice output
5
+ export const jsonFormatter = <T>(obj: T, fields?: string[]) =>
6
+ JSON.stringify(limitFields(obj, fields), null, 2);
7
+
8
+ // Flatten a JSON object such as an entry so there are no
9
+ // nested object and the keys are presented like "sys.version.versionNo": "1.0"
10
+ export const flattenObject = (obj: any) => flatten(cleaner(obj, ['workflow']));
11
+
12
+ // Will limit and sort an object's keys by an array of supplied fields
13
+ export const limitFields = (obj: any, fields?: string[]): any => {
14
+ if (!fields) return obj;
15
+ if (obj && Array.isArray(obj)) {
16
+ const arr = [];
17
+ for (const child of obj) arr.push(limitFields(child, fields));
18
+ return arr;
19
+ }
20
+
21
+ if (obj && typeof obj === 'object') {
22
+ const flattenedObj = flatten(obj) as any;
23
+ const sortedObj = {} as any;
24
+ for (const field of fields) {
25
+ sortedObj[field] = flattenedObj[field];
26
+ }
27
+
28
+ return unflatten(sortedObj);
29
+ }
30
+
31
+ return obj;
32
+ };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.0.12-beta.8";
1
+ export const LIB_VERSION = "1.1.1-beta.0";