Fix some issues with the test script and esm import syntax to fix CI.

This commit is contained in:
Dillon Kearns 2023-02-20 11:44:02 -08:00
parent 6b37a52888
commit e3cb9d3a01
13 changed files with 49 additions and 3418 deletions

View File

@ -1,5 +1,6 @@
{
"name": "elm-pages-example",
"type": "module",
"version": "1.0.0",
"description": "Example site built with elm-pages.",
"scripts": {

View File

@ -1,5 +1,6 @@
{
"name": "elm-pages-escaping-example",
"type": "module",
"version": "3.0.0-beta.3",
"description": "Example site built with elm-pages.",
"scripts": {

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
{
"name": "elm-pages-example",
"type": "module",
"version": "1.0.0",
"description": "Example site built with elm-pages.",
"scripts": {

View File

@ -17,7 +17,7 @@ import * as esbuild from "esbuild";
import { createHash } from "crypto";
import { merge_vite_configs } from "./vite-utils.js";
import { resolveConfig } from "./config.js";
import { globbySync } from "globby";
import globby from "globby";
import { fileURLToPath } from "url";
import { copyFile } from "fs/promises";
@ -166,7 +166,7 @@ export async function run(options) {
})
.catch((error) => {
const portBackendTaskFileFound =
globbySync("./custom-backend-task.*").length > 0;
globby.sync("./custom-backend-task.*").length > 0;
if (portBackendTaskFileFound) {
// don't present error if there are no files matching custom-backend-task
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it

View File

@ -9,7 +9,7 @@ import * as fs from "node:fs";
import * as path from "node:path";
import { restoreColorSafe } from "./error-formatter.js";
import * as renderer from "./render.js";
import { globbySync } from "globby";
import globby from "globby";
import * as esbuild from "esbuild";
import { rewriteElmJson } from "./rewrite-elm-json.js";
import { ensureDirSync } from "./file-helpers.js";
@ -148,7 +148,7 @@ async function main() {
})
.catch((error) => {
const portBackendTaskFileFound =
globbySync("./custom-backend-task.*").length > 0;
globby.sync("./custom-backend-task.*").length > 0;
if (portBackendTaskFileFound) {
// don't present error if there are no files matching custom-backend-task
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it
@ -247,7 +247,7 @@ async function main() {
);
// TODO allow no custom-backend-task
const portBackendTaskFileFound =
globbySync("./custom-backend-task.*").length > 0;
globby.sync("./custom-backend-task.*").length > 0;
const scriptRunner = `${
portBackendTaskFileFound

View File

@ -1,5 +1,5 @@
import * as fs from "node:fs";
import * as fsExtra from "fs-extra/esm";
import * as fsExtra from "fs-extra";
import { rewriteElmJson } from "./rewrite-elm-json.js";
import { rewriteClientElmJson } from "./rewrite-client-elm-json.js";
import { elmPagesCliFile, elmPagesUiFile } from "./elm-file-constants.js";

View File

@ -26,7 +26,7 @@ import * as esbuild from "esbuild";
import { merge_vite_configs } from "./vite-utils.js";
import { templateHtml } from "./pre-render-html.js";
import { resolveConfig } from "./config.js";
import { globbySync } from "globby";
import globby from "globby";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
@ -206,7 +206,7 @@ export async function start(options) {
});
} catch (e) {
const portBackendTaskFileFound =
globbySync("./custom-backend-task.*").length > 0;
globby.sync("./custom-backend-task.*").length > 0;
if (portBackendTaskFileFound) {
// don't present error if there are no files matching custom-backend-task
// if there are files matching custom-backend-task, warn the user in case something went wrong loading it

View File

@ -1,4 +1,4 @@
import { globbySync } from "globby";
import globby from "globby";
import * as path from "path";
import { default as mm } from "micromatch";
import * as routeHelpers from "./route-codegen-helpers.js";
@ -10,7 +10,7 @@ import { fileURLToPath } from "url";
* @param {'browser' | 'cli'} phase
*/
export async function generateTemplateModuleConnector(basePath, phase) {
const templates = globbySync(["app/Route/**/*.elm"], {}).map((file) => {
const templates = globby.sync(["app/Route/**/*.elm"], {}).map((file) => {
const captures = mm.capture("app/Route/**/*.elm", file);
if (captures) {
return path.join(captures[0], captures[1]).split(path.sep);

View File

@ -1,5 +1,5 @@
import * as fs from "fs";
import { copySync } from "fs-extra/esm";
import * as fsExtra from "fs-extra";
import * as path from "path";
import * as kleur from "kleur/colors";
import { fileURLToPath } from "url";
@ -17,7 +17,7 @@ export async function run(name) {
if (!fs.existsSync(name)) {
try {
copySync(template, appRoot);
fsExtra.copySync(template, appRoot);
fs.renameSync(
path.resolve(appRoot, "gitignore"),
path.resolve(appRoot, ".gitignore")

36
package-lock.json generated
View File

@ -20,7 +20,7 @@
"elm-hot": "^1.1.6",
"esbuild": "^0.17.8",
"fs-extra": "^11.1.0",
"globby": "^13.1.3",
"globby": "13.1.3",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.5",
@ -37,7 +37,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.2",
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^11.0.1",
"@types/make-fetch-happen": "^10.0.1",
"@types/micromatch": "^4.0.2",
"@types/node": "^18.11.9",
@ -613,11 +613,12 @@
"integrity": "sha512-orGL5LXERPYsLov6CWs3Fh6203+dXzJkR7OnddIr2514Hsecwc8xRpzCapshBbKFImCsvS/mk6+FWiN5LyZJAQ=="
},
"node_modules/@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz",
"integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==",
"dev": true,
"dependencies": {
"@types/jsonfile": "*",
"@types/node": "*"
}
},
@ -651,6 +652,15 @@
"pretty-format": "^27.0.0"
}
},
"node_modules/@types/jsonfile": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.1.tgz",
"integrity": "sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/keyv": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",
@ -8257,11 +8267,12 @@
"integrity": "sha512-orGL5LXERPYsLov6CWs3Fh6203+dXzJkR7OnddIr2514Hsecwc8xRpzCapshBbKFImCsvS/mk6+FWiN5LyZJAQ=="
},
"@types/fs-extra": {
"version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
"integrity": "sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==",
"version": "11.0.1",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.1.tgz",
"integrity": "sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==",
"dev": true,
"requires": {
"@types/jsonfile": "*",
"@types/node": "*"
}
},
@ -8295,6 +8306,15 @@
"pretty-format": "^27.0.0"
}
},
"@types/jsonfile": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.1.tgz",
"integrity": "sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/keyv": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz",

View File

@ -36,7 +36,7 @@
"elm-hot": "^1.1.6",
"esbuild": "^0.17.8",
"fs-extra": "^11.1.0",
"globby": "^13.1.3",
"globby": "13.1.3",
"gray-matter": "^4.0.3",
"jsesc": "^3.0.2",
"kleur": "^4.1.5",
@ -50,7 +50,7 @@
},
"devDependencies": {
"@types/cross-spawn": "^6.0.2",
"@types/fs-extra": "^9.0.13",
"@types/fs-extra": "^11.0.1",
"@types/make-fetch-happen": "^10.0.1",
"@types/micromatch": "^4.0.2",
"@types/node": "^18.11.9",
@ -78,4 +78,4 @@
"bin": {
"elm-pages": "generator/src/cli.js"
}
}
}

View File

@ -1,11 +1,10 @@
set -ex;
root=`pwd`
yes | lamdera reset || true
npx elm-test-rs --compiler=lamdera
cd examples/routing && npm i && npm run build && npx elm-test-rs --compiler=lamdera && cd $root
(cd examples/routing && npm i && npm run build && npx elm-test-rs --compiler=lamdera)
(cd generator/dead-code-review && npx elm-test-rs --compiler=lamdera)
(cd generator/review && npx elm-test-rs --compiler=lamdera)
npm run test:snapshot
npx elmi-to-json --version
elm-verify-examples --run-tests --elm-test-args '--compiler=lamdera'
cd generator && mocha && cd $root
(cd generator && mocha)