UI for Zipcoin Blue

index.js 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const tslib_1 = require("tslib");
  4. const chalk_1 = require("chalk");
  5. const cli_utils_1 = require("@ionic/cli-utils");
  6. const namespace_1 = require("@ionic/cli-utils/lib/namespace");
  7. const errors_1 = require("@ionic/cli-utils/lib/errors");
  8. class IonicNamespace extends namespace_1.Namespace {
  9. constructor() {
  10. super(...arguments);
  11. this.root = true;
  12. this.name = 'ionic';
  13. this.description = '';
  14. this.longDescription = '';
  15. this.namespaces = new namespace_1.NamespaceMap([
  16. ['config', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { ConfigNamespace } = yield Promise.resolve().then(() => require('./config/index')); return new ConfigNamespace(); })],
  17. ['cordova', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { CordovaNamespace } = yield Promise.resolve().then(() => require('./cordova/index')); return new CordovaNamespace(); })],
  18. ['git', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { GitNamespace } = yield Promise.resolve().then(() => require('./git/index')); return new GitNamespace(); })],
  19. ['ssh', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { SSHNamespace } = yield Promise.resolve().then(() => require('./ssh/index')); return new SSHNamespace(); })],
  20. ['package', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { PackageNamespace } = yield Promise.resolve().then(() => require('./package/index')); return new PackageNamespace(); })],
  21. ['monitoring', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { MonitoringNamespace } = yield Promise.resolve().then(() => require('./monitoring/index')); return new MonitoringNamespace(); })],
  22. ['doctor', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { DoctorNamespace } = yield Promise.resolve().then(() => require('./doctor/index')); return new DoctorNamespace(); })],
  23. ['integrations', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { IntegrationsNamespace } = yield Promise.resolve().then(() => require('./integrations/index')); return new IntegrationsNamespace(); })],
  24. ]);
  25. this.commands = new namespace_1.CommandMap([
  26. ['start', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { StartCommand } = yield Promise.resolve().then(() => require('./start')); return new StartCommand(); })],
  27. ['serve', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { ServeCommand } = yield Promise.resolve().then(() => require('./serve')); return new ServeCommand(); })],
  28. ['build', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { BuildCommand } = yield Promise.resolve().then(() => require('./build')); return new BuildCommand(); })],
  29. ['help', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { HelpCommand } = yield Promise.resolve().then(() => require('./help')); return new HelpCommand(); })],
  30. ['info', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { InfoCommand } = yield Promise.resolve().then(() => require('./info')); return new InfoCommand(); })],
  31. ['login', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { LoginCommand } = yield Promise.resolve().then(() => require('./login')); return new LoginCommand(); })],
  32. ['logout', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { LogoutCommand } = yield Promise.resolve().then(() => require('./logout')); return new LogoutCommand(); })],
  33. ['signup', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { SignupCommand } = yield Promise.resolve().then(() => require('./signup')); return new SignupCommand(); })],
  34. ['version', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { VersionCommand } = yield Promise.resolve().then(() => require('./version')); return new VersionCommand(); })],
  35. ['telemetry', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { TelemetryCommand } = yield Promise.resolve().then(() => require('./telemetry')); return new TelemetryCommand(); })],
  36. ['docs', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { DocsCommand } = yield Promise.resolve().then(() => require('./docs')); return new DocsCommand(); })],
  37. ['daemon', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { DaemonCommand } = yield Promise.resolve().then(() => require('./daemon')); return new DaemonCommand(); })],
  38. ['ionitron', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { IonitronCommand } = yield Promise.resolve().then(() => require('./ionitron')); return new IonitronCommand(); })],
  39. ['generate', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { GenerateCommand } = yield Promise.resolve().then(() => require('./generate')); return new GenerateCommand(); })],
  40. ['g', 'generate'],
  41. ['link', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { LinkCommand } = yield Promise.resolve().then(() => require('./link')); return new LinkCommand(); })],
  42. ['upload', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { UploadCommand } = yield Promise.resolve().then(() => require('./upload')); return new UploadCommand(); })],
  43. ['state', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { StateCommand } = yield Promise.resolve().then(() => require('./state')); return new StateCommand(); })],
  44. ['share', () => tslib_1.__awaiter(this, void 0, void 0, function* () { const { ShareCommand } = yield Promise.resolve().then(() => require('./share')); return new ShareCommand(); })],
  45. ]);
  46. }
  47. runCommand(env, pargv) {
  48. return tslib_1.__awaiter(this, void 0, void 0, function* () {
  49. const { metadataToMinimistOptions } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/utils/command'));
  50. const { parseArgs } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/init'));
  51. const { isCommand } = yield Promise.resolve().then(() => require('@ionic/cli-utils/guards'));
  52. const config = yield env.config.load();
  53. const argv = parseArgs(pargv, { boolean: true, string: '_' });
  54. let [depth, inputs, cmdOrNamespace] = yield this.locate(argv._);
  55. if (!isCommand(cmdOrNamespace)) {
  56. const { showHelp } = yield Promise.resolve().then(() => require('@ionic/cli-utils/lib/help'));
  57. yield env.telemetry.sendCommand('ionic help', argv._);
  58. return showHelp(env, argv._);
  59. }
  60. const command = cmdOrNamespace;
  61. const minimistOpts = metadataToMinimistOptions(command.metadata);
  62. if (command.metadata.backends && !command.metadata.backends.includes(config.backend)) {
  63. throw new errors_1.FatalException(`Sorry! The configured backend (${chalk_1.default.bold(config.backend)}) does not know about ${chalk_1.default.green('ionic ' + command.metadata.fullName)}.\n` +
  64. `You can switch backends with ${chalk_1.default.green('ionic config set -g backend')} (choose from ${cli_utils_1.KNOWN_BACKENDS.map(v => chalk_1.default.green(v)).join(', ')}).\n`);
  65. }
  66. const options = parseArgs(pargv, minimistOpts);
  67. inputs = options._.slice(depth);
  68. command.env = env;
  69. yield command.validate(inputs);
  70. if (!env.project.directory && command.metadata.type === 'project') {
  71. throw new errors_1.FatalException(`Sorry! ${chalk_1.default.green('ionic ' + command.metadata.fullName)} can only be run in an Ionic project directory.`);
  72. }
  73. if (command.metadata.options) {
  74. let found = false;
  75. for (let opt of command.metadata.options) {
  76. if (opt.backends && opt.default !== options[opt.name] && !opt.backends.includes(config.backend)) {
  77. found = true;
  78. env.log.warn(`${chalk_1.default.green('--' + (opt.default === true ? 'no-' : '') + opt.name)} has no effect with the configured backend (${chalk_1.default.bold(config.backend)}).`);
  79. }
  80. }
  81. if (found) {
  82. env.log.info(`You can switch backends with ${chalk_1.default.green('ionic config set -g backend')}.`);
  83. }
  84. }
  85. yield command.execute(inputs, options);
  86. });
  87. }
  88. }
  89. exports.IonicNamespace = IonicNamespace;