Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay copying of elm files to /gen folder until cli app is done #23

Merged
merged 3 commits into from
Jan 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions generator/src/elm-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,6 @@ function run() {
app.ports.writeFile.subscribe(contents => {
const routes = toRoutes(markdownContent.concat(content));

ensureDirSync("./gen");

// prevent compilation errors if migrating from previous elm-pages version
deleteIfExists("./gen/Pages/ContentCache.elm");
deleteIfExists("./gen/Pages/Platform.elm");

fs.writeFileSync(
"./gen/Pages.elm",
elmPagesUiFile(staticRoutes, markdownContent, content)
);
console.log("elm-pages DONE");
doCliStuff(
contents.watch ? "dev" : "prod",
staticRoutes,
Expand Down Expand Up @@ -122,6 +111,19 @@ function run() {
() => {}
);
}

ensureDirSync("./gen");

// prevent compilation errors if migrating from previous elm-pages version
deleteIfExists("./gen/Pages/ContentCache.elm");
deleteIfExists("./gen/Pages/Platform.elm");

fs.writeFileSync(
"./gen/Pages.elm",
elmPagesUiFile(staticRoutes, markdownContent, content)
);
console.log("elm-pages DONE");

}
);
});
Expand Down