Skip to content

Commit

Permalink
refactor: Convert to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
relekang committed Feb 14, 2025
1 parent 2d32634 commit 597c5f3
Show file tree
Hide file tree
Showing 32 changed files with 734 additions and 7,420 deletions.
13 changes: 13 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://swc.rs/schema.json",
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false
},
"target": "es2024",
"loose": false,
"keepClassNames": true
},
"minify": false
}
18 changes: 8 additions & 10 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/usr/bin/env node

const pkg = require("./package.json");
const createServer = require("./dist").default;
console.log("", createServer);
import updateNotifier from "update-notifier";
import { cli } from "./dist/cli.js";
import createServer from "./dist/index.js";
import pkg from "./package.json" with { type: "json" };

try {
const updateNotifier = require("update-notifier");
updateNotifier({ pkg }).notify();
} catch {}

require("./dist/cli")
.cli({ version: pkg.version, createServer })
.catch((error) => {
console.error(error);
process.exit(1);
});
cli({ version: pkg.version, createServer }).catch((error) => {
console.error(error);
process.exit(1);
});
13 changes: 0 additions & 13 deletions dev.js

This file was deleted.

10 changes: 8 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
module.exports = {
preset: "ts-jest",
export default {
transform: {
"^.+\\.(t|j)s$": "@swc/jest",
},
extensionsToTreatAsEsm: [".ts"],
testEnvironment: "node",
coverageDirectory: "./coverage/",
testRegex: "/__tests__/.*\\.tests\\.ts$",
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
};
Loading

0 comments on commit 597c5f3

Please sign in to comment.