auth0-deploy-cli 7.3.6 → 7.5.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 (113) hide show
  1. package/.circleci/config.yml +15 -0
  2. package/.github/CODEOWNERS +1 -0
  3. package/.husky/pre-commit +6 -0
  4. package/.husky/pre-push +4 -0
  5. package/.nyc_output/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
  6. package/.nyc_output/processinfo/60b76a45-577b-4171-9982-a8e836ab7fd6.json +1 -0
  7. package/.nyc_output/processinfo/index.json +1 -1
  8. package/CHANGELOG.md +35 -2
  9. package/lib/args.js +89 -81
  10. package/lib/commands/export.js +51 -77
  11. package/lib/commands/import.js +45 -69
  12. package/lib/commands/index.js +11 -20
  13. package/lib/configFactory.js +19 -27
  14. package/lib/context/defaults.js +18 -41
  15. package/lib/context/directory/handlers/actions.js +77 -107
  16. package/lib/context/directory/handlers/attackProtection.js +59 -0
  17. package/lib/context/directory/handlers/clientGrants.js +45 -54
  18. package/lib/context/directory/handlers/clients.js +60 -79
  19. package/lib/context/directory/handlers/connections.js +65 -89
  20. package/lib/context/directory/handlers/databases.js +91 -123
  21. package/lib/context/directory/handlers/emailProvider.js +46 -57
  22. package/lib/context/directory/handlers/emailTemplates.js +67 -80
  23. package/lib/context/directory/handlers/guardianFactorProviders.js +41 -49
  24. package/lib/context/directory/handlers/guardianFactorTemplates.js +41 -49
  25. package/lib/context/directory/handlers/guardianFactors.js +41 -49
  26. package/lib/context/directory/handlers/guardianPhoneFactorMessageTypes.js +40 -50
  27. package/lib/context/directory/handlers/guardianPhoneFactorSelectedProvider.js +40 -50
  28. package/lib/context/directory/handlers/guardianPolicies.js +40 -50
  29. package/lib/context/directory/handlers/hooks.js +55 -70
  30. package/lib/context/directory/handlers/index.js +53 -123
  31. package/lib/context/directory/handlers/migrations.js +36 -41
  32. package/lib/context/directory/handlers/organizations.js +54 -69
  33. package/lib/context/directory/handlers/pages.js +72 -86
  34. package/lib/context/directory/handlers/resourceServers.js +41 -49
  35. package/lib/context/directory/handlers/roles.js +49 -62
  36. package/lib/context/directory/handlers/rules.js +52 -68
  37. package/lib/context/directory/handlers/rulesConfigs.js +33 -32
  38. package/lib/context/directory/handlers/tenant.js +52 -47
  39. package/lib/context/directory/handlers/triggers.js +39 -54
  40. package/lib/context/directory/index.js +113 -101
  41. package/lib/context/index.js +96 -105
  42. package/lib/context/yaml/handlers/actions.js +71 -88
  43. package/lib/context/yaml/handlers/attackProtection.js +29 -0
  44. package/lib/context/yaml/handlers/clientGrants.js +36 -29
  45. package/lib/context/yaml/handlers/clients.js +61 -76
  46. package/lib/context/yaml/handlers/connections.js +76 -103
  47. package/lib/context/yaml/handlers/databases.js +64 -79
  48. package/lib/context/yaml/handlers/emailProvider.js +33 -30
  49. package/lib/context/yaml/handlers/emailTemplates.js +45 -54
  50. package/lib/context/yaml/handlers/guardianFactorProviders.js +27 -18
  51. package/lib/context/yaml/handlers/guardianFactorTemplates.js +27 -18
  52. package/lib/context/yaml/handlers/guardianFactors.js +27 -18
  53. package/lib/context/yaml/handlers/guardianPhoneFactorMessageTypes.js +27 -20
  54. package/lib/context/yaml/handlers/guardianPhoneFactorSelectedProvider.js +27 -20
  55. package/lib/context/yaml/handlers/guardianPolicies.js +27 -20
  56. package/lib/context/yaml/handlers/hooks.js +57 -67
  57. package/lib/context/yaml/handlers/index.js +53 -123
  58. package/lib/context/yaml/handlers/migrations.js +23 -24
  59. package/lib/context/yaml/handlers/organizations.js +40 -38
  60. package/lib/context/yaml/handlers/pages.js +49 -58
  61. package/lib/context/yaml/handlers/resourceServers.js +27 -18
  62. package/lib/context/yaml/handlers/roles.js +34 -24
  63. package/lib/context/yaml/handlers/rules.js +48 -58
  64. package/lib/context/yaml/handlers/rulesConfigs.js +27 -18
  65. package/lib/context/yaml/handlers/tenant.js +44 -30
  66. package/lib/context/yaml/handlers/triggers.js +32 -23
  67. package/lib/context/yaml/index.js +127 -142
  68. package/lib/index.js +73 -79
  69. package/lib/logger.js +18 -22
  70. package/lib/readonly.js +74 -66
  71. package/lib/tools/ValidationError.js +8 -13
  72. package/lib/tools/auth0/client.js +143 -133
  73. package/lib/tools/auth0/handlers/actions.js +231 -241
  74. package/lib/tools/auth0/handlers/attackProtection.js +86 -0
  75. package/lib/tools/auth0/handlers/branding.js +47 -46
  76. package/lib/tools/auth0/handlers/clientGrants.js +118 -116
  77. package/lib/tools/auth0/handlers/clients.js +72 -90
  78. package/lib/tools/auth0/handlers/connections.js +150 -118
  79. package/lib/tools/auth0/handlers/databases.js +127 -124
  80. package/lib/tools/auth0/handlers/default.js +186 -189
  81. package/lib/tools/auth0/handlers/emailProvider.js +67 -78
  82. package/lib/tools/auth0/handlers/emailTemplates.js +116 -92
  83. package/lib/tools/auth0/handlers/guardianFactorProviders.js +66 -81
  84. package/lib/tools/auth0/handlers/guardianFactorTemplates.js +60 -71
  85. package/lib/tools/auth0/handlers/guardianFactors.js +56 -63
  86. package/lib/tools/auth0/handlers/guardianPhoneFactorMessageTypes.js +80 -79
  87. package/lib/tools/auth0/handlers/guardianPhoneFactorSelectedProvider.js +77 -76
  88. package/lib/tools/auth0/handlers/guardianPolicies.js +59 -62
  89. package/lib/tools/auth0/handlers/hooks.js +201 -227
  90. package/lib/tools/auth0/handlers/index.js +53 -111
  91. package/lib/tools/auth0/handlers/migrations.js +99 -79
  92. package/lib/tools/auth0/handlers/organizations.js +225 -247
  93. package/lib/tools/auth0/handlers/pages.js +116 -154
  94. package/lib/tools/auth0/handlers/prompts.js +47 -46
  95. package/lib/tools/auth0/handlers/resourceServers.js +88 -112
  96. package/lib/tools/auth0/handlers/roles.js +203 -220
  97. package/lib/tools/auth0/handlers/rules.js +168 -189
  98. package/lib/tools/auth0/handlers/rulesConfigs.js +54 -63
  99. package/lib/tools/auth0/handlers/tenant.js +88 -64
  100. package/lib/tools/auth0/handlers/triggers.js +126 -126
  101. package/lib/tools/auth0/index.js +92 -85
  102. package/lib/tools/auth0/schema.js +39 -31
  103. package/lib/tools/constants.js +111 -21
  104. package/lib/tools/deploy.js +35 -32
  105. package/lib/tools/index.js +19 -32
  106. package/lib/tools/logger.js +11 -12
  107. package/lib/tools/utils.js +258 -254
  108. package/lib/utils.js +167 -190
  109. package/package.json +6 -3
  110. package/tsconfig.json +96 -0
  111. package/typescript-migration-progress.sh +22 -0
  112. package/.nyc_output/8cf4dd0c-1f3a-4ac1-899c-8e453a64221e.json +0 -1
  113. package/.nyc_output/processinfo/8cf4dd0c-1f3a-4ac1-899c-8e453a64221e.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.loadFile)(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.3.6",
3
+ "version": "7.5.0",
4
4
  "description": "A command line tool for deploying updates to your Auth0 tenant",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -11,7 +11,8 @@
11
11
  "lint": "eslint --ignore-path .eslintignore --ignore-pattern webpack . && kacl lint",
12
12
  "pretest": "rimraf ./.nyc_output",
13
13
  "test": "cross-env NODE_ENV=test nyc mocha --recursive --require @babel/register test",
14
- "build": "rimraf ./lib && babel src -d lib",
14
+ "build": "rimraf ./lib && npx tsc",
15
+ "dev": "npx tsc --watch",
15
16
  "prepare": "npm run build",
16
17
  "preversion": "kacl prerelease",
17
18
  "version": "kacl release && git add CHANGELOG.md"
@@ -29,7 +30,7 @@
29
30
  "homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
30
31
  "dependencies": {
31
32
  "ajv": "^6.12.6",
32
- "auth0": "2.37.0",
33
+ "auth0": "^2.40.0",
33
34
  "dot-prop": "^5.2.0",
34
35
  "fs-extra": "^7.0.0",
35
36
  "global-agent": "^2.1.12",
@@ -39,6 +40,7 @@
39
40
  "nconf": "^0.11.0",
40
41
  "promise-pool-executor": "^1.1.1",
41
42
  "sanitize-filename": "^1.6.1",
43
+ "typescript": "^4.5.5",
42
44
  "winston": "^2.3.0",
43
45
  "yargs": "^15.3.1"
44
46
  },
@@ -60,6 +62,7 @@
60
62
  "eslint-config-airbnb-base": "^14.2.1",
61
63
  "eslint-import-resolver-babel-module": "^5.1.2",
62
64
  "eslint-plugin-import": "^2.20.2",
65
+ "husky": "^7.0.4",
63
66
  "kacl": "^1.1.1",
64
67
  "mocha": "^9.1.3",
65
68
  "nyc": "^15.0.1",
package/tsconfig.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
+ /* Projects */
5
+ // "incremental": true, /* Enable incremental compilation */
6
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
7
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
8
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
9
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
10
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
11
+ /* Language and Environment */
12
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
13
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
14
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
15
+ "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
16
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
17
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
18
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
19
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
20
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
21
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
22
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
23
+ /* Modules */
24
+ "module": "commonjs", /* Specify what module code is generated. */
25
+ "rootDir": "./src", /* Specify the root folder within your source files. */
26
+ // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
27
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
28
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
29
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
30
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
31
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
32
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
33
+ // "resolveJsonModule": true, /* Enable importing .json files */
34
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
35
+ /* JavaScript Support */
36
+ "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
37
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
38
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
39
+ /* Emit */
40
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
41
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
42
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
43
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
44
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
45
+ "outDir": "./lib", /* Specify an output folder for all emitted files. */
46
+ // "removeComments": true, /* Disable emitting comments. */
47
+ // "noEmit": true, /* Disable emitting files from a compilation. */
48
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
49
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
50
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
51
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
52
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
53
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
54
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
55
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
56
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
57
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
58
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
59
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
60
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
61
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
62
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
63
+ /* Interop Constraints */
64
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
65
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
66
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
67
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
68
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
69
+ /* Type Checking */
70
+ "strict": false, /* Enable all strict type-checking options. */
71
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
72
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
73
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
74
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
75
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
76
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
77
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
78
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
79
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
80
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
81
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
82
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
83
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
84
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
85
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
86
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
87
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
88
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
89
+ /* Completeness */
90
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
91
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
92
+ },
93
+ "include": [
94
+ "src/**/*"
95
+ ]
96
+ }
@@ -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 "- - - - - - - - - - - - - - - - - - - - - -"