diff --git a/index.js b/index.js index 1d721d4..27f230e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ const Blueprint = require('ember-cli/lib/models/blueprint'); -const fs = require('fs-extra'); +const fs = require('fs'); const { join } = require('path'); const emberCliUpdate = require('./lib/ember-cli-update'); +const copyWithTemplate = require('./lib/copy-with-template'); const appBlueprint = Blueprint.lookup('app'); @@ -64,7 +65,7 @@ module.exports = { ); let packageJson = join(options.target, 'package.json'); - let json = await fs.readJSON(packageJson); + let json = JSON.parse(fs.readFileSync(packageJson)); json.scripts = { ...json.scripts, @@ -73,7 +74,7 @@ module.exports = { 'test:ember': 'vite build --mode test && ember test --path dist', }; - await fs.writeFile(packageJson, JSON.stringify(json, null, 2)); + fs.writeFileSync(packageJson, JSON.stringify(json, null, 2)); await emberCliUpdate({ projectDir: options.target, diff --git a/lib/ember-cli-update.js b/lib/ember-cli-update.js index 20c9094..091dbc9 100644 --- a/lib/ember-cli-update.js +++ b/lib/ember-cli-update.js @@ -1,4 +1,4 @@ -const fs = require('fs-extra'); +const fs = require('fs'); const { join } = require('path'); module.exports = async function ({ @@ -7,28 +7,29 @@ module.exports = async function ({ version, options = [], } = {}) { - fs.writeJSON( + fs.writeFileSync( join(projectDir, 'config', 'ember-cli-update.json'), - { - schemaVersion: '1.0.0', - projectName, - packages: [ - { - name: '@embroider/app-blueprint', - version, - blueprints: [ - { - name: '@embroider/app-blueprint', - isBaseBlueprint: true, - // TODO pass more of the original options through - options: [`--package-manager ${options.packageManager}`], - }, - ], - }, - ], - }, - { - spaces: 2, - }, + JSON.stringify( + { + schemaVersion: '1.0.0', + projectName, + packages: [ + { + name: '@embroider/app-blueprint', + version, + blueprints: [ + { + name: '@embroider/app-blueprint', + isBaseBlueprint: true, + // TODO pass more of the original options through + options: [`--package-manager ${options.packageManager}`], + }, + ], + }, + ], + }, + null, + { spaces: 2 }, + ), ); };