How to use the just-scripts-utils.logger.info function in just-scripts-utils

To help you get started, we’ve selected a few just-scripts-utils 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 / addPackageTask.ts View on Github external
return async function addPackage() {
    const args = argv();
    const rootPath = findMonoRepoRootPath();

    const name =
      args.name ||
      (await prompts({
        type: 'text',
        name: 'name',
        message: 'What is the name of the package?'
      })).name;

    logger.info(`Creating a package called: ${name}`);

    if (!rootPath) {
      logger.warn('Cannot determine the root path to the mono repo');
      return;
    }

    // TODO: do validation that the path is indeed a monorepo

    const installedStacks = findInstalledStacks(path.join(rootPath, 'scripts'));

    // TODO: autosuggest just-stack-* packages from npmjs.org
    let response = await prompts({
      type: 'select',
      name: 'stack',
      message: 'What type of package to add to the repo?',
      choices: installedStacks.map(stack => ({ title: stack.description, value: stack.name }))
github microsoft / just / packages / just-scripts / src / tasks / addPackageTask.ts View on Github external
return async function addPackage() {
    const args = argv();
    const rootPath = findMonoRepoRootPath();

    const name =
      args.name ||
      (await prompts({
        type: 'text',
        name: 'name',
        message: 'What is the name of the package?'
      })).name;

    logger.info(`Creating a package called: ${name}`);

    if (!rootPath) {
      logger.warn('Cannot determine the root path to the mono repo');
      return;
    }

    // TODO: do validation that the path is indeed a monorepo
    const installedStacks = findInstalledStacks(rootPath);

    const response = args.stack
      ? { stack: args.stack }
      : await prompts({
        type: 'select',
        name: 'stack',
        message: 'What type of package to add to the repo?',
        choices: installedStacks.map(stack => ({ title: stack.description, value: stack.name }))
github microsoft / just / packages / just-scripts / src / tasks / addPackageTask.ts View on Github external
const packagePath = path.join(rootPath, 'packages', name);
    const templatePath = path.join(selectedStack.path, 'template');

    if (templatePath) {
      applyTemplate(templatePath, packagePath, {
        name
      });

      // Remove some files that aren't relevant for an individual project within a monorepo
      fse.removeSync(path.join(packagePath, '.gitignore'));
      fse.removeSync(path.join(packagePath, '.gitattributes'));
      fse.removeSync(path.join(packagePath, '.vscode'));

      rushAddPackage(name, rootPath);
      logger.info('Running rush update');
      rushUpdate(rootPath);

      logger.info('All Set!');

      const readmeFile = path.join(packagePath, 'README.md');
      if (fse.existsSync(readmeFile)) {
        logger.info('\n' + prettyPrintMarkdown(fse.readFileSync(readmeFile).toString()));
      }
    }
  };
}
github microsoft / just / packages / just-scripts / src / tasks / upgradeRepoTask.ts View on Github external
await rushConfig.projects.reduce(async (currentPromise, project) => {
        await currentPromise;

        if (project.projectFolder !== 'scripts') {
          const projPackageJson = readPackageJson(path.join(rootPath, project.projectFolder));

          if (projPackageJson && projPackageJson.just && projPackageJson.just.stack) {
            const diffInfo = stackDiffs[projPackageJson.just.stack];

            // no diff info means that there isn't any diffs to apply
            if (diffInfo) {
              logger.info(
                `Upgrading ${project.packageName} from ${projPackageJson.just.stack} v${diffInfo.fromVersion} to v${diffInfo.toVersion}`
              );

              applyStackDiffs(path.join(rootPath, project.projectFolder), stackDiffs[projPackageJson.just.stack]);

              didUpgradeProjects = true;
            }
          }
        }
      }, Promise.resolve());
github microsoft / just / packages / just-scripts / src / tasks / addPackageTask.ts View on Github external
fse.removeSync(path.join(packagePath, '.vscode'));

      // Remove devDep entry that is not appropriate inside individual project
      const pkgJson = readPackageJson(packagePath);

      if (pkgJson && pkgJson.devDependencies && pkgJson.just && pkgJson.just.stack) {
        delete pkgJson.devDependencies[pkgJson.just.stack];
      }

      fse.writeFileSync(path.join(packagePath, 'package.json'), JSON.stringify(pkgJson, null, 2));

      rushAddPackage(name, rootPath);
      logger.info('Running rush update');
      rushUpdate(rootPath);

      logger.info('All Set!');

      const readmeFile = path.join(packagePath, 'README.md');
      if (fse.existsSync(readmeFile)) {
        logger.info('\n' + prettyPrintMarkdown(fse.readFileSync(readmeFile).toString()));
      }
    }
  };
}
github microsoft / just / packages / create-just / src / commands / initCommand.ts View on Github external
execSync('git commit -m "initial commit"', { cwd: paths.projectPath });
  } catch (e) {
    logger.warn('Looks like you may not have git installed or there was some sort of error initializing the git repo');
    logger.info(`
Please make sure you have git installed and then issue the following:

    cd ${paths.projectPath}
    git init
    git add .
    git commit -m "initial commit"

`);
    process.exit(1);
  }

  logger.info('All Set!');

  showNextSteps(argv, stackName, stackPath!);
}
github microsoft / just / packages / just-scripts / src / tasks / upgradeRepoTask.ts View on Github external
applyStackDiffs(path.join(rootPath, project.projectFolder), stackDiffs[projPackageJson.just.stack]);

              didUpgradeProjects = true;
            }
          }
        }
      }, Promise.resolve());

      if (didUpgradeProjects) {
        logger.info('Upgrade repo task has finished its work. You might notice some conflicts to be resolved by hand.');
        logger.info('You might also have to perform a `rush update` manually if package.json has been modified by the upgrade');
      }
    }

    logger.info('Writing just-stacks.json. Please check this file in!');
    writeLockFile(rootPath, resolveStacks);
  };
}
github microsoft / just / packages / create-just / src / commands / initCommand.ts View on Github external
argv.name = name;

  const stackPath = await getStackPath(argv.stack, argv.registry);

  logger.info(`Installing stack dependencies in ${stackPath}`);
  pkg.ensureNpmrcIfRequired(argv.registry, stackPath!);
  pkg.install(argv.registry, stackPath!);

  const stackName = getStackName(stackPath!);
  const generator = await getPlopGenerator(stackPath!, paths.projectPath, stackName);

  logger.info(`Running "${stackName}" code generation actions inside: ${paths.projectPath}`);

  await runGenerator(generator, argv);

  logger.info(`Initializing the repo in ${paths.projectPath}`);

  pkg.install(argv.registry, paths.projectPath);

  try {
    execSync('git init', { cwd: paths.projectPath });
    execSync('git add .', { cwd: paths.projectPath });
    execSync('git commit -m "initial commit"', { cwd: paths.projectPath });
  } catch (e) {
    logger.warn('Looks like you may not have git installed or there was some sort of error initializing the git repo');
    logger.info(`
Please make sure you have git installed and then issue the following:

    cd ${paths.projectPath}
    git init
    git add .
    git commit -m "initial commit"
github microsoft / just / packages / just-scripts / src / tasks / upgradeRepoTask.ts View on Github external
if (diffInfo) {
              logger.info(
                `Upgrading ${project.packageName} from ${projPackageJson.just.stack} v${diffInfo.fromVersion} to v${diffInfo.toVersion}`
              );

              applyStackDiffs(path.join(rootPath, project.projectFolder), stackDiffs[projPackageJson.just.stack]);

              didUpgradeProjects = true;
            }
          }
        }
      }, Promise.resolve());

      if (didUpgradeProjects) {
        logger.info('Upgrade repo task has finished its work. You might notice some conflicts to be resolved by hand.');
        logger.info('You might also have to perform a `rush update` manually if package.json has been modified by the upgrade');
      }
    }

    logger.info('Writing just-stacks.json. Please check this file in!');
    writeLockFile(rootPath, resolveStacks);
  };
}