buildOnlyPage function
.mdファイルが編集されたとき 全部ではなく関係するページだけを生成しなおす
- srcPagePath: 編集されたファイルのパス
Implementation
Future<void> buildOnlyPage(
String srcPagePath,
CometYaml cometYaml,
) async {
final srcPathSegments = srcPagePath.split(Platform.pathSeparator);
final srcPageSegment = srcPathSegments.removeLast();
final srcBookSegments = srcPathSegments;
final genFileName = srcPageSegment;
final genBookSegments = srcBookSegments.map(
(it) => toCodeName(it),
);
final genBookPath = genBookSegments.join(Platform.pathSeparator);
final genDataPath =
'${cometYaml.flutterProject.root}/$genRoot/$genDataFolderName';
final genBookFolderPath = '$genDataPath/$genBookPath';
final genFilePath = '$genBookFolderPath$genFileName$dartExt';
/// create raw-page
final srcPage = await readSrcPageFullPath(srcPagePath);
final rawPage = toRawPage(srcPage, genBookFolderPath);
// delete old gen-page
deleteFile(genFilePath);
// write gen-data
await writeGenPage(rawPage);
}