Skip to content

Commit

Permalink
chore: ai > docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 24, 2024
1 parent 3e8f7d6 commit b938cb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/sync/sync.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import fs from 'fs';
import * as logger from '../fishkit/logger';
import type { Context } from '../types';
import { writeAi } from './write_ai';
import { writeClientEntry } from './write_client_entry';
import { writeDocs } from './write_docs';
import { writeGlobalStyle } from './write_global_style';
import { writeRouteTree } from './write_route_tree';
import { writeRouter } from './write_router';
Expand All @@ -24,7 +24,7 @@ export async function sync(opts: SyncOptions) {
fs.mkdirSync(tmpPath, { recursive: true });
}

await writeAi({ context });
await writeDocs({ context });
await writeTypes({ context });
await writeRouteTree({ context });
const globalStyleImportPath = writeGlobalStyle({ context });
Expand Down
21 changes: 12 additions & 9 deletions src/sync/write_ai.ts → src/sync/write_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import path from 'pathe';
import type { Context } from '../types';
import { writeFileSync } from './fs';

export async function writeAi(opts: { context: Context }) {
export async function writeDocs(opts: { context: Context }) {
const { context } = opts;
const aiPath = path.join(context.paths.tmpPath, 'ai');
const docsPath = path.join(context.paths.tmpPath, 'docs');
const deps = {
...context.pkg.dependencies,
...context.pkg.devDependencies,
};
fs.mkdirSync(aiPath, { recursive: true });
fs.mkdirSync(docsPath, { recursive: true });

const generals = [
`- This a react project.`,
Expand Down Expand Up @@ -55,7 +55,7 @@ export async function writeAi(opts: { context: Context }) {
);

writeFileSync(
path.join(aiPath, 'general.md'),
path.join(docsPath, 'general.md'),
`
## General
Expand All @@ -81,20 +81,23 @@ ${fileDirs.join('\n')}
path.join(__dirname, '../../README.md'),
'utf-8',
);
writeFileSync(path.join(aiPath, 'tnf.md'), tnfContent);
writeFileSync(path.join(docsPath, 'tnf.md'), tnfContent);

writeFileSync(
path.join(aiPath, 'best_practices.md'),
path.join(docsPath, 'best_practices.md'),
'/* TODO: best practices */',
);

writeFileSync(path.join(aiPath, 'engineering.md'), '/* TODO: engineering */');
writeFileSync(
path.join(docsPath, 'engineering.md'),
'/* TODO: engineering */',
);

writeFileSync(path.join(aiPath, 'routing.md'), '/* TODO: routing */');
writeFileSync(path.join(docsPath, 'routing.md'), '/* TODO: routing */');

// copy third-party docs
const docsDir = path.join(__dirname, '../../third-party-docs');
fs.cpSync(docsDir, path.join(aiPath, 'third-party-docs'), {
fs.cpSync(docsDir, path.join(docsPath, 'third-party-docs'), {
recursive: true,
});
}

0 comments on commit b938cb5

Please sign in to comment.