mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(docs-infra): correctly read example type (#48665)
Prior to this change the universal example was broken as the example type was not retrieved correctly in bazel which caused the `_renameFile` method to be called with incorrect context. Closes #48664 PR Close #48665
This commit is contained in:
parent
a29203ff1f
commit
d4eaaefe30
1 changed files with 4 additions and 3 deletions
|
|
@ -57,8 +57,9 @@ export class ExampleZipper {
|
|||
return archive;
|
||||
}
|
||||
|
||||
_getExampleType(sourceFolder) {
|
||||
const filePath = path.join(sourceFolder, EXAMPLE_CONFIG_NAME);
|
||||
_getExampleType(exampleDirName) {
|
||||
const filePath = path.join(exampleDirName, EXAMPLE_CONFIG_NAME);
|
||||
|
||||
try {
|
||||
return this._loadJson(filePath).projectType || 'cli';
|
||||
} catch (err) { // empty file, so it is cli
|
||||
|
|
@ -89,7 +90,6 @@ export class ExampleZipper {
|
|||
const jsonFileName = configFileName.replace(/^.*[\\\/]/, '');
|
||||
let relativeDirName = path.basename(sourceDirName);
|
||||
let exampleZipName;
|
||||
const exampleType = this._getExampleType(path.join(sourceDirName, relativeDirName));
|
||||
if (relativeDirName.indexOf('/') !== -1) { // Special example
|
||||
exampleZipName = relativeDirName.split('/').join('-');
|
||||
} else {
|
||||
|
|
@ -97,6 +97,7 @@ export class ExampleZipper {
|
|||
}
|
||||
|
||||
const exampleDirName = path.dirname(configFileName);
|
||||
const exampleType = this._getExampleType(exampleDirName);
|
||||
const outputFileName = path.join(outputDirName, exampleZipName + '.zip');
|
||||
let defaultIncludes = ['**/*.ts', '**/*.js', '**/*.es6', '**/*.css', '**/*.html', '**/*.md', '**/*.json', '**/*.png', '**/*.svg'];
|
||||
let alwaysIncludes = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue