Skip to content

Commit

Permalink
Sets package.json type to module and converts a couple files to ESM (#58
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lourd authored Jan 15, 2025
1 parent 0409ba4 commit 572a9cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions content-watcher.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const { WebSocketServer } = require("ws")
const chokidar = require("chokidar")
// @ts-check

import chokidar from "chokidar"
import { WebSocketServer } from "ws"

const server = new WebSocketServer({ port: 3001 })
const watchCallbacks = []
let watchCallbacks = []

chokidar.watch("./public").on("all", (event) => {
if (event === "change") {
Expand All @@ -16,8 +18,7 @@ server.on("connection", function connection(socket) {
const onChange = () => socket.send("refresh")
watchCallbacks.push(onChange)
socket.on("close", function close() {
const index = watchCallbacks.findIndex(onChange)
watchCallbacks.splice(index, 1)
watchCallbacks = watchCallbacks.filter((cb) => cb !== onChange)
})
})

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "3.0.0",
"private": true,
"packageManager": "^[email protected]",
"type": "module",
"scripts": {
"dev": "pnpm run --reporter=append-only --reporter-hide-prefix \"/^dev:.*/\"",
"dev:content": "node ./content-watcher.js",
Expand Down
4 changes: 3 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module.exports = {
const config = {
plugins: {
"postcss-import": {},
"tailwindcss/nesting": {},
tailwindcss: {},
autoprefixer: {},
},
}

export default config

0 comments on commit 572a9cc

Please sign in to comment.