shipthis 0.1.23 → 0.1.25

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 (89) hide show
  1. package/README.md +25 -16
  2. package/docs/assets/ship-outputx0.8.gif +0 -0
  3. package/package.json +1 -1
  4. package/bin/readme.sh +0 -15
  5. package/dist/AppleBundleIdDetails-C9C5WSPR.js +0 -76
  6. package/dist/Command-BQCJ9Wf-.js +0 -28
  7. package/dist/CommandGame-CkGqTno0.js +0 -9
  8. package/dist/Create-t_E231OA.js +0 -59
  9. package/dist/Import-Ljz1gxXd.js +0 -110
  10. package/dist/JobProgress-D9tHgBvi.js +0 -121
  11. package/dist/JobStatusTable-DmI7qCHc.js +0 -203
  12. package/dist/NextSteps-CK9zHOCt.js +0 -18
  13. package/dist/ProgressSpinner-6pw1T8Iw.js +0 -16
  14. package/dist/ProjectCredentialsTable-CTkP1mvy.js +0 -37
  15. package/dist/RunWithSpinner-BVXNWGD3.js +0 -27
  16. package/dist/StatusTable-Dm5St4g-.js +0 -33
  17. package/dist/Table-CvM6pccN.js +0 -101
  18. package/dist/Title-BCQtayg6.js +0 -6
  19. package/dist/UserCredentialsTable-DhtM_iTG.js +0 -82
  20. package/dist/baseAppleCommand-IGl6KTvv.js +0 -10
  21. package/dist/baseGameAndroidCommand-DFn4zMvq.js +0 -43
  22. package/dist/commands/apple/apiKey/create.js +0 -103
  23. package/dist/commands/apple/apiKey/export.js +0 -81
  24. package/dist/commands/apple/apiKey/import.js +0 -85
  25. package/dist/commands/apple/apiKey/status.js +0 -122
  26. package/dist/commands/apple/certificate/create.js +0 -133
  27. package/dist/commands/apple/certificate/export.js +0 -81
  28. package/dist/commands/apple/certificate/import.js +0 -85
  29. package/dist/commands/apple/certificate/status.js +0 -130
  30. package/dist/commands/apple/login.js +0 -76
  31. package/dist/commands/apple/status.js +0 -79
  32. package/dist/commands/dashboard.js +0 -38
  33. package/dist/commands/game/android/apiKey/connect.js +0 -74
  34. package/dist/commands/game/android/apiKey/create.js +0 -74
  35. package/dist/commands/game/android/apiKey/export.js +0 -84
  36. package/dist/commands/game/android/apiKey/import.js +0 -93
  37. package/dist/commands/game/android/apiKey/invite.js +0 -81
  38. package/dist/commands/game/android/apiKey/status.js +0 -87
  39. package/dist/commands/game/android/keyStore/create.js +0 -69
  40. package/dist/commands/game/android/keyStore/export.js +0 -83
  41. package/dist/commands/game/android/keyStore/import.js +0 -112
  42. package/dist/commands/game/android/keyStore/status.js +0 -70
  43. package/dist/commands/game/android/status.js +0 -84
  44. package/dist/commands/game/build/download.js +0 -80
  45. package/dist/commands/game/build/list.js +0 -94
  46. package/dist/commands/game/create.js +0 -67
  47. package/dist/commands/game/details.js +0 -113
  48. package/dist/commands/game/export.js +0 -58
  49. package/dist/commands/game/ios/app/addTester.js +0 -124
  50. package/dist/commands/game/ios/app/create.js +0 -117
  51. package/dist/commands/game/ios/app/status.js +0 -66
  52. package/dist/commands/game/ios/app/sync.js +0 -95
  53. package/dist/commands/game/ios/profile/create.js +0 -129
  54. package/dist/commands/game/ios/profile/export.js +0 -83
  55. package/dist/commands/game/ios/profile/import.js +0 -92
  56. package/dist/commands/game/ios/profile/status.js +0 -139
  57. package/dist/commands/game/ios/status.js +0 -92
  58. package/dist/commands/game/ios/wizard.js +0 -153
  59. package/dist/commands/game/job/list.js +0 -91
  60. package/dist/commands/game/job/status.js +0 -91
  61. package/dist/commands/game/list.js +0 -83
  62. package/dist/commands/game/ship.js +0 -205
  63. package/dist/commands/game/status.js +0 -114
  64. package/dist/commands/game/wizard.js +0 -686
  65. package/dist/commands/internal/fastlane.js +0 -74
  66. package/dist/commands/internal/readme.js +0 -937
  67. package/dist/commands/login.js +0 -92
  68. package/dist/commands/status.js +0 -76
  69. package/dist/export-CVs_xoDN.js +0 -36
  70. package/dist/git-DREGq-jc.js +0 -32
  71. package/dist/import-Ch5O7xfN.js +0 -47
  72. package/dist/index-BB00V5oF.js +0 -136
  73. package/dist/index-CIa2EDQ6.js +0 -24
  74. package/dist/index-DkNQs11R.js +0 -711
  75. package/dist/index-DrcGhlrc.js +0 -138
  76. package/dist/index-DyOv-ge5.js +0 -125
  77. package/dist/index-vMXsdSCy.js +0 -208
  78. package/dist/index.d.ts +0 -1
  79. package/dist/index.js +0 -1
  80. package/dist/upload-CRE2nVdd.js +0 -60
  81. package/dist/useAndroidServiceAccountTestResult-DcYDam-p.js +0 -52
  82. package/dist/useAppleApp-B16WbUxJ.js +0 -32
  83. package/dist/useAppleBundleId-DobPATan.js +0 -64
  84. package/dist/useJobWatching-BZSUa8E-.js +0 -45
  85. package/dist/useProjectCredentials-Btnr7WK3.js +0 -54
  86. package/dist/useWebSocket-ByuNoqRw.js +0 -36
  87. package/dist/utils/help.js +0 -14
  88. package/npm-shrinkwrap.json +0 -14011
  89. package/oclif.manifest.json +0 -2275
