auth0-deploy-cli 7.4.0 → 7.5.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.
Files changed (112) hide show
  1. package/.circleci/config.yml +15 -0
  2. package/.eslintrc +66 -17
  3. package/.github/CODEOWNERS +1 -0
  4. package/.husky/pre-commit +2 -0
  5. package/CHANGELOG.md +27 -2
  6. package/lib/args.js +94 -81
  7. package/lib/commands/export.js +54 -78
  8. package/lib/commands/import.js +46 -70
  9. package/lib/commands/index.js +11 -20
  10. package/lib/configFactory.js +19 -27
  11. package/lib/context/defaults.js +18 -41
  12. package/lib/context/directory/handlers/actions.js +77 -107
  13. package/lib/context/directory/handlers/attackProtection.js +59 -0
  14. package/lib/context/directory/handlers/clientGrants.js +45 -54
  15. package/lib/context/directory/handlers/clients.js +60 -79
  16. package/lib/context/directory/handlers/connections.js +65 -89
  17. package/lib/context/directory/handlers/databases.js +91 -123
  18. package/lib/context/directory/handlers/emailProvider.js +46 -57
  19. package/lib/context/directory/handlers/emailTemplates.js +67 -80
  20. package/lib/context/directory/handlers/guardianFactorProviders.js +41 -49
  21. package/lib/context/directory/handlers/guardianFactorTemplates.js +41 -49
  22. package/lib/context/directory/handlers/guardianFactors.js +41 -49
  23. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +40 -50
  24. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +40 -50
  25. package/lib/context/directory/handlers/guardianPolicies.js +40 -50
  26. package/lib/context/directory/handlers/hooks.js +55 -70
  27. package/lib/context/directory/handlers/index.js +53 -123
  28. package/lib/context/directory/handlers/migrations.js +36 -41
  29. package/lib/context/directory/handlers/organizations.js +54 -69
  30. package/lib/context/directory/handlers/pages.js +72 -86
  31. package/lib/context/directory/handlers/resourceServers.js +41 -49
  32. package/lib/context/directory/handlers/roles.js +49 -62
  33. package/lib/context/directory/handlers/rules.js +52 -68
  34. package/lib/context/directory/handlers/rulesConfigs.js +33 -32
  35. package/lib/context/directory/handlers/tenant.js +52 -47
  36. package/lib/context/directory/handlers/triggers.js +39 -54
  37. package/lib/context/directory/index.js +113 -101
  38. package/lib/context/index.js +96 -105
  39. package/lib/context/yaml/handlers/actions.js +71 -88
  40. package/lib/context/yaml/handlers/attackProtection.js +29 -0
  41. package/lib/context/yaml/handlers/clientGrants.js +36 -29
  42. package/lib/context/yaml/handlers/clients.js +61 -76
  43. package/lib/context/yaml/handlers/connections.js +76 -103
  44. package/lib/context/yaml/handlers/databases.js +64 -79
  45. package/lib/context/yaml/handlers/emailProvider.js +33 -30
  46. package/lib/context/yaml/handlers/emailTemplates.js +45 -54
  47. package/lib/context/yaml/handlers/guardianFactorProviders.js +27 -18
  48. package/lib/context/yaml/handlers/guardianFactorTemplates.js +27 -18
  49. package/lib/context/yaml/handlers/guardianFactors.js +27 -18
  50. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +27 -20
  51. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +27 -20
  52. package/lib/context/yaml/handlers/guardianPolicies.js +27 -20
  53. package/lib/context/yaml/handlers/hooks.js +57 -67
  54. package/lib/context/yaml/handlers/index.js +53 -123
  55. package/lib/context/yaml/handlers/migrations.js +23 -24
  56. package/lib/context/yaml/handlers/organizations.js +40 -38
  57. package/lib/context/yaml/handlers/pages.js +49 -58
  58. package/lib/context/yaml/handlers/resourceServers.js +27 -18
  59. package/lib/context/yaml/handlers/roles.js +34 -24
  60. package/lib/context/yaml/handlers/rules.js +48 -58
  61. package/lib/context/yaml/handlers/rulesConfigs.js +27 -18
  62. package/lib/context/yaml/handlers/tenant.js +44 -30
  63. package/lib/context/yaml/handlers/triggers.js +32 -23
  64. package/lib/context/yaml/index.js +127 -142
  65. package/lib/index.js +73 -79
  66. package/lib/logger.js +18 -22
  67. package/lib/readonly.js +74 -66
  68. package/lib/tools/ValidationError.js +8 -13
  69. package/lib/tools/auth0/client.js +143 -133
  70. package/lib/tools/auth0/handlers/actions.js +231 -243
  71. package/lib/tools/auth0/handlers/attackProtection.js +86 -0
  72. package/lib/tools/auth0/handlers/branding.js +47 -46
  73. package/lib/tools/auth0/handlers/clientGrants.js +118 -116
  74. package/lib/tools/auth0/handlers/clients.js +72 -90
  75. package/lib/tools/auth0/handlers/connections.js +150 -118
  76. package/lib/tools/auth0/handlers/databases.js +127 -124
  77. package/lib/tools/auth0/handlers/default.js +186 -189
  78. package/lib/tools/auth0/handlers/emailProvider.js +67 -78
  79. package/lib/tools/auth0/handlers/emailTemplates.js +116 -92
  80. package/lib/tools/auth0/handlers/guardianFactorProviders.js +66 -81
  81. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +60 -71
  82. package/lib/tools/auth0/handlers/guardianFactors.js +56 -63
  83. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +80 -79
  84. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +77 -76
  85. package/lib/tools/auth0/handlers/guardianPolicies.js +59 -62
  86. package/lib/tools/auth0/handlers/hooks.js +201 -227
  87. package/lib/tools/auth0/handlers/index.js +53 -111
  88. package/lib/tools/auth0/handlers/migrations.js +99 -79
  89. package/lib/tools/auth0/handlers/organizations.js +225 -247
  90. package/lib/tools/auth0/handlers/pages.js +116 -154
  91. package/lib/tools/auth0/handlers/prompts.js +47 -46
  92. package/lib/tools/auth0/handlers/resourceServers.js +88 -112
  93. package/lib/tools/auth0/handlers/roles.js +203 -220
  94. package/lib/tools/auth0/handlers/rules.js +168 -189
  95. package/lib/tools/auth0/handlers/rulesConfigs.js +54 -63
  96. package/lib/tools/auth0/handlers/tenant.js +88 -64
  97. package/lib/tools/auth0/handlers/triggers.js +126 -126
  98. package/lib/tools/auth0/index.js +92 -85
  99. package/lib/tools/auth0/schema.js +39 -31
  100. package/lib/tools/constants.js +111 -21
  101. package/lib/tools/deploy.js +35 -32
  102. package/lib/tools/index.js +19 -32
  103. package/lib/tools/logger.js +11 -12
  104. package/lib/tools/utils.js +255 -282
  105. package/lib/utils.js +167 -190
  106. package/package.json +10 -16
  107. package/tsconfig.json +17 -0
  108. package/typescript-migration-progress.sh +22 -0
  109. package/.babelrc +0 -17
  110. package/.nyc_output/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
  111. package/.nyc_output/processinfo/597f412e-a239-4319-ad5b-ddb87fc39e67.json +0 -1
  112. package/.nyc_output/processinfo/index.json +0 -1
