Skip to content

Commit

Permalink
change wording
Browse files Browse the repository at this point in the history
  • Loading branch information
markkaylor committed May 26, 2021
1 parent 662d438 commit 05d9cd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('generate:template command', () => {
});

describe('handles prompt input', () => {
it('updates directory if confirmed', async () => {
it('replaces directory if confirmed', async () => {
fse.pathExists.mockReturnValue(true);
const mockInquiry = jest
.spyOn(inquirer, 'prompt')
Expand Down
10 changes: 5 additions & 5 deletions packages/strapi/lib/commands/generate-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TEMPLATE_CONTENT = ['api', 'components', 'config/functions/bootstrap.js',

/**
*
* @param {string} templatePath Absolute path to template content directory
* @param {string} templatePath Absolute path to template directory
* @param {string} rootBase Name of the root directory
*/
async function copyContent(templatePath, rootBase) {
Expand Down Expand Up @@ -61,12 +61,12 @@ module.exports = async function generateTemplate(directory) {
// Get path to template directory: <rootPath>/template
const templatePath = join(rootPath, 'template');

// Check if the correct template directory structure exists
// Check if the template directory exists
const exists = await fse.pathExists(templatePath);
const rootBase = basename(rootPath);

if (exists) {
// Confirm the user wants to update the existing template
// Confirm the user wants to replace the existing template
const inquiry = await inquirer.prompt({
type: 'confirm',
name: 'confirm',
Expand All @@ -78,9 +78,9 @@ module.exports = async function generateTemplate(directory) {
}
}

// Create or replace the template content directory
// Create or replace root directory with <roothPath>/template
await fse.ensureDir(templatePath);
// Copy the content
// Copy content to /template
await copyContent(templatePath, rootBase);
// Create config file if it doesn't exist
const configExists = await templateConfigExists(rootPath);
Expand Down

0 comments on commit 05d9cd8

Please sign in to comment.