mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-26 04:31:39 +03:00
Change file structure.
This commit is contained in:
parent
a24b02bfc3
commit
f0b98c8d63
@ -1 +0,0 @@
|
||||
["/", "/about", "/articles"]
|
0
.gitignore → generator/.gitignore
vendored
0
.gitignore → generator/.gitignore
vendored
@ -1,11 +1,11 @@
|
||||
port module Main exposing (generate)
|
||||
port module Main exposing (main)
|
||||
|
||||
import Cli.OptionsParser as OptionsParser exposing (with)
|
||||
import Cli.Program as Program
|
||||
import String.Interpolate exposing (interpolate)
|
||||
|
||||
|
||||
port writeFile : String -> Cmd msg
|
||||
port writeFile : { rawContent : String, prerenderrc : String } -> Cmd msg
|
||||
|
||||
|
||||
port printAndExitSuccess : String -> Cmd msg
|
||||
@ -25,6 +25,24 @@ generatePage pageOrPost =
|
||||
]
|
||||
|
||||
|
||||
prerenderRcFormattedPath : PageOrPost -> String
|
||||
prerenderRcFormattedPath pageOrPost =
|
||||
pageOrPost.path
|
||||
|> String.dropRight 4
|
||||
|> String.split "/"
|
||||
|> List.drop 1
|
||||
|> String.join "/"
|
||||
|
||||
|
||||
preRenderRc : Extras -> String
|
||||
preRenderRc extras =
|
||||
(extras.pages ++ extras.posts)
|
||||
|> List.map prerenderRcFormattedPath
|
||||
|> List.map (\path -> String.concat [ "\"", path, "\"" ])
|
||||
|> String.join ", "
|
||||
|> (\paths -> String.concat [ "[", paths, "]" ])
|
||||
|
||||
|
||||
pathFor : PageOrPost -> String
|
||||
pathFor pageOrPost =
|
||||
pageOrPost.path
|
||||
@ -91,7 +109,10 @@ type alias PageOrPost =
|
||||
|
||||
init : Flags -> CliOptions -> Cmd Never
|
||||
init flags Default =
|
||||
generate { pages = flags.pages, posts = flags.posts }
|
||||
{ rawContent =
|
||||
generate { pages = flags.pages, posts = flags.posts }
|
||||
, prerenderrc = preRenderRc { pages = flags.pages, posts = flags.posts }
|
||||
}
|
||||
|> writeFile
|
||||
|
||||
|
||||
|
@ -27,7 +27,9 @@ app.ports.printAndExitFailure.subscribe((message: string) => {
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
app.ports.writeFile.subscribe((contents: string) => {
|
||||
fs.writeFileSync("./gen/RawContent.elm", contents);
|
||||
// console.log(message);
|
||||
});
|
||||
app.ports.writeFile.subscribe(
|
||||
(contents: { rawContent: string; prerenderrc: string }) => {
|
||||
fs.writeFileSync("./gen/RawContent.elm", contents.rawContent);
|
||||
fs.writeFileSync("./.prerenderrc", contents.prerenderrc);
|
||||
}
|
||||
);
|
||||
|
@ -3,11 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "Static site generator for elm-markup.",
|
||||
"scripts": {
|
||||
"start": "parcel src/index.html",
|
||||
"build": "rm -r dist && parcel build src/index.html --public-url ./",
|
||||
"generator:build": "parcel build generator/src/elm-markup-pages.ts --out-file bundle.js --target node --bundle-node-modules --no-source-maps",
|
||||
"test": "elm-test",
|
||||
"autotest": "elm-test --watch"
|
||||
"build": "parcel build generator/src/elm-markup-pages.ts --out-file bundle.js --target node --bundle-node-modules --no-source-maps"
|
||||
},
|
||||
"author": "Dillon Kearns",
|
||||
"license": "BSD-3",
|
||||
@ -18,11 +14,9 @@
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/node": "^12.6.8",
|
||||
"elm": "^0.19.0-no-deps",
|
||||
"elm-hot": "^1.0.1",
|
||||
"elm-test": "^0.19.0-rev6",
|
||||
"node-elm-compiler": "^5.0.3",
|
||||
"parcel-bundler": "^1.12.3",
|
||||
"parcel-plugin-prerender": "^1.4.1",
|
||||
"typescript": "^3.5.3"
|
||||
}
|
||||
}
|
||||
|
4
site/.gitignore
vendored
Normal file
4
site/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
elm-stuff/
|
||||
dist/
|
||||
.cache/
|
1
site/.prerenderrc
Normal file
1
site/.prerenderrc
Normal file
@ -0,0 +1 @@
|
||||
["_pages/about.emu", "_pages/articles/index.emu", "_posts/articles/moving-faster-with-tiny-steps.emu"]
|
@ -3,8 +3,7 @@
|
||||
"source-directories": [
|
||||
"src",
|
||||
"_layout",
|
||||
"gen",
|
||||
"generator"
|
||||
"gen"
|
||||
],
|
||||
"elm-version": "0.19.0",
|
||||
"dependencies": {
|
||||
@ -35,4 +34,4 @@
|
||||
"elm/random": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
package-lock.json → site/package-lock.json
generated
0
package-lock.json → site/package-lock.json
generated
28
site/package.json
Normal file
28
site/package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "elm-markup-pages",
|
||||
"version": "1.0.0",
|
||||
"description": "Static site generator for elm-markup.",
|
||||
"scripts": {
|
||||
"start": "parcel src/index.html",
|
||||
"build": "rm -r dist && parcel build src/index.html --public-url ./",
|
||||
"generator:build": "parcel build generator/src/elm-markup-pages.ts --out-file bundle.js --target node --bundle-node-modules --no-source-maps",
|
||||
"test": "elm-test",
|
||||
"autotest": "elm-test --watch"
|
||||
},
|
||||
"author": "Dillon Kearns",
|
||||
"license": "BSD-3",
|
||||
"dependencies": {
|
||||
"glob": "^7.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/node": "^12.6.8",
|
||||
"elm": "^0.19.0-no-deps",
|
||||
"elm-hot": "^1.0.1",
|
||||
"elm-test": "^0.19.0-rev6",
|
||||
"node-elm-compiler": "^5.0.3",
|
||||
"parcel-bundler": "^1.12.3",
|
||||
"parcel-plugin-prerender": "^1.4.1",
|
||||
"typescript": "^3.5.3"
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
module Example exposing (..)
|
||||
|
||||
import Expect exposing (Expectation)
|
||||
import Fuzz exposing (Fuzzer, int, list, string)
|
||||
import Test exposing (..)
|
||||
|
||||
|
||||
suite : Test
|
||||
suite =
|
||||
todo "Implement our first test. See https://package.elm-lang.org/packages/elm-explorations/test/latest for how to do this!"
|
Loading…
Reference in New Issue
Block a user