package/lib/utils.js CHANGED
@@ -1,218 +1,195 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isDirectory = isDirectory;
7
- exports.isFile = isFile;
8
- exports.getFiles = getFiles;
9
- exports.loadJSON = loadJSON;
10
- exports.dumpJSON = dumpJSON;
11
- exports.existsMustBeDir = existsMustBeDir;
12
- exports.toConfigFn = toConfigFn;
13
- exports.stripIdentifiers = stripIdentifiers;
14
- exports.sanitize = sanitize;
15
- exports.hoursAsInteger = hoursAsInteger;
16
- exports.formatResults = formatResults;
17
- exports.recordsSorter = recordsSorter;
18
- exports.clearTenantFlags = clearTenantFlags;
19
- exports.ensureProp = ensureProp;
20
- exports.clearClientArrays = clearClientArrays;
21
- exports.convertClientIdToName = convertClientIdToName;
22
- exports.mapClientID2NameSorted = mapClientID2NameSorted;
23
-
24
- var _fsExtra = require("fs-extra");
25
-
26
- var _fsExtra2 = _interopRequireDefault(_fsExtra);
27
-
28
- var _path = require("path");
29
-
30
- var _path2 = _interopRequireDefault(_path);
31
-
32
- var _sanitizeFilename = require("sanitize-filename");
33
-
34
- var _sanitizeFilename2 = _interopRequireDefault(_sanitizeFilename);
35
-
36
- var _dotProp = require("dot-prop");
37
-
38
- var _dotProp2 = _interopRequireDefault(_dotProp);
39
-
40
- var _tools = require("./tools");
41
-
42
- var _logger = require("./logger");
43
-
44
- var _logger2 = _interopRequireDefault(_logger);
45
-
46
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
-
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mapClientID2NameSorted = exports.convertClientIdToName = exports.clearClientArrays = exports.ensureProp = exports.clearTenantFlags = exports.recordsSorter = exports.formatResults = exports.hoursAsInteger = exports.sanitize = exports.stripIdentifiers = exports.toConfigFn = exports.existsMustBeDir = exports.dumpJSON = exports.loadJSON = exports.getFiles = exports.isFile = exports.isDirectory = void 0;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const sanitize_filename_1 = __importDefault(require("sanitize-filename"));
10
+ const dot_prop_1 = __importDefault(require("dot-prop"));
11
+ const tools_1 = require("./tools");
12
+ const logger_1 = __importDefault(require("./logger"));
48
13
  function isDirectory(f) {
49
- try {
50
- return _fsExtra2.default.statSync(_path2.default.resolve(f)).isDirectory();
51
- } catch (err) {
52
- return false;
53
- }
14
+ try {
15
+ return fs_extra_1.default.statSync(path_1.default.resolve(f))
16
+ .isDirectory();
17
+ }
18
+ catch (err) {
19
+ return false;
20
+ }
54
21
  }
