Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function compileTypeScript() {
// Find this project's relative directory. Rush already knows this, so just ask.
const packageDir = path.resolve('.');
const rushConfig = RushConfiguration.loadFromDefaultLocation({
startingFolder: packageDir
});
const project = rushConfig.tryGetProjectForPath(packageDir);
if (!project) {
console.error(`Unable to find project for '${packageDir}' in 'rush.json'.`);
throw Error();
}
//REVIEW: Better way to detect deployable projects?
// Since extension .js files are deployed to 'dist//out', and libraries are deployed to
// 'dist//node_modules//out'.
const pathToRoot = (path.dirname(project.projectRelativeFolder) === 'extensions') ?
'../../..' : '../../../../..';
return tsProject.src()
.pipe(sourcemaps.init())
protected onExecute(): Promise { // abstract
const rushConfiguration: RushConfiguration = RushConfiguration.loadFromDefaultLocation();
const builder: StringBuilder = new StringBuilder();
const orderedProjects: RushConfigurationProject[] = [...rushConfiguration.projects];
Sort.sortBy(orderedProjects, x => x.projectRelativeFolder);
builder.append('## Published Packages\n\n');
builder.append('\n\n');
builder.append('| Folder | Version | Changelog | Package |\n');
builder.append('| ------ | ------- | --------- | ------- |\n');
for (const project of orderedProjects.filter(x => ReadmeAction._isPublished(x))) {
// Example:
//
// | [/apps/api-extractor](./apps/api-extractor/)
// | [![npm version](https://badge.fury.io/js/%40microsoft%2Fapi-extractor.svg
// )](https://badge.fury.io/js/%40microsoft%2Fapi-extractor)
protected onExecute(): void {
this._rushConfiguration = this._rushConfiguration = RushConfiguration.loadFromDefaultLocation();
console.log('Starting "rush link"');
const stopwatch: Stopwatch = Stopwatch.start();
readPackageTree(this._rushConfiguration.commonFolder, (error: Error, npmPackage: PackageNode) => {
this._parser.trapErrors(() => {
if (error) {
throw error;
} else {
const commonRootPackage: Package = Package.createFromNpm(npmPackage);
const commonPackageLookup: PackageLookup = new PackageLookup();
commonPackageLookup.loadTree(commonRootPackage);
const rushLinkJson: IRushLinkJson = { localLinks: {} };
protected async onExecute(): Promise {
const rushConfig: RushConfiguration = RushConfiguration.loadFromDefaultLocation();
FileSystem.deleteFolder(path.resolve(rushConfig.commonTempFolder, 'bxl', 'modules'));
this._terminal.writeLine(`Successfully cleaned BuildXL configuration.`);
}
}
protected async onExecute(): Promise {
if (process.env.BUILDXL_BIN === undefined) {
throw new Error('Environment variable BUILDXL_BIN not defined');
}
const generator: BxlModulesGenerator =
new BxlModulesGenerator(
RushConfiguration.loadFromDefaultLocation(),
process.env.BUILDXL_BIN);
await generator.run();
this._terminal.writeLine(`Successfully generated BuildXL configuration.`);
}
}