Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Rename template suffix by *.njk #852

Merged
merged 3 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/generate/generators/CoreFull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class AzCoreFullGenerator extends GeneratorBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.cmdletFolder,
PathConstants.conftestFile + PathConstants.njxFileExtension,
PathConstants.conftestFile + PathConstants.njkFileExtension,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/generate/generators/CoreIncre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class AzCoreIncrementalGenerator extends GeneratorBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.cmdletFolder,
PathConstants.conftestFile + PathConstants.njxFileExtension,
PathConstants.conftestFile + PathConstants.njkFileExtension,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/generate/generators/ExtensionFull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class AzExtensionFullGenerator extends GeneratorBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.cmdletFolder,
PathConstants.conftestFile + PathConstants.njxFileExtension,
PathConstants.conftestFile + PathConstants.njkFileExtension,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/generate/generators/ExtensionIncre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class AzExtensionIncrementalGenerator extends GeneratorBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.cmdletFolder,
PathConstants.conftestFile + PathConstants.njxFileExtension,
PathConstants.conftestFile + PathConstants.njkFileExtension,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/CliReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CliReport extends TemplateBase {
this.relativePath = path.join(PathConstants.reportFile);
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.reportFile + PathConstants.njxFileExtension,
PathConstants.reportFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/extraExt/CliExtHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class CliExtHistory extends TemplateBase {
this.relativePath = PathConstants.historyRstFile;
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.historyRstFile + PathConstants.njxFileExtension,
PathConstants.historyRstFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/extraExt/CliExtMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class CliTopMetadata extends TemplateBase {
this.tmplPath = path.join(
PathConstants.templateRootFolder,
'azext',
PathConstants.metadataFile + PathConstants.njxFileExtension,
PathConstants.metadataFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/extraExt/CliExtReadme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class CliExtReadme extends TemplateBase {
this.relativePath = PathConstants.readmeFile;
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.readmeFile + PathConstants.njxFileExtension,
PathConstants.readmeFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/extraExt/CliExtSetupCfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class CliExtSetupCfg extends TemplateBase {
this.relativePath = PathConstants.setupCfgFile;
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.setupCfgFile + PathConstants.njxFileExtension,
PathConstants.setupCfgFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/extraExt/CliExtSetupPy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class CliExtSetupPy extends TemplateBase {
this.relativePath = PathConstants.setupPyFile;
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.setupPyFile + PathConstants.njxFileExtension,
PathConstants.setupPyFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/generated/CliActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class CliActions extends TemplateBase {
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.generatedFolder,
PathConstants.actionFile + PathConstants.njxFileExtension,
PathConstants.actionFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/generated/CliCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class CliCommands extends TemplateBase {
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.generatedFolder,
PathConstants.commandsFile + PathConstants.njxFileExtension,
PathConstants.commandsFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/tests/CliTestCmdlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CliCmdletTest extends TemplateBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.cmdletFolder,
testFileName + PathConstants.njxFileExtension,
testFileName + PathConstants.njkFileExtension,
);
this.className = isNegativeTest ? 'NegativeTest' : 'PositiveTest';
}
Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/tests/CliTestInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class CliTestInit extends TemplateBase {
this.tmplPath = path.join(
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.initFile + PathConstants.njxFileExtension,
PathConstants.initFile + PathConstants.njkFileExtension,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/generate/renders/tests/CliTestPrepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class CliTestPrepare extends TemplateBase {
PathConstants.templateRootFolder,
PathConstants.testFolder,
PathConstants.latestFolder,
PathConstants.preparersFile + PathConstants.njxFileExtension,
PathConstants.preparersFile + PathConstants.njkFileExtension,
);
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class PathConstants {
return 'test_' + rpName + '_scenario_incrementalGenerated.py';
}

public static readonly njxFileExtension = '.njx';
public static readonly njkFileExtension = '.njk';
}

export enum CodeGenConstants {
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-HISTORY.rst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sourceMapSupport.install();

describe('renderHistoryRST', () => {
it('renderHistoryRSTTest', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/HISTORY.rst.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/HISTORY.rst.njk');
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {});
const expectedFile = path.join(`${__dirname}`, '../../test/unittest/expected/HISTORY.rst');
const expected = await readFile(expectedFile);
Expand Down
6 changes: 3 additions & 3 deletions test/unittest/render-action.py.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sourceMapSupport.install();

describe('renderActionPYTest', () => {
it('single positional action test', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njk');
nunjucks.configure({ autoescape: false });
let result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
data: {
Expand Down Expand Up @@ -116,7 +116,7 @@ describe('renderActionPYTest', () => {
}, 30000);

it('single key value action test', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njk');
nunjucks.configure({ autoescape: false });
let result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
data: {
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('renderActionPYTest', () => {
}, 30000);

it('single shorthand syntax action test', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njk');
nunjucks.configure({ autoescape: false });
let result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
data: {
Expand Down
6 changes: 3 additions & 3 deletions test/unittest/render-azext_metadata.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('renderHistoryRST', () => {
it('renderHistoryRSTCase1', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/azext/azext_metadata.json.njx',
'../../src/templates/azext/azext_metadata.json.njk',
);
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
model: { Extension_Mode: 'experimental', minCliCoreVersion: '2.15.0' },
Expand All @@ -34,7 +34,7 @@ describe('renderHistoryRST', () => {
it('renderHistoryRSTCase2', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/azext/azext_metadata.json.njx',
'../../src/templates/azext/azext_metadata.json.njk',
);
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
model: { Extension_Mode: 'preview', minCliCoreVersion: '2.15.1' },
Expand All @@ -54,7 +54,7 @@ describe('renderHistoryRST', () => {
it('renderHistoryRSTCase3', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/azext/azext_metadata.json.njx',
'../../src/templates/azext/azext_metadata.json.njk',
);

const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
Expand Down
6 changes: 3 additions & 3 deletions test/unittest/render-cmdlets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('renderTestsCmdlets', () => {
it('renderPositive', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/tests/cmdlet/test_positive.py.njx',
'../../src/templates/tests/cmdlet/test_positive.py.njk',
);
nunjucks.configure({ autoescape: false });
data.testData.className = 'PositiveTest';
Expand All @@ -143,7 +143,7 @@ describe('renderTestsCmdlets', () => {
it('renderNegative', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/tests/cmdlet/test_negative.py.njx',
'../../src/templates/tests/cmdlet/test_negative.py.njk',
);
nunjucks.configure({ autoescape: false });
data.testData.className = 'NegativeTest';
Expand All @@ -159,7 +159,7 @@ describe('renderTestsCmdlets', () => {
it('renderEmptyData', async () => {
const tmplPath = path.join(
`${__dirname}`,
'../../src/templates/tests/cmdlet/test_positive.py.njx',
'../../src/templates/tests/cmdlet/test_positive.py.njk',
);
nunjucks.configure({ autoescape: false });
data_empty.testData.className = 'PositiveTest';
Expand Down
4 changes: 2 additions & 2 deletions test/unittest/render-commands.py.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sourceMapSupport.install();

describe('renderCommandsPYTest', () => {
it('renderCommandsPYTestCase1', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njk');
nunjucks.configure({ autoescape: false });
let result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
data: {
Expand Down Expand Up @@ -309,7 +309,7 @@ describe('renderCommandsPYTest', () => {
}, 30000);

it('renderCommandsPYTestCase2', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njk');
nunjucks.configure({ autoescape: false });
let result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
data: {
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-getActionRenderData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('getActionsRender', () => {
});

it('getActionRenderDataTest2', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/action.py.njk');
const data = await getActionsRenderData();
let result = render(path.relative(process.cwd(), tmplPath), data);
const oriFile = path.join(
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-getCommandsRenderData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('getCommandsRender', () => {
});

it('getCommandRenderDataTest2', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/generated/commands.py.njk');
const data = await getCommandsRenderData();
let result = render(path.relative(process.cwd(), tmplPath), data);
const oriFile = path.join(
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-readme.md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sourceMapSupport.install();

describe('renderReadmeMD', () => {
it('renderReadmeMDTest', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/README.md.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/README.md.njk');
nunjucks.configure({ autoescape: false });
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
hasExtension: true,
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-report.md.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sourceMapSupport.install();

describe('renderRepordMd', () => {
it('renderRepordMdTest', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/report.md.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/report.md.njk');
nunjucks.configure({ autoescape: false });
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
hasExtension: true,
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/render-setup.cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sourceMapSupport.install();

describe('renderSetupCFG', () => {
it('renderSetupCFGTest', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.cfg.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.cfg.njk');
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {});
const expectedFile = path.join(`${__dirname}`, '../../test/unittest/expected/setup.cfg');
const expected = await readFile(expectedFile);
Expand Down
4 changes: 2 additions & 2 deletions test/unittest/render-setup.py.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sourceMapSupport.install();

describe('RenderSetupPy', () => {
it('setupPYTestCase1', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.py.njk');
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
model: {
AzextFolder: 'azext_offazure',
Expand All @@ -29,7 +29,7 @@ describe('RenderSetupPy', () => {
});

it('setupPYTestCase2', async () => {
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.py.njx');
const tmplPath = path.join(`${__dirname}`, '../../src/templates/setup.py.njk');
const result = nunjucks.render(path.relative(process.cwd(), tmplPath), {
model: {
AzextFolder: 'azext_offazure',
Expand Down