cli/ts/mod_format/format.readme.ts

32 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2024-06-21 17:48:43 +00:00
import * as plugins from './mod.plugins.js';
import * as paths from '../paths.js';
2024-06-23 11:26:51 +00:00
export const run = async () => {
2024-06-21 17:48:43 +00:00
const readmePath = plugins.path.join(paths.cwd, 'readme.md');
2024-06-23 11:26:51 +00:00
const readmeHintsPath = plugins.path.join(paths.cwd, 'readme.hints.md');
2024-06-21 17:48:43 +00:00
2024-06-23 11:26:51 +00:00
// Check and initialize readme.md if it doesn't exist
const readmeExists = await plugins.smartfile.fs.fileExists(readmePath);
if (!readmeExists) {
await plugins.smartfile.fs.toFs(
'# Project Readme\n\nThis is the initial readme file.',
readmePath,
);
2024-06-23 11:26:51 +00:00
console.log('Initialized readme.md');
} else {
console.log('readme.md already exists');
2024-06-21 17:48:43 +00:00
}
2024-06-23 11:26:51 +00:00
// Check and initialize readme.hints.md if it doesn't exist
const readmeHintsExists = await plugins.smartfile.fs.fileExists(readmeHintsPath);
if (!readmeHintsExists) {
await plugins.smartfile.fs.toFs(
'# Project Readme Hints\n\nThis is the initial readme hints file.',
readmeHintsPath,
);
2024-06-23 11:26:51 +00:00
console.log('Initialized readme.hints.md');
} else {
console.log('readme.hints.md already exists');
2024-06-21 17:48:43 +00:00
}
};