Skip to content

Commit f8a20fa

Browse files
author
Kelly Selden
committed
use empty commit instead of base blueprint when init
1 parent c8d8bad commit f8a20fa

File tree

3 files changed

+33
-365
lines changed

3 files changed

+33
-365
lines changed

src/get-start-and-end-commands.js

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,17 @@ function getArgs({
9292
directoryName,
9393
blueprint
9494
}) {
95-
let args = [];
95+
let args = [
96+
'new',
97+
projectName
98+
];
9699

97-
if (blueprint.isBaseBlueprint) {
98-
args.push('new');
99-
args.push(projectName);
100-
if (directoryName !== projectName) {
101-
args.push(`-dir=${directoryName}`);
102-
}
103-
args.push('-sg');
104-
} else {
105-
args.push('init');
106-
if (directoryName !== projectName) {
107-
args.push(`--name=${projectName}`);
108-
}
100+
if (directoryName !== projectName) {
101+
args.push(`-dir=${directoryName}`);
109102
}
110103

104+
args.push('-sg');
105+
111106
let _blueprint;
112107
if (blueprint.path) {
113108
// Only use path when necessary, because `npm install <folder>`
@@ -185,52 +180,42 @@ function createProject(runEmber) {
185180
}
186181
}) => {
187182
return async function createProject(cwd) {
183+
if (!blueprint) {
184+
return cwd;
185+
}
186+
188187
// remove scope
189188
let directoryName = projectName.replace(/^@.+\//, '');
190189

191-
let projectRoot = path.join(cwd, directoryName);
192-
193190
async function _runEmber(blueprint) {
194-
let _cwd = cwd;
195-
196-
if (!blueprint.isBaseBlueprint) {
197-
_cwd = projectRoot;
198-
}
199-
200191
let args = getArgs({
201192
projectName,
202193
directoryName,
203194
blueprint
204195
});
205196

206-
let ps = runEmber({
197+
await runEmber({
207198
packageRoot,
208-
cwd: _cwd,
199+
cwd,
209200
blueprint,
210201
args
211202
});
212-
213-
module.exports.overwriteBlueprintFiles(ps);
214-
215-
await ps;
216203
}
217204

218-
if (!blueprint || !blueprint.isBaseBlueprint) {
205+
let projectRoot = path.join(cwd, directoryName);
206+
207+
if (await isDefaultAddonBlueprint(blueprint)) {
219208
await _runEmber(baseBlueprint);
220-
}
221209

222-
if (blueprint) {
223-
if (await isDefaultAddonBlueprint(blueprint)) {
224-
await module.exports.installAddonBlueprint({
225-
projectRoot,
226-
blueprint
227-
});
228-
} else {
229-
await _runEmber(blueprint);
230-
}
210+
await module.exports.installAddonBlueprint({
211+
projectRoot,
212+
blueprint
213+
});
214+
} else {
215+
await _runEmber(blueprint);
231216
}
232217

233-
if (!(blueprint && isDefaultBlueprint(blueprint))) {
218+
if (!isDefaultBlueprint(blueprint)) {
234219
// This might not be needed anymore.
235220
await module.exports.appendNodeModulesIgnore({
236221
projectRoot
@@ -289,4 +274,3 @@ async function appendNodeModulesIgnore({
289274

290275
module.exports.appendNodeModulesIgnore = appendNodeModulesIgnore;
291276
module.exports.getArgs = getArgs;
292-
module.exports.overwriteBlueprintFiles = overwriteBlueprintFiles;

test/fixtures/blueprint/app/local-app/reset/my-app/test-file.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)