Decouple frontend from Rails, establish pnpm workspace dev workflow

Strip the Chatwoot frontend down to a standalone Vite + Vue 3 SPA that talks
directly to the GoChat Go backend — no Ruby/Rails required.

Deleted from frontend/ (all Rails-only):
- Ruby: Gemfile, Gemfile.lock, config.ru, Capfile, Rakefile, bin/ (binstubs),
  config/ (application/boot/environment/routes/initializers/environments/locales),
  app/helpers/ (*.rb), app/views/ (ERB/jbuilder), app/assets/ (administrate scss)
- Enterprise overlay (enterprise/ — pure Ruby/jbuilder, zero JS)
- Infra: Procfile*, docker-compose*, docker/, deployment/, swagger/, .circleci/,
  .devcontainer/, .qlty/, .codegraph/, .windsurf/, .github/, .vscode/, .husky/
- Lint/config: .rubocop.yml, .scss-lint.yml, .rspec, rubocop/, .bundler-audit.yml,
  .annotaterb.yml, .all-contributorsrc, crowdin.yml, histoire.config.ts, etc.
- Stale frontend/pnpm-lock.yaml (replaced by root workspace lockfile)

Kept (frontend build essentials):
- app/javascript/ (all Vue SPA source — dashboard/widget/sdk/portal/superadmin/survey/v3)
- package.json, vite.config.ts, tailwind.config.js, postcss.config.js
- theme/, vitest.setup.js, .prettierrc

Key decoupling changes:
- vite.config.ts: removed vite-plugin-ruby, added explicit rollupOptions.input
  for all 7 entrypoints + dev-server proxy (/api,/platform,/cable,/health → GoChat)
- index.html: created static SPA entry that injects window.chatwootConfig /
  window.globalConfig (previously done by Rails ERB vueapp.html.erb)
- package.json: renamed @gochat/frontend, removed vite-plugin-ruby/histoire/husky,
  scripts now use plain vite dev/build
- tailwind.config.js: removed enterprise ERB content paths
- markdownEmbeds.js: relocated markdown_embeds.yml into app/javascript/dashboard/config/

Root pnpm workspace:
- package.json: dev:backend (air), dev:frontend (vite), dev (concurrently)
- pnpm-workspace.yaml: frontend as workspace package
- .gitignore: node_modules/, frontend/dist/, frontend build artifacts

Verified: pnpm install + vite build succeeds (4446 modules, all 7 entrypoints
produce JS+CSS chunks in dist/).
This commit is contained in:
2026-07-07 15:37:24 +08:00
parent 321c61aaae
commit 1535e6cd55
1103 changed files with 8628 additions and 186164 deletions
+15 -39
View File
@@ -1,32 +1,27 @@
{
"name": "@chatwoot/chatwoot",
"version": "4.14.0",
"name": "@gochat/frontend",
"version": "0.1.0",
"private": true,
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:sdk": "BUILD_MODE=library vite build",
"preview": "vite preview",
"eslint": "eslint app/**/*.{js,vue}",
"eslint:fix": "eslint app/**/*.{js,vue} --fix",
"test": "TZ=UTC vitest --no-watch --no-cache --no-coverage --logHeapUsage",
"test:watch": "TZ=UTC vitest --no-cache --no-coverage",
"test:coverage": "TZ=UTC vitest --no-watch --no-cache --coverage",
"start:dev": "foreman start -f ./Procfile.dev",
"start:test": "RAILS_ENV=test foreman start -f ./Procfile.test",
"dev": "overmind start -f ./Procfile.dev",
"ruby:prettier": "bundle exec rubocop -a",
"build:sdk": "BUILD_MODE=library vite build",
"prepare": "husky install",
"size": "size-limit",
"story:dev": "histoire dev",
"story:build": "histoire build",
"story:preview": "histoire preview",
"sync:i18n": "bin/sync_i18n_file_change"
"size": "size-limit"
},
"size-limit": [
{
"path": "public/vite/assets/widget-*.js",
"path": "dist/assets/widget-*.js",
"limit": "300 KB"
},
{
"path": "public/packs/js/sdk.js",
"path": "dist/sdk/js/sdk.js",
"limit": "40 KB"
}
],
@@ -114,7 +109,6 @@
},
"devDependencies": {
"@egoist/tailwindcss-icons": "^1.9.2",
"@histoire/plugin-vue": "0.17.15",
"@iconify-json/logos": "^1.2.10",
"@iconify-json/lucide": "^1.2.82",
"@iconify-json/ph": "^1.2.2",
@@ -129,35 +123,27 @@
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-interactive": "^11.1.0",
"eslint-plugin-html": "7.1.0",
"eslint-plugin-import": "2.30.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-vitest-globals": "^1.5.0",
"eslint-plugin-vue": "^9.28.0",
"fake-indexeddb": "^6.0.0",
"histoire": "0.17.15",
"husky": "^7.0.0",
"jsdom": "^27.2.0",
"lint-staged": "^16.2.7",
"postcss": "^8.4.47",
"postcss-import": "^15.1.0",
"postcss-preset-env": "^8.5.1",
"prettier": "^3.3.3",
"prosemirror-model": "^1.22.3",
"sass-embedded": "^1.100.0",
"size-limit": "^8.2.4",
"tailwindcss": "^3.4.19",
"vite": "^5.4.21",
"vite-plugin-ruby": "^5.0.0",
"vitest": "3.0.5"
},
"engines": {
"node": "24.x",
"pnpm": "10.x"
},
"husky": {
"hooks": {
"pre-push": "sh bin/validate_push"
}
"node": ">=20",
"pnpm": ">=10"
},
"pnpm": {
"overrides": {
@@ -168,15 +154,5 @@
"minimatch@>=9.0.0 <9.0.7": "9.0.9",
"rollup": ">=4.59.0"
}
},
"lint-staged": {
"app/**/*.{js,vue}": [
"eslint --fix",
"git add"
],
"*.scss": [
"scss-lint"
]
},
"packageManager": "pnpm@10.2.0+sha512.0d27364e0139c6aadeed65ada153135e0ca96c8da42123bd50047f961339dc7a758fc2e944b428f52be570d1bd3372455c1c65fa2e7aa0bfbf931190f9552001"
}
}