chr15m / sitefox

Node + cljs backend web framework
https://chr15m.github.io/sitefox/
MIT License
283 stars 7 forks source link

Problems installing via sitefox-shadow-fullstack #21

Closed chr15m closed 1 year ago

chr15m commented 1 year ago

Carl from Clojurians Slack reports problems installing via sitefox-shadow-fullstack.

Original: https://clojurians.slack.com/archives/C02LB2842UA/p1662117079308339

------ WARNING #1 - :undeclared-var --------------------------------------------
 File: C:\Users\xxx\repos\yyy\node_modules\sitefox\src\sitefox\auth.cljs:4:37
--------------------------------------------------------------------------------
   1 | (ns sitefox.auth)
   2 |
   3 | (defn login [req res]
   4 |   (if (= (aget req.body "password") site-password)
-------------------------------------------^------------------------------------
 Use of undeclared Var sitefox.auth/site-password
--------------------------------------------------------------------------------
   5 |     (do
   6 |       (aset req.session "authenticated" true)
   7 |       (.json res true))
   8 |     (-> res (.status 403) (.json #js {:error "Incorrect password"}))))
--------------------------------------------------------------------------------

Anyone know why the above happens when I include sitefox.auth in an app created with

npm init sitefox-shadow-fullstack myapp

server file:

(ns yyy.server 
  (:require
    ["fs" :as fs]
    [applied-science.js-interop :as j]
    [promesa.core :as p]
    [sitefox.util :refer [env]]
    [sitefox.html :refer [render-into]]
    [sitefox.web :as web]
    [sitefox.logging :refer [bind-console-to-file]]
    [sitefox.auth :as auth]))
chr15m commented 1 year ago

I'm not able to replicate this. It has probably happened because Sitefox is included in the package.json without any version pinning. I'll have a think about whether to pin it to a specific version instead, or maybe @latest from npm instead of GitHub.