diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..efac883 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,62 @@ +{ + "name": "Tailor - Table Content Element", + "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm", + "features": { + "ghcr.io/devcontainers-extra/features/pnpm:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "forwardPorts": [8080, 8010, 8020, 8030], + "portsAttributes": { + "8080": { + "label": "Content Element Kit preview", + "onAutoForward": "notify" + }, + "8010": { + "label": "Edit runtime", + "onAutoForward": "silent" + }, + "8020": { + "label": "Display runtime", + "onAutoForward": "silent" + }, + "8030": { + "label": "Server runtime", + "onAutoForward": "silent" + } + }, + "postCreateCommand": "pnpm install --frozen-lockfile && pnpm build", + "postAttachCommand": "/bin/bash .devcontainer/setup.sh && pnpm dev", + "customizations": { + "vscode": { + "settings": { + "editor.formatOnSave": true, + "eslint.enable": true, + "prettier.requireConfig": true, + "files.exclude": { + "**/.pnpm": true, + "**/node_modules": true + }, + "workbench.colorTheme": "One Dark Pro", + "oneDarkPro.editorFontLigatures": true, + "oneDarkPro.bold": true, + "oneDarkPro.italic": true, + "editor.fontSize": 20, + "editor.fontFamily": "'Dank Mono', 'Fira Code', monospace", + "editor.fontLigatures": true + }, + "extensions": [ + "akamud.vscode-theme-onedark", + "zhuangtongfa.Material-theme", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "mikestead.dotenv", + "sainoba.px-to-rem", + "stylelint.vscode-stylelint", + "zhuangtongfa.material-theme", + "EditorConfig.EditorConfig", + "Vue.volar", + "GitHub.copilot" + ] + } + } +} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100644 index 0000000..aa03bd3 --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# This script sets port 8030 to public in GitHub Codespaces to handle preflight request issues. +# @see https://github.com/community/community/discussions/15351 + +set -euo pipefail + +# Default server port assumed for codespace environment +DEFAULT_SERVER_PORT=8030 + +if [[ -n "${CODESPACE_NAME:-}" ]]; then + echo "Setting port $DEFAULT_SERVER_PORT to public in Codespace: $CODESPACE_NAME" + gh codespace ports visibility "$DEFAULT_SERVER_PORT:public" -c "$CODESPACE_NAME" +else + echo "Not running in a Codespace, skipping port visibility change." +fi diff --git a/.env.example b/.env.example index b40e3ac..3da843d 100644 --- a/.env.example +++ b/.env.example @@ -10,8 +10,12 @@ EDIT_RUNTIME_URL=http://localhost:8002 DISPLAY_RUNTIME_URL=http://localhost:8003 SERVER_RUNTIME_URL=http://localhost:8004 -# Use Vue 3 editor runtime -TAILOR_NEXT=true +# AI service configuration +# If AI_UI_ENABLED is set to true, the AI service will be enabled and model id +# and secret key must be provided. +AI_UI_ENABLED= +AI_MODEL_ID= +AI_SECRET_KEY= # Content Element env variables; TCE_ prefix is required # Will be loaded to the server runtime diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 65da40e..2ce6017 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -6,7 +6,7 @@ runs: - name: Setup node to enable caching uses: actions/setup-node@v4 with: - node-version: 22.12 + node-version: 24 cache: 'pnpm' cache-dependency-path: './pnpm-lock.yaml' - name: Install dependencies diff --git a/.gitignore b/.gitignore index 9daa49b..f878903 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ +.pnpm-store /dist/ # OS @@ -14,6 +15,7 @@ node_modules/ npm-debug.log* yarn-debug.log* yarn-error.log* +nohup.out # Editor directories and files .idea diff --git a/packages/display/.prettierrc b/.prettierrc similarity index 100% rename from packages/display/.prettierrc rename to .prettierrc diff --git a/Dockerfile b/Dockerfile index ee4a2d7..0c75a8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG PNPM_HOME="/root/.local/share/pnpm" -ARG PNPM_VERSION="8.8.0" +ARG PNPM_VERSION="10.12.3" -FROM node:20.10.0-alpine3.18 +FROM node:24-alpine ARG PNPM_HOME ARG PNPM_VERSION # github and ssh diff --git a/README.md b/README.md index 2496805..7eaa71c 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ Tailor table content element component. -Make sure to set TAILOR_NEXT=true .env variable to enable Vue 3 based authoring runtime. - ## Usage Run diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..a77b6ef --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,18 @@ +import tailorConfig from '@tailor-cms/eslint-config/base.js'; + +export default [ + ...tailorConfig, + { + ignores: ['dist/**', 'packages/**'], + }, + { + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + ecmaVersion: 'latest', + sourceType: 'module', + }, + }, + }, +]; diff --git a/package.json b/package.json index 8603b8e..2b80f89 100644 --- a/package.json +++ b/package.json @@ -6,30 +6,26 @@ "type": "module", "private": true, "scripts": { - "dev": "concurrently 'pnpm boot:cek' 'pnpm boot:display' -n cek,display-runtime -c blue,cyan", - "boot:cek": "cd ./node_modules/@tailor-cms/tce-boot && pnpm start", - "boot:display": "export TCE_DISPLAY_DIR=${PWD}/packages/display/dist && cd ./node_modules/@tailor-cms/tce-display-runtime && pnpm vite optimize && pnpm dev", + "dev": "pnpm boot:cek", + "boot:cek": "cd ./node_modules/@tailor-cms/tce-boot && pnpm start --default-display", "build": "pnpm -r run build", - "lint": "pnpm -r run lint", - "lint:fix": "pnpm -r run lint --fix", + "lint": "pnpm -r run lint && eslint .", + "lint:fix": "pnpm -r run lint --fix && eslint . --fix", + "nuke:dist": "pnpm -r run nuke:dist", + "nuke": "pnpm -r run nuke && pnpm dlx del-cli node_modules", "test": "pnpm playwright test --config ./test/playwright.config.ts" }, - "bin": { - "@tailor-cms/tce-template": "bin/index.cjs" - }, - "dependencies": { - "dotenv": "^16.4.7" - }, "devDependencies": { - "@changesets/cli": "^2.27.11", - "@playwright/test": "1.50.1", - "@tailor-cms/eslint-config": "0.0.2", - "@tailor-cms/tce-boot": "1.0.4", - "@tailor-cms/tce-display-runtime": "0.6.11", - "@types/node": "^22.13.1", - "concurrently": "^9.1.2", - "prettier": "3.5.0", - "typescript": "^5.7.3" + "@changesets/cli": "^2.29.5", + "@playwright/test": "1.53.2", + "@tailor-cms/cek-e2e": "^1.3.2", + "@tailor-cms/eslint-config": "1.1.2", + "@tailor-cms/tce-boot": "1.3.2", + "@types/node": "^24.0.12", + "dotenv": "^17.1.0", + "eslint": "^9.30.1", + "prettier": "^3.6.2", + "typescript": "^5.8.3" }, - "packageManager": "pnpm@9.0.6+sha512.f6d863130973207cb7a336d6b439a242a26ac8068077df530d6a86069419853dc1ffe64029ec594a9c505a3a410d19643c870aba6776330f5cfddcf10a9c1617" + "packageManager": "pnpm@10.12.3" } diff --git a/packages/display/.eslintrc.cjs b/packages/display/.eslintrc.cjs deleted file mode 100644 index 7b59619..0000000 --- a/packages/display/.eslintrc.cjs +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - root: true, - extends: '@tailor-cms/eslint-config', - parserOptions: { - tsconfigRootDir: __dirname, - ecmaVersion: 2022, - sourceType: 'module', - parser: '@typescript-eslint/parser', - project: ['./tsconfig.json', './tsconfig.node.json'], - extraFileExtensions: ['vue'], - }, - ignorePatterns: ['**/components.d.ts', 'dist/**'], - rules: { - 'vue/multi-word-component-names': [ - 'error', - { - ignores: ['Display'], - }, - ], - }, -}; diff --git a/packages/display/CHANGELOG.md b/packages/display/CHANGELOG.md index a63abf8..4dc2475 100644 --- a/packages/display/CHANGELOG.md +++ b/packages/display/CHANGELOG.md @@ -1,5 +1,11 @@ # @tailor-cms/ce-table-display +## 0.1.0 + +### Minor Changes + +- Migrates package to the latest tce-boot version, adds AI config and devcontainers. Updates dependencies to the latest versions. + ## 0.0.3 ### Patch Changes diff --git a/packages/display/eslint.config.js b/packages/display/eslint.config.js new file mode 100644 index 0000000..8845077 --- /dev/null +++ b/packages/display/eslint.config.js @@ -0,0 +1,19 @@ +import tailorConfig from '@tailor-cms/eslint-config'; + +export default [ + ...tailorConfig, + { + ignores: ['**/components.d.ts', 'dist/**'], + }, + { + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + ecmaVersion: 'latest', + sourceType: 'module', + extraFileExtensions: ['.vue'], + }, + }, + }, +]; diff --git a/packages/display/package.json b/packages/display/package.json index 95bdae3..f0b997c 100644 --- a/packages/display/package.json +++ b/packages/display/package.json @@ -3,7 +3,7 @@ "description": "Tailor CMS table end-user component", "author": "Studion (https://github.com/tailor-cms)", "type": "module", - "version": "0.0.3", + "version": "0.1.0", "exports": { ".": { "import": "./dist/index.js", @@ -11,29 +11,33 @@ } }, "main": "./dist/index.cjs", + "types": "./types/index.d.ts", "files": [ "dist" ], "scripts": { "dev": "vite build --watch", - "build": "vue-tsc --noEmit && vite build", - "lint": "eslint --ext .js,.ts,.vue ./src", - "lint:fix": "pnpm lint --fix" + "build": "pnpm nuke:dist && vue-tsc && vite build", + "lint": "eslint ./src", + "lint:fix": "pnpm lint --fix", + "nuke": "pnpm dlx del-cli dist node_modules", + "nuke:dist": "pnpm dlx del-cli dist", + "prepublish": "pnpm build" }, "peerDependencies": { "vue": "^3.5.13" }, "devDependencies": { "@tailor-cms/ce-table-manifest": "workspace:*", - "@tailor-cms/eslint-config": "0.0.2", - "@types/lodash": "^4.17.6", - "@vitejs/plugin-vue": "^5.2.1", - "typescript": "^5.7.3", - "vite": "^6.1.0", - "vue-tsc": "^2.2.0" + "@tailor-cms/eslint-config": "1.1.2", + "@types/lodash-es": "^4.17.12", + "@vitejs/plugin-vue": "^6.0.0", + "typescript": "^5.8.3", + "vite": "^7.0.3", + "vue-tsc": "^3.0.1" }, "dependencies": { - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "publishConfig": { "access": "public" diff --git a/packages/display/src/components/Display.vue b/packages/display/src/components/Display.vue index 0779f51..d6edc1c 100644 --- a/packages/display/src/components/Display.vue +++ b/packages/display/src/components/Display.vue @@ -1,5 +1,5 @@ diff --git a/packages/edit/src/components/TableCell.vue b/packages/edit/src/components/TableCell.vue index 3f29488..0b48915 100644 --- a/packages/edit/src/components/TableCell.vue +++ b/packages/edit/src/components/TableCell.vue @@ -1,8 +1,9 @@ +