Add starting design for separate routes module.

This commit is contained in:
Dillon Kearns 2021-04-10 10:47:25 -07:00
parent 8c4990551c
commit 2722df72f7
2 changed files with 9 additions and 7 deletions

View File

@ -38,14 +38,13 @@ async function writeFiles() {
"./elm-stuff/elm-pages/Pages.elm",
elmPagesCliFile(staticRoutes)
);
const cliCode = generateTemplateModuleConnector("cli");
fs.writeFileSync(
"./elm-stuff/elm-pages/TemplateModulesBeta.elm",
generateTemplateModuleConnector("cli")
);
fs.writeFileSync(
"./gen/TemplateModulesBeta.elm",
generateTemplateModuleConnector("browser")
cliCode.mainModule
);
const browserCode = generateTemplateModuleConnector("browser");
fs.writeFileSync("./gen/TemplateModulesBeta.elm", browserCode.mainModule);
// write modified elm.json to elm-stuff/elm-pages/
copyModifiedElmJson();

View File

@ -15,7 +15,8 @@ function generateTemplateModuleConnector(phase) {
}
});
return `module TemplateModulesBeta exposing (..)
return {
mainModule: `module TemplateModulesBeta exposing (..)
import Browser
import Pages.Internal.Platform
@ -389,7 +390,9 @@ mapDocument document =
mapBoth fnA fnB ( a, b, c ) =
( fnA a, fnB b, c )
`;
`,
routesModule: ``,
};
}
/**