mirror of
https://github.com/dillonkearns/elm-pages.git
synced 2024-09-11 09:05:28 +03:00
Build elm-pages-codegen.js compiled code for generator in bundle.
This commit is contained in:
parent
83aa56edac
commit
630e458b0e
1
codegen/.gitignore
vendored
1
codegen/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
Gen/
|
||||
elm-pages-codegen.js
|
||||
|
||||
|
@ -64,29 +64,31 @@ async function generateTemplateModuleConnector(basePath, phase) {
|
||||
|
||||
async function runElmCodegenCli(templates, basePath, phase) {
|
||||
// await runElmCodegenInstall();
|
||||
try {
|
||||
await compileCliApp(
|
||||
// { debug: true },
|
||||
{},
|
||||
`Generate.elm`,
|
||||
path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js"),
|
||||
path.join(__dirname, "../../codegen"),
|
||||
// try {
|
||||
// await compileCliApp(
|
||||
// // { debug: true },
|
||||
// {},
|
||||
// `Generate.elm`,
|
||||
// path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js"),
|
||||
// path.join(__dirname, "../../codegen"),
|
||||
|
||||
path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js")
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(restoreColorSafe(error));
|
||||
process.exit(1);
|
||||
// throw error;
|
||||
}
|
||||
// path.join(process.cwd(), "elm-stuff/elm-pages-codegen.js")
|
||||
// );
|
||||
// } catch (error) {
|
||||
// console.log(restoreColorSafe(error));
|
||||
// process.exit(1);
|
||||
// // throw error;
|
||||
// }
|
||||
|
||||
const filePath = path.join(__dirname, `../../codegen/elm-pages-codegen.js`);
|
||||
|
||||
// TODO use uncached require here to prevent stale code from running
|
||||
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const elmPagesCodegen = require(path.join(
|
||||
process.cwd(),
|
||||
"./elm-stuff/elm-pages-codegen.js"
|
||||
)).Elm.Generate;
|
||||
const elmPagesCodegen = require(filePath).Elm.Generate;
|
||||
// path.join(
|
||||
// process.cwd(),
|
||||
// "./elm-stuff/elm-pages-codegen.js")
|
||||
|
||||
const app = elmPagesCodegen.init({
|
||||
flags: { templates: templates, basePath, phase },
|
||||
|
@ -10,7 +10,8 @@
|
||||
"test": "./test.sh",
|
||||
"test:snapshot": "(cd examples/escaping && npm install && npm test) && (cd examples/base-path && npm install && npm test)",
|
||||
"cypress": "npm start & cypress run",
|
||||
"prepare": "elm-codegen install",
|
||||
"prepare": "npm run build:generator",
|
||||
"build:generator": "elm-codegen install && elm make Generate.elm --output elm-pages-codegen.js",
|
||||
"review": "elm-review"
|
||||
},
|
||||
"repository": "https://github.com/dillonkearns/elm-pages",
|
||||
@ -68,8 +69,9 @@
|
||||
"files": [
|
||||
"generator/src/",
|
||||
"generator/review/",
|
||||
"generator/dead-code-review/",
|
||||
"src/",
|
||||
"codegen/",
|
||||
"codegen/elm-pages-codegen.js",
|
||||
"generator/template/",
|
||||
"generator/static-code/"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user