Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions .github/workflows/studio-frontend-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
name: "Studio Frontend Build"

on:
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "feature-*"
- "nightly"
- "studio"
paths:
- "assets/studio/**"
pull_request_target:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "*_actions"
- "feature-*"
- "nightly"
paths:
- "assets/studio/**"
workflow_dispatch:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

permissions:
contents: read

jobs:
install:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ./assets/studio/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install dependencies
working-directory: ./assets/studio
run: npm ci

lint:
needs: install
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ./assets/studio/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run code linting
working-directory: ./assets/studio
run: npm run lint-fix

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply eslint-fixer changes

check-types:
needs: install
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ./assets/studio/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run code linting
working-directory: ./assets/studio
run: npm run check-types

build:
needs:
- lint
- check-types
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ./assets/studio/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Run production build
working-directory: ./assets/studio
run: npm run build

- uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: './public/'
commit_message: Automatic frontend build
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ node_modules/
# keep legacy paths ignored for easier migration
/plugins/
/tools/
/website/
/website/


# Studio related files
/assets/studio/node_modules
81 changes: 81 additions & 0 deletions assets/studio/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
module.exports = {
"ignorePatterns": ['*.gen.ts'],
"env": {
"browser": true,
"es2021": true
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"standard-with-typescript",
"plugin:react/recommended",
"plugin:storybook/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
},
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
},

{
"files": ["*.spec.ts", "*.spec.tsx", "*.test.ts", "*.test.tsx"],
"env": {
"jest": true
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/unbound-method": "off",
'react/jsx-boolean-value': 'error',
'react/jsx-closing-bracket-location': 'error',
'react/jsx-curly-spacing': [ 'error', 'always' ],
'react/jsx-equals-spacing': 'error',
'react/jsx-first-prop-new-line': 'error',
'react/jsx-indent-props': [ 'error', 2 ],
'react/jsx-indent': [ 'error', 2 ],
'react/jsx-key': 'error',
'react/jsx-max-props-per-line': [ 'error', { 'maximum': 1 }],
'react/jsx-no-literals': 'off',
'react/jsx-no-target-blank': 'error',
'react/jsx-pascal-case': 'error',
'react/jsx-sort-props': 'error',
'react/jsx-tag-spacing': 'error',
'react/jsx-no-constructed-context-values': 'error',
'react/jsx-wrap-multilines': [
'error',
{
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "parens-new-line",
"condition": "parens-new-line",
"logical": "parens-new-line",
"prop": "ignore"
}
]
}
}
Empty file added assets/studio/js/src/main.ts
Empty file.
6 changes: 6 additions & 0 deletions assets/studio/js/src/modules/personalization/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type AbstractModule } from '@pimcore/studio-ui-bundle'

export const PersonalizationModule: AbstractModule = {
onInit: (): void => {
}
}
21 changes: 21 additions & 0 deletions assets/studio/js/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type IAbstractPlugin } from '@pimcore/studio-ui-bundle'
import { PersonalizationModule } from './modules/personalization'

if (module.hot !== undefined) {
module.hot.accept()
}

export const PersonalizationPlugin: IAbstractPlugin = {
name: 'pimcore-personalization-plugin',

// Register and overwrite services here
onInit: ({ container }): void => {

},

// register modules here
onStartup: ({ moduleSystem }): void => {
moduleSystem.registerModule(PersonalizationModule)
console.log('Hello from personalization.')
}
}
Loading