fix(core): update
This commit is contained in:
21
ts/mod_format/format.gitignore.ts
Normal file
21
ts/mod_format/format.gitignore.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as plugins from './mod.plugins.js';
|
||||
import * as paths from '../paths.js';
|
||||
|
||||
import { Project } from '../classes.project.js';
|
||||
|
||||
import { logger } from '../gitzone.logging.js';
|
||||
const gitignorePath = plugins.path.join(paths.cwd, './.gitignore');
|
||||
|
||||
export const run = async (projectArg: Project) => {
|
||||
const gitignoreExists = await plugins.smartfile.fs.fileExists(gitignorePath);
|
||||
const templateModule = await import('../mod_template/index.js');
|
||||
const ciTemplate = await templateModule.getTemplate('gitignore');
|
||||
if (gitignoreExists) {
|
||||
// lets get the existing gitignore file
|
||||
const existingGitIgnoreString = plugins.smartfile.fs.toStringSync(gitignorePath);
|
||||
let customPart = existingGitIgnoreString.split('# custom\n')[1];
|
||||
customPart ? null : (customPart = '');
|
||||
}
|
||||
ciTemplate.writeToDisk(paths.cwd);
|
||||
logger.log('info', 'Added a .gitignore!');
|
||||
};
|
Reference in New Issue
Block a user