feat(importer): fix the projects gitignore on import
This commit is contained in:
Родитель
bddb903841
Коммит
75366bfe9b
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче