Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Volto 18.2.3 / Add empty typescript file to stop "No inputs" error #30

Merged
merged 1 commit into from
Dec 24, 2024
Merged
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
11 changes: 3 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const { AddonRegistry } = require('@plone/registry/addon-registry');

let coreLocation;
if (fs.existsSync(`${projectRootPath}/core`))
coreLocation = `${projectRootPath}/core`;
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

const registry = new AddonConfigurationRegistry(
`${coreLocation}/packages/volto`,
);
const { registry } = AddonRegistry.init(`${coreLocation}/packages/volto`);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(registry.packages).map((o) => [
Expand All @@ -30,10 +28,7 @@ module.exports = {
['@plone/volto', `${coreLocation}/packages/volto/src`],
['@plone/volto-slate', `${coreLocation}/packages/volto-slate/src`],
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
'@kitconcept/volto-solr',
'./packages/volto-solr/src',
],
['@kitconcept/volto-solr', './packages/volto-solr/src'],
...addonAliases,
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
run: make install

- name: Unit tests
run: make test-ci
run: make ci-test
6 changes: 3 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ module.exports = {
[],
defaultRazzleOptions,
);
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const { AddonRegistry } = require('@plone/registry/addon-registry');

const registry = new AddonConfigurationRegistry(projectRootPath);
const { registry } = AddonRegistry.init(projectRootPath);

config = lessPlugin({ registry }).modifyWebpackConfig({
env: { target: 'web', dev: 'dev' },
Expand Down Expand Up @@ -146,7 +146,7 @@ module.exports = {
resolve: {
...config.resolve,
alias: { ...config.resolve.alias, ...baseConfig.resolve.alias },
fallback: { ...config.resolve.fallback, zlib: false },
fallback: { ...config.resolve.fallback, zlib: false, buffer: false },
},
};

Expand Down
40 changes: 31 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ GIT_FOLDER=$(CURRENT_DIR)/.git
PRE_COMMIT=pipx run --spec 'pre-commit==3.7.1' pre-commit

PLONE_VERSION=6
VOLTO_VERSION=18.2.3
DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION}
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}

ADDON_NAME='@kitconcept/volto-solr'
ADDON_PATH='volto-solr'
# DEV_COMPOSE=dockerfiles/docker-compose.yml
ACCEPTANCE_COMPOSE=acceptance/docker-compose.yml
SOLR_CONTEXT_FOLDER=${CURRENT_DIR}/acceptance/solr
CMD=CURRENT_DIR=${CURRENT_DIR} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} VOLTO_VERSION=${VOLTO_VERSION} PLONE_VERSION=${PLONE_VERSION} SOLR_CONTEXT_FOLDER=${SOLR_CONTEXT_FOLDER} docker compose
# DOCKER_COMPOSE=${CMD} -p ${ADDON_PATH} -f ${DEV_COMPOSE}
ACCEPTANCE=${CMD} -p ${ADDON_PATH}-acceptance -f ${ACCEPTANCE_COMPOSE}

.PHONY: help
help: ## Show this help
Expand All @@ -50,10 +58,10 @@ start: ## Starts Volto, allowing reloading of the add-on during development
build: ## Build a production bundle for distribution of the project with the add-on
pnpm build

core/packages/registry/dist: core/packages/registry/src
core/packages/registry/dist: $(shell find core/packages/registry/src -type f)
pnpm --filter @plone/registry build

core/packages/components/dist: core/packages/components/src
core/packages/components/dist: $(shell find core/packages/components/src -type f)
pnpm --filter @plone/components build

.PHONY: build-deps
Expand Down Expand Up @@ -91,7 +99,7 @@ release-dry-run: ## Dry-run the release of the add-on on npmjs.org
test: ## Run unit tests
pnpm test

.PHONY: test-ci
.PHONY: ci-test
ci-test: ## Run unit tests in CI
# Unit Tests need the i18n to be built
VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto i18n
Expand All @@ -115,26 +123,40 @@ storybook-build: ## Build Storybook
pnpm run storybook-build -o $(CURRENT_DIR)/.storybook-build

## Acceptance
.PHONY: acceptance-install
acceptance-install: ## Install Cypress, build containers
# (cd acceptance && pnpm install)
# ${ACCEPTANCE} --profile dev --profile prod build
${ACCEPTANCE} --profile dev --profile prod build

.PHONY: acceptance-frontend-dev-start
acceptance-frontend-dev-start: ## Start acceptance frontend in development mode
RAZZLE_API_PATH=http://127.0.0.1:55001/plone pnpm start
# Note the error is that :3001 gives an empty response from a cypress browser.
# Also see https://github.com/cypress-io/cypress/issues/27962
RAZZLE_API_PATH=http://127.0.0.1:55001/plone NODE_OPTIONS=--dns-result-order=ipv4first pnpm start

.PHONY: acceptance-frontend-prod-start
acceptance-frontend-prod-start: ## Start acceptance frontend in production mode
RAZZLE_API_PATH=http://127.0.0.1:55001/plone pnpm build && pnpm start:prod
# Note the error is that :3001 gives an empty response from a cypress browser.
# Also see https://github.com/cypress-io/cypress/issues/27962
RAZZLE_API_PATH=http://127.0.0.1:55001/plone NODE_OPTIONS=--dns-result-order=ipv4first pnpm build && pnpm start:prod

.PHONY: acceptance-backend-start
acceptance-backend-start: ## Start backend acceptance server
docker run -it --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)
${ACCEPTANCE} up -d

.PHONY: acceptance-backend-stop
acceptance-backend-stop: ## Stop backend acceptance server
${ACCEPTANCE} down

.PHONY: ci-acceptance-backend-start
ci-acceptance-backend-start: ## Start backend acceptance server in headless mode for CI
docker run -i --rm -p 55001:55001 $(DOCKER_IMAGE_ACCEPTANCE)
${ACCEPTANCE} up -d

.PHONY: acceptance-test
acceptance-test: ## 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 --filter @plone/volto exec cypress open --config-file $(CURRENT_DIR)/acceptance/cypress.config.js --config specPattern=$(CURRENT_DIR)'/acceptance/cypress/tests/**/*.{js,jsx,ts,tsx}'

.PHONY: ci-acceptance-test
ci-acceptance-test: ## 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 --filter @plone/volto exec cypress run --config-file $(CURRENT_DIR)/acceptance/cypress.config.js --config specPattern=$(CURRENT_DIR)'/acceptance/cypress/tests/**/*.{js,jsx,ts,tsx}'
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const theme = '@kitconcept/volto-solr';

The configuration is provided by default and can be overwritten from any package.


### Result type templates

The search results are rendered by default components, which are customizable.
Expand Down Expand Up @@ -127,21 +126,18 @@ The rest of the options provide the baselines for the package and the `Search` c

## Test installation

Visit http://localhost:3000/ in a browser, login, and check the awesome new features.

Visit <http://localhost:3000/> in a browser, login, and check the awesome new features.

## Development

The development of this add-on is done in isolation using a new approach using pnpm workspaces and latest `mrs-developer` and other Volto core improvements.
For this reason, it only works with pnpm and Volto 18 (currently in alpha).


### Pre-requisites

- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js)
- [Make](https://6.docs.plone.org/install/create-project.html#make)
- [Docker](https://6.docs.plone.org/install/create-project.html#docker)

- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js)
- [Make](https://6.docs.plone.org/install/create-project.html#make)
- [Docker](https://6.docs.plone.org/install/create-project.html#docker)

### Make convenience commands

Expand All @@ -166,6 +162,7 @@ storybook-build Build Storybook
acceptance-frontend-dev-start Start acceptance frontend in development mode
acceptance-frontend-prod-start Start acceptance frontend in production mode
acceptance-backend-start Start backend acceptance server
acceptance-backend-stop Stop backend acceptance server
ci-acceptance-backend-start Start backend acceptance server in headless mode for CI
acceptance-test Start Cypress in interactive mode
ci-acceptance-test Run cypress tests in headless mode for CI
Expand Down Expand Up @@ -247,6 +244,12 @@ In the third session, start the Cypress interactive test runner.
make acceptance-test
```

There is also a stop command for the backend acceptance server.

```shell
make acceptance-backend-stop
```

## License

The project is licensed under the MIT license.
Expand Down
3 changes: 2 additions & 1 deletion cypress.config.js → acceptance/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = defineConfig({
runMode: 3,
},
e2e: {
supportFile: '../../../acceptance/cypress/support/e2e.js',
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/tests/**/*.cy.{js,jsx,ts,tsx}',
specPattern: 'cypress/tests/*.cy.{js,jsx}',
},
});
File renamed without changes.
Binary file added acceptance/cypress/fixtures/broccoli.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions acceptance/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
Binary file added acceptance/cypress/fixtures/file.pdf
Binary file not shown.
Binary file added acceptance/cypress/fixtures/halfdome2022.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added acceptance/cypress/fixtures/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions acceptance/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};
Loading
Loading