How to use the @boost/internal.color.toolName function in @boost/internal

To help you get started, we’ve selected a few @boost/internal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github milesj / boost / packages / plugin / src / Loader.ts View on Github external
this.debug('Found a shorthand module with custom scope: %s', color.moduleName(moduleName));

      resolver.lookupNodeModule(customModuleName);

      // tool-plugin-name
    } else if (moduleName.match(new RegExp(`^${projectName}-${typeName}-${modulePattern}$`, 'u'))) {
      this.debug('Found an explicit public module: %s', color.moduleName(moduleName));

      resolver.lookupNodeModule(moduleName);

      // The previous 2 patterns if only name provided
    } else if (moduleName.match(new RegExp(`^${modulePattern}$`, 'u')) && isNotToolOrType) {
      this.debug(
        'Resolving modules with internal "%s" scope and public "%s" prefix',
        color.toolName(`@${projectName}`),
        color.toolName(projectName),
      );

      // Detect internal scopes before public ones
      resolver.lookupNodeModule(this.manager.formatModuleName(moduleName, true));
      resolver.lookupNodeModule(this.manager.formatModuleName(moduleName));

      // Unknown plugin module pattern
    } else {
      throw new Error(`Unknown plugin module format "${moduleName}".`);
    }

    return resolver;
  }
github milesj / boost / packages / plugin / src / Loader.ts View on Github external
this.debug('Found a shorthand module with custom scope: %s', color.moduleName(moduleName));

      resolver.lookupNodeModule(customModuleName);

      // tool-plugin-name
    } else if (moduleName.match(new RegExp(`^${projectName}-${typeName}-${modulePattern}$`, 'u'))) {
      this.debug('Found an explicit public module: %s', color.moduleName(moduleName));

      resolver.lookupNodeModule(moduleName);

      // The previous 2 patterns if only name provided
    } else if (moduleName.match(new RegExp(`^${modulePattern}$`, 'u')) && isNotToolOrType) {
      this.debug(
        'Resolving modules with internal "%s" scope and public "%s" prefix',
        color.toolName(`@${projectName}`),
        color.toolName(projectName),
      );

      // Detect internal scopes before public ones
      resolver.lookupNodeModule(this.manager.formatModuleName(moduleName, true));
      resolver.lookupNodeModule(this.manager.formatModuleName(moduleName));

      // Unknown plugin module pattern
    } else {
      throw new Error(`Unknown plugin module format "${moduleName}".`);
    }

    return resolver;
  }
github milesj / boost / packages / core / src / ConfigLoader.ts View on Github external
findConfigInPackageJSON(pkg: PackageConfig): ConfigPathOrObject | null {
    const configName = this.getConfigName();
    const config = (pkg as any)[configName];

    this.debug.invariant(
      !!config,
      `Looking in package.json under ${color.toolName(configName)} property`,
      'Found',
      'Not found',
    );

    if (!config) {
      return null;
    }

    // Extend from a preset if a string
    if (typeof config === 'string') {
      return { extends: [config] };
    }

    return config;
  }
github milesj / boost / packages / core / src / Tool.ts View on Github external
initialize(): this {
    if (this.initialized) {
      return this;
    }

    const { appName } = this.options;
    const pluginNames = Object.keys(this.pluginTypes);

    this.debug('Initializing %s application', color.toolName(appName));

    this.args = parseArgs(
      this.argv,
      mergeWith(
        {
          array: [...pluginNames],
          boolean: ['debug', 'silent'],
          number: ['output'],
          string: ['config', 'locale', 'theme', ...pluginNames],
        },
        this.options.argOptions,
        handleMerge,
      ),
    );

    this.loadConfig();