From b26d05b88c824dcc1030903e1d0766233683cd5f Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Mon, 26 Oct 2020 11:03:43 -0700 Subject: [PATCH] Generate Template.elm module. --- {examples/docs => generator}/src/Template.elm | 0 generator/src/codegen-template-builder.js | 0 generator/src/codegen.js | 5 +++++ generator/src/generate-elm-stuff.js | 1 + 4 files changed, 6 insertions(+) rename {examples/docs => generator}/src/Template.elm (100%) create mode 100644 generator/src/codegen-template-builder.js diff --git a/examples/docs/src/Template.elm b/generator/src/Template.elm similarity index 100% rename from examples/docs/src/Template.elm rename to generator/src/Template.elm diff --git a/generator/src/codegen-template-builder.js b/generator/src/codegen-template-builder.js new file mode 100644 index 00000000..e69de29b diff --git a/generator/src/codegen.js b/generator/src/codegen.js index 3c5dd422..f0794067 100644 --- a/generator/src/codegen.js +++ b/generator/src/codegen.js @@ -47,6 +47,11 @@ async function writeFiles(markdownContent) { ensureDirSync("./elm-stuff"); ensureDirSync("./gen"); ensureDirSync("./elm-stuff/elm-pages"); + fs.copyFileSync(path.join(__dirname, `./Template.elm`), `./gen/Template.elm`); + fs.copyFileSync( + path.join(__dirname, `./Template.elm`), + `./elm-stuff/elm-pages/Template.elm` + ); // prevent compilation errors if migrating from previous elm-pages version deleteIfExists("./elm-stuff/elm-pages/Pages/ContentCache.elm"); diff --git a/generator/src/generate-elm-stuff.js b/generator/src/generate-elm-stuff.js index 3d5e4d06..8477d714 100644 --- a/generator/src/generate-elm-stuff.js +++ b/generator/src/generate-elm-stuff.js @@ -36,6 +36,7 @@ module.exports = function run(mode, staticRoutes, markdownContent) { global.previousUiFileContent = uiFileContent; + fs.copyFileSync(path.join(__dirname, `./Template.elm`), `./gen/Template.elm`); // write `Pages.elm` with cli interface fs.writeFileSync( "./elm-stuff/elm-pages/Pages.elm",