Skip to content

Commit

Permalink
Merge pull request #62 from embroider-build/move-index
Browse files Browse the repository at this point in the history
move the index.html into the root of the blueprint
  • Loading branch information
mansona authored Sep 2, 2024
2 parents 5b3e5e4 + 40ab24e commit 8322e13
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
File renamed without changes.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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(
Expand Down
12 changes: 12 additions & 0 deletions tests/default.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 8322e13

Please sign in to comment.