Skip to content

Commit

Permalink
refactor(CLI Onboarding): Download templates from v2 examples branch
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Jan 6, 2022
1 parent 62d8da2 commit 46d090a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/cli/interactive-setup/service.js
Expand Up @@ -203,7 +203,7 @@ module.exports = {
stepHistory: context.stepHistory,
});
projectDir = join(workingDir, projectName);
const templateUrl = `https://github.com/serverless/examples/tree/master/${projectType}`;
const templateUrl = `https://github.com/serverless/examples/tree/v2/${projectType}`;
legacy.write(`\nDownloading "${projectType}" template...\n`);
const downloadProgress = progress.get('template-download');
downloadProgress.notice(`Downloading "${projectType}" template`);
Expand Down
11 changes: 5 additions & 6 deletions test/unit/lib/cli/interactive-setup/service.test.js
Expand Up @@ -104,7 +104,7 @@ describe('test/unit/lib/cli/interactive-setup/service.test.js', () => {
const stats = await fsp.lstat('test-project/serverless.yml');
expect(stats.isFile()).to.be.true;
expect(downloadTemplateFromRepoStub).to.have.been.calledWith(
'https://github.com/serverless/examples/tree/master/aws-nodejs',
'https://github.com/serverless/examples/tree/v2/aws-nodejs',
'aws-nodejs',
'test-project'
);
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('test/unit/lib/cli/interactive-setup/service.test.js', () => {
const stats = await fsp.lstat('test-project-template/serverless.yml');
expect(stats.isFile()).to.be.true;
expect(downloadTemplateFromRepoStub).to.have.been.calledWith(
'https://github.com/serverless/examples/tree/master/aws-nodejs',
'https://github.com/serverless/examples/tree/v2/aws-nodejs',
'aws-nodejs',
'test-project-template'
);
Expand Down Expand Up @@ -192,7 +192,7 @@ describe('test/unit/lib/cli/interactive-setup/service.test.js', () => {
const stats = await fsp.lstat('test-project-package-json/serverless.yml');
expect(stats.isFile()).to.be.true;
expect(downloadTemplateFromRepoStub).to.have.been.calledWith(
'https://github.com/serverless/examples/tree/master/aws-nodejs',
'https://github.com/serverless/examples/tree/v2/aws-nodejs',
'aws-nodejs',
'test-project-package-json'
);
Expand Down Expand Up @@ -368,7 +368,7 @@ describe('test/unit/lib/cli/interactive-setup/service.test.js', () => {
const stats = await fsp.lstat('test-project-from-provided-template/serverless.yml');
expect(stats.isFile()).to.be.true;
expect(downloadTemplateFromRepoStub).to.have.been.calledWith(
'https://github.com/serverless/examples/tree/master/test-template',
'https://github.com/serverless/examples/tree/v2/test-template',
'test-template',
'test-project-from-provided-template'
);
Expand All @@ -379,8 +379,7 @@ describe('test/unit/lib/cli/interactive-setup/service.test.js', () => {
});

it('Should create project at not existing directory with provided `template-url`', async () => {
const providedTemplateUrl =
'https://github.com/serverless/examples/tree/master/test-template';
const providedTemplateUrl = 'https://github.com/serverless/examples/tree/v2/test-template';
const downloadTemplateFromRepoStub = sinon.stub();
const mockedStep = proxyquire('../../../../../lib/cli/interactive-setup/service', {
'../../utils/downloadTemplateFromRepo': {
Expand Down

0 comments on commit 46d090a

Please sign in to comment.