Skip to content

Commit

Permalink
Improve project-less setup (#18)
Browse files Browse the repository at this point in the history
* Improve project-less setup

* Fix tests

* Changelog

* Fix changelog

* Fix location of config

* lock

* fix changelog

* Pin Volto tag
  • Loading branch information
sneridagh authored Mar 23, 2024
1 parent a0791fc commit 8f8b0f5
Show file tree
Hide file tree
Showing 20 changed files with 132 additions and 199 deletions.
27 changes: 1 addition & 26 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Acceptance tests
on: [push]

env:
ADDON_NAME: "@kitconcept/volto-button-block"
ADDON_PATH: "volto-button-block"
VOLTO_VERSION: "17.0.0-alpha.1"

jobs:

acceptance:
Expand Down Expand Up @@ -47,10 +42,7 @@ jobs:
key: binary-20.x-${{ hashFiles('pnpm-lock.yaml') }}

- name: Install dependencies
run: |
pnpm i
make install
pnpm i
run: make install

- name: Install Cypress if not in cache
if: steps.cache-cypress-binary.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -91,23 +83,6 @@ jobs:

- run: make test-acceptance-headless

# - name: "Cypress: Acceptance tests"
# uses: cypress-io/github-action@v6
# env:
# BABEL_ENV: production
# CYPRESS_RETRIES: 2
# with:
# # working-directory: core/packages/volto
# # project: ../../../.
# # config-file: ../../../cypress.config.js
# browser: chrome
# spec: cypress/tests/**/*.{js,jsx,ts,tsx}
# install: false
# start: |
# make start-test-acceptance-server-ci
# make start-test-acceptance-frontend
# wait-on: 'npx wait-on --httpTimeout 20000 http-get://localhost:55001/plone http://localhost:3000'

# Upload Cypress screenshots
- uses: actions/upload-artifact@v4
if: failure()
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
node-version: 20.x
ADDON_NAME: volto-button-block

jobs:
build:
Expand All @@ -20,10 +21,10 @@ jobs:
- name: Install pipx
run: pip install towncrier

- name: Use Node.js 20.x
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: ${{ env.node-version }}

- uses: pnpm/action-setup@v3
name: Install pnpm
Expand All @@ -47,18 +48,15 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm i
make install
pnpm i
run: make install

- name: Check for presence of a Change Log fragment (only pull requests)
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
git fetch --no-tags origin ${BASE_BRANCH}
towncrier check --dir packages/${ADDON_NAME}
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
8 changes: 1 addition & 7 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ on: [push]
jobs:
codeanalysis:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]

steps:
- name: Main checkout
Expand Down Expand Up @@ -38,10 +35,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm i
make install
pnpm i
run: make install

- name: Linting
run: make lint
5 changes: 1 addition & 4 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm i
make install
pnpm i
run: make install

- name: test i18n command
run: make i18n
5 changes: 1 addition & 4 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
pnpm i
make install
pnpm i
run: make install

- name: Unit tests
run: make test-ci
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=*cypress*
public-hoist-pattern[]=*process*
public-hoist-pattern[]=*parcel*
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ help: ## Show this help

# Dev Helpers
.PHONY: install
install: ## Installs the dev environment using mrs-developer
@echo "$(GREEN)==> Installs the dev environment $(RESET)"
pnpm exec missdev --no-config --fetch-https
install: ## Install task, checks if missdev (mrs-developer) is present and runs it
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i

.PHONY: i18n
i18n: ## Sync i18n
Expand Down Expand Up @@ -83,8 +83,8 @@ start-test-acceptance-server-ci: ## Start acceptance server in CI mode (no termi

.PHONY: test-acceptance
test-acceptance: ## Start Cypress in interactive mode
pnpm --filter @plone/volto exec cypress open --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'
pnpm exec cypress open --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'

.PHONY: test-acceptance-headless
test-acceptance-headless: ## Run cypress tests in headless mode for CI
pnpm --filter @plone/volto exec cypress run --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'
pnpm exec cypress run --config-file $(CURRENT_DIR)/cypress.config.js --config specPattern=$(CURRENT_DIR)'/cypress/tests/**/*.{js,jsx,ts,tsx}'
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@plone/volto-testing/cypress/support/commands';
import '@plone/volto/cypress/add-commands';
2 changes: 1 addition & 1 deletion cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'cypress-axe';
import 'cypress-file-upload';
import './commands';
import { setup, teardown } from './reset-fixture';
import { setup, teardown } from '@plone/volto/cypress/support/reset-fixture';

beforeEach(function () {
cy.log('Setting up API fixture');
Expand Down
45 changes: 0 additions & 45 deletions cypress/support/reset-fixture.js

This file was deleted.

14 changes: 0 additions & 14 deletions cypress/support/slate.js

This file was deleted.

2 changes: 1 addition & 1 deletion mrs.developer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"package": "@plone/volto",
"url": "git@github.com:plone/volto.git",
"https": "https://github.com/plone/volto.git",
"tag": "18.0.0-alpha.23"
"tag": "18.0.0-alpha.24"
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@kitconcept/volto-button-block": "workspace:*"
},
"devDependencies": {
"@plone/scripts": "^3.6.1",
"mrs-developer": "^2.2.0"
},
"packageManager": "pnpm@8.15.4"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/volto-button-block/news/18.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve project-less setup @sneridagh
15 changes: 13 additions & 2 deletions packages/volto-button-block/src/components/Data.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ const messages = defineMessages({
});

const ButtonData = (props) => {
const { data, block, onChangeBlock, schemaEnhancer } = props;
const {
block,
blocksConfig,
data,
schemaEnhancer,
onChangeBlock,
navRoot,
contentType,
} = props;
const intl = useIntl();
const schema = schemaEnhancer
? schemaEnhancer(ButtonSchema({ ...props, intl }), props)
Expand All @@ -27,9 +35,12 @@ const ButtonData = (props) => {
[id]: value,
});
}}
onChangeBlock={onChangeBlock}
formData={data}
fieldIndex={data.index}
block={block}
blocksConfig={blocksConfig}
navRoot={navRoot}
contentType={contentType}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title_format = "## {version} ({project_date})"
underlines = ["", "", ""]
template = "./node_modules/@plone/scripts/templates/towncrier_template.jinja"
start_string = "<!-- towncrier release notes start -->\n"
issue_format = "[#{issue}](https://github.com/kitconcept/volto-export/pull/{issue})"
issue_format = "[#{issue}](https://github.com/kitconcept/volto-button-block/pull/{issue})"

[[tool.towncrier.type]]
directory = "breaking"
Expand Down
Loading

0 comments on commit 8f8b0f5

Please sign in to comment.