Skip to content

Commit

Permalink
Convert to ESM module (#83)
Browse files Browse the repository at this point in the history
* start to convert to esm

* convert files

* remove original tests

* remove plugins

* fix lint script
  • Loading branch information
mldangelo authored Oct 3, 2023
1 parent ac50a83 commit 668e907
Show file tree
Hide file tree
Showing 33 changed files with 5,364 additions and 3,221 deletions.
File renamed without changes.
14 changes: 5 additions & 9 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
const { defineConfig } = require("cypress"); // eslint-disable-line import/no-extraneous-dependencies
import { defineConfig } from "cypress"; // eslint-disable-line import/no-extraneous-dependencies

module.exports = defineConfig({
const config = defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// eslint-disable-next-line global-require
return require("./cypress/plugins/index")(on, config);
},
baseUrl: "http://localhost:8000",
specPattern: "cypress/tests/**/*.cy.{js,jsx,ts,tsx}",
specPattern: "cypress/tests/**/*.cy.cjs",
},
});

export default config;
22 changes: 0 additions & 22 deletions cypress/plugins/index.js

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe("smartselfie authentication ", () => {
describe("smartselfie authentication", () => {
beforeEach(() => {
cy.visit("/smartselfie");

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 9 additions & 6 deletions esbuild.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require("fs");
const path = require("path");
const esbuild = require("esbuild");
const rimraf = require("rimraf");
import fs from "fs";
import path from "path";
import esbuild from "esbuild";

/**
* Ensures a directory exists. If not, creates it.
Expand Down Expand Up @@ -59,7 +58,9 @@ const copyFiles = (srcDir, pattern, destDir) => {
* and copies necessary files.
*/
const prebuildDist = () => {
rimraf.sync("dist");
if (fs.existsSync("dist")) {
fs.rmSync("build", { recursive: true });
}
ensureDirSync("dist");
copySync("src", "dist", (file) => !file.endsWith(".js"));
};
Expand All @@ -70,7 +71,9 @@ const prebuildDist = () => {
* copies necessary files, and copies HTML pages from cypress.
*/
const prebuild = () => {
rimraf.sync("build");
if (fs.existsSync("build")) {
fs.rmSync("build", { recursive: true });
}
ensureDirSync("build");
copySync("src", "build", (file) => !file.endsWith(".js"));
copyFiles("cypress/pages", "*.html", "build");
Expand Down
Loading

0 comments on commit 668e907

Please sign in to comment.