@epic-web/workshop-app 6.2.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import fs from "fs";
2
1
  import path from "path";
3
2
  import { fileURLToPath } from "url";
4
3
  import { getPresentUsers } from "@epic-web/workshop-presence/presence.server";
@@ -8,6 +7,7 @@ import {
8
7
  init as initApps,
9
8
  setModifiedTimesForAppDirs
10
9
  } from "@epic-web/workshop-utils/apps.server";
10
+ import { getEnv, init as initEnv } from "@epic-web/workshop-utils/env.server";
11
11
  import { checkForUpdatesCached } from "@epic-web/workshop-utils/git.server";
12
12
  import { checkConnectionCached } from "@epic-web/workshop-utils/utils.server";
13
13
  import { createRequestHandler } from "@react-router/express";
@@ -25,19 +25,19 @@ closeWithGrace(({ err, manual }) => {
25
25
  if (manual) return;
26
26
  if (err) console.error(err.stack);
27
27
  });
28
+ await initEnv();
29
+ global.ENV = getEnv();
28
30
  const MODE = process.env.NODE_ENV ?? "development";
31
+ const isProd = MODE === "production";
29
32
  void initApps();
30
33
  sourceMapSupport.install();
31
- const viteDevServer = process.env.NODE_ENV === "production" ? null : await import("vite").then(
34
+ const viteDevServer = isProd ? null : await import("vite").then(
32
35
  (vite) => vite.createServer({
33
36
  server: { middlewareMode: true },
34
37
  appType: "custom"
35
38
  })
36
39
  );
37
- const isProd = process.env.NODE_ENV === "production";
38
40
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
39
- const isPublished = !fs.existsSync(path.join(__dirname, "..", "app"));
40
- const isDeployed = process.env.EPICSHOP_DEPLOYED === "true" || process.env.EPICSHOP_DEPLOYED === "1";
41
41
  const isRunningInBuildDir = path.dirname(__dirname).endsWith("dist");
42
42
  const epicshopAppRootDir = isRunningInBuildDir ? path.join(__dirname, "..", "..") : path.join(__dirname, "..");
43
43
  const hasUpdatesPromise = checkForUpdatesCached();
@@ -67,7 +67,7 @@ if (viteDevServer) {
67
67
  })
68
68
  );
69
69
  }
