How to use the just-task.logger.error 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 / upgradeStackTask.ts View on Github external
function upgradePackageDeps(stackPath: string, projectPath: string, packageJson: PackageJson) {
  const templatePath = paths.tempPath(packageJson.name);
  applyTemplate(stackPath, templatePath, { name: packageJson.name });

  // Update package.json deps
  const stackPackageJson = readPackageJson(templatePath);
  if (!stackPackageJson) {
    logger.error(`Cannot find or read stack's package.json under ${stackPath}`);
    return;
  }

  const newPackageJson = mergePackageJson(packageJson, stackPackageJson);

  // If modified, the reference would be different
  logger.info(`Checking if package ${packageJson.name} should be upgraded...`);
  if (newPackageJson !== packageJson) {
    logger.info(`Package ${chalk.cyan(packageJson.name)} is being upgraded.`);
    fse.writeJsonSync(path.join(projectPath, 'package.json'), newPackageJson, { spaces: 2 });
  } else {
    logger.info(`Package ${chalk.cyan(packageJson.name)} upgrade not needed.`);
  }
}
github AgoraIO / Electron-SDK / scripts / synclib.js View on Github external
const genOS = () => {
    if (platform === "darwin") {
      return "mac";
    } else if (platform === "win32") {
      return "win32";
    } else {
      // not supported in temp
      logger.error("Unsupported platform!");
      throw new Error("Unsupported platform!");
    }
  };
github AgoraIO / Electron-SDK / scripts / synclib.js View on Github external
return new Promise((resolve, reject) => {
    const os = genOS()
    let downloadUrl;
    if(os === "mac") {
      if(!libUrl.mac){
        logger.error(`no macos lib specified`)
        return reject(new Error(`no macos lib specified`))
      } else {
        downloadUrl = libUrl.mac
      }
    } else {
      if(!libUrl.win){
        logger.error(`no windows lib specified`)
        return reject(new Error(`no windows lib specified`))
      } else {
        downloadUrl = libUrl.win
      }
    }

    /** start download */
    const outputDir = "./tmp/";
    logger.info(`Downloading ${os} Libs...\n${downloadUrl}\n`);
github microsoft / just / packages / just-scripts / src / tasks / webpackTask.ts View on Github external
errorStats.errors.forEach((error: any) => {
              logger.error(error);
            });
            reject(`Webpack failed with ${errorStats.errors.length} error(s).`);
github microsoft / just / packages / just-scripts / src / tasks / upgradeStackTask.ts View on Github external
const packageJson = readPackageJson(projectPath);

  if (packageJson && packageJson.just && packageJson.just.stack) {
    const stack = packageJson.just.stack;
    let stackPath: string | null = null;

    if (!templateInstallationPath) {
      stackPath = await downloadPackage(stack);
    } else {
      stackPath = path.join(templateInstallationPath, stack, 'template');
    }

    if (stackPath) {
      upgradePackageDeps(stackPath, projectPath, packageJson);
    } else {
      logger.error(`Cannot read or retrieve the stack package.json for ${stack}`);
    }
  } else if (packageJson) {
    logger.info(
      `Package ${chalk.cyan(packageJson.name)} does not have a "just" key. Skipping upgrade.`
    );
  } else {
    logger.info(`package.json not found under ${chalk.cyan(projectPath)}. Skipping upgrade.`);
  }
}
github AgoraIO / Electron-SDK / scripts / synclib.js View on Github external
}).catch(err => {
      logger.error("Failed: ", err);
      reject(new Error(err));
    });
  })