@@ -1,937 +0,0 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import fs__default from 'fs';
3
- import path from 'path';
4
- import { Y as BaseCommand } from '../../index-DkNQs11R.js';
5
- import CustomHelp from '../../utils/help.js';
6
- import '@expo/apple-utils/build/index.js';
7
- import 'axios';
8
- import 'crypto-js';
9
- import 'uuid';
10
- import 'luxon';
11
- import 'crypto';
12
- import 'readline-sync';
13
- import 'node:readline';
14
- import 'node:path';
15
- import 'node:url';
16
- import 'isomorphic-git';
17
- import 'ini';
18
- import 'deepmerge';
19
- import 'react';
20
- import '@tanstack/react-query';
21
- import 'fast-glob';
22
- import 'yazl';
23
- import 'socket.io-client';
24
-
25
- function getDefaultExportFromCjs (x) {
26
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
27
- }
28
-
29
- var ejs$1 = {};
30
-
31
- var utils = {};
32
-
33
- var hasRequiredUtils;
34
-
35
- function requireUtils () {
36
- if (hasRequiredUtils) return utils;
37
- hasRequiredUtils = 1;
38
- (function (exports) {
39
- var regExpChars = /[|\\{}()[\]^$+*?.]/g;
40
- var hasOwnProperty = Object.prototype.hasOwnProperty;
41
- var hasOwn = function(obj, key) {
42
- return hasOwnProperty.apply(obj, [key]);
43
- };
44
- exports.escapeRegExpChars = function(string) {
45
- if (!string) {
46
- return "";
47
- }
48
- return String(string).replace(regExpChars, "\\$&");
49
- };
50
- var _ENCODE_HTML_RULES = {
51
- "&": "&",
52
- "<": "&lt;",
53
- ">": "&gt;",
54
- '"': "&#34;",
55
- "'": "&#39;"
56
- };
57
- var _MATCH_HTML = /[&<>'"]/g;
58
- function encode_char(c) {
59
- return _ENCODE_HTML_RULES[c] || c;
60
- }
61
- var escapeFuncStr = `var _ENCODE_HTML_RULES = {
62
- "&": "&amp;"
63
- , "<": "&lt;"
64
- , ">": "&gt;"
65
- , '"': "&#34;"
66
- , "'": "&#39;"
67
- }
68
- , _MATCH_HTML = /[&<>'"]/g;
69
- function encode_char(c) {
70
- return _ENCODE_HTML_RULES[c] || c;
71
- };
72
- `;
73
- exports.escapeXML = function(markup) {
74
- return markup == void 0 ? "" : String(markup).replace(_MATCH_HTML, encode_char);
75
- };
76
- function escapeXMLToString() {
77
- return Function.prototype.toString.call(this) + ";\n" + escapeFuncStr;
78
- }
79
- try {
80
- if (typeof Object.defineProperty === "function") {
81
- Object.defineProperty(exports.escapeXML, "toString", { value: escapeXMLToString });
82
- } else {
83
- exports.escapeXML.toString = escapeXMLToString;
84
- }
85
- } catch (err) {
86
- console.warn("Unable to set escapeXML.toString (is the Function prototype frozen?)");
87
- }
88
- exports.shallowCopy = function(to, from) {
89
- from = from || {};
90
- if (to !== null && to !== void 0) {
91
- for (var p in from) {
92
- if (!hasOwn(from, p)) {
93
- continue;
94
- }
95
- if (p === "__proto__" || p === "constructor") {
96
- continue;
97
- }
98
- to[p] = from[p];
99
- }
100
- }
101
- return to;
102
- };
103
- exports.shallowCopyFromList = function(to, from, list) {
104
- list = list || [];
105
- from = from || {};
106
- if (to !== null && to !== void 0) {
107
- for (var i = 0; i < list.length; i++) {
108
- var p = list[i];
109
- if (typeof from[p] != "undefined") {
110
- if (!hasOwn(from, p)) {
111
- continue;
112
- }
113
- if (p === "__proto__" || p === "constructor") {
114
- continue;
115
- }
116
- to[p] = from[p];
117
- }
118
- }
119
- }
120
- return to;
121
- };
122
- exports.cache = {
123
- _data: {},
124
- set: function(key, val) {
125
- this._data[key] = val;
126
- },
127
- get: function(key) {
128
- return this._data[key];
129
- },
130
- remove: function(key) {
131
- delete this._data[key];
132
- },
133
- reset: function() {
134
- this._data = {};
135
- }
136
- };
137
- exports.hyphenToCamel = function(str) {
138
- return str.replace(/-[a-z]/g, function(match) {
139
- return match[1].toUpperCase();
140
- });
141
- };
142
- exports.createNullProtoObjWherePossible = function() {
143
- if (typeof Object.create == "function") {
144
- return function() {
145
- return /* @__PURE__ */ Object.create(null);
146
- };
147
- }
148
- if (!({ __proto__: null } instanceof Object)) {
149
- return function() {
150
- return { __proto__: null };
151
- };
152
- }
153
- return function() {
154
- return {};
155
- };
156
- }();
157
- exports.hasOwnOnlyObject = function(obj) {
158
- var o = exports.createNullProtoObjWherePossible();
159
- for (var p in obj) {
160
- if (hasOwn(obj, p)) {
161
- o[p] = obj[p];
162
- }
163
- }
164
- return o;
165
- };
166
- } (utils));
167
- return utils;
168
- }
169
-
170
- var version = "3.1.10";
171
- var require$$3 = {
172
- version: version};
173
-
174
- var hasRequiredEjs;
175
-
176
- function requireEjs () {
177
- if (hasRequiredEjs) return ejs$1;
178
- hasRequiredEjs = 1;
179
- (function (exports) {
180
- /**
181
- * @file Embedded JavaScript templating engine. {@link http://ejs.co}
182
- * @author Matthew Eernisse <mde@fleegix.org>
183
- * @author Tiancheng "Timothy" Gu <timothygu99@gmail.com>
184
- * @project EJS
185
- * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
186
- */
187
- var fs = fs__default;
188
- var path$1 = path;
189
- var utils = requireUtils();
190
- var scopeOptionWarned = false;
191
- var _VERSION_STRING = require$$3.version;
192
- var _DEFAULT_OPEN_DELIMITER = "<";
193
- var _DEFAULT_CLOSE_DELIMITER = ">";
194
- var _DEFAULT_DELIMITER = "%";
195
- var _DEFAULT_LOCALS_NAME = "locals";
196
- var _NAME = "ejs";
197
- var _REGEX_STRING = "(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";
198
- var _OPTS_PASSABLE_WITH_DATA = [
199
- "delimiter",
200
- "scope",
201
- "context",
202
- "debug",
203
- "compileDebug",
204
- "client",
205
- "_with",
206
- "rmWhitespace",
207
- "strict",
208
- "filename",
209
- "async"
210
- ];
211
- var _OPTS_PASSABLE_WITH_DATA_EXPRESS = _OPTS_PASSABLE_WITH_DATA.concat("cache");
212
- var _BOM = /^\uFEFF/;
213
- var _JS_IDENTIFIER = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
214
- exports.cache = utils.cache;
215
- exports.fileLoader = fs.readFileSync;
216
- exports.localsName = _DEFAULT_LOCALS_NAME;
217
- exports.promiseImpl = new Function("return this;")().Promise;
218
- exports.resolveInclude = function(name, filename, isDir) {
219
- var dirname = path$1.dirname;
220
- var extname = path$1.extname;
221
- var resolve = path$1.resolve;
222
- var includePath = resolve(isDir ? filename : dirname(filename), name);
223
- var ext = extname(name);
224
- if (!ext) {
225
- includePath += ".ejs";
226
- }
227
- return includePath;
228
- };
229
- function resolvePaths(name, paths) {
230
- var filePath;
231
- if (paths.some(function(v) {
232
- filePath = exports.resolveInclude(name, v, true);
233
- return fs.existsSync(filePath);
234
- })) {
235
- return filePath;
236
- }
237
- }
238
- function getIncludePath(path2, options) {
239
- var includePath;
240
- var filePath;
241
- var views = options.views;
242
- var match = /^[A-Za-z]+:\\|^\//.exec(path2);
243
- if (match && match.length) {
244
- path2 = path2.replace(/^\/*/, "");
245
- if (Array.isArray(options.root)) {
246
- includePath = resolvePaths(path2, options.root);
247
- } else {
248
- includePath = exports.resolveInclude(path2, options.root || "/", true);
249
- }
250
- } else {
251
- if (options.filename) {
252
- filePath = exports.resolveInclude(path2, options.filename);
253
- if (fs.existsSync(filePath)) {
254
- includePath = filePath;
255
- }
256
- }
257
- if (!includePath && Array.isArray(views)) {
258
- includePath = resolvePaths(path2, views);
259
- }
260
- if (!includePath && typeof options.includer !== "function") {
261
- throw new Error('Could not find the include file "' + options.escapeFunction(path2) + '"');
262
- }
263
- }
264
- return includePath;
265
- }
266
- function handleCache(options, template) {
267
- var func;
268
- var filename = options.filename;
269
- var hasTemplate = arguments.length > 1;
270
- if (options.cache) {
271
- if (!filename) {
272
- throw new Error("cache option requires a filename");
273
- }
274
- func = exports.cache.get(filename);
275
- if (func) {
276
- return func;
277
- }
278
- if (!hasTemplate) {
279
- template = fileLoader(filename).toString().replace(_BOM, "");
280
- }
281
- } else if (!hasTemplate) {
282
- if (!filename) {
283
- throw new Error("Internal EJS error: no file name or template provided");
284
- }
285
- template = fileLoader(filename).toString().replace(_BOM, "");
286
- }
287
- func = exports.compile(template, options);
288
- if (options.cache) {
289
- exports.cache.set(filename, func);
290
- }
291
- return func;
292
- }
293
- function tryHandleCache(options, data, cb) {
294
- var result;
295
- if (!cb) {
296
- if (typeof exports.promiseImpl == "function") {
297
- return new exports.promiseImpl(function(resolve, reject) {
298
- try {
299
- result = handleCache(options)(data);
300
- resolve(result);
301
- } catch (err) {
302
- reject(err);
303
- }
304
- });
305
- } else {
306
- throw new Error("Please provide a callback function");
307
- }
308
- } else {
309
- try {
310
- result = handleCache(options)(data);
311
- } catch (err) {
312
- return cb(err);
313
- }
314
- cb(null, result);
315
- }
316
- }
317
- function fileLoader(filePath) {
318
- return exports.fileLoader(filePath);
319
- }
320
- function includeFile(path2, options) {
321
- var opts = utils.shallowCopy(utils.createNullProtoObjWherePossible(), options);
322
- opts.filename = getIncludePath(path2, opts);
323
- if (typeof options.includer === "function") {
324
- var includerResult = options.includer(path2, opts.filename);
325
- if (includerResult) {
326
- if (includerResult.filename) {
327
- opts.filename = includerResult.filename;
328
- }
329
- if (includerResult.template) {
330
- return handleCache(opts, includerResult.template);
331
- }
332
- }
333
- }
334
- return handleCache(opts);
335
- }
336
- function rethrow(err, str, flnm, lineno, esc) {
337
- var lines = str.split("\n");
338
- var start = Math.max(lineno - 3, 0);
339
- var end = Math.min(lines.length, lineno + 3);
340
- var filename = esc(flnm);
341
- var context = lines.slice(start, end).map(function(line, i) {
342
- var curr = i + start + 1;
343
- return (curr == lineno ? " >> " : " ") + curr + "| " + line;
344
- }).join("\n");
345
- err.path = filename;
346
- err.message = (filename || "ejs") + ":" + lineno + "\n" + context + "\n\n" + err.message;
347
- throw err;
348
- }
349
- function stripSemi(str) {
350
- return str.replace(/;(\s*$)/, "$1");
351
- }
352
- exports.compile = function compile(template, opts) {
353
- var templ;
354
- if (opts && opts.scope) {
355
- if (!scopeOptionWarned) {
356
- console.warn("`scope` option is deprecated and will be removed in EJS 3");
357
- scopeOptionWarned = true;
358
- }
359
- if (!opts.context) {
360
- opts.context = opts.scope;
361
- }
362
- delete opts.scope;
363
- }
364
- templ = new Template(template, opts);
365
- return templ.compile();
366
- };
367
- exports.render = function(template, d, o) {
368
- var data = d || utils.createNullProtoObjWherePossible();
369
- var opts = o || utils.createNullProtoObjWherePossible();
370
- if (arguments.length == 2) {
371
- utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA);
372
- }
373
- return handleCache(opts, template)(data);
374
- };
375
- exports.renderFile = function() {
376
- var args = Array.prototype.slice.call(arguments);
377
- var filename = args.shift();
378
- var cb;
379
- var opts = { filename };
380
- var data;
381
- var viewOpts;
382
- if (typeof arguments[arguments.length - 1] == "function") {
383
- cb = args.pop();
384
- }
385
- if (args.length) {
386
- data = args.shift();
387
- if (args.length) {
388
- utils.shallowCopy(opts, args.pop());
389
- } else {
390
- if (data.settings) {
391
- if (data.settings.views) {
392
- opts.views = data.settings.views;
393
- }
394
- if (data.settings["view cache"]) {
395
- opts.cache = true;
396
- }
397
- viewOpts = data.settings["view options"];
398
- if (viewOpts) {
399
- utils.shallowCopy(opts, viewOpts);
400
- }
401
- }
402
- utils.shallowCopyFromList(opts, data, _OPTS_PASSABLE_WITH_DATA_EXPRESS);
403
- }
404
- opts.filename = filename;
405
- } else {
406
- data = utils.createNullProtoObjWherePossible();
407
- }
408
- return tryHandleCache(opts, data, cb);
409
- };
410
- exports.Template = Template;
411
- exports.clearCache = function() {
412
- exports.cache.reset();
413
- };
414
- function Template(text, optsParam) {
415
- var opts = utils.hasOwnOnlyObject(optsParam);
416
- var options = utils.createNullProtoObjWherePossible();
417
- this.templateText = text;
418
- this.mode = null;
419
- this.truncate = false;
420
- this.currentLine = 1;
421
- this.source = "";
422
- options.client = opts.client || false;
423
- options.escapeFunction = opts.escape || opts.escapeFunction || utils.escapeXML;
424
- options.compileDebug = opts.compileDebug !== false;
425
- options.debug = !!opts.debug;
426
- options.filename = opts.filename;
427
- options.openDelimiter = opts.openDelimiter || exports.openDelimiter || _DEFAULT_OPEN_DELIMITER;
428
- options.closeDelimiter = opts.closeDelimiter || exports.closeDelimiter || _DEFAULT_CLOSE_DELIMITER;
429
- options.delimiter = opts.delimiter || exports.delimiter || _DEFAULT_DELIMITER;
430
- options.strict = opts.strict || false;
431
- options.context = opts.context;
432
- options.cache = opts.cache || false;
433
- options.rmWhitespace = opts.rmWhitespace;
434
- options.root = opts.root;
435
- options.includer = opts.includer;
436
- options.outputFunctionName = opts.outputFunctionName;
437
- options.localsName = opts.localsName || exports.localsName || _DEFAULT_LOCALS_NAME;
438
- options.views = opts.views;
439
- options.async = opts.async;
440
- options.destructuredLocals = opts.destructuredLocals;
441
- options.legacyInclude = typeof opts.legacyInclude != "undefined" ? !!opts.legacyInclude : true;
442
- if (options.strict) {
443
- options._with = false;
444
- } else {
445
- options._with = typeof opts._with != "undefined" ? opts._with : true;
446
- }
447
- this.opts = options;
448
- this.regex = this.createRegex();
449
- }
450
- Template.modes = {
451
- EVAL: "eval",
452
- ESCAPED: "escaped",
453
- RAW: "raw",
454
- COMMENT: "comment",
455
- LITERAL: "literal"
456
- };
457
- Template.prototype = {
458
- createRegex: function() {
459
- var str = _REGEX_STRING;
460
- var delim = utils.escapeRegExpChars(this.opts.delimiter);
461
- var open = utils.escapeRegExpChars(this.opts.openDelimiter);
462
- var close = utils.escapeRegExpChars(this.opts.closeDelimiter);
463
- str = str.replace(/%/g, delim).replace(/</g, open).replace(/>/g, close);
464
- return new RegExp(str);
465
- },
466
- compile: function() {
467
- var src;
468
- var fn;
469
- var opts = this.opts;
470
- var prepended = "";
471
- var appended = "";
472
- var escapeFn = opts.escapeFunction;
473
- var ctor;
474
- var sanitizedFilename = opts.filename ? JSON.stringify(opts.filename) : "undefined";
475
- if (!this.source) {
476
- this.generateSource();
477
- prepended += ' var __output = "";\n function __append(s) { if (s !== undefined && s !== null) __output += s }\n';
478
- if (opts.outputFunctionName) {
479
- if (!_JS_IDENTIFIER.test(opts.outputFunctionName)) {
480
- throw new Error("outputFunctionName is not a valid JS identifier.");
481
- }
482
- prepended += " var " + opts.outputFunctionName + " = __append;\n";
483
- }
484
- if (opts.localsName && !_JS_IDENTIFIER.test(opts.localsName)) {
485
- throw new Error("localsName is not a valid JS identifier.");
486
- }
487
- if (opts.destructuredLocals && opts.destructuredLocals.length) {
488
- var destructuring = " var __locals = (" + opts.localsName + " || {}),\n";
489
- for (var i = 0; i < opts.destructuredLocals.length; i++) {
490
- var name = opts.destructuredLocals[i];
491
- if (!_JS_IDENTIFIER.test(name)) {
492
- throw new Error("destructuredLocals[" + i + "] is not a valid JS identifier.");
493
- }
494
- if (i > 0) {
495
- destructuring += ",\n ";
496
- }
497
- destructuring += name + " = __locals." + name;
498
- }
499
- prepended += destructuring + ";\n";
500
- }
501
- if (opts._with !== false) {
502
- prepended += " with (" + opts.localsName + " || {}) {\n";
503
- appended += " }\n";
504
- }
505
- appended += " return __output;\n";
506
- this.source = prepended + this.source + appended;
507
- }
508
- if (opts.compileDebug) {
509
- src = "var __line = 1\n , __lines = " + JSON.stringify(this.templateText) + "\n , __filename = " + sanitizedFilename + ";\ntry {\n" + this.source + "} catch (e) {\n rethrow(e, __lines, __filename, __line, escapeFn);\n}\n";
510
- } else {
511
- src = this.source;
512
- }
513
- if (opts.client) {
514
- src = "escapeFn = escapeFn || " + escapeFn.toString() + ";\n" + src;
515
- if (opts.compileDebug) {
516
- src = "rethrow = rethrow || " + rethrow.toString() + ";\n" + src;
517
- }
518
- }
519
- if (opts.strict) {
520
- src = '"use strict";\n' + src;
521
- }
522
- if (opts.debug) {
523
- console.log(src);
524
- }
525
- if (opts.compileDebug && opts.filename) {
526
- src = src + "\n//# sourceURL=" + sanitizedFilename + "\n";
527
- }
528
- try {
529
- if (opts.async) {
530
- try {
531
- ctor = new Function("return (async function(){}).constructor;")();
532
- } catch (e) {
533
- if (e instanceof SyntaxError) {
534
- throw new Error("This environment does not support async/await");
535
- } else {
536
- throw e;
537
- }
538
- }
539
- } else {
540
- ctor = Function;
541
- }
542
- fn = new ctor(opts.localsName + ", escapeFn, include, rethrow", src);
543
- } catch (e) {
544
- if (e instanceof SyntaxError) {
545
- if (opts.filename) {
546
- e.message += " in " + opts.filename;
547
- }
548
- e.message += " while compiling ejs\n\n";
549
- e.message += "If the above error is not helpful, you may want to try EJS-Lint:\n";
550
- e.message += "https://github.com/RyanZim/EJS-Lint";
551
- if (!opts.async) {
552
- e.message += "\n";
553
- e.message += "Or, if you meant to create an async function, pass `async: true` as an option.";
554
- }
555
- }
556
- throw e;
557
- }
558
- var returnedFn = opts.client ? fn : function anonymous(data) {
559
- var include = function(path2, includeData) {
560
- var d = utils.shallowCopy(utils.createNullProtoObjWherePossible(), data);
561
- if (includeData) {
562
- d = utils.shallowCopy(d, includeData);
563
- }
564
- return includeFile(path2, opts)(d);
565
- };
566
- return fn.apply(
567
- opts.context,
568
- [data || utils.createNullProtoObjWherePossible(), escapeFn, include, rethrow]
569
- );
570
- };
571
- if (opts.filename && typeof Object.defineProperty === "function") {
572
- var filename = opts.filename;
573
- var basename = path$1.basename(filename, path$1.extname(filename));
574
- try {
575
- Object.defineProperty(returnedFn, "name", {
576
- value: basename,
577
- writable: false,
578
- enumerable: false,
579
- configurable: true
580
- });
581
- } catch (e) {
582
- }
583
- }
584
- return returnedFn;
585
- },
586
- generateSource: function() {
587
- var opts = this.opts;
588
- if (opts.rmWhitespace) {
589
- this.templateText = this.templateText.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
590
- }
591
- this.templateText = this.templateText.replace(/[ \t]*<%_/gm, "<%_").replace(/_%>[ \t]*/gm, "_%>");
592
- var self = this;
593
- var matches = this.parseTemplateText();
594
- var d = this.opts.delimiter;
595
- var o = this.opts.openDelimiter;
596
- var c = this.opts.closeDelimiter;
597
- if (matches && matches.length) {
598
- matches.forEach(function(line, index) {
599
- var closing;
600
- if (line.indexOf(o + d) === 0 && line.indexOf(o + d + d) !== 0) {
601
- closing = matches[index + 2];
602
- if (!(closing == d + c || closing == "-" + d + c || closing == "_" + d + c)) {
603
- throw new Error('Could not find matching close tag for "' + line + '".');
604
- }
605
- }
606
- self.scanLine(line);
607
- });
608
- }
609
- },
610
- parseTemplateText: function() {
611
- var str = this.templateText;
612
- var pat = this.regex;
613
- var result = pat.exec(str);
614
- var arr = [];
615
- var firstPos;
616
- while (result) {
617
- firstPos = result.index;
618
- if (firstPos !== 0) {
619
- arr.push(str.substring(0, firstPos));
620
- str = str.slice(firstPos);
621
- }
622
- arr.push(result[0]);
623
- str = str.slice(result[0].length);
624
- result = pat.exec(str);
625
- }
626
- if (str) {
627
- arr.push(str);
628
- }
629
- return arr;
630
- },
631
- _addOutput: function(line) {
632
- if (this.truncate) {
633
- line = line.replace(/^(?:\r\n|\r|\n)/, "");
634
- this.truncate = false;
635
- }
636
- if (!line) {
637
- return line;
638
- }
639
- line = line.replace(/\\/g, "\\\\");
640
- line = line.replace(/\n/g, "\\n");
641
- line = line.replace(/\r/g, "\\r");
642
- line = line.replace(/"/g, '\\"');
643
- this.source += ' ; __append("' + line + '")\n';
644
- },
645
- scanLine: function(line) {
646
- var self = this;
647
- var d = this.opts.delimiter;
648
- var o = this.opts.openDelimiter;
649
- var c = this.opts.closeDelimiter;
650
- var newLineCount = 0;
651
- newLineCount = line.split("\n").length - 1;
652
- switch (line) {
653
- case o + d:
654
- case o + d + "_":
655
- this.mode = Template.modes.EVAL;
656
- break;
657
- case o + d + "=":
658
- this.mode = Template.modes.ESCAPED;
659
- break;
660
- case o + d + "-":
661
- this.mode = Template.modes.RAW;
662
- break;
663
- case o + d + "#":
664
- this.mode = Template.modes.COMMENT;
665
- break;
666
- case o + d + d:
667
- this.mode = Template.modes.LITERAL;
668
- this.source += ' ; __append("' + line.replace(o + d + d, o + d) + '")\n';
669
- break;
670
- case d + d + c:
671
- this.mode = Template.modes.LITERAL;
672
- this.source += ' ; __append("' + line.replace(d + d + c, d + c) + '")\n';
673
- break;
674
- case d + c:
675
- case "-" + d + c:
676
- case "_" + d + c:
677
- if (this.mode == Template.modes.LITERAL) {
678
- this._addOutput(line);
679
- }
680
- this.mode = null;
681
- this.truncate = line.indexOf("-") === 0 || line.indexOf("_") === 0;
682
- break;
683
- default:
684
- if (this.mode) {
685
- switch (this.mode) {
686
- case Template.modes.EVAL:
687
- case Template.modes.ESCAPED:
688
- case Template.modes.RAW:
689
- if (line.lastIndexOf("//") > line.lastIndexOf("\n")) {
690
- line += "\n";
691
- }
692
- }
693
- switch (this.mode) {
694
- // Just executing code
695
- case Template.modes.EVAL:
696
- this.source += " ; " + line + "\n";
697
- break;
698
- // Exec, esc, and output
699
- case Template.modes.ESCAPED:
700
- this.source += " ; __append(escapeFn(" + stripSemi(line) + "))\n";
701
- break;
702
- // Exec and output
703
- case Template.modes.RAW:
704
- this.source += " ; __append(" + stripSemi(line) + ")\n";
705
- break;
706
- case Template.modes.COMMENT:
707
- break;
708
- // Literal <%% mode, append as raw output
709
- case Template.modes.LITERAL:
710
- this._addOutput(line);
711
- break;
712
- }
713
- } else {
714
- this._addOutput(line);
715
- }
716
- }
717
- if (self.opts.compileDebug && newLineCount) {
718
- this.currentLine += newLineCount;
719
- this.source += " ; __line = " + this.currentLine + "\n";
720
- }
721
- }
722
- };
723
- exports.escapeXML = utils.escapeXML;
724
- exports.__express = exports.renderFile;
725
- exports.VERSION = _VERSION_STRING;
726
- exports.name = _NAME;
727
- if (typeof window != "undefined") {
728
- window.ejs = exports;
729
- }
730
- } (ejs$1));
731
- return ejs$1;
732
- }
733
-
734
- var ejsExports = requireEjs();
735
- var ejs = /*@__PURE__*/getDefaultExportFromCjs(ejsExports);
736
-
737
- const ROOT_TOPIC_NAME = "shipthis";
738
- const ROOT_TOPIC_DESCRIPTION = "Root topic";
739
- const ROOT_TOPIC_FILENAME = "README.md";
740
- const TOPIC_TEMPLATE = `
741
- # Topic: \`<%= topic.name.replaceAll(":", " ") %>\`
742
-
743
- <%= topic.description || "" %>
744
-
745
- <% if (subTopics && subTopics.length > 0) { -%>
746
- ## Topics
747
-
748
- <% subTopics.forEach(subTopic => { -%>
749
- - [<%= subTopic.topic.name %>](<%= subTopic.filePath %>)
750
- <% }) -%>
751
- <% } -%>
752
-
753
- <% if (commands && commands.length > 0) { -%>
754
- ## Commands
755
-
756
- <% commands.forEach(readmeCommand => { -%>
757
- - [<%= readmeCommand.command.id %>](<%= readmeCommand.filePath %>)
758
- <% }) -%>
759
- <% } -%>
760
- `.trim();
761
- const TOPIC_TEMPLATE_INCLUDE = `
762
- # Topic: \`<%= topic.name.replaceAll(":", " ") %>\`
763
-
764
- <%= topic.description || "" %>
765
-
766
- <% if (subTopics && subTopics.length > 0) { -%>
767
- ## Topics
768
-
769
- <% subTopics.forEach(subTopic => { %>
770
- <%- subTopic.rendered %>
771
- <% }) -%>
772
- <% } -%>
773
-
774
- <% if (commands && commands.length > 0) { -%>
775
- ## Commands
776
-
777
- <% commands.forEach(readmeCommand => { %>
778
- <%- readmeCommand.renderedForInclude %>
779
- <% }) -%>
780
- <% } -%>
781
- `.trim();
782
- const COMMAND_TEMPLATE = `
783
- # Command: \`<%= command.id %>\`
784
-
785
- ## Description
786
-
787
- <%= command.description || "" %>
788
-
789
- ## Help Output
790
-
791
- \`\`\`help
792
- <%- helpOutput %>
793
- \`\`\`
794
- `.trim();
795
- const COMMAND_TEMPLATE_INCLUDE = `
796
- ### \`<%= command.id %>\`
797
-
798
- #### Description
799
-
800
- <%= command.description || "" %>
801
-
802
- #### Help Output
803
-
804
- \`\`\`help
805
- <%- helpOutput %>
806
- \`\`\`
807
- `.trim();
808
- function getTopicTree(topics, commands, separateFileDepth) {
809
- const commandIds = commands.map((command) => command.id);
810
- const nonInternalTopics = topics.filter((topic) => topic.name !== "internal");
811
- const nonCommandTopics = nonInternalTopics.filter((topic) => !commandIds.includes(topic.name));
812
- let topicTree = {
813
- [ROOT_TOPIC_NAME]: {
814
- filePath: ROOT_TOPIC_FILENAME,
815
- topic: { name: ROOT_TOPIC_NAME, description: ROOT_TOPIC_DESCRIPTION },
816
- subTopics: [],
817
- commands: [],
818
- includeTopicsAndCommands: separateFileDepth === 0
819
- }
820
- };
821
- const topicsByName = Object.fromEntries(topics.map((topic) => [topic.name, topic]));
822
- for (const topic of nonCommandTopics) {
823
- const topicPath = topic.name.split(":");
824
- let currentParent = topicTree[ROOT_TOPIC_NAME];
825
- for (let i = 0; i < topicPath.length; i++) {
826
- const name = topicPath.slice(0, i + 1).join(":");
827
- const subTopic = currentParent.subTopics.find((subTopic2) => subTopic2.topic.name === name);
828
- if (!subTopic) {
829
- const currentDepth = i + 1;
830
- const includeTopicsAndCommands = currentParent.includeTopicsAndCommands || currentDepth >= separateFileDepth;
831
- const newSubTopic = {
832
- topic: topicsByName[name],
833
- subTopics: [],
834
- commands: [],
835
- filePath: `${path.join(...name.split(":"))}.md`,
836
- includeTopicsAndCommands
837
- };
838
- currentParent.subTopics.push(newSubTopic);
839
- currentParent = newSubTopic;
840
- } else {
841
- currentParent = subTopic;
842
- }
843
- }
844
- }
845
- for (const command of commands) {
846
- const commandPath = command.id.split(":");
847
- if (commandPath[0] === "internal") continue;
848
- let currentParent = topicTree[ROOT_TOPIC_NAME];
849
- for (let i = 0; i < commandPath.length - 1; i++) {
850
- const name = commandPath.slice(0, i + 1).join(":");
851
- const subTopic = currentParent.subTopics.find((subTopic2) => subTopic2.topic.name === name);
852
- if (!subTopic) throw new Error("Could not find topic for command: " + command.id);
853
- currentParent = subTopic;
854
- }
855
- currentParent.commands.push({ command, filePath: `${path.join(...command.id.split(":"))}.md` });
856
- }
857
- return topicTree;
858
- }
859
- function renderTopic(readmeTopic, config) {
860
- const renderedSubTopics = readmeTopic.subTopics.map((subTopic) => renderTopic(subTopic, config));
861
- const renderedCommands = readmeTopic.commands.map((readmeCommand) => renderCommand(readmeCommand, config));
862
- const topicTemplate = readmeTopic.includeTopicsAndCommands ? TOPIC_TEMPLATE_INCLUDE : TOPIC_TEMPLATE;
863
- const rendered = ejs.render(topicTemplate, {
864
- topic: readmeTopic.topic,
865
- subTopics: renderedSubTopics,
866
- commands: renderedCommands
867
- });
868
- return { ...readmeTopic, subTopics: renderedSubTopics, commands: renderedCommands, rendered };
869
- }
870
- function renderCommand(readmeCommand, config) {
871
- const columns = Number.parseInt(process.env.COLUMNS, 10) || 120;
872
- const help = new CustomHelp(config, { maxWidth: columns, stripAnsi: true });
873
- const helpOutput = help.exposedFormatCommand(readmeCommand.command);
874
- const renderedForInclude = ejs.render(COMMAND_TEMPLATE_INCLUDE, { command: readmeCommand.command, helpOutput });
875
- const renderedForFile = ejs.render(COMMAND_TEMPLATE, { command: readmeCommand.command, helpOutput });
876
- return { ...readmeCommand, renderedForFile, renderedForInclude };
877
- }
878
- function writeTopic(topic, outputDir, dryRun, overWrite, only) {
879
- if (!topic.rendered) throw new Error(`Topic ${topic.topic.name} has not been rendered`);
880
- const makeFolderAndSave = (filePath2, rendered) => {
881
- const exists = fs__default.existsSync(filePath2);
882
- const outputList = exists ? writeOutput.overwritten : writeOutput.created;
883
- outputList.push(filePath2);
884
- const doWrite = !exists || overWrite;
885
- if (!doWrite || dryRun) return;
886
- const folder = path.dirname(filePath2);
887
- fs__default.mkdirSync(folder, { recursive: true });
888
- fs__default.writeFileSync(filePath2, rendered);
889
- };
890
- const skipFile = (filePath2) => only && !filePath2.match(only);
891
- const writeOutput = { created: [], overwritten: [] };
892
- const filePath = path.join(outputDir, topic.filePath);
893
- if (!skipFile(filePath)) makeFolderAndSave(filePath, topic.rendered);
894
- for (const subTopic of topic.subTopics) {
895
- const subWriteOutput = writeTopic(subTopic, outputDir, dryRun, overWrite, only);
896
- writeOutput.created.push(...subWriteOutput.created);
897
- writeOutput.overwritten.push(...subWriteOutput.overwritten);
898
- }
899
- for (const command of topic.commands) {
900
- if (!command.renderedForFile) throw new Error(`Command ${command.command.id} has not been rendered`);
901
- const filePath2 = path.join(outputDir, command.filePath);
902
- if (!skipFile(filePath2)) makeFolderAndSave(filePath2, command.renderedForFile);
903
- }
904
- return writeOutput;
905
- }
906
- class InternalReadme extends BaseCommand {
907
- static args = {
908
- outputDir: Args.string({ description: "The directory where the readme files will be written", required: true })
909
- };
910
- static description = "Generate the readme files for the commands";
911
- static examples = ["<%= config.bin %> <%= command.id %>"];
912
- static flags = {
913
- // By default do nothing
914
- notDryRun: Flags.boolean({ char: "n", description: "Set to actually write the files (will not overwrite)" }),
915
- overWrite: Flags.boolean({ char: "o", description: "Overwrite existing files" }),
916
- depth: Flags.integer({ char: "d", description: "The depth of the topic tree to render as separate files" }),
917
- only: Flags.string({ char: "l", description: "Glob pattern - will only write the files which match" })
918
- };
919
- async run() {
920
- const { outputDir } = this.args;
921
- const { notDryRun, overWrite, depth, only } = this.flags;
922
- const dryRun = !notDryRun;
923
- const { commands, topics } = this.config;
924
- const topicTree = getTopicTree(topics, commands, depth || 0);
925
- const renderedTopicTree = renderTopic(topicTree[ROOT_TOPIC_NAME], this.config);
926
- if (dryRun) console.log("Dry-run mode: No files will be written.");
927
- const writeOutput = writeTopic(renderedTopicTree, outputDir, dryRun, overWrite, only);
928
- if (writeOutput.created.length > 0)
929
- console.log(dryRun ? "Would create the following files:" : "Created the following files:");
930
- writeOutput.created.forEach((file) => console.log(`- ${file}`));
931
- if (writeOutput.overwritten.length > 0)
932
- console.log(notDryRun && overWrite ? "Overwritten the following files:" : "Would overwrite the following files:");
933
- writeOutput.overwritten.forEach((file) => console.log(`- ${file}`));
934
- }
935
- }
936
-
937
- export { InternalReadme as default };