How to use the just-task.logger.warn function in just-task

To help you get started, we’ve selected a few just-task 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 microsoft / just / packages / just-scripts / src / tasks / webpackCliTask.ts View on Github external
return function webpackCli() {
    const init = tryRequire('@webpack-cli/init').default;
    if (!init) {
      logger.warn('webpack-cli init requires three dependencies: @webpack-cli/init (preferred - as a devDependency)');
      return;
    }
    logger.info(`Running Webpack-cli init `);
    if (typeof customScaffold === 'undefined') {
      if (auto) {
        try {
          init(null, null, null, '--auto');
        } catch (error) {
          throw `Webpack-cli init failed with ${error.length} error(s).`;
        }
      } else {
        try {
          init();
        } catch (error) {
          throw `Webpack-cli init failed with ${error.length} error(s).`;
        }
github microsoft / just / packages / just-scripts / src / tasks / apiExtractorTask.ts View on Github external
function initApiExtractor(options: ApiExtractorOptions): ApiExtractorContext | undefined {
  const apiExtractorModule: typeof ApiExtractorTypes = tryRequire('@microsoft/api-extractor');

  if (!apiExtractorModule) {
    logger.warn('@microsoft/api-extractor package not detected. This task will have no effect.');
    return;
  }

  if (!apiExtractorModule.Extractor.invoke) {
    logger.warn('Please update your @microsoft/api-extractor package. This task will have no effect.');
    return;
  }

  const { ExtractorConfig } = apiExtractorModule;
  const { configJsonFilePath = ExtractorConfig.FILENAME, fixNewlines, onResult, ...extractorOptions } = options;

  if (!fs.existsSync(configJsonFilePath)) {
    const defaultConfig = path.resolve(__dirname, '../../config/apiExtractor/api-extractor.json');
    logger.warn(`Config file not found for api-extractor! Please copy ${defaultConfig} to project root folder to try again`);
    return;
  }
github microsoft / just / packages / just-scripts / src / tasks / webpackTask.ts View on Github external
return function webpackDevServer() {
    if (devServerCmd && configPath && fs.existsSync(configPath)) {
      const mode = options.mode || 'development';
      const args = [...(options.nodeArgs || []), devServerCmd, '--config', configPath, '--open', '--mode', mode];

      logger.info(devServerCmd, encodeArgs(args).join(' '));
      return spawn(process.execPath, args, { stdio: 'inherit' });
    } else {
      logger.warn('no webpack.serve.config.js configuration found, skipping');
      return Promise.resolve();
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / apiExtractorTask.ts View on Github external
return function apiExtractorUpdate() {
    const context = initApiExtractor(options);
    if (context) {
      const apiExtractorResult = apiExtractorWrapper(context);

      if (apiExtractorResult) {
        if (!apiExtractorResult.succeeded) {
          logger.warn(`- Update API: API file is out of date, updating...`);
          fs.copyFileSync(context.config.reportTempFilePath, context.config.reportFilePath);

          logger.info(`- Update API: successfully updated API file, verifying the updates...`);

          if (!apiExtractorWrapper(context)!.succeeded) {
            throw new Error(`- Update API: failed to verify API updates.`);
          } else {
            logger.info(`- Update API: successully verified API file. Please commit API file as part of your changes.`);
          }
        } else {
          logger.info(`- Update API: API file is already up to date, no update needed.`);
        }
      }
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / apiExtractorTask.ts View on Github external
function initApiExtractor(options: ApiExtractorOptions): ApiExtractorContext | undefined {
  const apiExtractorModule: typeof ApiExtractorTypes = tryRequire('@microsoft/api-extractor');

  if (!apiExtractorModule) {
    logger.warn('@microsoft/api-extractor package not detected. This task will have no effect.');
    return;
  }

  if (!apiExtractorModule.Extractor.invoke) {
    logger.warn('Please update your @microsoft/api-extractor package. This task will have no effect.');
    return;
  }

  const { ExtractorConfig } = apiExtractorModule;
  const { configJsonFilePath = ExtractorConfig.FILENAME, fixNewlines, onResult, ...extractorOptions } = options;

  if (!fs.existsSync(configJsonFilePath)) {
    const defaultConfig = path.resolve(__dirname, '../../config/apiExtractor/api-extractor.json');
    logger.warn(`Config file not found for api-extractor! Please copy ${defaultConfig} to project root folder to try again`);
    return;
  }

  const config = ExtractorConfig.loadFileAndPrepare(configJsonFilePath);

  return { apiExtractorModule, config, extractorOptions, options };
}
github microsoft / just / packages / just-scripts / src / tasks / sassTask.ts View on Github external
return function sass(done: (err?: Error) => void) {
    const nodeSass = tryRequire('node-sass');
    const postcss = tryRequire('postcss');
    const autoprefixer = tryRequire('autoprefixer');

    if (!nodeSass || !postcss || !autoprefixer) {
      logger.warn('One of these [node-sass, postcss, autoprefixer] is not installed, so this task has no effect');
      done();
      return;
    }

    const autoprefixerFn = autoprefixer({ browsers: ['> 1%', 'last 2 versions', 'ie >= 11'] });

    const files = glob.sync(path.resolve(process.cwd(), 'src/**/*.scss'));

    if (files.length) {
      const tasks = files.map(
        fileName =>
          function(cb: any) {
            fileName = path.resolve(fileName);
            nodeSass.render(
              {
                file: fileName,
github microsoft / just / packages / just-scripts / src / tasks / jestTask.ts View on Github external
'--config',
        configFile,
        ...(options.passWithNoTests ? ['--passWithNoTests'] : []),
        ...(options.colors !== false && supportsColor.stdout ? ['--colors'] : []),
        ...(options.runInBand ? ['--runInBand'] : []),
        ...(options.coverage ? ['--coverage'] : []),
        ...(options.watch ? ['--watch'] : []),
        ...(options.u || options.updateSnapshot ? ['--updateSnapshot'] : ['']),
        ...(options._ || [])
      ].filter(arg => !!arg) as Array;

      logger.info(cmd, encodeArgs(args).join(' '));

      return spawn(cmd, args, { stdio: 'inherit', env: options.env });
    } else {
      logger.warn('no jest configuration found, skipping jest');
      return Promise.resolve();
    }
  };
}
github AgoraIO / Electron-SDK / scripts / synclib.js View on Github external
rimraf(filePath, (err) => {
      err && logger.warn(err.message)
      resolve()
    })
  })