55
-
22
+ exports.isDirectory = isDirectory;
56
23
  function isFile(f) {
57
- try {
58
- return _fsExtra2.default.statSync(_path2.default.resolve(f)).isFile();
59
- } catch (err) {
60
- return false;
61
- }
24
+ try {
25
+ return fs_extra_1.default.statSync(path_1.default.resolve(f))
26
+ .isFile();
27
+ }
28
+ catch (err) {
29
+ return false;
30
+ }
62
31
  }
63
-
32
+ exports.isFile = isFile;
64
33
  function getFiles(folder, exts) {
65
- if (isDirectory(folder)) {
66
- return _fsExtra2.default.readdirSync(folder).map(f => _path2.default.join(folder, f)).filter(f => isFile(f) && exts.includes(_path2.default.extname(f)));
67
- }
68
-
69
- return [];
34
+ if (isDirectory(folder)) {
35
+ return fs_extra_1.default.readdirSync(folder)
36
+ .map((f) => path_1.default.join(folder, f))
37
+ .filter((f) => isFile(f) && exts.includes(path_1.default.extname(f)));
38
+ }
39
+ return [];
70
40
  }
71
-
41
+ exports.getFiles = getFiles;
72
42
  function loadJSON(file, mappings) {
73
- try {
74
- const content = (0, _tools.loadFileAndReplaceKeywords)(file, mappings);
75
- return JSON.parse(content);
76
- } catch (e) {
77
- throw new Error(`Error parsing JSON from metadata file: ${file}, because: ${e.message}`);
78
- }
79
- }
80
-
43
+ try {
44
+ const content = (0, tools_1.loadFileAndReplaceKeywords)(file, mappings);
45
+ return JSON.parse(content);
46
+ }
47
+ catch (e) {
48
+ throw new Error(`Error parsing JSON from metadata file: ${file}, because: ${e.message}`);
49
+ }
50
+ }
51
+ exports.loadJSON = loadJSON;
81
52
  function dumpJSON(file, mappings) {
82
- try {
83
- _logger2.default.info(`Writing ${file}`);
84
-
85
- const jsonBody = JSON.stringify(mappings, null, 2);
86
-
87
- _fsExtra2.default.writeFileSync(file, jsonBody.endsWith('\n') ? jsonBody : `${jsonBody}\n`);
88
- } catch (e) {
89
- throw new Error(`Error writing JSON to metadata file: ${file}, because: ${e.message}`);
90
- }
91
- }
92
-
53
+ try {
54
+ logger_1.default.info(`Writing ${file}`);
55
+ const jsonBody = JSON.stringify(mappings, null, 2);
56
+ fs_extra_1.default.writeFileSync(file, jsonBody.endsWith('\n') ? jsonBody : `${jsonBody}\n`);
57
+ }
58
+ catch (e) {
59
+ throw new Error(`Error writing JSON to metadata file: ${file}, because: ${e.message}`);
60
+ }
61
+ }
62
+ exports.dumpJSON = dumpJSON;
93
63
  function existsMustBeDir(folder) {
94
- if (_fsExtra2.default.existsSync(folder)) {
95
- if (!isDirectory(folder)) {
96
- throw new Error(`Expected ${folder} to be a folder but got a file?`);
64
+ if (fs_extra_1.default.existsSync(folder)) {
65
+ if (!isDirectory(folder)) {
66
+ throw new Error(`Expected ${folder} to be a folder but got a file?`);
67
+ }
68
+ return true;
97
69
  }
98
-
99
- return true;
100
- }
101
-
102
- return false;
70
+ return false;
103
71
  }
104
-
72
+ exports.existsMustBeDir = existsMustBeDir;
105
73
  function toConfigFn(data) {
106
- return key => data[key];
74
+ return (key) => data[key];
107
75
  }
108
-
76
+ exports.toConfigFn = toConfigFn;
109
77
  function stripIdentifiers(auth0, assets) {
110
- const updated = { ...assets
111
- };
112
- const ignore = ['actions', 'rulesConfigs', 'emailTemplates', 'guardianFactors', 'guardianFactorProviders', 'guardianFactorTemplates'];
113
- auth0.handlers.forEach(h => {
114
- if (ignore.includes(h.type)) return;
115
- const exist = updated[h.type];
116
-
117
- if (Array.isArray(exist)) {
118
- updated[h.type] = exist.map(o => {
119
- const newObj = { ...o
120
- };
121
- delete newObj[h.id];
122
- return newObj;
123
- });
124
- }
125
- });
126
- return updated;
127
- }
128
-
78
+ const updated = Object.assign({}, assets);
79
+ // Some of the object identifiers are required to perform updates.
80
+ // Don't strip these object id's
81
+ const ignore = [
82
+ 'actions',
83
+ 'rulesConfigs',
84
+ 'emailTemplates',
85
+ 'guardianFactors',
86
+ 'guardianFactorProviders',
87
+ 'guardianFactorTemplates'
88
+ ];
89
+ // Optionally Strip identifiers
90
+ auth0.handlers.forEach((h) => {
91
+ if (ignore.includes(h.type))
92
+ return;
93
+ const exist = updated[h.type];
94
+ // All objects with the identifier field is an array. This could change in future.
95
+ if (Array.isArray(exist)) {
96
+ updated[h.type] = exist.map((o) => {
97
+ const newObj = Object.assign({}, o);
98
+ delete newObj[h.id];
99
+ return newObj;
100
+ });
101
+ }
102
+ });
103
+ return updated;
104
+ }
105
+ exports.stripIdentifiers = stripIdentifiers;
129
106
  function sanitize(str) {
130
- return (0, _sanitizeFilename2.default)(str, {
131
- replacement: '-'
132
- });
107
+ return (0, sanitize_filename_1.default)(str, { replacement: '-' });
133
108
  }
