Move Page Modules and special elm-pages modules into app folder.

This commit is contained in:
Dillon Kearns 2022-02-10 16:27:56 -08:00
parent ce8a3c9e5c
commit b91f978d24
14 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,8 @@
"src",
"../../src",
".elm-pages",
"../../plugins"
"../../plugins",
"app"
],
"elm-version": "0.19.1",
"dependencies": {

View File

@ -14,7 +14,7 @@ async function run({ moduleName, withState, serverRender, withFallback }) {
withFallback
);
const fullFilePath = path.join(
`src/Page/`,
`app/Page/`,
moduleName.replace(/\./g, "/") + ".elm"
);
await fs.tryMkdir(path.dirname(fullFilePath));

View File

@ -246,7 +246,7 @@ async function start(options) {
function needToRerunCodegen(eventName, pathThatChanged) {
return (
(eventName === "add" || eventName === "unlink") &&
pathThatChanged.match(/src\/Page\/.*\.elm/)
pathThatChanged.match(/app\/Page\/.*\.elm/)
);
}

View File

@ -8,8 +8,8 @@ const routeHelpers = require("./route-codegen-helpers");
* @param {'browser' | 'cli'} phase
*/
function generateTemplateModuleConnector(basePath, phase) {
const templates = globby.sync(["src/Page/**/*.elm"], {}).map((file) => {
const captures = mm.capture("src/Page/**/*.elm", file);
const templates = globby.sync(["app/Page/**/*.elm"], {}).map((file) => {
const captures = mm.capture("app/Page/**/*.elm", file);
if (captures) {
return path.join(captures[0], captures[1]).split(path.sep);
} else {

View File

@ -20,7 +20,7 @@ function rewriteElmJson(elmJson) {
// 1. remove existing path that looks at `Pages.elm`
elmJson["source-directories"] = elmJson["source-directories"].filter(
(item) => {
return item != ".elm-pages";
return item != ".elm-pages" && item != "app";
}
);
// 2. prepend ../../../ to remaining