build(docs-infra): fix CLI command github links (#30889)
The "view" links were broken because the version used to compute the git tag for the GitHub URL included a build SHA. Now we clean that off before using it in the URL. The links are to the JSON schema that defines the documentation for the command. This is accurate but confusing because the content for the long description is stored in a separate markdown file referenced from this schema file. This commit adds a second set of links for the long description, if it exists, which links directly to the markdown file. Closes #30700 PR Close #30889
This commit is contained in:

committed by
Miško Hevery

parent
3859bcc70c
commit
f440bd1793
@ -40,7 +40,12 @@ const content = `
|
||||
}
|
||||
`;
|
||||
|
||||
const fileInfo = {content, baseName: 'add'};
|
||||
const fileInfo = {
|
||||
content,
|
||||
baseName: 'add',
|
||||
relativePath: 'add.json',
|
||||
basePath: __dirname + '/mocks/help',
|
||||
};
|
||||
|
||||
describe('cli-command reader', () => {
|
||||
describe('getDocs', () => {
|
||||
@ -77,8 +82,8 @@ describe('cli-command reader', () => {
|
||||
it('should compute the bread crumbs', () => {
|
||||
const docs = reader.getDocs(fileInfo);
|
||||
expect(docs[0].breadCrumbs).toEqual([
|
||||
{ text: 'CLI', path: 'cli' },
|
||||
{ text: 'add', path: 'cli/add' },
|
||||
{text: 'CLI', path: 'cli'},
|
||||
{text: 'add', path: 'cli/add'},
|
||||
]);
|
||||
});
|
||||
|
||||
@ -89,7 +94,9 @@ describe('cli-command reader', () => {
|
||||
|
||||
it('should extract the long description', () => {
|
||||
const docs = reader.getDocs(fileInfo);
|
||||
expect(docs[0].longDescription).toEqual('Add support for a library in your project, for example adding `@angular/pwa` which would configure\nyour project for PWA support.\n');
|
||||
expect(docs[0].longDescription)
|
||||
.toEqual(
|
||||
'Add support for a library in your project, for example adding `@angular/pwa` which would configure\nyour project for PWA support.\n');
|
||||
});
|
||||
|
||||
it('should extract the command type', () => {
|
||||
@ -110,10 +117,19 @@ describe('cli-command reader', () => {
|
||||
it('should extract the options', () => {
|
||||
const docs = reader.getDocs(fileInfo);
|
||||
expect(docs[0].options).toEqual([
|
||||
jasmine.objectContaining({ name: 'collection' }),
|
||||
jasmine.objectContaining({ name: 'help' }),
|
||||
jasmine.objectContaining({ name: 'helpJson' }),
|
||||
jasmine.objectContaining({name: 'collection'}),
|
||||
jasmine.objectContaining({name: 'help'}),
|
||||
jasmine.objectContaining({name: 'helpJson'}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('should extract file info for the long description', () => {
|
||||
const [doc] = reader.getDocs(fileInfo);
|
||||
expect(doc.longDescriptionDoc).toEqual({
|
||||
docType: 'content',
|
||||
startingLine: 0,
|
||||
fileInfo: {realProjectRelativePath: 'packages/angular/cli/commands/add-long.md'}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user