fix: atoms local (#22245)

* Revert "fix: atoms for local development (#22178)"

This reverts commit d74d99dde7.

* chore: remove comment

* feat: local dev scripts

* feat: local dev scripts
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2025-07-03 16:45:23 +00:00
1 parent 0825cce82c
commit 29122934a9
7 files changed
+25 -26

No files matched your search

+1 -2
View File
@@ -1,2 +1 @@
globals.min.css
cal-atoms-dev.tgz
globals.min.css
+2 -1
View File
@@ -10,7 +10,8 @@
"build": "NODE_OPTIONS='--max_old_space_size=12288' rm -rf dist && yarn vite build && npx tailwindcss -i ./globals.css -o ./globals.min.css --postcss --minify && mkdir ./dist/packages/prisma-client && cp -rf ../../../node_modules/.prisma/client/*.d.ts ./dist/packages/prisma-client",
"publish-npm": "yarn build && npm publish --access public",
"test": "jest",
"pack-dev": "yarn build && npm pack && mv calcom-atoms-*.tgz cal-atoms-dev.tgz"
"dev-on": "node scripts/dev-on.js",
"dev-off": "git checkout -- package.json vite.config.ts"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.0.1",
+20
View File
@@ -0,0 +1,20 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const packageJsonPath = path.join(__dirname, "../package.json");
const viteConfigPath = path.join(__dirname, "../vite.config.ts");
// Modify package.json
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
packageJson.main = "./dist/cal-atoms.umd.cjs";
packageJson.exports["."].require = "./dist/cal-atoms.umd.cjs";
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
// Modify vite.config.ts
let viteConfig = fs.readFileSync(viteConfigPath, "utf-8");
viteConfig = viteConfig.replace(/formats: \["es"\],/g, "");
viteConfig = viteConfig.replace(/external: \[([^\]]+)\]/, 'external: [$1, "react-awesome-query-builder"]');
viteConfig = viteConfig.replace(/format: "esm",\s*/g, "");
fs.writeFileSync(viteConfigPath, viteConfig);
+1 -1
View File
@@ -36,7 +36,7 @@ export default defineConfig(({ mode }) => {
rollupOptions: {
external: ["react", "fs", "path", "os", "react/jsx-runtime", "react-dom", "react-dom/client"],
output: {
format: "esm", // Force ESM output
format: "esm",
globals: {
react: "React",
"react-dom": "ReactDOM",
+1 -1
View File
@@ -19,7 +19,7 @@ REDIS_URL="redis://localhost:6379"
```
3. Start "apps/api/v2" api using `yarn dev`.
4. Setup "packages/platform/atoms" by running `yarn atoms-dev-on` in the example app directory - it will pack atoms into a dev .tgz and switch the dependency to point to it. When you are done with development, run `yarn atoms-dev-off` to switch back to the published version because otherwise examples app would have entry in the yarn.lock file pointing to the dev .tgz and installation would fail in prod because dev tar file exists only locally.
4. Start "packages/platform/atoms" atoms package with `yarn dev`.
5. Start "apps/web" cal web app using `yarn dx`.
6. Open your browser at "http://localhost:3000/" and login with admin username `admin@example.com` and password `ADMINadmin2022!`.
7. In the web app navigate to `http://localhost:3000/settings/organizations/new` and create a sample organization. When asked for phone verification code enter `111111`.
@@ -1,19 +0,0 @@
#!/bin/bash
set -e
echo "📦 Packing @calcom/atoms into dev .tgz..."
yarn workspace @calcom/atoms pack-dev
echo "🔧 Switching @calcom/atoms to dev .tgz..."
# Detect platform for sed compatibility
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's|"@calcom/atoms": ".*"|"@calcom/atoms": "file:../../atoms/cal-atoms-dev.tgz"|' package.json
else
sed -i 's|"@calcom/atoms": ".*"|"@calcom/atoms": "file:../../atoms/cal-atoms-dev.tgz"|' package.json
fi
yarn install
echo "✅ Local atoms .tgz linked. Ready for dev."
@@ -4,8 +4,6 @@
"private": true,
"scripts": {
"dev": "PORT=4321 next dev",
"atoms-dev-on": "./atoms-dev-on.sh",
"atoms-dev-off": "git checkout -- package.json ../../../../yarn.lock",
"build": "next build",
"start": "next start",
"lint": "next lint"