Bez popisu

Michael Bromley 945c36def4 feat(core): Warn when deleting a Zone used as a Channel default před 5 roky
.github a3a4e2dcd1 chore: Fix elasticsearch e2e tests in CI před 5 roky
docs 65be8c8a8a fix(docs): Fix plugin worker example před 5 roky
e2e-common 867fc1ed72 chore: Increase default e2e timeout for CI před 5 roky
packages 945c36def4 feat(core): Warn when deleting a Zone used as a Channel default před 5 roky
scripts ec345be37c chore: Fix codegen paths for new admin-ui directory structure před 5 roky
.editorconfig d2d77d20d3 chore: Set up root linting & formatting on commit před 7 roky
.gitignore b46d201e8a feat(docs): Re-organize plugin API docs & plugins guide před 6 roky
.graphqlconfig 566706262f chore: Fix graphqlconfig path to admin-ui před 6 roky
.lintstagedrc.json ffc8bc86ca chore: Re-work build, watch, test scripts před 6 roky
.prettierignore 20913fe587 chore(admin-ui): Exclude generated modules from Prettier formatting před 6 roky
.prettierrc d2d77d20d3 chore: Set up root linting & formatting on commit před 7 roky
CHANGELOG.md e97cb93282 chore: Publish v0.11.0 před 5 roky
CONTRIBUTING.md b14ab7003a docs: Update readme and contribution guide před 6 roky
LICENSE 5919ce67da docs: Add MIT license, expand readme před 7 roky
README.md a3781a8caf feat(docs): Add docs on Channels & update README před 5 roky
lerna.json e97cb93282 chore: Publish v0.11.0 před 5 roky
package.json e255674fab feat(core): Update to TypeScript 3.8 před 5 roky
schema-admin.json 8b45d86b16 feat(docs): Add docs on JobQueue & examples před 5 roky
schema-shop.json f717fb33f1 feat(core): Add asset focal point data to SearchResult type před 6 roky
tsconfig.json 9a5824c811 chore: Move common tsconfig setting to root před 6 roky
tslint.json 45e7e33b6f feat(docs): Add version info to side menu před 6 roky
yarn.lock 856dd28752 chore(create): Add missing dependency před 5 roky

README.md

Vendure

A headless GraphQL ecommerce framework built on Node.js with Nest & TypeScript, with a focus on developer productivity and ease of customization.

Build Status lerna

www.vendure.io

Structure

This project is a monorepo managed with Lerna. Several npm packages are published from this repo, which can be found in the packages/ directory.

vendure/
├── docs/           # Documentation source
├── e2e-common/     # Shared config for package e2e tests
├── packages/       # Source for the Vendure server, admin-ui & plugin packages
├── scripts/
    ├── changelog/  # Scripts used to generate the changelog based on the git history
    ├── codegen/    # Scripts used to generate TypeScript code from the GraphQL APIs
    ├── docs/       # Scripts used to generate documentation markdown from the source

Development

The following instructions are for those who want to develop the Vendure core framework or plugins (e.g. if you intend to make a pull request). For instructions on how to build a project using Vendure, please see the Getting Started guide.

1. Install top-level dependencies

yarn

The root directory has a package.json which contains build-related dependencies for tasks including:

  • Building & deploying the docs
  • Generating TypeScript types from the GraphQL schema
  • Linting, formatting & testing tasks to run on git commit & push

2. Bootstrap the packages

yarn bootstrap

This runs the Lerna "bootstrap" command, which cross-links monorepo dependencies.

3. Build all packages

yarn build

Packages must be built (i.e. TypeScript compiled, admin ui app built, certain assets copied etc.) before being used.

Note that this can take a few minutes.

4. Set up the server

The server requires an SQL database to be available. I am currently using bitnami-docker-phpmyadmin Docker image, which is MariaDB including phpMyAdmin. However, the simplest option is to use SQLite.

Vendure uses TypeORM, and officially supports MySQL, PostgreSQL and SQLite, though other TypeORM-supported databases may work.

  1. Configure the dev config, making sure the connection settings in the getDbConfig() function are correct for the database type you will be using.
  2. Create the database using your DB admin tool of choice (e.g. phpMyAdmin if you are using the docker image suggested above). Name it according to the getDbConfig() settings. If you are using SQLite, you can skip this step.
  3. Populate mock data:

    cd packages/dev-server
    DB=<mysql|postgres|sqlite> yarn populate
    

    If you do not specify the DB variable, it will default to "mysql".

5. Run the dev server

DB=<mysql|postgres|sqlite> yarn dev-server:start

If you do not specify the DB argument, it will default to "mysql".

6. Launch the admin ui

  1. cd admin-ui
  2. yarn start
  3. Go to http://localhost:4200 and log in with "superadmin", "superadmin"

Code generation

graphql-code-generator is used to automatically create TypeScript interfaces for all GraphQL server operations and admin ui queries. These generated interfaces are used in both the admin ui and the server.

Running yarn codegen will generate the following files:

Testing

Server Unit Tests

The core and several other packages have unit tests which are can be run all together by running yarn test from the root directory, or individually by running it from the package directory.

Unit tests are co-located with the files which they test, and have the suffix .spec.ts.

End-to-end Tests

Certain packages have e2e tests, which are located at /packages/<name>/e2e/. All e2e tests can be run by running yarn e2e from the root directory, or individually by running it from the package directory.

e2e tests use the @vendure/testing package. For details of how the setup works, see the Testing docs

When debugging e2e tests, set an environment variable E2E_DEBUG=true which will increase the global Jest timeout and allow you to step through the e2e tests without the tests automatically failing due to timeout.

Release Process

All packages in this repo are released at every version change (using Lerna's fixed mode). This simplifies both the development (tracking multiple disparate versions is tough) and also the developer experience for users of the framework (it is simple to see that all packages are up-to-date and compatible).

To make a release:

1. yarn publish-release

It will run lerna publish which will prompt for which version to update to. Although we are using conventional commits, the version is not automatically being calculated from the commit messages. Therefore the next version should be manually selected.

Next it will build all packages to ensure the distributed files are up to date.

Finally the command will create changelog entries for this release.

2. git push origin master --follow-tags

The reason we do not rely on Lerna to push the release to Git is that this repo has a lengthy pre-push hook which runs all tests and builds the admin ui. This long wait then invalidates the npm OTP and the publish will fail. So the solution is to publish first and then push.

License

MIT