Skip to content

Commit

Permalink
Transfer @plone/components to the monorepo (#5544)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh authored Dec 16, 2023
1 parent a4e79f0 commit fbfe657
Show file tree
Hide file tree
Showing 264 changed files with 12,840 additions and 319 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
node_modules
build
storybook-static
packages/volto
packages/volto-guillotina
packages/generator-volto/generators/app/templates
!.*
35 changes: 20 additions & 15 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
- 'packages/client/**'
registry:
- 'packages/registry/**'
components:
- 'packages/components/**'
types:
- 'packages/types/**'
generator:
- 'packages/generator-volto/**'
scripts:
Expand All @@ -53,9 +57,6 @@ jobs:
- name: Client changelog check
if: steps.filter.outputs.client == 'true'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/client
env:
Expand All @@ -64,20 +65,30 @@ jobs:
- name: Registry changelog check
if: steps.filter.outputs.registry == 'true'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/registry
env:
BASE_BRANCH: ${{ github.base_ref }}

- name: Components changelog check
if: steps.filter.outputs.components == 'true'
run: |
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/components
env:
BASE_BRANCH: ${{ github.base_ref }}

- name: Types changelog check
if: steps.filter.outputs.types == 'true'
run: |
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/types
env:
BASE_BRANCH: ${{ github.base_ref }}

- name: Generator changelog check
if: steps.filter.outputs.generator == 'true'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/generator-volto
env:
Expand All @@ -86,9 +97,6 @@ jobs:
- name: scripts changelog check
if: steps.filter.outputs.scripts == 'true'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/scripts
env:
Expand All @@ -97,9 +105,6 @@ jobs:
- name: volto-slate changelog check
if: steps.filter.outputs.voltoSlate == 'true'
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin main
towncrier check --compare-with origin/main --dir packages/volto-slate
env:
Expand Down
45 changes: 44 additions & 1 deletion .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,52 @@ jobs:
- run: pnpm i

- name: ESlint check
- name: Main ESlint check
run: pnpm lint

- name: Volto ESlint check
run: pnpm lint:volto

stylelint:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Stylelint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# node setup
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm i

- name: Volto Stylelint check
run: pnpm --filter @plone/volto stylelint

- name: Components Stylelint check
run: pnpm --filter @plone/components stylelint

i18n:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: i18n
Expand Down
89 changes: 84 additions & 5 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ env:
node-version: 20.x

jobs:
unit:
volto:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: Core Unit Tests
name: '@plone/volto'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -46,9 +46,6 @@ jobs:
# node test
- run: pnpm --filter @plone/volto i18n:ci

- name: Run unit tests @plone/registry
run: pnpm --filter @plone/registry test

- name: Run unit tests Volto
run: pnpm --filter @plone/volto test

Expand All @@ -58,6 +55,88 @@ jobs:
# with:
# bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

registry:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: '@plone/registry'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3

# node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm i

- name: Run unit tests @plone/registry
run: pnpm --filter @plone/registry test

components:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: '@plone/components'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v3

# node setup
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm i

- name: Run unit tests @plone/registry
run: pnpm --filter @plone/components test

client:
name: '@plone/client'
runs-on: ubuntu-latest
Expand Down
11 changes: 8 additions & 3 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages/!volto/**/*.{js,jsx,ts,tsx}": [
"packages/!(volto)/**/*.{js,jsx,ts,tsx}": [
"pnpm eslint --max-warnings=0 --fix",
"pnpm prettier --single-quote --write"
],
Expand All @@ -8,6 +8,11 @@
"pnpm --filter @plone/volto prettier:husky"
],
"packages/volto/src/**/*.{jsx, tsx}": ["pnpm --filter @plone/volto i18n"],
"**/*.{css,less,scss}": ["pnpm stylelint --fix"],
"packages/volto/**/*.overrides": ["pnpm stylelint --fix"]
"packages/!(volto)/**/*.{css,less,scss}": ["pnpm stylelint --fix"],
"packages/volto/**/*.{css,less,scss}": [
"pnpm --filter @plone/volto stylelint --fix"
],
"packages/volto/**/*.overrides": [
"pnpm --filter @plone/volto stylelint --fix"
]
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"husky:uninstall": "husky uninstall"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.7.0",
"@typescript-eslint/parser": "6.7.0",
"eslint": "^8.48.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "2.28.1",
Expand All @@ -33,6 +33,7 @@
"husky": "^8.0.3",
"lint-staged": "15.0.2",
"prettier": "3.0.3",
"stylelint": "^15.11.0",
"tsconfig": "workspace:*",
"turbo": "latest",
"typescript": "5.2.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/components/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '../../.eslintrc.cjs',
};
16 changes: 16 additions & 0 deletions packages/components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
node_modules/
dist/
stats.html
storybook-static
lib

# yarn 3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.parcel-cache/
25 changes: 25 additions & 0 deletions packages/components/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
news
lib
towncrier.toml
.towncrier
.storybook
.changelog.draft
node_modules/
.vscode
.github
coverage
storybook-static
stats.html
setupTesting.ts

.prettierignore
.prettierrc
.release-it.json
.eslintrc.cjs
.stylelintrc
Makefile

# yarn 3
.yarnrc.yml
.pnp.*
.yarn
1 change: 1 addition & 0 deletions packages/components/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/styles/rules/*
4 changes: 4 additions & 0 deletions packages/components/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "all",
"singleQuote": true
}
25 changes: 25 additions & 0 deletions packages/components/.release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"plugins": {
"../scripts/prepublish.js": {}
},
"hooks": {
"after:bump": [
"pipx run towncrier build --draft --yes --version ${version} > .changelog.draft && pipx run towncrier build --yes --version ${version}",
"yarn build"
],
"after:release": "rm .changelog.draft"
},
"git": {
"changelog": "pipx run towncrier build --draft --yes --version 0.0.0",
"requireUpstream": false,
"requireCleanWorkingDir": false,
"commitMessage": "Release @plone/components ${version}",
"tagName": "plone-components-${version}",
"tagAnnotation": "Release @plone/components ${version}"
},
"github": {
"release": true,
"releaseName": "@plone/components ${version}",
"releaseNotes": "cat .changelog.draft"
}
}
Loading

0 comments on commit fbfe657

Please sign in to comment.