Skip to content
Permalink
Browse files

feat(importer): fix the projects gitignore on import

  • Loading branch information
MarshallOfSound authored and malept committed Dec 4, 2016
1 parent bddb903 commit 75366bfe9b211800cd2c154bb2cd37ce7d31b5a3
Showing with 10 additions and 28 deletions.
  1. +9 −0 src/electron-forge-import.js
  2. +1 −28 src/util/terminate.js
@@ -138,6 +138,15 @@ const main = async () => {
packageJSON.config.forge = JSON.parse(await fs.readFile(path.resolve(__dirname, '../tmpl/package.json'))).config.forge;

await writeChanges();

const gitignoreSpinner = ora.ora('Fixing .gitignore').start();
if (await fs.exists(path.resolve(dir, '.gitignore'))) {
const gitignore = await fs.readFile(path.resolve(dir, '.gitignore'));
if (!gitignore.includes('out')) {
await fs.writeFile(path.resolve(dir, '.gitignore'), `${gitignore}\nout/`);
}
}
gitignoreSpinner.succeed();
};

main();
@@ -4,17 +4,13 @@ import ora from 'ora';

const d = debug('electron-forge:lifecycle');

const runningOras = {};

process.on('unhandledRejection', (err) => {
Object.keys(runningOras).forEach(key => runningOras[key].fail());
process.stdout.write('\n\nAn unhandled rejection has occurred inside Forge:\n');
console.error(colors.red(err.stack || JSON.stringify(err)));
process.exit(1);
});

process.on('uncaughtException', (err) => {
Object.keys(runningOras).forEach(key => runningOras[key].fail());
process.stdout.write('\n\nAn unhandled exception has occurred inside Forge:\n');
console.error(colors.red(err.stack || JSON.stringify(err)));
process.exit(1);
@@ -44,28 +40,5 @@ if (process.env.DEBUG && process.env.DEBUG.includes('electron-forge')) {
return fake;
};
} else {
let oraID = 1;
ora.ora = (name) => {
const createdOra = ora(name);
createdOra.id = oraID;
const fns = {};
fns.start = createdOra.start.bind(createdOra);
fns.stop = createdOra.stop.bind(createdOra);
fns.succeed = createdOra.succeed.bind(createdOra);
fns.fail = createdOra.fail.bind(createdOra);
createdOra.start = () => {
runningOras[createdOra.id] = createdOra;
fns.start();
return createdOra;
};
['stop', 'succeed', 'fail'].forEach((fnName) => {
createdOra[fnName] = (...args) => {
delete runningOras[createdOra.id];
fns[fnName](...args);
return createdOra;
};
});
oraID += 1;
return createdOra;
};
ora.ora = ora;
}

0 comments on commit 75366bf

Please sign in to comment.
You can’t perform that action at this time.