"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tools/example-module/generate-example-module.ts" between
material2-7.3.4.tar.gz and material2-7.3.5.tar.gz

About: material2 offers Material Design components for Angular.

generate-example-module.ts  (material2-7.3.4):generate-example-module.ts  (material2-7.3.5)
skipping to change at line 64 skipping to change at line 64
name = name.replace(/[A-Z]/g, ' $&'); name = name.replace(/[A-Z]/g, ' $&');
name = name.toLowerCase().trim(); name = name.toLowerCase().trim();
return name.split(' ').join('-'); return name.split(' ').join('-');
} }
/** Collects the metadata of the given source files by parsing the given TypeScr ipt files. */ /** Collects the metadata of the given source files by parsing the given TypeScr ipt files. */
function collectExampleMetadata(sourceFiles: string[], baseFile: string): Exampl eMetadata[] { function collectExampleMetadata(sourceFiles: string[], baseFile: string): Exampl eMetadata[] {
const exampleMetadata: ExampleMetadata[] = []; const exampleMetadata: ExampleMetadata[] = [];
for (const sourceFile of sourceFiles) { for (const sourceFile of sourceFiles) {
// Avoid parsing non-example files.
if (!path.basename(sourceFile, path.extname(sourceFile)).endsWith('-example'
)) {
continue;
}
const sourceContent = fs.readFileSync(sourceFile, 'utf-8'); const sourceContent = fs.readFileSync(sourceFile, 'utf-8');
const {primaryComponent, secondaryComponents} = parseExampleFile(sourceFile, sourceContent); const {primaryComponent, secondaryComponents} = parseExampleFile(sourceFile, sourceContent);
if (primaryComponent) { if (primaryComponent) {
// Generate a unique id for the component by converting the class name to dash-case. // Generate a unique id for the component by converting the class name to dash-case.
const exampleId = convertToDashCase(primaryComponent.component.replace('Ex ample', '')); const exampleId = convertToDashCase(primaryComponent.component.replace('Ex ample', ''));
const example: ExampleMetadata = { const example: ExampleMetadata = {
sourcePath: path.relative(baseFile, sourceFile), sourcePath: path.relative(baseFile, sourceFile),
id: exampleId, id: exampleId,
component: primaryComponent.component, component: primaryComponent.component,
skipping to change at line 99 skipping to change at line 104
if (meta.styleUrls) { if (meta.styleUrls) {
example.additionalFiles.push(...meta.styleUrls); example.additionalFiles.push(...meta.styleUrls);
} }
example.selectorName.push(meta.component); example.selectorName.push(meta.component);
} }
} }
exampleMetadata.push(example); exampleMetadata.push(example);
} else {
throw Error(`Could not find a primary example component in ${sourceFile}
. ` +
`Ensure that there's a component with an @title annotation.`
);
} }
} }
return exampleMetadata; return exampleMetadata;
} }
/** /**
* Generates the example module from the given source files and writes it to a s pecified output * Generates the example module from the given source files and writes it to a s pecified output
* file. * file.
*/ */
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)