134
-
109
+ exports.sanitize = sanitize;
135
110
  function hoursAsInteger(property, hours) {
136
- if (Number.isInteger(hours)) return {
137
- [property]: hours
138
- };
139
- return {
140
- [`${property}_in_minutes`]: Math.round(hours * 60)
141
- };
142
- }
143
-
111
+ if (Number.isInteger(hours))
112
+ return { [property]: hours };
113
+ return { [`${property}_in_minutes`]: Math.round(hours * 60) };
114
+ }
115
+ exports.hoursAsInteger = hoursAsInteger;
144
116
  function formatResults(item) {
145
- if (typeof item !== 'object') {
146
- return item;
147
- }
148
-
149
- const importantFields = {
150
- name: null,
151
- client_id: null,
152
- audience: null,
153
- template: null,
154
- identifier: null,
155
- strategy: null,
156
- script: null,
157
- stage: null,
158
- id: null
159
- };
160
- const result = { ...importantFields
161
- };
162
- Object.entries(item).sort().forEach(([key, value]) => {
163
- result[key] = value;
164
- });
165
- Object.keys(importantFields).forEach(key => {
166
- if (result[key] === null) delete result[key];
167
- });
168
- return result;
169
- }
170
-
117
+ if (typeof item !== 'object') {
118
+ return item;
119
+ }
120
+ const importantFields = {
121
+ name: null,
122
+ client_id: null,
123
+ audience: null,
124
+ template: null,
125
+ identifier: null,
126
+ strategy: null,
127
+ script: null,
128
+ stage: null,
129
+ id: null
130
+ };
131
+ const result = Object.assign({}, importantFields);
132
+ Object.entries(item).sort().forEach(([key, value]) => {
133
+ result[key] = value;
134
+ });
135
+ Object.keys(importantFields).forEach((key) => {
136
+ if (result[key] === null)
137
+ delete result[key];
138
+ });
139
+ return result;
140
+ }
141
+ exports.formatResults = formatResults;
171
142
  function recordsSorter(a, b) {
172
- const importantFields = ['name', 'key', 'client_id', 'template'];
173
-
174
- for (let i = 0; i < importantFields.length; i += 1) {
175
- const key = importantFields[i];
176
-
177
- if (a[key] && b[key]) {
178
- return a[key] > b[key] ? 1 : -1;
179
- }
180
- }
181
-
182
- return 0;
183
- }
184
-
143
+ const importantFields = [
144
+ 'name',
145
+ 'key',
146
+ 'client_id',
147
+ 'template'
148
+ ];
149
+ for (let i = 0; i < importantFields.length; i += 1) {
150
+ const key = importantFields[i];
151
+ if (a[key] && b[key]) {
152
+ return a[key] > b[key] ? 1 : -1;
153
+ }
154
+ }
155
+ return 0;
156
+ }
157
+ exports.recordsSorter = recordsSorter;
185
158
  function clearTenantFlags(tenant) {
186
- if (tenant.flags && !Object.keys(tenant.flags).length) {
187
- delete tenant.flags;
188
- }
159
+ if (tenant.flags && !Object.keys(tenant.flags).length) {
160
+ delete tenant.flags;
161
+ }
189
162
  }
190
-
163
+ exports.clearTenantFlags = clearTenantFlags;
191
164
  function ensureProp(obj, props, value = '') {
192
- if (!_dotProp2.default.has(obj, props)) {
193
- _dotProp2.default.set(obj, props, value);
194
- }
165
+ if (!dot_prop_1.default.has(obj, props)) {
166
+ dot_prop_1.default.set(obj, props, value);
167
+ }
195
168
  }
196
-
169
+ exports.ensureProp = ensureProp;
197
170
  function clearClientArrays(client) {
198
- const propsToClear = ['allowed_clients', 'allowed_logout_urls', 'allowed_origins', 'callbacks'];
199
- Object.keys(client).forEach(prop => {
200
- if (propsToClear.indexOf(prop) >= 0 && !client[prop]) {
201
- client[prop] = [];
202
- }
203
- });
204
- return client;
171
+ const propsToClear = ['allowed_clients', 'allowed_logout_urls', 'allowed_origins', 'callbacks'];
172
+ Object.keys(client).forEach((prop) => {
173
+ if (propsToClear.indexOf(prop) >= 0 && !client[prop]) {
174
+ client[prop] = [];
175
+ }
176
+ });
177
+ return client;
205
178
  }
206
-
179
+ exports.clearClientArrays = clearClientArrays;
207
180
  function convertClientIdToName(clientId, knownClients = []) {
208
- try {
209
- const found = knownClients.find(c => c.client_id === clientId);
210
- return found && found.name || clientId;
211
- } catch (e) {
212
- return clientId;
213
- }
214
- }
215
-
181
+ try {
182
+ const found = knownClients.find((c) => c.client_id === clientId);
183
+ return (found && found.name) || clientId;
184
+ }
185
+ catch (e) {
186
+ return clientId;
187
+ }
188
+ }
189
+ exports.convertClientIdToName = convertClientIdToName;
216
190
  function mapClientID2NameSorted(enabledClients, knownClients) {
217
- return [...(enabledClients || []).map(clientId => convertClientIdToName(clientId, knownClients))].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
218
- }
191
+ return [
192
+ ...(enabledClients || []).map((clientId) => convertClientIdToName(clientId, knownClients))
193
+ ].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
194
+ }
195
+ exports.mapClientID2NameSorted = mapClientID2NameSorted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0-deploy-cli",
3
- "version": "7.4.0",
3
+ "version": "7.5.2",
4
4
  "description": "A command line tool for deploying updates to your Auth0 tenant",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -10,9 +10,9 @@
10
10
  "lint:fix": "eslint --fix --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
11
11
  "lint": "eslint --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
12
12
  "pretest": "rimraf ./.nyc_output",
