How to use the just-scripts-utils.rushAddPackage 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
const selectedStack = installedStacks.find(stack => stack.name === response.stack)!;

    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 / addPackageTask.ts View on Github external
// 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'));

      // 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()));
      }
    }
  };
}