From 40ab24e0c6f29d4793a0c93eb9d0cb32d13c4397 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Mon, 2 Sep 2024 21:03:25 +0100 Subject: [PATCH] move the index.html into the root of the blueprint --- {files-override/app => files}/index.html | 0 index.js | 7 +++++++ tests/default.test.mjs | 12 ++++++++++++ 3 files changed, 19 insertions(+) rename {files-override/app => files}/index.html (100%) diff --git a/files-override/app/index.html b/files/index.html similarity index 100% rename from files-override/app/index.html rename to files/index.html diff --git a/index.js b/index.js index 542fafe..3efb720 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,7 @@ const fs = require('fs'); const { join } = require('path'); const emberCliUpdate = require('./lib/ember-cli-update'); const copyWithTemplate = require('./lib/copy-with-template'); +const { rm } = require('fs/promises'); const appBlueprint = Blueprint.lookup('app'); @@ -57,6 +58,12 @@ module.exports = { }, async afterInstall(options) { + const filesToDelete = ['app/index.html']; + + for (let file of filesToDelete) { + await rm(join(options.target, file)); + } + // there doesn't seem to be a way to tell ember-cli to not prompt to override files that were added in the beforeInstall // so I'm just copying a few over at this stage copyWithTemplate( diff --git a/tests/default.test.mjs b/tests/default.test.mjs index 955fa70..30e74fc 100644 --- a/tests/default.test.mjs +++ b/tests/default.test.mjs @@ -3,6 +3,7 @@ import { join } from 'path'; import tmp from 'tmp-promise'; import { execa } from 'execa'; import copyWithTemplate from '../lib/copy-with-template'; +import { existsSync } from 'fs'; const blueprintPath = join(__dirname, '..'); const appName = 'fancy-app-in-test'; @@ -37,6 +38,17 @@ describe('basic functionality', function () { return tmpDir.cleanup(); }); + it('verify files', async function () { + expect( + !existsSync(join(tmpDir.path, 'app/index.html')), + 'the app index.html has been removed', + ); + expect( + existsSync(join(tmpDir.path, 'index.html')), + 'the root index.html has been added', + ); + }); + it('successfully builds', async function () { let result = await execa('pnpm', ['build'], { cwd: join(tmpDir.path, appName),