13
- "test": "cross-env NODE_ENV=test nyc mocha --recursive --require @babel/register test",
14
- "build": "rimraf ./lib && babel src -d lib",
15
- "dev": "npm run build -- --watch",
13
+ "test": "ts-mocha -p tsconfig.json --recursive 'test/**/*.test.*'",
14
+ "build": "rimraf ./lib && npx tsc",
15
+ "dev": "npx tsc --watch",
16
16
  "prepare": "npm run build",
17
17
  "preversion": "kacl prerelease",
18
18
  "version": "kacl release && git add CHANGELOG.md"
@@ -44,28 +44,22 @@
44
44
  "yargs": "^15.3.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/cli": "^7.14.5",
48
- "@babel/core": "^7.9.6",
49
- "@babel/eslint-parser": "^7.14.5",
50
- "@babel/plugin-proposal-decorators": "^7.8.3",
51
- "@babel/preset-env": "^7.9.6",
52
- "@babel/register": "^7.9.0",
53
- "babel-eslint": "^10.0.0",
54
- "babel-plugin-dynamic-import-node": "^2.3.3",
55
- "babel-plugin-module-resolver": "^4.0.0",
56
- "babel-preset-env": "^1.7.0",
47
+ "@types/expect": "^24.3.0",
48
+ "@types/mocha": "^9.1.0",
49
+ "@typescript-eslint/parser": "^5.14.0",
57
50
  "chai": "^4.1.2",
58
51
  "chai-as-promised": "^7.1.1",
59
52
  "cross-env": "^3.1.4",
60
53
  "eslint": "^7.28.0",
61
54
  "eslint-config-airbnb-base": "^14.2.1",
62
- "eslint-import-resolver-babel-module": "^5.1.2",
63
55
  "eslint-plugin-import": "^2.20.2",
64
56
  "husky": "^7.0.4",
65
57
  "kacl": "^1.1.1",
66
58
  "mocha": "^9.1.3",
67
59
  "nyc": "^15.0.1",
68
60
  "rimraf": "^3.0.2",
69
- "rmdir-sync": "^1.0.1"
61
+ "rmdir-sync": "^1.0.1",
62
+ "ts-mocha": "^9.0.2",
63
+ "typescript": "^4.6.2"
70
64
  }
71
65
  }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2016",
4
+ "experimentalDecorators": true,
5
+ "module": "commonjs",
6
+ "rootDir": "./src",
7
+ "allowJs": true,
8
+ "outDir": "./lib",
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "strict": false,
12
+ "skipLibCheck": true
13
+ },
14
+ "include": [
15
+ "src/**/*"
16
+ ]
17
+ }
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ # Script providing insight into the progress of migrating Deploy CLI source code to Typescript. See: DXCDT-70
4
+ # This can be deleted once migration from JS => TS is complete
5
+
6
+ echo "- - - - - Typescript Migration - - - - - -"
7
+
8
+ locJs=$( (find ./src -name "*.js" -print0 | xargs -0 cat) | wc -l | xargs)
9
+ locTs=$( (find ./src -name "*.ts" -print0 | xargs -0 cat) | wc -l | xargs)
10
+ totalLoc=$(expr ${locJs} + ${locTs})
11
+ percentLocMigrated=$(expr $(expr ${locTs} \* 100) / ${totalLoc})
12
+
13
+ echo "${locTs} of ${totalLoc} (${percentLocMigrated}%) lines of code migrated to Typescript"
14
+
15
+ numTsFiles=$(find ./src -name "*.ts" | wc -l | xargs)
16
+ numJsFiles=$(find ./src -name "*.js" | wc -l | xargs)
17
+ totalNumFiles=$(expr ${numTsFiles} + ${numJsFiles})
18
+ percentFilesMigrated=$(expr $(expr ${numTsFiles} \* 100) / ${totalNumFiles})
19
+
20
+ echo "${numTsFiles} of ${numJsFiles} (${percentFilesMigrated}%) files migrated to Typescript"
21
+
22
+ echo "- - - - - - - - - - - - - - - - - - - - - -"
package/.babelrc DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "comments": false,
3
- "presets": [
4
- [
5
- "env",
6
- {
7
- "targets": {
8
- "node": "8"
9
- }
10
- }
11
- ]
12
- ],
13
- "plugins": [
14
- ["@babel/plugin-proposal-decorators", { "legacy": true }],
15
- "dynamic-import-node"
16
- ]
17
- }