mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-27 21:29:55 +03:00
Merge pull request #261 from dillonkearns/remove-obsolete-file-from-dist
Remove obsolete script from dist folder (it is now inlined as a <script>)
This commit is contained in:
commit
9455a6fc3e
@ -326,12 +326,6 @@ async function runTerser(filePath) {
|
||||
}
|
||||
|
||||
async function copyAssets() {
|
||||
await fsPromises.writeFile(
|
||||
"dist/elm-pages.js",
|
||||
await fsPromises.readFile(
|
||||
path.join(__dirname, "../static-code/elm-pages.js")
|
||||
)
|
||||
);
|
||||
fs.copyDirFlat("public", "dist");
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ async function runElmReview(cwd) {
|
||||
child.on("close", function (code) {
|
||||
console.log(`Ran elm-review in ${timeFrom(startTime)}`);
|
||||
if (code === 0) {
|
||||
reject();
|
||||
resolve(scriptOutput);
|
||||
} else {
|
||||
resolve(scriptOutput);
|
||||
}
|
||||
|
@ -320,7 +320,11 @@ async function start(options) {
|
||||
|
||||
if (req.url.includes("content.json")) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
if (emptyReviewError(reviewOutput)) {
|
||||
res.end(error);
|
||||
} else {
|
||||
res.end(reviewOutput);
|
||||
}
|
||||
} else {
|
||||
res.writeHead(500, { "Content-Type": "text/html" });
|
||||
res.end(errorHtml());
|
||||
@ -385,6 +389,18 @@ async function start(options) {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} reviewReportJsonString
|
||||
*/
|
||||
function emptyReviewError(reviewReportJsonString) {
|
||||
try {
|
||||
return JSON.parse(reviewReportJsonString).errors.length === 0;
|
||||
} catch (e) {
|
||||
console.trace("problem with format in reviewReportJsonString", e);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async function awaitElmMiddleware(req, res, next) {
|
||||
if (req.url && req.url.startsWith("/elm.js")) {
|
||||
try {
|
||||
@ -506,12 +522,10 @@ function errorHtml() {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<!--<link rel="preload" href="/elm-pages.js" as="script"> -->
|
||||
<link rel="preload" href="/index.js" as="script">
|
||||
<!--<link rel="preload" href="/elm.js" as="script">-->
|
||||
<script src="/hmr.js" type="text/javascript"></script>
|
||||
<!--<script defer="defer" src="/elm.js" type="text/javascript"></script>-->
|
||||
<!--<script defer="defer" src="/elm-pages.js" type="module"></script>-->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<script>
|
||||
|
Loading…
Reference in New Issue
Block a user