Skip to content

Commit

Permalink
a few minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Sep 23, 2022
1 parent 6d34917 commit f8dae56
Showing 1 changed file with 33 additions and 11 deletions.
44 changes: 33 additions & 11 deletions bin/bottled-ember
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const argv = minimist(process.argv.slice(2));
const emberVersion = argv.emberVersion || '4.0';

const cacheDir = findCacheDir({
name: `bottled-ember-${emberVersion}`.replace(/\./g, '-'),
name: `bottled-ember-${emberVersion.replace(/\./g, '-')}-${argv['cache-name'] ?? 'default'}`,
});

async function run() {
Expand Down Expand Up @@ -51,7 +51,7 @@ async function run() {
});

console.log('finished installing dependencies 🤖');
console.log('customising bottle-ember app 🤖');
console.log('customising bottled-ember app 🤖');

await rmSync(join(cacheDir, 'app/templates/application.hbs'));

Expand Down Expand Up @@ -89,6 +89,9 @@ async function run() {
`'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const mergeTrees = require('broccoli-merge-trees');
const { join } = require('path');
const { existsSync } = require('fs');
let buildConfig = {}
try {
Expand All @@ -101,12 +104,26 @@ async function run() {
// do nothing
}
let trees = {};
// todo make no-overlay work at runtime so you don't need to clear cache
if (${argv['no-overlay'] ? false : true} && existsSync(join('/Users/mansona/git/projects/bottled-ember/emberfest-fancy-button-addon', 'app'))) {
trees.app = mergeTrees([join(__dirname, 'app'), join('${process.cwd()}', 'app')], { overwrite: true })
}
if (${argv['no-overlay'] ? false : true} && existsSync(join('/Users/mansona/git/projects/bottled-ember/emberfest-fancy-button-addon', 'tests'))) {
trees.tests = mergeTrees([join(__dirname, 'tests'), join('${process.cwd()}', 'tests')], { overwrite: true })
}
module.exports = function (defaults) {
let app = new EmberApp(defaults, buildConfig);
let app = new EmberApp({
...defaults,
trees,
}, buildConfig);
return app.toTree();
};
`
)
);

console.log('installing linking your local app 🤖');

Expand Down Expand Up @@ -157,14 +174,19 @@ async function run() {
});
}

const commandArgs = [
'ember',
argv._[0] || 'serve',
'--output-path',
join(process.cwd(), 'dist'),
];
const commandArgs = ['ember', argv._[0] || 'serve'];

if (argv['output-path']) {
commandArgs.push('--output-path', join(process.cwd(), argv['output-path']));
} else {
commandArgs.push('--output-path', join(process.cwd(), 'dist'));
}

if (argv.p !== null && argv.p !== undefined) {
commandArgs.push(`--port=${argv.p}`);
}

if(argv.environment) {
if (argv.environment) {
commandArgs.push('--environment', argv.environment);
}

Expand Down

0 comments on commit f8dae56

Please sign in to comment.