70
- if (process.env.NODE_ENV !== "production" && !isPublished || isDeployed) {
70
+ if (!isProd && !ENV.EPICSHOP_IS_PUBLISHED || ENV.EPICSHOP_DEPLOYED) {
71
71
  morgan.token("url", (req) => decodeURIComponent(req.url ?? ""));
72
72
  app.use(morgan("tiny"));
73
73
  }
@@ -144,7 +144,7 @@ ${lanUrl ? `${chalk.bold("On Your Network:")} ${chalk.cyan(lanUrl)}` : ""}
144
144
  `.trim()
145
145
  );
146
146
  console.log("");
147
- if (process.env.EPICSHOP_DEPLOYED !== "true" && process.env.EPICSHOP_ENABLE_WATCHER === "true") {
147
+ if (!ENV.EPICSHOP_DEPLOYED && process.env.EPICSHOP_ENABLE_WATCHER) {
148
148
  const watches = /* @__PURE__ */ new Map();
149
149
  const wss = new WebSocketServer({ noServer: true });
150
150
  server.on("upgrade", (request, socket, head) => {
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@epic-web/workshop-app","version":"6.2.0","sideEffects":false,"publishConfig":{"access":"public"},"files":["build","dist","start.js"],"type":"module","imports":{"#app/*":"./app/*","#tests/*":"./tests/*","#build/*":"./build/*"},"exports":{"./start":{"default":"./start.js"}},"scripts":{"build":"run-p --print-label --print-name build:*","build:app":"react-router build --sourcemapClient --sourcemapServer","build:server":"tsx ./other/build-dir.ts server","dev":"node ./server/dev-server.js","format":"prettier --write .","lint":"eslint --cache --cache-location ./node_modules/.cache/eslint .","start":"cross-env NODE_ENV=production node ./start.js","typecheck":"react-router typegen && tsc --noEmit","validate":"run-p lint typecheck"},"dependencies":{"@conform-to/react":"^1.8.0","@conform-to/zod":"^1.8.0","@epic-web/cachified":"^5.6.0","@epic-web/client-hints":"^1.3.5","@epic-web/invariant":"^1.0.0","@epic-web/remember":"^1.1.0","@epic-web/restore-scroll":"^2.0.0","@epic-web/workshop-presence":"6.2.0","@epic-web/workshop-utils":"6.2.0","@mdx-js/mdx":"^3.1.0","@mux/mux-player-react":"^3.5.0","@nasa-gcn/remix-seo":"^2.0.1","@paralleldrive/cuid2":"^2.2.2","@radix-ui/react-accordion":"^1.2.11","@radix-ui/react-dialog":"^1.1.14","@radix-ui/react-popover":"^1.1.14","@radix-ui/react-select":"^2.2.5","@radix-ui/react-tabs":"^1.1.12","@radix-ui/react-toast":"^1.2.14","@radix-ui/react-tooltip":"^1.2.7","@react-router/express":"^7.6.3","@react-router/node":"^7.6.3","@react-router/remix-routes-option-adapter":"^7.6.3","@resvg/resvg-js":"^2.6.2","@sindresorhus/slugify":"^2.2.1","address":"^2.0.3","ansi-to-html":"^0.7.2","chalk":"^5.4.1","chokidar":"^4.0.3","close-with-grace":"^2.2.0","clsx":"^2.1.1","compression":"^1.8.0","confetti-react":"^2.6.0","cookie":"^1.0.2","cross-env":"^7.0.3","cross-spawn":"^7.0.6","dotenv":"^17.0.1","esbuild":"^0.25.5","etag":"^1.8.1","execa":"^9.6.0","express":"^5.1.0","fkill":"^9.0.0","framer-motion":"^12.23.0","fs-extra":"^11.3.0","get-port":"^7.1.0","glob":"^11.0.3","isbot":"^5.1.28","lru-cache":"^11.1.0","md5-hex":"^5.0.0","mdx-bundler":"^10.1.1","mermaid":"^11.8.0","mime-types":"^3.0.1","morgan":"^1.10.0","msw":"^2.10.2","open":"^10.1.2","openid-client":"^6.6.2","p-queue":"^8.1.0","partysocket":"^1.1.4","react":"^19.1.0","react-dom":"^19.1.0","react-router":"^7.6.3","remix-flat-routes":"^0.8.5","remix-utils":"^8.7.0","satori":"^0.15.2","shell-quote":"^1.8.3","sonner":"^2.0.6","source-map-support":"^0.5.21","spin-delay":"^2.0.1","tailwind-merge":"^2.6.0","vite-env-only":"^3.0.3","ws":"^8.18.3","zod":"^3.25.71"},"devDependencies":{"@playwright/test":"^1.53.2","@react-router/dev":"^7.6.3","@tailwindcss/typography":"^0.5.16","@testing-library/dom":"^10.4.0","@total-typescript/ts-reset":"^0.6.1","@types/compression":"^1.8.1","@types/cross-spawn":"^6.0.6","@types/etag":"^1.8.4","@types/express":"^5.0.3","@types/fs-extra":"^11.0.4","@types/hast":"^3.0.4","@types/lodash.escape":"^4.0.9","@types/mdast":"^4.0.4","@types/mime-types":"^3.0.1","@types/morgan":"^1.9.10","@types/node":"^24.0.10","@types/react":"^19.1.8","@types/react-dom":"^19.1.6","@types/shell-quote":"^1.7.5","@types/source-map-support":"^0.5.10","@types/wait-on":"^5.3.4","@types/ws":"^8.18.1","autoprefixer":"^10.4.21","eslint":"^9.30.1","mdast-util-mdx-jsx":"^3.2.0","npm-run-all":"^4.1.5","prettier":"^3.6.2","prettier-plugin-tailwindcss":"^0.6.13","tailwind-scrollbar":"^3.1.0","tailwindcss":"^3.4.13","tailwindcss-animate":"^1.0.7","tailwindcss-radix":"^3.0.5","tailwindcss-safe-area":"^0.6.0","tsx":"^4.20.3","typescript":"^5.8.3","vite":"^7.0.1"},"engines":{"node":"20 || 22 || 24"},"repository":{"type":"git","url":"https://github.com/epicweb-dev/epicshop.git","directory":"packages/workshop-app"}}
1
+ {"name":"@epic-web/workshop-app","version":"6.3.0","sideEffects":false,"publishConfig":{"access":"public"},"files":["build","dist","start.js"],"type":"module","imports":{"#app/*":"./app/*","#tests/*":"./tests/*","#build/*":"./build/*"},"exports":{"./start":{"default":"./start.js"},"./package.json":"./package.json"},"scripts":{"build":"run-p --print-label --print-name build:*","build:app":"react-router build --sourcemapClient --sourcemapServer","build:server":"tsx ./other/build-dir.ts server","dev":"node ./server/dev-server.js","format":"prettier --write .","lint":"eslint --cache --cache-location ./node_modules/.cache/eslint .","start":"cross-env NODE_ENV=production node ./start.js","typecheck":"react-router typegen && tsc --noEmit","validate":"run-p lint typecheck"},"dependencies":{"@conform-to/react":"^1.8.0","@conform-to/zod":"^1.8.0","@epic-web/cachified":"^5.6.0","@epic-web/client-hints":"^1.3.5","@epic-web/invariant":"^1.0.0","@epic-web/remember":"^1.1.0","@epic-web/restore-scroll":"^2.0.0","@epic-web/workshop-presence":"6.3.0","@epic-web/workshop-utils":"6.3.0","@mdx-js/mdx":"^3.1.0","@mux/mux-player-react":"^3.5.0","@nasa-gcn/remix-seo":"^2.0.1","@paralleldrive/cuid2":"^2.2.2","@radix-ui/react-accordion":"^1.2.11","@radix-ui/react-dialog":"^1.1.14","@radix-ui/react-popover":"^1.1.14","@radix-ui/react-select":"^2.2.5","@radix-ui/react-tabs":"^1.1.12","@radix-ui/react-toast":"^1.2.14","@radix-ui/react-tooltip":"^1.2.7","@react-router/express":"^7.6.3","@react-router/node":"^7.6.3","@react-router/remix-routes-option-adapter":"^7.6.3","@resvg/resvg-js":"^2.6.2","@sindresorhus/slugify":"^2.2.1","address":"^2.0.3","ansi-to-html":"^0.7.2","chalk":"^5.4.1","chokidar":"^4.0.3","close-with-grace":"^2.2.0","clsx":"^2.1.1","compression":"^1.8.0","confetti-react":"^2.6.0","cookie":"^1.0.2","cross-env":"^7.0.3","cross-spawn":"^7.0.6","dotenv":"^17.0.1","esbuild":"^0.25.5","etag":"^1.8.1","execa":"^9.6.0","express":"^5.1.0","fkill":"^9.0.0","framer-motion":"^12.23.0","fs-extra":"^11.3.0","get-port":"^7.1.0","glob":"^11.0.3","isbot":"^5.1.28","lru-cache":"^11.1.0","md5-hex":"^5.0.0","mdx-bundler":"^10.1.1","mermaid":"^11.8.0","mime-types":"^3.0.1","morgan":"^1.10.0","msw":"^2.10.2","open":"^10.1.2","openid-client":"^6.6.2","p-queue":"^8.1.0","partysocket":"^1.1.4","react":"^19.1.0","react-dom":"^19.1.0","react-router":"^7.6.3","remix-flat-routes":"^0.8.5","remix-utils":"^8.7.0","satori":"^0.15.2","shell-quote":"^1.8.3","sonner":"^2.0.6","source-map-support":"^0.5.21","spin-delay":"^2.0.1","tailwind-merge":"^2.6.0","vite-env-only":"^3.0.3","ws":"^8.18.3","zod":"^3.25.71"},"devDependencies":{"@playwright/test":"^1.53.2","@react-router/dev":"^7.6.3","@tailwindcss/typography":"^0.5.16","@testing-library/dom":"^10.4.0","@total-typescript/ts-reset":"^0.6.1","@types/compression":"^1.8.1","@types/cross-spawn":"^6.0.6","@types/etag":"^1.8.4","@types/express":"^5.0.3","@types/fs-extra":"^11.0.4","@types/hast":"^3.0.4","@types/lodash.escape":"^4.0.9","@types/mdast":"^4.0.4","@types/mime-types":"^3.0.1","@types/morgan":"^1.9.10","@types/node":"^24.0.10","@types/react":"^19.1.8","@types/react-dom":"^19.1.6","@types/shell-quote":"^1.7.5","@types/source-map-support":"^0.5.10","@types/wait-on":"^5.3.4","@types/ws":"^8.18.1","autoprefixer":"^10.4.21","eslint":"^9.30.1","mdast-util-mdx-jsx":"^3.2.0","npm-run-all":"^4.1.5","prettier":"^3.6.2","prettier-plugin-tailwindcss":"^0.6.13","tailwind-scrollbar":"^3.1.0","tailwindcss":"^3.4.13","tailwindcss-animate":"^1.0.7","tailwindcss-radix":"^3.0.5","tailwindcss-safe-area":"^0.6.0","tsx":"^4.20.3","typescript":"^5.8.3","vite":"^7.0.1"},"engines":{"node":"20 || 22 || 24"},"repository":{"type":"git","url":"https://github.com/epicweb-dev/epicshop.git","directory":"packages/workshop-app"}}
package/start.js CHANGED
@@ -2,17 +2,17 @@ import fs from 'fs/promises'
2
2
  import path from 'path'
3
3
  import dotenv from 'dotenv'
4
4
 
5
- if (process.env.EPICSHOP_SLOW_START === 'true') {
6
- // slow start is used when doing the update-repo action to give time for the
7
- // old server to exist before the new server starts (so ports are freed up).
8
- await new Promise((resolve) => setTimeout(resolve, 1000))
9
- }
10
-
11
5
  const packageJson = JSON.parse(
12
6
  await fs.readFile(path.resolve(process.cwd(), 'package.json'), 'utf-8'),
13
7
  )
14
8
 
15
9
  process.env.EPICSHOP_APP_VERSION ??= packageJson.version
10
+ process.env.EPICSHOP_IS_PUBLISHED ??= packageJson.version.includes('0.0.0')
11
+ ? 'false'
12
+ : 'true'
13
+ process.env.EPICSHOP_APP_LOCATION ??= path.dirname(
14
+ new URL(import.meta.url).pathname,
15
+ )
16
16
  process.env.NODE_ENV ??= 'development'
17
17
  process.env.EPICSHOP_ENABLE_WATCHER ??= 'true'
18
18
  const EPICSHOP_CONTEXT_CWD = process.env.EPICSHOP_CONTEXT_CWD ?? process.cwd()