diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 0000000000..a6e4039ab2 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,25 @@ +{ + "projectName": "sylius", + "projectOwner": "vuestorefront", + "repoType": "github", + "repoHost": "https://github.com", + "files": [ + "README.md" + ], + "imageSize": 80, + "commit": true, + "commitConvention": "angular", + "contributors": [ + { + "login": "bloodf", + "name": "Heitor Ramon Ribeiro", + "avatar_url": "https://avatars.githubusercontent.com/u/1626923?v=4", + "profile": "https://github.com/bloodf", + "contributions": [ + "maintenance", + "projectManagement" + ] + } + ], + "contributorsPerLine": 5 +} diff --git a/.czrc b/.czrc new file mode 100644 index 0000000000..9373d2a5fd --- /dev/null +++ b/.czrc @@ -0,0 +1,7 @@ +{ + "path": "cz-conventional-changelog", + "disableScopeLowerCase": false, + "disableSubjectLowerCase": false, + "maxHeaderWidth": 100, + "maxLineWidth": 100 +} diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000000..6131f1ab2c --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Contributing to @vuestorefront-community/sylius +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + +## We Develop with Github +We use github to host code, to track issues and feature requests, as well as accept pull requests. + +## We Use [Git Flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow), So All Code Changes Happen Through Pull Requests +Pull requests are the best way to propose changes to the codebase (we use [Git Flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)). We actively welcome your pull requests: + +1. Fork the repo and create your branch from `develop`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. Issue that pull request! + +## Any contributions you make will be under the MIT Software License +In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](https://github.com/vuestorefront-community/sylius/issues) +We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/vuestorefront-community/sylius/issues/new); it's that easy! + +## Write bug reports with detail, background, and sample code +**Great Bug Reports** tend to have: + +- A quick summary and/or background +- Steps to reproduce + - Be specific! + - Give sample code if you can. +- What you expected would happen +- What actually happens +- The environment you're running the application +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) + +People *love* thorough bug reports. I'm not even kidding. + +## Use a Consistent Coding Style +I'm again borrowing these from [AirBnB's Code Style](https://github.com/airbnb/javascript) + +* 2 spaces for indentation rather than tabs +* You can try running `npm run lint` for style unification + +## License +By contributing, you agree that your contributions will be licensed under its MIT License. diff --git a/.github/ISSUE_TEMPLATE/1.bug-report.yml b/.github/ISSUE_TEMPLATE/1.bug-report.yml index 5bc7ad62eb..bb237200e5 100644 --- a/.github/ISSUE_TEMPLATE/1.bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug-report.yml @@ -1,6 +1,5 @@ name: "🐛 Bug report" -description: | - Create a report to help us improve +description: Report errors or unexpected behavior labels: - bug - triage-needed @@ -9,34 +8,41 @@ body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this bug report, please make sure to [search for existing issues](https://github.com/vuestorefront/vue-storefront/issues) before filing a new one! + Thanks for taking the time to fill out this bug report, please make sure to [search for existing issues](https://github.com/vuestorefront-community/sylius/issues) before filing a new one! - type: textarea + id: whattoexpect attributes: - label: Describe the Bug - description: Can you provide a clear and concise description of the bug + label: Expected Behavior + placeholder: What were you expecting? validations: - required: true + required: false - type: textarea - id: currentbehavior + id: whathappened attributes: - label: Current behavior - placeholder: Describe the current behavior pointing exactly why it's not working as intended + label: Actual Behavior + placeholder: What happened instead?? + validations: + required: true - type: textarea - id: expectedbehavior + id: solution attributes: - label: Expected behavior - placeholder: Describe what the desired behavior should be + label: Possible Solution + description: Also, if possible provide the information on how to implement the solution. + placeholder: Do you have any possible solution or fix for this bug? validations: - required: true + required: false - type: textarea id: reproduce attributes: label: Steps to reproduce - placeholder: Please provide the steps to reproduce and if possible a minimal reproducible example of the problem + description: Please provide detailed instructions on how to reproduce. + placeholder: How we can reproduce this bug? + validations: + required: false - type: input attributes: - label: What version of Vue Storefront are you using? - description: 'For example: 2.3.4' + label: What version of Sylius integration are you using? + description: 'For example: 1.0.0' validations: required: true - type: input @@ -63,21 +69,11 @@ body: label: Relevant log output description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell - - type: checkboxes - id: fixthebug - attributes: - label: Able to fix / change the documentation? - description: Can you handle this change and create a Pull Request? - options: - - label: 'Yes' - required: false - - label: 'No' - required: false - type: checkboxes id: terms attributes: label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront/vue-storefront/blob/master/CODE_OF_CONDUCT.md) + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront-community/sylius/blob/master/CODE_OF_CONDUCT.md) options: - label: I agree to follow this project's Code of Conduct required: true diff --git a/.github/ISSUE_TEMPLATE/2.documentation-issue.yml b/.github/ISSUE_TEMPLATE/2.documentation-issue.yml index 1b3ba7313f..f0e45f2fd1 100644 --- a/.github/ISSUE_TEMPLATE/2.documentation-issue.yml +++ b/.github/ISSUE_TEMPLATE/2.documentation-issue.yml @@ -25,7 +25,7 @@ body: id: terms attributes: label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront/vue-storefront/blob/master/CODE_OF_CONDUCT.md) + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront-community/sylius/blob/master/CODE_OF_CONDUCT.md) options: - label: I agree to follow this project's Code of Conduct required: true diff --git a/.github/ISSUE_TEMPLATE/3.feature-request.yml b/.github/ISSUE_TEMPLATE/3.feature-request.yml index 30cf58d1dd..ac50275ae3 100644 --- a/.github/ISSUE_TEMPLATE/3.feature-request.yml +++ b/.github/ISSUE_TEMPLATE/3.feature-request.yml @@ -30,17 +30,11 @@ body: attributes: label: Additional information description: If you think that any additional information would be useful please provide them here. - - type: input - attributes: - label: What version of Vue Storefront this feature can be implemented? - description: 'For example: 2.3.4' - validations: - required: true - type: checkboxes id: terms attributes: label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront/vue-storefront/blob/master/CODE_OF_CONDUCT.md) + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/vuestorefront-community/sylius/blob/master/CODE_OF_CONDUCT.md) options: - label: I agree to follow this project's Code of Conduct required: true diff --git a/.github/ISSUE_TEMPLATE/4.question.yml b/.github/ISSUE_TEMPLATE/4.question.yml index a760ab0344..4c4a421bed 100644 --- a/.github/ISSUE_TEMPLATE/4.question.yml +++ b/.github/ISSUE_TEMPLATE/4.question.yml @@ -14,8 +14,8 @@ body: required: true - type: input attributes: - label: What version of Vue Storefront are you using? - description: 'For example: 2.3.4' + label: What version of Sylius Integration are you using? + description: 'For example: 1.0.0' validations: required: true - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 64ba95063c..ccae31e286 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,5 @@ blank_issues_enabled: false contact_links: - - name: Documentation - url: https://docs.vuestorefront.io/ - about: Find more information about the project and how to implement in our documentation. - name: Discord Chat url: https://discord.vuestorefront.io/ about: Ask questions and discuss with other Vue Storefront users in real time. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 87f637ae12..fab5004390 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,13 +1,12 @@ ## Description - + ## Related Issue - ## Motivation and Context @@ -18,8 +17,7 @@ -## Screenshots: - +## Screenshots (if appropriate): ## Types of changes @@ -30,28 +28,9 @@ ## Checklist: -- [ ] I have read the **CONTRIBUTING** document. - -#### Changelog -- [ ] I have updated the Changelog ([V1](https://github.com/DivanteLtd/vue-storefront/blob/develop/CHANGELOG.md)) [v2](https://docs-next.vuestorefront.io/contributing/creating-changelog.html) and mentioned all breaking changes in the public API. -- [ ] I have documented all new public APIs and made changes to existing docs mentioning the parts I've changed so they're up to date. - -#### Tests -- [ ] I have written test cases for my code -- [ ] I have tested my Pull Request on production build and (to my knowledge) it works without any issues -- [ ] I have added tests to cover my changes. -- [ ] All new and existing tests passed. - -> I tested manually my code, and it works well with both: -- [ ] Default Theme -- [ ] Capybara Theme - -#### Code standards - [ ] My code follows the code style of this project. - -- [ ] I have followed [naming conventions](https://github.com/kettanaito/naming-cheatsheet) - -#### Docs - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. diff --git a/.github/lock.yml b/.github/lock.yml new file mode 100644 index 0000000000..4bd5b48a8a --- /dev/null +++ b/.github/lock.yml @@ -0,0 +1,9 @@ +# Configuration for lock-threads - https://github.com/dessant/lock-threads +# disable lock bot for now +daysUntilLock: 3650 +exemptLabels: [] +lockLabel: false +lockComment: > + This thread has been automatically locked since there has not been + any recent activity after it was closed. Please open a new issue for + related bugs. diff --git a/.github/workflows/assing-pr-to-author.yml b/.github/workflows/assing-pr-to-author.yml new file mode 100644 index 0000000000..37af3ceb7e --- /dev/null +++ b/.github/workflows/assing-pr-to-author.yml @@ -0,0 +1,18 @@ +name: PR to Author +on: + pull_request: + types: [opened, ready_for_review, edited, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + assignAuthor: + name: Assing + runs-on: ubuntu-latest + steps: + - uses: samspills/assign-pr-to-author@v1.0 + if: github.event_name == 'pull_request' && github.event.action == 'opened' + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/conventional-pr-name.yml b/.github/workflows/conventional-pr-name.yml index dcea291aa9..207be5eb5b 100644 --- a/.github/workflows/conventional-pr-name.yml +++ b/.github/workflows/conventional-pr-name.yml @@ -3,12 +3,23 @@ on: pull_request: types: ['opened', 'edited', 'reopened', 'synchronize'] +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: lint: name: Validate PR Title (conventional-commit) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v1 + + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: "14" + - name: Install Dependencies - run: npm install @commitlint/config-conventional - - uses: JulienKode/pull-request-name-linter-action@v0.1.2 + run: yarn + + - uses: JulienKode/pull-request-name-linter-action@v0.2.0 diff --git a/.github/workflows/deploy-lighthouse.yml b/.github/workflows/deploy-lighthouse.yml deleted file mode 100644 index f2e9329d1d..0000000000 --- a/.github/workflows/deploy-lighthouse.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Lighthouse Test - -on: - push: - branches: - - lighthouse/next - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: "12.x" - - name: Build and publish docker image - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: demo-lighthouse-storefrontcloud-io/vue-storefront:${{ github.sha }} - registry: registry.storefrontcloud.io - username: ${{ secrets.CLOUD_USERNAME }} - password: ${{ secrets.CLOUD_PASSWORD }} - dockerfile: dev/docker/Dockerfile - buildoptions: "--compress" - deploy: - runs-on: ubuntu-latest - needs: build - steps: - - uses: chrnorm/deployment-action@releases/v1 - name: Create GitHub deployment - id: deployment - with: - token: "${{ github.token }}" - target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io - environment: production - initial_status: in_progress - - name: Deploy on demo-lighthouse.europe-west1.gcp.storefrontcloud.io - if: github.ref == 'refs/heads/next' - run: | - if curl -s -H 'X-User-Id: ${{ secrets.DOCS_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DOCS_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{ - "code":"demo-lighthouse", - "region":"europe-west1.gcp", - "frontContainerVersion":"${{ github.sha }}" - }' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Update deployment status (success) - if: success() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io - state: "success" - description: Congratulations! The deploy is done. - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - name: Update deployment status (failure) - if: failure() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - target_url: https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io - description: Unfortunately, the instance hasn't been updated. - state: "failure" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - lighthouse: - runs-on: ubuntu-latest - needs: deploy - steps: - - uses: actions/checkout@v2 - - name: Audit URLs using Lighthouse - uses: treosh/lighthouse-ci-action@v7 - with: - urls: | - https://demo-lighthouse.europe-west1.gcp.storefrontcloud.io - # budgetPath: ./budget.json # test performance budgets - uploadArtifacts: true # save results as an action artifacts - temporaryPublicStorage: true # upload lighth \ No newline at end of file diff --git a/.github/workflows/deploy-preview-storefrontcloud.yml b/.github/workflows/deploy-preview-storefrontcloud.yml deleted file mode 100644 index 4ffcc1dd64..0000000000 --- a/.github/workflows/deploy-preview-storefrontcloud.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: Deploy PR Preview on Storefrontcloud -on: - pull_request: - types: [opened, synchronize] -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: "12.x" - - name: Build and publish docker image - # uses: elgohr/Publish-Docker-Github-Action@master - # 3.04 is hardcoded as a workaround for https://github.com/elgohr/Publish-Docker-Github-Action/issues/134 - uses: elgohr/Publish-Docker-Github-Action@3.04 - with: - name: vsf-next-demo-storefrontcloud-io/vue-storefront:${{ github.sha }} - registry: registry.storefrontcloud.io - username: ${{ secrets.CLOUD_USERNAME }} - password: ${{ secrets.CLOUD_PASSWORD }} - dockerfile: dev/docker/Dockerfile - buildoptions: "--compress" - deploy: - runs-on: ubuntu-latest - needs: build - steps: - - uses: chrnorm/deployment-action@releases/v1 - name: Create GitHub deployment - id: deployment - with: - token: "${{ github.token }}" - environment: preview - initial_status: in_progress - - name: Deploy on Storefrontcloud.io - id: deploy - uses: storefrontcloud/storefrontcloud-preview-deploy@0.1.0 - with: - token: "${{ github.token }}" - namespace: "vsf-next-demo" - username: ${{ secrets.CLOUD_USERNAME }} - password: ${{ secrets.CLOUD_PASSWORD }} - - name: Comment PR - if: success() - uses: storefrontcloud/storefrontcloud-comment-pr-preview-deploy@master - with: - preview_url: '${{ steps.deploy.outputs.preview_url }}' - token: "${{ github.token }}" - namespace: 'vsf-next-demo' - - name: Update deployment status (success) - if: success() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - target_url: ${{ steps.deploy.outputs.preview_url }} - state: "success" - description: Congratulations! The deploy is done. - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - name: Update deployment status (failure) - if: failure() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - description: Unfortunately, the instance hasn't been updated. - state: "failure" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} \ No newline at end of file diff --git a/.github/workflows/deploy-storefrontcloud.yml b/.github/workflows/deploy-storefrontcloud.yml deleted file mode 100644 index 2edeb3667a..0000000000 --- a/.github/workflows/deploy-storefrontcloud.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Deploy to Storefrontcloud -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v1 - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: "12.x" - - name: Build and publish docker image - # uses: elgohr/Publish-Docker-Github-Action@master - # 3.04 is hardcoded as a workaround for https://github.com/elgohr/Publish-Docker-Github-Action/issues/134 - uses: elgohr/Publish-Docker-Github-Action@3.04 - with: - name: vsf-next-demo-storefrontcloud-io/vue-storefront:${{ github.sha }} - registry: registry.storefrontcloud.io - username: ${{ secrets.CLOUD_USERNAME }} - password: ${{ secrets.CLOUD_PASSWORD }} - dockerfile: dev/docker/Dockerfile - buildoptions: "--compress" - deploy: - runs-on: ubuntu-latest - needs: build - steps: - - uses: chrnorm/deployment-action@releases/v1 - name: Create GitHub deployment - id: deployment - with: - token: "${{ github.token }}" - target_url: https://vsf-next-demo.storefrontcloud.io - environment: production - initial_status: in_progress - - name: Deploy on lovecrafts-demo.storefrontcloud.io - if: github.ref == 'refs/heads/next' - run: | - if curl -s -u ${{ secrets.CLOUD_USERNAME }}:${{ secrets.CLOUD_PASSWORD }} -H 'Content-Type: application/json' -X POST -d '{"code":"lovecrafts-demo","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Deploy on vsf-next-demo.storefrontcloud.io - if: github.ref == 'refs/heads/release/next' - run: | - if curl -s -H 'X-User-Id: ${{ secrets.DEMO_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DEMO_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"vsf-next-demo","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Deploy on vsf-next-demo.europe-west1.gcp.storefrontcloud.io - if: github.ref == 'refs/heads/test/next' - run: | - if curl -s -H 'X-User-Id: ${{ secrets.DEMO_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DEMO_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"vsf-next-demo","region":"europe-west1.gcp","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Deploy on demo-ct.europe-west1.gcp.storefrontcloud.io - if: github.ref == 'refs/heads/main' - run: | - if curl -s -H 'X-User-Id: ${{ secrets.DEMO_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DEMO_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"demo-ct","region":"europe-west1.gcp","frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Deploy on canary-ct.europe-west1.gcp.storefrontcloud.io - if: github.ref == 'refs/heads/release/next' - run: | - if curl -s -H 'X-User-Id: ${{ secrets.DEMO_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DEMO_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"canary-ct","region":"europe-west1.gcp",frontContainerVersion":"${{ github.sha }}"}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then - echo "Instance updated" - else - echo "Something went wrong during the update process..." - exit 1 - fi - - name: Update deployment status (success) - if: success() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - target_url: https://vsf-next-demo.storefrontcloud.io - state: "success" - description: Congratulations! The deploy is done. - deployment_id: ${{ steps.deployment.outputs.deployment_id }} - - name: Update deployment status (failure) - if: failure() - uses: chrnorm/deployment-status@releases/v1 - with: - token: "${{ github.token }}" - target_url: https://vsf-next-demo.storefrontcloud.io - description: Unfortunately, the instance hasn't been updated. - state: "failure" - deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/docs-deployment.yaml similarity index 79% rename from .github/workflows/deploy-docs.yml rename to .github/workflows/docs-deployment.yaml index f137427b06..385aab5b8d 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/docs-deployment.yaml @@ -1,8 +1,9 @@ -name: Deploy Docs +name: Deploy Documentation on: push: branches: - - release/next + - main + workflow_dispatch: jobs: build: @@ -22,17 +23,16 @@ jobs: id: get_version run: echo ::set-output name=VERSION::$(cat version.txt) - name: Build and publish docker image - # uses: elgohr/Publish-Docker-Github-Action@master - # 3.04 is hardcoded as a workaround for https://github.com/elgohr/Publish-Docker-Github-Action/issues/134 - uses: elgohr/Publish-Docker-Github-Action@3.04 + uses: elgohr/Publish-Docker-Github-Action@master with: - name: docs-storefrontcloud-io/v2:${{ steps.get_version.outputs.VERSION }} + name: docs-storefrontcloud-io/v2-sylius:${{ steps.get_version.outputs.VERSION }} registry: registry.storefrontcloud.io username: ${{ secrets.DOCS_CLOUD_USERNAME }} password: ${{ secrets.DOCS_CLOUD_PASSWORD }} workdir: . - dockerfile: ./packages/core/docs/Dockerfile + dockerfile: ./.vuestorefrontcloud/docker/docs/Dockerfile buildoptions: "--compress" + deploy: runs-on: ubuntu-latest needs: build @@ -49,12 +49,12 @@ jobs: id: deployment with: token: "${{ github.token }}" - target_url: https://docs.europe-west1.gcp.storefrontcloud.io/v2 + target_url: https://docs.europe-west1.gcp.storefrontcloud.io/sylius environment: production initial_status: in_progress - - name: Deploy on docs.europe-west1.gcp.storefrontcloud.io/v2 + - name: Deploy on docs.europe-west1.gcp.storefrontcloud.io/sylius run: | - if curl -s -H 'X-User-Id: ${{ secrets.DOCS_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DOCS_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"docs","region":"europe-west1.gcp","additionalApps":{"apps":[{"name":"docs-v2","tag":"${{ steps.get_version.outputs.VERSION }}","image":"registry.storefrontcloud.io/docs-storefrontcloud-io/v2","path":"/v2","port":"80"}]}}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then + if curl -s -H 'X-User-Id: ${{ secrets.DOCS_CLOUD_USERNAME }}' -H 'X-Api-Key: ${{ secrets.DOCS_CLOUD_PASSWORD }}' -H 'Content-Type: application/json' -X POST -d '{"code":"docs","region":"europe-west1.gcp","additionalApps":{"apps":[{"name":"docs-v2-sylius","tag":"${{ steps.get_version.outputs.VERSION }}","image":"registry.storefrontcloud.io/docs-storefrontcloud-io/v2-sylius","path":"/sylius","port":"80"}]}}' https://farmer.storefrontcloud.io/instances | grep -q '{"code":200,"result":"Instance updated!"}'; then echo "Instance updated" else echo "Something went wrong during the update process..." @@ -65,7 +65,7 @@ jobs: uses: chrnorm/deployment-status@releases/v1 with: token: "${{ github.token }}" - target_url: https://docs.europe-west1.gcp.storefrontcloud.io/v2 + target_url: https://docs.europe-west1.gcp.storefrontcloud.io/sylius state: "success" description: Congratulations! The deploy is done. deployment_id: ${{ steps.deployment.outputs.deployment_id }} @@ -74,7 +74,7 @@ jobs: uses: chrnorm/deployment-status@releases/v1 with: token: "${{ github.token }}" - target_url: https://docs.europe-west1.gcp.storefrontcloud.io/v2 + target_url: https://docs.europe-west1.gcp.storefrontcloud.io/sylius description: Unfortunately, the instance hasn't been updated. state: "failure" deployment_id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/draft-release-pr.yml b/.github/workflows/draft-release-pr.yml new file mode 100644 index 0000000000..4113d19aa2 --- /dev/null +++ b/.github/workflows/draft-release-pr.yml @@ -0,0 +1,50 @@ +name: "Draft new release" + +on: + workflow_dispatch: + inputs: + version: + description: 'The version you want to release.' + required: true + +jobs: + draft-new-release: + name: "Draft a new release" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: develop + + - name: Initialize mandatory git config + run: | + git config user.name "GitHub actions" + git config user.email noreply@github.com + + - name: Create release branch + run: git checkout -b release/${{ github.event.inputs.version }} + + - name: Bump version in package.json + run: lerna version "${{ github.event.inputs.version }}" --no-git-tag-version --no-changelog --ignore-changes "*/internals/**" -y + + - name: Commit changelog and manifest files + id: make-commit + run: | + git add . + git commit --message "chore: release ${{ github.event.inputs.version }}" + echo "::set-output name=commit::$(git rev-parse HEAD)" + - name: Push new branch + run: git push origin release/${{ github.event.inputs.version }} + + - name: Create pull request + uses: thomaseizinger/create-pull-request@1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + head: release/${{ github.event.inputs.version }} + base: main + title: "chore: release ${{ github.event.inputs.version }}" + reviewers: ${{ github.actor }} + body: | + Hey @${{ github.actor }}! + Remeber to update this PR with the correct information, before merging it :) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index a904b6e0ce..0000000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,19 +0,0 @@ -# This workflow will triage pull requests and apply a label based on the -# paths that are modified in the pull request. -# -# To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: -# https://github.com/actions/labeler - -name: Labeler -on: [pull_request] - -jobs: - label: - - runs-on: ubuntu-latest - - steps: - - uses: actions/labeler@master - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/merge-release.yml b/.github/workflows/merge-release.yml new file mode 100644 index 0000000000..22cfd8ece3 --- /dev/null +++ b/.github/workflows/merge-release.yml @@ -0,0 +1,58 @@ +name: "Publish new release" + +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + release: + name: Publish new release + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + steps: + - name: Extract version from branch name (for release branches) + if: startsWith(github.event.pull_request.head.ref, 'release/') + run: | + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + VERSION=${BRANCH_NAME#release/} + echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV + - name: Extract version from branch name (for hotfix branches) + if: startsWith(github.event.pull_request.head.ref, 'hotfix/') + run: | + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + VERSION=${BRANCH_NAME#hotfix/} + echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV + - name: Create Release + uses: thomaseizinger/create-release@1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + target_commitish: ${{ github.event.pull_request.merge_commit_sha }} + tag_name: ${{ env.RELEASE_VERSION }} + name: ${{ env.RELEASE_VERSION }} + draft: false + prerelease: false + - name: Checkout to the develop branch + uses: actions/checkout@v2 + with: + ref: develop + - name: Create main-dev branch + uses: peterjgrainger/action-create-branch@v2.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + branch: chore/main-dev-${{ env.RELEASE_VERSION }} + - name: Merge main into develop branch + uses: thomaseizinger/create-pull-request@1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + head: chore/main-dev-${{ env.RELEASE_VERSION }} + base: develop + title: Align develop branch with main after release ${{ env.RELEASE_VERSION }} + body: | + This PR merges the main branch back into develop. + This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates are also present on the develop branch. diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000000..75564538ad --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,35 @@ +name: Publish Packages on NPM +on: + workflow_dispatch: + inputs: + npmTag: + description: 'NPM Tag' + required: true + default: 'latest' + +jobs: + publishing: + name: Package Publishing + runs-on: ubuntu-latest + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: "14" + registry-url: "https://registry.npmjs.org/" + scope: "@vue-storefront" + - run: echo "" >> .npmrc && echo "@vue-storefront:registry=https://registry.npmjs.org/" >> .npmrc + - run: yarn + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: yarn build:api-client && yarn publish:api-client "${{ github.event.inputs.npmTag }}" "$NODE_AUTH_TOKEN" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: yarn build:composables && yarn publish:composables "${{ github.event.inputs.npmTag }}" "$NODE_AUTH_TOKEN" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/run-e2e-regression.yml b/.github/workflows/run-e2e-regression.yml deleted file mode 100644 index fcb4314e63..0000000000 --- a/.github/workflows/run-e2e-regression.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Run E2E Regression Tests -on: - schedule: - - cron: "0 0 * * 1-5" -jobs: - run_e2e_tests: - name: Run E2E Tests - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - package: ["ct", "bp"] - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/Cypress - **/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn install - - - name: Build package - run: yarn build:${{ matrix.package }} - env: - NUXT_ENV_E2E: true - - - name: Run cypress tests - uses: cypress-io/github-action@v2.8.2 - with: - start: yarn start:${{ matrix.package }} - wait-on: 'http://localhost:3000' - wait-on-timeout: 180 - command: yarn run test:e2e:${{ matrix.package }}:hl - browser: chrome - headless: true - install: false - env: - CYPRESS_INCLUDE_TAGS: regression - - - name: Generate report - if: ${{ always() }} - run: yarn test:e2e:${{ matrix.package }}:generate:report - - - name: Upload bp report artifact - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: report-bp - path: "packages/boilerplate/theme/tests/e2e/report" - if-no-files-found: ignore - - - name: Upload ct report artifact - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: report-ct - path: "packages/commercetools/theme/tests/e2e/report" - if-no-files-found: ignore diff --git a/.github/workflows/run-e2e-tests.yml b/.github/workflows/run-e2e-tests.yml deleted file mode 100644 index 5cdc5bee8b..0000000000 --- a/.github/workflows/run-e2e-tests.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Run E2E Tests -on: - workflow_dispatch: - inputs: - tags_include: - description: "Include tags" - required: false - tags_exclude: - description: "Exclude tags" - required: false - package: - description: "Package" - required: true - default: "ct" - browser: - description: "Browser" - required: true - default: "chrome" -jobs: - run_e2e_tests: - name: Run E2E Tests - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v2 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 - with: - path: | - ~/.cache/Cypress - **/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: yarn install - - - name: Build package - run: yarn build:${{ github.event.inputs.package }} - env: - NUXT_ENV_E2E: true - - - name: Run cypress tests - uses: cypress-io/github-action@v2.8.2 - with: - start: yarn start:${{ github.event.inputs.package }} - wait-on: 'http://localhost:3000' - wait-on-timeout: 180 - command: yarn run test:e2e:${{ github.event.inputs.package }}:hl - browser: ${{ github.event.inputs.browser }} - headless: true - install: false - env: - CYPRESS_INCLUDE_TAGS: ${{ github.event.inputs.tags_include }} - CYPRESS_EXCLUDE_TAGS: ${{ github.event.inputs.tags_exclude }} - - - name: Generate report - if: ${{ always() }} - run: yarn test:e2e:${{ github.event.inputs.package }}:generate:report - - - name: Upload bp report artifact - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: report-bp - path: "packages/boilerplate/theme/tests/e2e/report" - if-no-files-found: ignore - - - name: Upload ct report artifact - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: report-ct - path: "packages/commercetools/theme/tests/e2e/report" - if-no-files-found: ignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6d0471d95..b27195022f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run tests +name: Build, test on: push: @@ -12,139 +12,29 @@ on: - develop - release-** +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + jobs: - prepare_dependencies: - name: Prepare dependencies + test_repository: + name: Build and test runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 + uses: actions/setup-node@v2 with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + node-version: '14.19.0' + cache: 'yarn' - name: Install dependencies - run: yarn --network-concurrency 1 --frozen-lockfile - - lint: - name: Lint - needs: prepare_dependencies - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Run linter - run: yarn lint - - validate_core: - name: Validate core - needs: prepare_dependencies - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + run: yarn install - - name: Build core - run: yarn build:core - - - name: Test cache - run: yarn test:cache --coverage - - - name: Test CLI - run: yarn test:cli --coverage - - - name: Test core - run: yarn test:core --coverage - - - name: Test middleware - run: yarn test:middleware --coverage - - validate_integrations: - name: Validate ${{ matrix.integration }} - needs: validate_core - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - integration: - - boilerplate - - commercetools - # - shopify - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Get cached dependencies - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - - - name: Build core - run: yarn build:core - - - name: Build middleware - run: yarn build:middleware - - - name: Build api-client - run: cd packages/${{ matrix.integration }}/api-client && yarn build - - - name: Test api-client - run: cd packages/${{ matrix.integration }}/api-client && yarn test --passWithNoTests --coverage - - - name: Build composables - run: cd packages/${{ matrix.integration }}/composables && yarn build - - - name: Test composables - run: cd packages/${{ matrix.integration }}/composables && yarn test --passWithNoTests --coverage - - - name: Build theme - run: cd packages/${{ matrix.integration }}/theme && yarn build + - name: Build packages + run: yarn build - name: Test theme - run: cd packages/${{ matrix.integration }}/theme && yarn test --passWithNoTests - - - name: api-client coverage file - id: api-coverage - run: echo "::set-output name=exists::$((test -s packages/${{ matrix.integration }}/api-client/coverage/lcov.info && echo 'true') || echo 'false')" - - - name: composables coverage file - id: composables-coverage - run: echo "::set-output name=exists::$((test -s packages/${{ matrix.integration }}/composables/coverage/lcov.info && echo 'true') || echo 'false')" + run: yarn test:theme diff --git a/.ncurc.json b/.ncurc.json new file mode 100644 index 0000000000..a8ca41797b --- /dev/null +++ b/.ncurc.json @@ -0,0 +1,5 @@ +{ + "reject": [ + "typescript" + ] +} diff --git a/.vuestorefrontcloud/docker/docs/Dockerfile b/.vuestorefrontcloud/docker/docs/Dockerfile new file mode 100644 index 0000000000..bce88b3c2b --- /dev/null +++ b/.vuestorefrontcloud/docker/docs/Dockerfile @@ -0,0 +1,15 @@ +FROM node:14 AS build + +WORKDIR /var/www + +COPY . . + +RUN cd docs \ + && npm install \ + && sed -i "s/base: '\/',/base: '\/sylius\/',/g" ./.vuepress/config.js \ + && cat ./.vuepress/config.js \ + && npm run build + +FROM nginx + +COPY --from=build /var/www/docs/.vuepress/dist /usr/share/nginx/html/sylius diff --git a/.vuestorefrontcloud/docker/docs/build-docker.sh b/.vuestorefrontcloud/docker/docs/build-docker.sh new file mode 100755 index 0000000000..85426d4268 --- /dev/null +++ b/.vuestorefrontcloud/docker/docs/build-docker.sh @@ -0,0 +1,3 @@ +TAG=`git rev-parse HEAD` +docker build --progress plain -t registry.storefrontcloud.io/docs-storefrontcloud-io/v2-sylius:${TAG:0:8} -f Dockerfile ../../../ +# docker push registry.storefrontcloud.io/docs-storefrontcloud-io/v2-sylius:${TAG:0:8} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5dd51f7a66..4384cf3557 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -60,8 +60,7 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -contributors@vuestorefront.io - +contributors@vuestorefront.io All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c57158bce4..4525a36259 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,31 +1,28 @@ # Contributing -We are very happy that you want to contribute to Vue Storefront. -To create a perfect experience for everyone in the community, there are a set of rules and best practices which our repository got. +Yeay! You want to contribute to @vuestorefront-community/sylius. That's amazing! To smoothen everyone's experience involved with the project please take note of the following guidelines and rules. -Please take note of the following guidelines and rules. ## Found an Issue? -Thank you for reporting any issues you find. - -We do our best to test and make our repository as solid as possible, but any reported issue is a real help. +Thank you for reporting any issues you find. We do our best to test and make @vuestorefront-community/sylius as solid as possible, but any reported issue is a real help. Please follow these guidelines when reporting issues: -- Provide a title in the format of Ex: `[BUG]: when `, `[Issue]: When I try to , an appears` -- Tag your issue with the tag `triage-needed` +- Provide a title in the format of ` when ` +- Tag your issue with the tag `bug` - Provide a short summary of what you are trying to do - Provide the log of the encountered error if applicable -- Provide the exact version of the framework you are using. +- Provide the exact version of @vuestorefront-community/sylius. - Be awesome and consider contributing a [pull request](#want-to-contribute) ## Want to contribute? -You consider contributing changes to our framework, this is awesome! - +You consider contributing changes to @vuestorefront-community/sylius – we dig that! Please consider these guidelines when filing a pull request: +> @vuestorefront-community/sylius pull requests + - Follow the [Coding Rules](#coding-rules) - Follow the [Commit Rules](#commit-rules) - Make sure you rebased the current master branch when filing the pull request @@ -39,19 +36,18 @@ Please consider these guidelines when filing a pull request: ## Coding Rules -To keep the code base of our repository neat and tidy, we apply a set of rules to every change +To keep the code base of @vuestorefront-community/sylius neat and tidy the following rules apply to every change > Coding standards - `eslint` is king -- Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra) - Just in case you really need one :) +- Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra) - Be awesome ## Commit Rules -To help everyone with understanding the commit history of commits the following rules are enforced. - -To make your life easier our repository is commitizen-friendly and provides the npm run-script `commit`. +To help everyone with understanding the commit history of commitlint the following commit rules are enforced. +To make your life easier @vuestorefront-community/sylius is commitizen-friendly and provides the npm run-script `commit`. > Commit standards @@ -60,3 +56,14 @@ To make your life easier our repository is commitizen-friendly and provides the - present tense - maximum of 100 characters - message format of `$type($scope): $message` + +## Definition of done +Issue is considered complete when: +1. The issue has precise requirements (acceptance criteria) - if issue description is not clear, please reach us out by adding the comment to the issue +2. Those requirements are implemented in the code +3. Code is covered by tests (at least unit or integration) +4. Code is reviewed and approved by at least 1 person +5. Code is deployed to the dev environment and tested by the developer +6. Code is deployed to the stage as a part of a release. (we will be releasing a new version after each sprint) and tested by the Q.A. engineer + 1. tests including manual regression testing, usability, accessibility, and whether the business requirements are met +7. Finally, the ticket is approved by the team leader/product owner and marked as done diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..2801ae1d5b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Vue Storefront + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/SECURITY.md b/SECURITY.md index a57dec4d2f..3aa4dae1a4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,13 +1,36 @@ -# Security Policy +# Security Policies and Procedures -## Reporting a Vulnerability +This document outlines security procedures and general policies for the Vue Storefront Magento 2 Integraion. -Please do not publicly disclose potential security vulnerabilities. Instead, report them to our dedicated email address security@vuestorefront.io. Informing us this way will allow us to quickly determine the severity of the problem and provide a fix without putting existing projects at risk. + * [Reporting a Bug](#reporting-a-bug) + * [Disclosure Policy](#disclosure-policy) + * [Comments on this Policy](#comments-on-this-policy) -If you would like to provide a patch, please **do not open a pull request**. Instead, create a commit on your fork of Vue Storefront and run this command: +## Reporting a Bug -```bash -git format-patch HEAD~1..HEAD --stdout > patch.txt -``` +The Vue Storefront Magento 2 Integraion team and community take all security bugs very seriously. +Thank you for improving the security of our integration. We appreciate your efforts and +responsible disclosure and will make every effort to acknowledge your contributions. -It will generate a file called `patch.txt`. Please email a description of the patch along with the patch itself to our dedicated email address mentioned above. +Report security bugs by emailing the lead maintainer at contributors@vuestorefront.io. + +The lead maintainer will acknowledge your email within 48 hours, and will send a +more detailed response within 48 hours indicating the next steps in handling +your report. After the initial reply to your report, the security team will +endeavor to keep you informed of the progress towards a fix and full +announcement, and may ask for additional information or guidance. + +Report security bugs in third-party modules to the person or team maintaining the module. + +## Disclosure Policy + +When the security team receives a security bug report, they will assign it to aprimary handler. +This person will coordinate the fix and release process, involving the following steps: + + * Confirm the problem and determine the affected versions. + * Audit code to find any potential similar problems. + * Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible to npm. + +## Comments on this Policy + +If you have suggestions on how this process could be improved please submit a pull request. diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index ca16ae54ba..5971c288a4 100755 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -20,7 +20,31 @@ module.exports = { })) })) }, + plugins: [ + '@vuepress/plugin-back-to-top', + [ + '@vuepress/plugin-medium-zoom', + { + // This selector excludes images from the "Integrations" page + selector: 'main :not(.tile-image) > img' + } + ], + '@vuepress/active-header-links', + '@vuepress/search' + ], themeConfig: { + repo: 'https://github.com/vuestorefront-community/sylius/', + editLinks: true, + docsDir: 'docs', + docsBranch: 'develop', + editLinkText: 'Edit this page', + logo: 'https://user-images.githubusercontent.com/1626923/137092657-fb398d20-b592-4661-a1f9-4135db0b61d5.png', + nav: [ + { text: 'Vue Storefront', link: 'https://vuestorefront.io/' }, + { text: 'Core Documentation', link: 'https://docs.vuestorefront.io/v2/' }, + // { text: 'Demo', link: 'https://demo-magento2.europe-west1.gcp.storefrontcloud.io/' }, + { text: 'GitHub', link: 'https://github.com/vuestorefront-community/sylius'}, + ], sidebar: [ { title: 'Essentials', diff --git a/docs/.vuepress/public/vuelogo.jpg b/docs/.vuepress/public/vuelogo.jpg new file mode 100644 index 0000000000..fcebc49525 Binary files /dev/null and b/docs/.vuepress/public/vuelogo.jpg differ diff --git a/docs/.vuepress/styles/index.styl b/docs/.vuepress/styles/index.styl old mode 100755 new mode 100644 index 420feb93f9..fad3ec455f --- a/docs/.vuepress/styles/index.styl +++ b/docs/.vuepress/styles/index.styl @@ -1,8 +1,27 @@ -/** - * Custom Styles here. - * - * ref:https://v1.vuepress.vuejs.org/config/#index-styl - */ - -.home .hero img - max-width 450px!important + +.site-name { + display: none !important; +} + +.badge { + margin-top: 4px; + background-color: #22c34b; +} + +.badge.info { + background-color: #22c34b !important; +} + +.multiselect__tag { + background: #22c34b !important; +} + +.custom-block.tip { + border-color: #22c34b; + background-color: #f0f7f2; +} + +a code { + color: $accentColor !important; + font-weight: bold; +} diff --git a/docs/.vuepress/styles/palette.styl b/docs/.vuepress/styles/palette.styl old mode 100755 new mode 100644 index 6490cb359a..9305fc9aa4 --- a/docs/.vuepress/styles/palette.styl +++ b/docs/.vuepress/styles/palette.styl @@ -4,7 +4,7 @@ * ref:https://v1.vuepress.vuejs.org/zh/config/#palette-styl */ -$accentColor = #3eaf7c +$accentColor = #22c34b $textColor = #2c3e50 $borderColor = #eaecef $codeBgColor = #282c34 diff --git a/docs/.vuepress/theme/index.js b/docs/.vuepress/theme/index.js new file mode 100644 index 0000000000..cc636ec827 --- /dev/null +++ b/docs/.vuepress/theme/index.js @@ -0,0 +1,3 @@ +module.exports = { + extend: '@vuepress/theme-default' +}; diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue new file mode 100644 index 0000000000..ef47d49f32 --- /dev/null +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -0,0 +1,162 @@ + + + diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index 376ba26c1b..7fb4727cc8 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -11,7 +11,7 @@ You can read more about middleware configuration in Vue Storefront [here](https: module.exports = { integrations: { sylius: { - location: '@realtainment/sylius-api/server', + location: '@vue-storefront/sylius-api/server', configuration: { api: 'YOUR SYLIUS GRAPHQL URL', locale: 'en_US', diff --git a/docs/package.json b/docs/package.json index bf78f7ac7c..88e99b8588 100755 --- a/docs/package.json +++ b/docs/package.json @@ -9,15 +9,24 @@ "dev": "vuepress dev", "build": "vuepress build", "build:docs": "concurrently \"yarn:docs-gen:*\" && concurrently \"yarn:docs-md:*\"", - "docs-gen:api": "cd ../packages/sylius/api-client && api-extractor run --local", - "docs-gen:composables": "cd ../packages/sylius/composables && api-extractor run --local", + "docs-gen:api": "cd ../packages/api-client && api-extractor run --local", + "docs-gen:composables": "cd ../packages/composables && api-extractor run --local", "docs-md:api": "api-documenter markdown --i ../packages/docs/api-client --o guide/api-client", "docs-md:composables": "api-documenter markdown --i ../packages/docs/composables --o guide/composables" }, "devDependencies": { - "@microsoft/api-documenter": "^7.13.75", - "@microsoft/api-extractor": "^7.19.1", - "concurrently": "^6.4.0", - "vuepress": "^1.5.3" + "@microsoft/api-documenter": "^7.13.7", + "@microsoft/api-extractor": "^7.18.3", + "@vuepress/plugin-active-header-links": "^1.8.2", + "@vuepress/plugin-back-to-top": "^1.8.2", + "@vuepress/plugin-medium-zoom": "^1.8.2", + "@vuepress/plugin-search": "^1.8.2", + "handlebars": "^4.7.7", + "typescript": "^4.5.4", + "vuepress": "^1.2.0" + }, + "dependencies": { + "sass-loader": "^8.0.2", + "vue-multiselect": "^2.1.6" } } diff --git a/package.json b/package.json index 15057dab2f..46440aa023 100644 --- a/package.json +++ b/package.json @@ -2,25 +2,39 @@ "name": "root", "private": true, "scripts": { - "build:sylius:api-client": "cd packages/sylius/api-client && yarn build", - "build:sylius:composables": "cd packages/sylius/composables && yarn build", - "build:sylius:tools": "yarn build:sylius:api-client && yarn build:sylius:composables", - "build:sylius:theme": "cd packages/sylius/theme && yarn build", - "build:sylius": "yarn build:sylius:tools && yarn build:sylius:theme", - "test:sylius:api-client": "cd packages/sylius/api-client && yarn test", - "dev:sylius:api-client": "cd packages/sylius/api-client && yarn dev", - "dev:sylius:composables": "cd packages/sylius/composables && yarn dev", - "dev:sylius:theme": "cd packages/sylius/theme && yarn dev", - "dev:sylius": "concurrently \"yarn:dev:sylius:*\"", - "start:sylius": "cd packages/sylius/theme && yarn start", - "cli": "cd packages/core/cli && yarn cli", + "build": "yarn build:api-client && yarn build:composables && yarn build:theme", + "build:api-client": "cd packages/api-client && yarn build", + "build:composables": "cd packages/composables && yarn build", + "build:theme": "cd packages/theme && yarn build", + "contributors:add": "all-contributors add", + "contributors:generate": "all-contributors generate", + "dev": "concurrently \"yarn:dev:*\"", + "dev:api-client": "cd packages/api-client && yarn dev", + "dev:composables": "cd packages/composables && yarn dev", + "dev:theme": "cd packages/theme && yarn dev", + "docs:install": "cd docs && yarn", + "docs:dev": "cd docs && yarn dev", + "docs:build": "cd docs && yarn build", + "lint": "eslint . --ext .ts,.vue --fix", + "prepare": "[ -d '.husky' ] && (husky install && shx rm -rf .git/hooks && shx ln -s ../.husky .git/hooks) || true", + "publish:api-client": "node ./scripts/publishApi.js", + "publish:composables": "node ./scripts/publishComposable.js", + "start": "cd packages/theme && yarn start", + "test": "yarn test:api-client && yarn test:composables && yarn test:theme", + "test:api-client": "cd packages/api-client && yarn test --passWithNoTests", + "test:composables": "cd packages/composables && yarn test --passWithNoTests", + "test:theme": "cd packages/theme && yarn test --passWithNoTests", + "update:check": "ncu && lerna run update:check --stream", + "update:update": "ncu -u && lerna run update:update --stream", "commit": "cz", "heroku-postbuild": "scripts/build.sh" }, "devDependencies": { "@babel/core": "^7.10.5", - "@commitlint/cli": "^13.1.0", - "@commitlint/config-conventional": "^13.1.0", + "@commitlint/cli": "^16.1.0", + "@commitlint/config-conventional": "^16.0.0", + "@commitlint/config-lerna-scopes": "^16.0.0", + "@manypkg/cli": "^0.19.1", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-replace": "^3.0.0", "@types/jest": "^26.0.24", @@ -28,6 +42,7 @@ "@typescript-eslint/eslint-plugin": "^4.15.2", "@typescript-eslint/parser": "^4.15.2", "@vue/eslint-config-typescript": "^7.0.0", + "all-contributors-cli": "^6.20.0", "commitizen": "^4.2.4", "cross-env": "^6.0.3", "cz-conventional-changelog": "^3.3.0", @@ -42,10 +57,12 @@ "jest": "^27.0.6", "lerna": "^3.15.0", "lint-staged": "^10.0.7", + "majestic": "^1.8.1", "rimraf": "^3.0.2", "rollup": "^2.59.0", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-typescript2": "^0.30.0", + "shx": "^0.3.4", "ts-jest": "^27.0.3", "ts-node": "^8.4.1", "tslib": "^2.1.0", @@ -58,25 +75,11 @@ "packages/**/*" ] }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,ts,vue}": "eslint --fix" - }, - "config": { - "commitizen": { - "path": "cz-conventional-changelog", - "maxHeaderWidth": 100, - "maxLineWidth": 100 - } - }, "engines": { - "node": "14.19.0" + "node": "14.x.x", + "yarn": "1.x.x||>=3.x.x" }, "dependencies": { - "concurrently": "^6.4.0" + "concurrently": "^7.3.0" } } diff --git a/packages/sylius/.gitignore b/packages/.gitignore similarity index 100% rename from packages/sylius/.gitignore rename to packages/.gitignore diff --git a/packages/sylius/api-client/.gitignore b/packages/api-client/.gitignore similarity index 100% rename from packages/sylius/api-client/.gitignore rename to packages/api-client/.gitignore diff --git a/packages/sylius/api-client/README.md b/packages/api-client/README.md similarity index 100% rename from packages/sylius/api-client/README.md rename to packages/api-client/README.md diff --git a/packages/sylius/api-client/api-extractor.json b/packages/api-client/api-extractor.json similarity index 100% rename from packages/sylius/api-client/api-extractor.json rename to packages/api-client/api-extractor.json diff --git a/packages/api-client/jest.config.js b/packages/api-client/jest.config.js new file mode 100644 index 0000000000..dfc57cb356 --- /dev/null +++ b/packages/api-client/jest.config.js @@ -0,0 +1,17 @@ +// For a detailed explanation regarding each configuration property, visit: +// https://jestjs.io/docs/en/configuration.html + +module.exports = { + testMatch: ['/**/__tests__/**/*spec.[jt]s?(x)'], + collectCoverage: true, + transform: { + '^.+\\.[jt]s$': 'ts-jest' + }, + coverageDirectory: './coverage/', + coverageReporters: ['html', 'lcov', 'text'], + collectCoverageFrom: [ + 'src/**/*.ts' + ], + moduleFileExtensions: ['ts', 'js', 'json'], + watchPathIgnorePatterns: ['**/node_modules'], +}; diff --git a/packages/sylius/api-client/package.json b/packages/api-client/package.json similarity index 96% rename from packages/sylius/api-client/package.json rename to packages/api-client/package.json index bfd2561305..d38c9fc7c0 100644 --- a/packages/sylius/api-client/package.json +++ b/packages/api-client/package.json @@ -1,5 +1,5 @@ { - "name": "@realtainment/sylius-api", + "name": "@vue-storefront/sylius-api", "description": "Sylius Api Client", "version": "1.1.2", "server": "server/index.js", diff --git a/packages/sylius/api-client/rollup.config.js b/packages/api-client/rollup.config.js similarity index 100% rename from packages/sylius/api-client/rollup.config.js rename to packages/api-client/rollup.config.js diff --git a/packages/sylius/api-client/src/api/cart/index.ts b/packages/api-client/src/api/cart/index.ts similarity index 98% rename from packages/sylius/api-client/src/api/cart/index.ts rename to packages/api-client/src/api/cart/index.ts index bb4160c2c6..ce51e67ea8 100644 --- a/packages/sylius/api-client/src/api/cart/index.ts +++ b/packages/api-client/src/api/cart/index.ts @@ -31,7 +31,7 @@ export const getCart = async (context, cartId: string, customQuery?: CustomQuery acceptLanguage }; const queryGql = extendQuery(context, getCartQuery, variables, customQuery); - const data = await query(context, queryGql, variables); + const data = await query(context, queryGql.query, variables); return data.order ? transformCart(context, data.order) : {}; }; diff --git a/packages/sylius/api-client/src/api/cart/mutations.ts b/packages/api-client/src/api/cart/mutations.ts similarity index 100% rename from packages/sylius/api-client/src/api/cart/mutations.ts rename to packages/api-client/src/api/cart/mutations.ts diff --git a/packages/sylius/api-client/src/api/cart/queries.ts b/packages/api-client/src/api/cart/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/cart/queries.ts rename to packages/api-client/src/api/cart/queries.ts diff --git a/packages/sylius/api-client/src/api/createOrder/index.ts b/packages/api-client/src/api/createOrder/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/createOrder/index.ts rename to packages/api-client/src/api/createOrder/index.ts diff --git a/packages/sylius/api-client/src/api/createOrder/mutations.ts b/packages/api-client/src/api/createOrder/mutations.ts similarity index 100% rename from packages/sylius/api-client/src/api/createOrder/mutations.ts rename to packages/api-client/src/api/createOrder/mutations.ts diff --git a/packages/sylius/api-client/src/api/filters/index.ts b/packages/api-client/src/api/filters/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/filters/index.ts rename to packages/api-client/src/api/filters/index.ts diff --git a/packages/sylius/api-client/src/api/filters/queries.ts b/packages/api-client/src/api/filters/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/filters/queries.ts rename to packages/api-client/src/api/filters/queries.ts diff --git a/packages/sylius/api-client/src/api/fragments/address.ts b/packages/api-client/src/api/fragments/address.ts similarity index 100% rename from packages/sylius/api-client/src/api/fragments/address.ts rename to packages/api-client/src/api/fragments/address.ts diff --git a/packages/sylius/api-client/src/api/fragments/cart.ts b/packages/api-client/src/api/fragments/cart.ts similarity index 100% rename from packages/sylius/api-client/src/api/fragments/cart.ts rename to packages/api-client/src/api/fragments/cart.ts diff --git a/packages/sylius/api-client/src/api/fragments/customer.ts b/packages/api-client/src/api/fragments/customer.ts similarity index 100% rename from packages/sylius/api-client/src/api/fragments/customer.ts rename to packages/api-client/src/api/fragments/customer.ts diff --git a/packages/sylius/api-client/src/api/fragments/review.ts b/packages/api-client/src/api/fragments/review.ts similarity index 100% rename from packages/sylius/api-client/src/api/fragments/review.ts rename to packages/api-client/src/api/fragments/review.ts diff --git a/packages/sylius/api-client/src/api/getCategory/fragments.ts b/packages/api-client/src/api/getCategory/fragments.ts similarity index 100% rename from packages/sylius/api-client/src/api/getCategory/fragments.ts rename to packages/api-client/src/api/getCategory/fragments.ts diff --git a/packages/sylius/api-client/src/api/getCategory/index.ts b/packages/api-client/src/api/getCategory/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/getCategory/index.ts rename to packages/api-client/src/api/getCategory/index.ts diff --git a/packages/sylius/api-client/src/api/getCategory/queries.ts b/packages/api-client/src/api/getCategory/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/getCategory/queries.ts rename to packages/api-client/src/api/getCategory/queries.ts diff --git a/packages/sylius/api-client/src/api/getCategory/types.ts b/packages/api-client/src/api/getCategory/types.ts similarity index 100% rename from packages/sylius/api-client/src/api/getCategory/types.ts rename to packages/api-client/src/api/getCategory/types.ts diff --git a/packages/sylius/api-client/src/api/getProduct/fragments.ts b/packages/api-client/src/api/getProduct/fragments.ts similarity index 100% rename from packages/sylius/api-client/src/api/getProduct/fragments.ts rename to packages/api-client/src/api/getProduct/fragments.ts diff --git a/packages/sylius/api-client/src/api/getProduct/index.ts b/packages/api-client/src/api/getProduct/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/getProduct/index.ts rename to packages/api-client/src/api/getProduct/index.ts diff --git a/packages/sylius/api-client/src/api/getProduct/queries.ts b/packages/api-client/src/api/getProduct/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/getProduct/queries.ts rename to packages/api-client/src/api/getProduct/queries.ts diff --git a/packages/sylius/api-client/src/api/getProduct/types.ts b/packages/api-client/src/api/getProduct/types.ts similarity index 100% rename from packages/sylius/api-client/src/api/getProduct/types.ts rename to packages/api-client/src/api/getProduct/types.ts diff --git a/packages/sylius/api-client/src/api/helpers.ts b/packages/api-client/src/api/helpers.ts similarity index 100% rename from packages/sylius/api-client/src/api/helpers.ts rename to packages/api-client/src/api/helpers.ts diff --git a/packages/sylius/api-client/src/api/index.ts b/packages/api-client/src/api/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/index.ts rename to packages/api-client/src/api/index.ts diff --git a/packages/sylius/api-client/src/api/review/index.ts b/packages/api-client/src/api/review/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/review/index.ts rename to packages/api-client/src/api/review/index.ts diff --git a/packages/sylius/api-client/src/api/review/mutations.ts b/packages/api-client/src/api/review/mutations.ts similarity index 100% rename from packages/sylius/api-client/src/api/review/mutations.ts rename to packages/api-client/src/api/review/mutations.ts diff --git a/packages/sylius/api-client/src/api/review/queries.ts b/packages/api-client/src/api/review/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/review/queries.ts rename to packages/api-client/src/api/review/queries.ts diff --git a/packages/sylius/api-client/src/api/user/index.ts b/packages/api-client/src/api/user/index.ts similarity index 100% rename from packages/sylius/api-client/src/api/user/index.ts rename to packages/api-client/src/api/user/index.ts diff --git a/packages/sylius/api-client/src/api/user/mutations.ts b/packages/api-client/src/api/user/mutations.ts similarity index 100% rename from packages/sylius/api-client/src/api/user/mutations.ts rename to packages/api-client/src/api/user/mutations.ts diff --git a/packages/sylius/api-client/src/api/user/queries.ts b/packages/api-client/src/api/user/queries.ts similarity index 100% rename from packages/sylius/api-client/src/api/user/queries.ts rename to packages/api-client/src/api/user/queries.ts diff --git a/packages/sylius/api-client/src/apollo.ts b/packages/api-client/src/apollo.ts similarity index 100% rename from packages/sylius/api-client/src/apollo.ts rename to packages/api-client/src/apollo.ts diff --git a/packages/sylius/api-client/src/index.server.ts b/packages/api-client/src/index.server.ts similarity index 100% rename from packages/sylius/api-client/src/index.server.ts rename to packages/api-client/src/index.server.ts diff --git a/packages/sylius/api-client/src/index.ts b/packages/api-client/src/index.ts similarity index 100% rename from packages/sylius/api-client/src/index.ts rename to packages/api-client/src/index.ts diff --git a/packages/sylius/api-client/src/settings.ts b/packages/api-client/src/settings.ts similarity index 100% rename from packages/sylius/api-client/src/settings.ts rename to packages/api-client/src/settings.ts diff --git a/packages/sylius/api-client/src/types.ts b/packages/api-client/src/types.ts similarity index 100% rename from packages/sylius/api-client/src/types.ts rename to packages/api-client/src/types.ts diff --git a/packages/sylius/api-client/tests/api/cart.spec.ts b/packages/api-client/tests/api/cart.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/cart.spec.ts rename to packages/api-client/tests/api/cart.spec.ts diff --git a/packages/sylius/api-client/tests/api/createOrder.spec.ts b/packages/api-client/tests/api/createOrder.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/createOrder.spec.ts rename to packages/api-client/tests/api/createOrder.spec.ts diff --git a/packages/sylius/api-client/tests/api/getCategory.spec.ts b/packages/api-client/tests/api/getCategory.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/getCategory.spec.ts rename to packages/api-client/tests/api/getCategory.spec.ts diff --git a/packages/sylius/api-client/tests/api/getProduct.spec.ts b/packages/api-client/tests/api/getProduct.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/getProduct.spec.ts rename to packages/api-client/tests/api/getProduct.spec.ts diff --git a/packages/sylius/api-client/tests/api/review.spec.ts b/packages/api-client/tests/api/review.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/review.spec.ts rename to packages/api-client/tests/api/review.spec.ts diff --git a/packages/sylius/api-client/tests/api/user.spec.ts b/packages/api-client/tests/api/user.spec.ts similarity index 100% rename from packages/sylius/api-client/tests/api/user.spec.ts rename to packages/api-client/tests/api/user.spec.ts diff --git a/packages/sylius/api-client/tests/setup.spec.ts b/packages/api-client/tests/setup.spec.ts similarity index 81% rename from packages/sylius/api-client/tests/setup.spec.ts rename to packages/api-client/tests/setup.spec.ts index 749612b404..be0b3cee2c 100644 --- a/packages/sylius/api-client/tests/setup.spec.ts +++ b/packages/api-client/tests/setup.spec.ts @@ -1,4 +1,4 @@ -import { createApiClient } from './../src/index.server'; +import { createApiClient } from '../src/index.server'; jest.mock('apollo-client'); diff --git a/packages/sylius/api-client/tests/setup.ts b/packages/api-client/tests/setup.ts similarity index 87% rename from packages/sylius/api-client/tests/setup.ts rename to packages/api-client/tests/setup.ts index 12bc54061f..8974dcb3c0 100644 --- a/packages/sylius/api-client/tests/setup.ts +++ b/packages/api-client/tests/setup.ts @@ -1,4 +1,4 @@ -import { createApiClient } from './../src/index.server'; +import { createApiClient } from '../src/index.server'; jest.mock('apollo-client'); diff --git a/packages/sylius/api-client/tsconfig.json b/packages/api-client/tsconfig.json similarity index 72% rename from packages/sylius/api-client/tsconfig.json rename to packages/api-client/tsconfig.json index 2ab53ecfdc..d399604b1a 100644 --- a/packages/sylius/api-client/tsconfig.json +++ b/packages/api-client/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "../tsconfig.base.json", - "include": ["src"], + "include": [ + "src" + ], "exclude": ["node_modules", "lib"] } diff --git a/packages/api-extractor.base.json b/packages/api-extractor.base.json deleted file mode 100644 index 9f9fe79743..0000000000 --- a/packages/api-extractor.base.json +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Config file for API Extractor. For more info, please visit: https://api-extractor.com - */ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "projectFolder": ".", - "compiler": { - "tsconfigFilePath": "/tsconfig.base.json" - }, - "docModel": { - "enabled": true - }, - "dtsRollup": { - "enabled": true - }, - "tsdocMetadata": { - "enabled": false - }, - "apiReport": { - "enabled": false - }, - "messages": { - "compilerMessageReporting": { - "default": { - "logLevel": "warning" - } - }, - "extractorMessageReporting": { - "default": { - "logLevel": "none", - "addToApiReportFile": false - }, - "ae-extra-release-tag": { - "logLevel": "none", - "addToApiReportFile": false - }, - "ae-forgotten-export": { - "logLevel": "none" - } - }, - "tsdocMessageReporting": { - "default": { - "logLevel": "none", - "addToApiReportFile": false - } - } - } -} \ No newline at end of file diff --git a/packages/sylius/composables/README.md b/packages/composables/README.md similarity index 100% rename from packages/sylius/composables/README.md rename to packages/composables/README.md diff --git a/packages/sylius/composables/api-extractor.json b/packages/composables/api-extractor.json similarity index 100% rename from packages/sylius/composables/api-extractor.json rename to packages/composables/api-extractor.json diff --git a/packages/sylius/jest.base.config.js b/packages/composables/jest.config.js similarity index 52% rename from packages/sylius/jest.base.config.js rename to packages/composables/jest.config.js index d246220ffd..a79e60212e 100644 --- a/packages/sylius/jest.base.config.js +++ b/packages/composables/jest.config.js @@ -3,11 +3,14 @@ module.exports = { transform: { - '^.+\\.(ts)$': 'ts-jest' + '^.+\\.[jt]s$': 'ts-jest' }, coverageDirectory: './coverage/', + coverageReporters: ['html', 'lcov', 'text'], collectCoverageFrom: [ 'src/**/*.ts' ], - collectCoverage: true + moduleFileExtensions: ['ts', 'js', 'json'], + watchPathIgnorePatterns: ['**/node_modules'], + testMatch: ['/**/__tests__/**/*spec.[jt]s?(x)'] }; diff --git a/packages/sylius/composables/nuxt/README.MD b/packages/composables/nuxt/README.MD similarity index 100% rename from packages/sylius/composables/nuxt/README.MD rename to packages/composables/nuxt/README.MD diff --git a/packages/sylius/composables/nuxt/helpers/index.js b/packages/composables/nuxt/helpers/index.js similarity index 100% rename from packages/sylius/composables/nuxt/helpers/index.js rename to packages/composables/nuxt/helpers/index.js diff --git a/packages/sylius/composables/nuxt/index.js b/packages/composables/nuxt/index.js similarity index 100% rename from packages/sylius/composables/nuxt/index.js rename to packages/composables/nuxt/index.js diff --git a/packages/sylius/composables/nuxt/plugin.js b/packages/composables/nuxt/plugin.js similarity index 96% rename from packages/sylius/composables/nuxt/plugin.js rename to packages/composables/nuxt/plugin.js index f385a59285..9da2da641b 100644 --- a/packages/sylius/composables/nuxt/plugin.js +++ b/packages/composables/nuxt/plugin.js @@ -1,5 +1,5 @@ import { integrationPlugin } from '@vue-storefront/core'; -import { mapConfigToSetupObject } from '@realtainment/sylius/nuxt/helpers'; +import { mapConfigToSetupObject } from '@vue-storefront/sylius/nuxt/helpers'; const moduleOptions = JSON.parse('<%= JSON.stringify(options) %>'); const defaultConfig = { diff --git a/packages/sylius/composables/package.json b/packages/composables/package.json similarity index 95% rename from packages/sylius/composables/package.json rename to packages/composables/package.json index 2ae3f86074..f587fdf0e0 100644 --- a/packages/sylius/composables/package.json +++ b/packages/composables/package.json @@ -1,5 +1,5 @@ { - "name": "@realtainment/sylius", + "name": "@vue-storefront/sylius", "description": "Sylius Composables", "version": "1.1.2", "sideEffects": false, diff --git a/packages/sylius/composables/rollup.config.js b/packages/composables/rollup.config.js similarity index 100% rename from packages/sylius/composables/rollup.config.js rename to packages/composables/rollup.config.js diff --git a/packages/sylius/composables/src/useBilling/index.ts b/packages/composables/src/composables/useBilling/index.ts similarity index 90% rename from packages/sylius/composables/src/useBilling/index.ts rename to packages/composables/src/composables/useBilling/index.ts index daf46c66c3..198fb8c259 100644 --- a/packages/sylius/composables/src/useBilling/index.ts +++ b/packages/composables/src/composables/useBilling/index.ts @@ -3,10 +3,10 @@ import { useBillingFactory, UseBillingParams } from '@vue-storefront/core'; -import type { BillingAddress } from '@realtainment/sylius-api'; +import type { BillingAddress } from '@vue-storefront/sylius-api'; import type { UseBillingAddParams as AddParams -} from '../types'; +} from '../../types'; import { useCart } from '../useCart'; const params: UseBillingParams = { provide() { @@ -41,6 +41,9 @@ const params: UseBillingParams = { } }; const addAddressResponse = await context.$sylius.api.addAddress({ addAddressInput }); + + if (addAddressResponse.graphQLErrors) throw addAddressResponse; + return addAddressResponse.billingAddress; } }; diff --git a/packages/sylius/composables/src/useCart/index.ts b/packages/composables/src/composables/useCart/index.ts similarity index 99% rename from packages/sylius/composables/src/useCart/index.ts rename to packages/composables/src/composables/useCart/index.ts index ba41047f4f..5d1d8a474f 100644 --- a/packages/sylius/composables/src/useCart/index.ts +++ b/packages/composables/src/composables/useCart/index.ts @@ -8,7 +8,7 @@ import type { Cart, CartItem, Product -} from '@realtainment/sylius-api'; +} from '@vue-storefront/sylius-api'; const params: UseCartFactoryParams = { load: async (context: Context) => { const apiState = context.$sylius.config.state; diff --git a/packages/sylius/composables/src/useCategory/index.ts b/packages/composables/src/composables/useCategory/index.ts similarity index 92% rename from packages/sylius/composables/src/useCategory/index.ts rename to packages/composables/src/composables/useCategory/index.ts index 191ef35181..f24364cd5a 100644 --- a/packages/sylius/composables/src/useCategory/index.ts +++ b/packages/composables/src/composables/useCategory/index.ts @@ -4,7 +4,7 @@ import { useCategoryFactory, UseCategoryFactoryParams } from '@vue-storefront/core'; -import { Category } from '../types'; +import { Category } from '../../types'; const params: UseCategoryFactoryParams = { categorySearch: async (context: Context, { customQuery, ...searchParams }) => { diff --git a/packages/sylius/composables/src/useContent/index.ts b/packages/composables/src/composables/useContent/index.ts similarity index 100% rename from packages/sylius/composables/src/useContent/index.ts rename to packages/composables/src/composables/useContent/index.ts diff --git a/packages/sylius/composables/src/useFacet/index.ts b/packages/composables/src/composables/useFacet/index.ts similarity index 100% rename from packages/sylius/composables/src/useFacet/index.ts rename to packages/composables/src/composables/useFacet/index.ts diff --git a/packages/sylius/composables/src/useForgotPassword/index.ts b/packages/composables/src/composables/useForgotPassword/index.ts similarity index 100% rename from packages/sylius/composables/src/useForgotPassword/index.ts rename to packages/composables/src/composables/useForgotPassword/index.ts diff --git a/packages/sylius/composables/src/useMakeOrder/index.ts b/packages/composables/src/composables/useMakeOrder/index.ts similarity index 93% rename from packages/sylius/composables/src/useMakeOrder/index.ts rename to packages/composables/src/composables/useMakeOrder/index.ts index c413f55910..0398642456 100644 --- a/packages/sylius/composables/src/useMakeOrder/index.ts +++ b/packages/composables/src/composables/useMakeOrder/index.ts @@ -3,7 +3,7 @@ import { useMakeOrderFactory, UseMakeOrderFactoryParams } from '@vue-storefront/core'; -import type { Order } from '@realtainment/sylius-api'; +import type { Order } from '@vue-storefront/sylius-api'; import { useCart } from '../useCart'; const factoryParams: UseMakeOrderFactoryParams = { provide() { diff --git a/packages/sylius/composables/src/useProduct/index.ts b/packages/composables/src/composables/useProduct/index.ts similarity index 92% rename from packages/sylius/composables/src/useProduct/index.ts rename to packages/composables/src/composables/useProduct/index.ts index fcaa4ee14e..deaa286427 100644 --- a/packages/sylius/composables/src/useProduct/index.ts +++ b/packages/composables/src/composables/useProduct/index.ts @@ -5,7 +5,7 @@ import { UseProductFactoryParams, Logger } from '@vue-storefront/core'; -import { ProductsResponse } from '../types'; +import { ProductsResponse } from '../../types'; const params: UseProductFactoryParams = { productsSearch: async (context: Context, params: ProductsSearchParams): Promise => { const { customQuery, ...searchParams } = params; diff --git a/packages/sylius/composables/src/useReview/index.ts b/packages/composables/src/composables/useReview/index.ts similarity index 95% rename from packages/sylius/composables/src/useReview/index.ts rename to packages/composables/src/composables/useReview/index.ts index 7873eea3d9..8cc0499a35 100644 --- a/packages/sylius/composables/src/useReview/index.ts +++ b/packages/composables/src/composables/useReview/index.ts @@ -3,7 +3,7 @@ import { useReviewFactory, UseReviewFactoryParams } from '@vue-storefront/core'; -import { Review } from '../types'; +import { Review } from '../../types'; const params: UseReviewFactoryParams = { // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/sylius/composables/src/useShipping/index.ts b/packages/composables/src/composables/useShipping/index.ts similarity index 97% rename from packages/sylius/composables/src/useShipping/index.ts rename to packages/composables/src/composables/useShipping/index.ts index 46f59dd230..e0f87170ec 100644 --- a/packages/sylius/composables/src/useShipping/index.ts +++ b/packages/composables/src/composables/useShipping/index.ts @@ -1,5 +1,5 @@ import { useShippingFactory, UseShippingParams, Context } from '@vue-storefront/core'; -import { Address } from '../types'; +import { Address } from '../../types'; import { useCart } from '../useCart'; const params: UseShippingParams = { provide() { diff --git a/packages/sylius/composables/src/useShippingProvider/index.ts b/packages/composables/src/composables/useShippingProvider/index.ts similarity index 93% rename from packages/sylius/composables/src/useShippingProvider/index.ts rename to packages/composables/src/composables/useShippingProvider/index.ts index 86d6438d53..47fe2e74fb 100644 --- a/packages/sylius/composables/src/useShippingProvider/index.ts +++ b/packages/composables/src/composables/useShippingProvider/index.ts @@ -1,5 +1,5 @@ import { useShippingProviderFactory, UseShippingProviderParams, Context } from '@vue-storefront/core'; -import { Shipping, ShippingMethod } from '../types'; +import { Shipping, ShippingMethod } from '../../types'; import { useCart } from '../useCart'; const params: UseShippingProviderParams = { provide() { diff --git a/packages/sylius/composables/src/useStore/index.ts b/packages/composables/src/composables/useStore/index.ts similarity index 100% rename from packages/sylius/composables/src/useStore/index.ts rename to packages/composables/src/composables/useStore/index.ts diff --git a/packages/sylius/composables/src/useUser/index.ts b/packages/composables/src/composables/useUser/index.ts similarity index 99% rename from packages/sylius/composables/src/useUser/index.ts rename to packages/composables/src/composables/useUser/index.ts index e57776018e..1013585de2 100644 --- a/packages/sylius/composables/src/useUser/index.ts +++ b/packages/composables/src/composables/useUser/index.ts @@ -6,7 +6,7 @@ import { useUserFactory, UseUserFactoryParams } from '@vue-storefront/core'; -import { User } from '../types'; +import { User } from '../../types'; import { useCart } from '../useCart'; const params: UseUserFactoryParams = { provide() { diff --git a/packages/sylius/composables/src/useUserBilling/index.ts b/packages/composables/src/composables/useUserBilling/index.ts similarity index 100% rename from packages/sylius/composables/src/useUserBilling/index.ts rename to packages/composables/src/composables/useUserBilling/index.ts diff --git a/packages/sylius/composables/src/useUserOrder/index.ts b/packages/composables/src/composables/useUserOrder/index.ts similarity index 91% rename from packages/sylius/composables/src/useUserOrder/index.ts rename to packages/composables/src/composables/useUserOrder/index.ts index 4725adf84b..daeda4204d 100644 --- a/packages/sylius/composables/src/useUserOrder/index.ts +++ b/packages/composables/src/composables/useUserOrder/index.ts @@ -5,7 +5,7 @@ import { useUserOrderFactory, UseUserOrderFactoryParams } from '@vue-storefront/core'; -import { OrdersResponse, OrderSearchParams } from '../types'; +import { OrdersResponse, OrderSearchParams } from '../../types'; const params: UseUserOrderFactoryParams = { // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/sylius/composables/src/useUserShipping/index.ts b/packages/composables/src/composables/useUserShipping/index.ts similarity index 100% rename from packages/sylius/composables/src/useUserShipping/index.ts rename to packages/composables/src/composables/useUserShipping/index.ts diff --git a/packages/sylius/composables/src/useWishlist/index.ts b/packages/composables/src/composables/useWishlist/index.ts similarity index 95% rename from packages/sylius/composables/src/useWishlist/index.ts rename to packages/composables/src/composables/useWishlist/index.ts index 4d41df8f32..cabe09b771 100644 --- a/packages/sylius/composables/src/useWishlist/index.ts +++ b/packages/composables/src/composables/useWishlist/index.ts @@ -5,7 +5,7 @@ import { UseWishlistFactoryParams } from '@vue-storefront/core'; import { ref, Ref } from '@vue/composition-api'; -import { Wishlist, WishlistProduct, Product } from '../types'; +import { Wishlist, WishlistProduct, Product } from '../../types'; export const wishlist: Ref = ref(null); diff --git a/packages/sylius/composables/src/getters/cartGetters.ts b/packages/composables/src/getters/cartGetters.ts similarity index 97% rename from packages/sylius/composables/src/getters/cartGetters.ts rename to packages/composables/src/getters/cartGetters.ts index 45d5bc6dff..ee1250be64 100644 --- a/packages/sylius/composables/src/getters/cartGetters.ts +++ b/packages/composables/src/getters/cartGetters.ts @@ -1,5 +1,5 @@ import { CartGetters, AgnosticPrice, AgnosticTotals, AgnosticCoupon, AgnosticDiscount } from '@vue-storefront/core'; -import { Cart, CartLineItem } from '@realtainment/sylius-api/src/types'; +import { Cart, CartLineItem } from '@vue-storefront/sylius-api/src/types'; // eslint-disable-next-line @typescript-eslint/no-unused-vars export const getCartItems = (cart: Cart): CartLineItem[] => { @@ -95,7 +95,7 @@ export const getCoupons = (cart: Cart): AgnosticCoupon[] => []; // eslint-disable-next-line @typescript-eslint/no-unused-vars export const getDiscounts = (cart: Cart): AgnosticDiscount[] => { - if (cart.promotionCoupon) { + if (cart?.promotionCoupon) { const promotion = { id: cart.promotionCoupon.code, name: cart.promotionCoupon.promotion.name, diff --git a/packages/sylius/composables/src/getters/categoryGetters.ts b/packages/composables/src/getters/categoryGetters.ts similarity index 90% rename from packages/sylius/composables/src/getters/categoryGetters.ts rename to packages/composables/src/getters/categoryGetters.ts index 084bc5c2e3..c3c70636fa 100644 --- a/packages/sylius/composables/src/getters/categoryGetters.ts +++ b/packages/composables/src/getters/categoryGetters.ts @@ -1,5 +1,5 @@ import { CategoryGetters, AgnosticCategoryTree } from '@vue-storefront/core'; -import { Category } from '@realtainment/sylius-api/src/types'; +import { Category } from '@vue-storefront/sylius-api/src/types'; const itemToTree = (category: Category): AgnosticCategoryTree => { return { diff --git a/packages/sylius/composables/src/getters/facetGetters.ts b/packages/composables/src/getters/facetGetters.ts similarity index 100% rename from packages/sylius/composables/src/getters/facetGetters.ts rename to packages/composables/src/getters/facetGetters.ts diff --git a/packages/sylius/composables/src/getters/forgotPasswordGetters.ts b/packages/composables/src/getters/forgotPasswordGetters.ts similarity index 100% rename from packages/sylius/composables/src/getters/forgotPasswordGetters.ts rename to packages/composables/src/getters/forgotPasswordGetters.ts diff --git a/packages/composables/src/getters/index.ts b/packages/composables/src/getters/index.ts new file mode 100644 index 0000000000..69844c3e41 --- /dev/null +++ b/packages/composables/src/getters/index.ts @@ -0,0 +1,26 @@ +/* istanbul ignore file */ +import { cartGetters } from './cartGetters'; +import { categoryGetters } from './categoryGetters'; +import { facetGetters } from './facetGetters'; +import { forgotPasswordGetters } from './forgotPasswordGetters'; +import { productGetters } from './productGetters'; +import { reviewGetters } from './reviewGetters'; +import { userGetters } from './userGetters'; +import { userShippingGetters } from './userShippingGetters'; +import { userBillingGetters } from './userBillingGetters'; +import { orderGetters } from './orderGetters'; +import { wishlistGetters } from './wishlistGetters'; + +export { + cartGetters, + categoryGetters, + facetGetters, + forgotPasswordGetters, + productGetters, + reviewGetters, + userGetters, + userShippingGetters, + userBillingGetters, + orderGetters, + wishlistGetters +}; diff --git a/packages/sylius/composables/src/getters/orderGetters.ts b/packages/composables/src/getters/orderGetters.ts similarity index 100% rename from packages/sylius/composables/src/getters/orderGetters.ts rename to packages/composables/src/getters/orderGetters.ts diff --git a/packages/sylius/composables/src/getters/productGetters.ts b/packages/composables/src/getters/productGetters.ts similarity index 98% rename from packages/sylius/composables/src/getters/productGetters.ts rename to packages/composables/src/getters/productGetters.ts index 1b0c9ef919..6af7c68f95 100644 --- a/packages/sylius/composables/src/getters/productGetters.ts +++ b/packages/composables/src/getters/productGetters.ts @@ -4,7 +4,7 @@ import { AgnosticPrice, ProductGetters } from '@vue-storefront/core'; -import { Product } from '@realtainment/sylius-api/src/types'; +import { Product } from '@vue-storefront/sylius-api/src/types'; type ProductVariantFilters = any diff --git a/packages/sylius/composables/src/getters/reviewGetters.ts b/packages/composables/src/getters/reviewGetters.ts similarity index 100% rename from packages/sylius/composables/src/getters/reviewGetters.ts rename to packages/composables/src/getters/reviewGetters.ts diff --git a/packages/sylius/composables/src/getters/userBillingGetters.ts b/packages/composables/src/getters/userBillingGetters.ts similarity index 98% rename from packages/sylius/composables/src/getters/userBillingGetters.ts rename to packages/composables/src/getters/userBillingGetters.ts index 401aa02ac1..34cb7b33e0 100644 --- a/packages/sylius/composables/src/getters/userBillingGetters.ts +++ b/packages/composables/src/getters/userBillingGetters.ts @@ -3,7 +3,7 @@ import type { UserBillingAddress as Address, UserAddressItem as AddressItem, UserBillingAddressSearchCriteria -} from '@realtainment/sylius-api'; +} from '@vue-storefront/sylius-api'; // eslint-disable-next-line @typescript-eslint/no-unused-vars function getAddresses(billing, criteria?: UserBillingAddressSearchCriteria): AddressItem[] { diff --git a/packages/sylius/composables/src/getters/userGetters.ts b/packages/composables/src/getters/userGetters.ts similarity index 100% rename from packages/sylius/composables/src/getters/userGetters.ts rename to packages/composables/src/getters/userGetters.ts diff --git a/packages/sylius/composables/src/getters/userShippingGetters.ts b/packages/composables/src/getters/userShippingGetters.ts similarity index 98% rename from packages/sylius/composables/src/getters/userShippingGetters.ts rename to packages/composables/src/getters/userShippingGetters.ts index f4c6e238eb..b4f1119c89 100644 --- a/packages/sylius/composables/src/getters/userShippingGetters.ts +++ b/packages/composables/src/getters/userShippingGetters.ts @@ -3,7 +3,7 @@ import type { UserShippingAddress as Address, UserAddressItem as AddressItem, UserShippingAddressSearchCriteria -} from '@realtainment/sylius-api'; +} from '@vue-storefront/sylius-api'; // eslint-disable-next-line @typescript-eslint/no-unused-vars function getAddresses(shipping, criteria?: UserShippingAddressSearchCriteria): AddressItem[] { diff --git a/packages/sylius/composables/src/getters/wishlistGetters.ts b/packages/composables/src/getters/wishlistGetters.ts similarity index 96% rename from packages/sylius/composables/src/getters/wishlistGetters.ts rename to packages/composables/src/getters/wishlistGetters.ts index 4030b6c716..1998ed280b 100644 --- a/packages/sylius/composables/src/getters/wishlistGetters.ts +++ b/packages/composables/src/getters/wishlistGetters.ts @@ -4,7 +4,7 @@ import { AgnosticPrice, AgnosticTotals } from '@vue-storefront/core'; -import type { Wishlist, WishlistItem } from '@realtainment/sylius-api'; +import type { Wishlist, WishlistItem } from '@vue-storefront/sylius-api'; // eslint-disable-next-line @typescript-eslint/no-unused-vars function getItems(wishlist: Wishlist): WishlistItem[] { diff --git a/packages/composables/src/index.ts b/packages/composables/src/index.ts new file mode 100644 index 0000000000..0985bb0e90 --- /dev/null +++ b/packages/composables/src/index.ts @@ -0,0 +1,24 @@ +// Composables +export { useBilling } from './composables/useBilling'; +export { useCart } from './composables/useCart'; +export { useCategory } from './composables/useCategory'; +export { useContent } from './composables/useContent'; +export { useFacet } from './composables/useFacet'; +export { useForgotPassword } from './composables/useForgotPassword'; +export { useMakeOrder } from './composables/useMakeOrder'; +export { useProduct } from './composables/useProduct'; +export { useReview } from './composables/useReview'; +export { useShipping } from './composables/useShipping'; +export { useShippingProvider } from './composables/useShippingProvider'; +export { useUser } from './composables/useUser'; +export { useStore } from './composables/useStore'; +export { useUserBilling } from './composables/useUserBilling'; +export { useUserOrder } from './composables/useUserOrder'; +export { useUserShipping } from './composables/useUserShipping'; +export { useWishlist } from './composables/useWishlist'; + +// Getters +export * from './getters'; + +// Types +export * from './types'; diff --git a/packages/sylius/composables/src/types/index.ts b/packages/composables/src/types/index.ts similarity index 100% rename from packages/sylius/composables/src/types/index.ts rename to packages/composables/src/types/index.ts diff --git a/packages/sylius/composables/tsconfig.json b/packages/composables/tsconfig.json similarity index 72% rename from packages/sylius/composables/tsconfig.json rename to packages/composables/tsconfig.json index 2ab53ecfdc..d399604b1a 100644 --- a/packages/sylius/composables/tsconfig.json +++ b/packages/composables/tsconfig.json @@ -1,5 +1,7 @@ { "extends": "../tsconfig.base.json", - "include": ["src"], + "include": [ + "src" + ], "exclude": ["node_modules", "lib"] } diff --git a/packages/jest.base.config.js b/packages/jest.base.config.js index a79e60212e..dfc57cb356 100644 --- a/packages/jest.base.config.js +++ b/packages/jest.base.config.js @@ -2,6 +2,8 @@ // https://jestjs.io/docs/en/configuration.html module.exports = { + testMatch: ['/**/__tests__/**/*spec.[jt]s?(x)'], + collectCoverage: true, transform: { '^.+\\.[jt]s$': 'ts-jest' }, @@ -12,5 +14,4 @@ module.exports = { ], moduleFileExtensions: ['ts', 'js', 'json'], watchPathIgnorePatterns: ['**/node_modules'], - testMatch: ['/**/__tests__/**/*spec.[jt]s?(x)'] }; diff --git a/packages/rollup.base.config.js b/packages/rollup.base.config.js index 7107e0ff04..ed452f5847 100644 --- a/packages/rollup.base.config.js +++ b/packages/rollup.base.config.js @@ -1,41 +1,28 @@ -import nodeResolve from '@rollup/plugin-node-resolve'; import typescript from 'rollup-plugin-typescript2'; import { terser } from 'rollup-plugin-terser'; -const extensions = ['.ts', '.js']; - -export function generateBaseConfig(pkg, useTerser = false) { - const plugins = [ - nodeResolve({ - extensions - }), - typescript({ - // eslint-disable-next-line global-require - typescript: require('typescript'), - objectHashIgnoreUnknownHack: false - }) - ]; - - if (useTerser) plugins.push(terser()); - +export function generateBaseConfig(pkg) { return { input: 'src/index.ts', output: [ { file: pkg.main, - format: 'cjs', - sourcemap: true + format: 'cjs' }, { file: pkg.module, - format: 'es', - sourcemap: true + format: 'es' } ], external: [ - ...Object.keys(pkg.dependencies || {}), - ...Object.keys(pkg.peerDependencies || {}) + ...Object.keys(pkg.dependencies || {}) ], - plugins + plugins: [ + typescript({ + // eslint-disable-next-line global-require + typescript: require('typescript') + }), + terser() + ] }; } diff --git a/packages/sylius/api-client/jest.config.js b/packages/sylius/api-client/jest.config.js deleted file mode 100644 index 4333eb5fde..0000000000 --- a/packages/sylius/api-client/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('./../jest.base.config'); - -module.exports = baseConfig; diff --git a/packages/sylius/composables/jest.config.js b/packages/sylius/composables/jest.config.js deleted file mode 100644 index 4333eb5fde..0000000000 --- a/packages/sylius/composables/jest.config.js +++ /dev/null @@ -1,3 +0,0 @@ -const baseConfig = require('./../jest.base.config'); - -module.exports = baseConfig; diff --git a/packages/sylius/composables/src/getters/index.ts b/packages/sylius/composables/src/getters/index.ts deleted file mode 100644 index 3ca3d41012..0000000000 --- a/packages/sylius/composables/src/getters/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* istanbul ignore file */ -import cartGetters from './cartGetters'; -import categoryGetters from './categoryGetters'; -import facetGetters from './facetGetters'; -import productGetters from './productGetters'; -import reviewGetters from './reviewGetters'; -import userGetters from './userGetters'; -import userShippingGetters from './userShippingGetters'; -import userBillingGetters from './userBillingGetters'; -import orderGetters from './orderGetters'; -import wishlistGetters from './wishlistGetters'; - -export { - cartGetters, - categoryGetters, - facetGetters, - productGetters, - reviewGetters, - userGetters, - userShippingGetters, - userBillingGetters, - orderGetters, - wishlistGetters -}; diff --git a/packages/sylius/composables/src/index.ts b/packages/sylius/composables/src/index.ts deleted file mode 100644 index b89c451b29..0000000000 --- a/packages/sylius/composables/src/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Composables -export { useBilling } from './useBilling'; -export { useCart } from './useCart'; -export { useCategory } from './useCategory'; -export { useContent } from './useContent'; -export { useFacet } from './useFacet'; -export { useForgotPassword } from './useForgotPassword'; -export { useMakeOrder } from './useMakeOrder'; -export { useProduct } from './useProduct'; -export { useReview } from './useReview'; -export { useShipping } from './useShipping'; -export { useShippingProvider } from './useShippingProvider'; -export { useUser } from './useUser'; -export { useStore } from './useStore'; -export { useUserBilling } from './useUserBilling'; -export { useUserOrder } from './useUserOrder'; -export { useUserShipping } from './useUserShipping'; -export { useWishlist } from './useWishlist'; - -// Getters -export { cartGetters } from './getters/cartGetters'; -export { categoryGetters } from './getters/categoryGetters'; -export { facetGetters } from './getters/facetGetters'; -export { forgotPasswordGetters } from './getters/forgotPasswordGetters'; -export { orderGetters } from './getters/orderGetters'; -export { productGetters } from './getters/productGetters'; -export { reviewGetters } from './getters/reviewGetters'; -export { userBillingGetters } from './getters/userBillingGetters'; -export { userGetters } from './getters/userGetters'; -export { userShippingGetters } from './getters/userShippingGetters'; -export { wishlistGetters } from './getters/wishlistGetters'; - -// Types -export * from './types'; diff --git a/packages/sylius/rollup.base.config.js b/packages/sylius/rollup.base.config.js deleted file mode 100644 index ed452f5847..0000000000 --- a/packages/sylius/rollup.base.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import typescript from 'rollup-plugin-typescript2'; -import { terser } from 'rollup-plugin-terser'; - -export function generateBaseConfig(pkg) { - return { - input: 'src/index.ts', - output: [ - { - file: pkg.main, - format: 'cjs' - }, - { - file: pkg.module, - format: 'es' - } - ], - external: [ - ...Object.keys(pkg.dependencies || {}) - ], - plugins: [ - typescript({ - // eslint-disable-next-line global-require - typescript: require('typescript') - }), - terser() - ] - }; -} diff --git a/packages/sylius/tsconfig.base.json b/packages/sylius/tsconfig.base.json deleted file mode 100644 index 55f81c31e0..0000000000 --- a/packages/sylius/tsconfig.base.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./lib", - "esModuleInterop": true, - "target": "es5", - "module": "ES2015", - "moduleResolution": "node", - "importHelpers": true, - "noEmitHelpers": true, - "sourceMap": true, - "declaration": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": "./", - "lib": ["es6", "es7"], - "strict": false, - }, - "exclude": ["node_modules", "**/*.spec.ts"] -} diff --git a/packages/sylius/theme/.editorconfig b/packages/theme/.editorconfig similarity index 100% rename from packages/sylius/theme/.editorconfig rename to packages/theme/.editorconfig diff --git a/packages/sylius/theme/.gitignore b/packages/theme/.gitignore similarity index 100% rename from packages/sylius/theme/.gitignore rename to packages/theme/.gitignore diff --git a/packages/sylius/theme/README.md b/packages/theme/README.md similarity index 100% rename from packages/sylius/theme/README.md rename to packages/theme/README.md diff --git a/packages/sylius/theme/assets/styles.scss b/packages/theme/assets/styles.scss similarity index 100% rename from packages/sylius/theme/assets/styles.scss rename to packages/theme/assets/styles.scss diff --git a/packages/sylius/theme/components/AppHeader.vue b/packages/theme/components/AppHeader.vue similarity index 99% rename from packages/sylius/theme/components/AppHeader.vue rename to packages/theme/components/AppHeader.vue index cdd53bf3b8..81ca960880 100644 --- a/packages/sylius/theme/components/AppHeader.vue +++ b/packages/theme/components/AppHeader.vue @@ -101,7 +101,7 @@ + + diff --git a/packages/sylius/theme/components/LoginModal.vue b/packages/theme/components/LoginModal.vue similarity index 99% rename from packages/sylius/theme/components/LoginModal.vue rename to packages/theme/components/LoginModal.vue index 275d64fd05..9506e3de52 100644 --- a/packages/sylius/theme/components/LoginModal.vue +++ b/packages/theme/components/LoginModal.vue @@ -200,7 +200,7 @@ import { ref, watch, reactive, computed } from '@vue/composition-api'; import { SfModal, SfInput, SfButton, SfCheckbox, SfLoader, SfAlert, SfBar } from '@storefront-ui/vue'; import { ValidationProvider, ValidationObserver, extend } from 'vee-validate'; import { required, email } from 'vee-validate/dist/rules'; -import { useUser, useForgotPassword } from '@realtainment/sylius'; +import { useUser, useForgotPassword } from '@vue-storefront/sylius'; import { useUiState } from '~/composables'; extend('email', { diff --git a/packages/sylius/theme/components/MyAccount/BillingAddressForm.vue b/packages/theme/components/MyAccount/BillingAddressForm.vue similarity index 100% rename from packages/sylius/theme/components/MyAccount/BillingAddressForm.vue rename to packages/theme/components/MyAccount/BillingAddressForm.vue diff --git a/packages/sylius/theme/components/MyAccount/PasswordResetForm.vue b/packages/theme/components/MyAccount/PasswordResetForm.vue similarity index 100% rename from packages/sylius/theme/components/MyAccount/PasswordResetForm.vue rename to packages/theme/components/MyAccount/PasswordResetForm.vue diff --git a/packages/sylius/theme/components/MyAccount/ProfileUpdateForm.vue b/packages/theme/components/MyAccount/ProfileUpdateForm.vue similarity index 98% rename from packages/sylius/theme/components/MyAccount/ProfileUpdateForm.vue rename to packages/theme/components/MyAccount/ProfileUpdateForm.vue index abe1d67652..8c36502398 100644 --- a/packages/sylius/theme/components/MyAccount/ProfileUpdateForm.vue +++ b/packages/theme/components/MyAccount/ProfileUpdateForm.vue @@ -101,7 +101,7 @@ + + diff --git a/packages/sylius/theme/pages/Checkout.vue b/packages/theme/pages/Checkout.vue similarity index 100% rename from packages/sylius/theme/pages/Checkout.vue rename to packages/theme/pages/Checkout.vue diff --git a/packages/sylius/theme/pages/Checkout/Billing.vue b/packages/theme/pages/Checkout/Billing.vue similarity index 97% rename from packages/sylius/theme/pages/Checkout/Billing.vue rename to packages/theme/pages/Checkout/Billing.vue index 72bd726cbb..0f384108ed 100644 --- a/packages/sylius/theme/pages/Checkout/Billing.vue +++ b/packages/theme/pages/Checkout/Billing.vue @@ -196,7 +196,7 @@ import { SfCheckbox } from '@storefront-ui/vue'; import { ref, computed, onMounted } from '@vue/composition-api'; -import { useBilling, useUser, useUserBilling, userBillingGetters } from '@realtainment/sylius'; +import { useBilling, useUser, useUserBilling, userBillingGetters } from '@vue-storefront/sylius'; import { required, min, digits, email } from 'vee-validate/dist/rules'; import { ValidationProvider, ValidationObserver, extend } from 'vee-validate'; import { onSSR, useVSFContext } from '@vue-storefront/core'; @@ -260,11 +260,8 @@ export default { let hasErrors = false; if (errors.length) { errors.forEach(errorKey => { - if ( - error.value[errorKey] && - error.value[errorKey]?.response?.data?.graphQLErrors?.length - ) { - const e = error.value[errorKey].response.data.graphQLErrors[0]; + if (error.value[errorKey]?.graphQLErrors?.length) { + const e = error.value[errorKey].graphQLErrors[0]; send({ type: 'danger', message: e.debugMessage}); hasErrors = true; diff --git a/packages/sylius/theme/pages/Checkout/Payment.vue b/packages/theme/pages/Checkout/Payment.vue similarity index 93% rename from packages/sylius/theme/pages/Checkout/Payment.vue rename to packages/theme/pages/Checkout/Payment.vue index 0bc1d65c00..8925180c0a 100644 --- a/packages/sylius/theme/pages/Checkout/Payment.vue +++ b/packages/theme/pages/Checkout/Payment.vue @@ -75,14 +75,6 @@ - - - -
@@ -121,7 +113,7 @@ import { } from '@storefront-ui/vue'; import { onSSR } from '@vue-storefront/core'; import { ref, computed } from '@vue/composition-api'; -import { useMakeOrder, useCart, cartGetters, orderGetters } from '@realtainment/sylius'; +import { useMakeOrder, useCart, cartGetters, orderGetters } from '@vue-storefront/sylius'; export default { name: 'ReviewOrder', @@ -144,7 +136,6 @@ export default { const { order, make, loading } = useMakeOrder(); const isPaymentReady = ref(false); - const terms = ref(false); onSSR(async () => { await load(); @@ -159,7 +150,6 @@ export default { return { isPaymentReady, - terms, loading, products: computed(() => cartGetters.getItems(cart.value)), totals: computed(() => cartGetters.getTotals(cart.value)), @@ -214,9 +204,6 @@ export default { --price-font-size: var(--font-size--base); } .summary { - &__terms { - margin: var(--spacer-base) 0 0 0; - } &__total { margin: 0 0 var(--spacer-sm) 0; flex: 0 0 16.875rem; diff --git a/packages/sylius/theme/pages/Checkout/Shipping.vue b/packages/theme/pages/Checkout/Shipping.vue similarity index 99% rename from packages/sylius/theme/pages/Checkout/Shipping.vue rename to packages/theme/pages/Checkout/Shipping.vue index c40e557fb9..8567424c9b 100644 --- a/packages/sylius/theme/pages/Checkout/Shipping.vue +++ b/packages/theme/pages/Checkout/Shipping.vue @@ -205,7 +205,7 @@ import { } from '@storefront-ui/vue'; import { ref, computed, onMounted } from '@vue/composition-api'; import { useUiNotification } from '~/composables/'; -import { useBilling, useShipping, useUserShipping, userShippingGetters, useUser } from '@realtainment/sylius'; +import { useBilling, useShipping, useUserShipping, userShippingGetters, useUser } from '@vue-storefront/sylius'; import { required, min, digits } from 'vee-validate/dist/rules'; import { ValidationProvider, ValidationObserver, extend } from 'vee-validate'; import { onSSR, useVSFContext } from '@vue-storefront/core'; diff --git a/packages/sylius/theme/pages/Checkout/ThankYou.vue b/packages/theme/pages/Checkout/ThankYou.vue similarity index 99% rename from packages/sylius/theme/pages/Checkout/ThankYou.vue rename to packages/theme/pages/Checkout/ThankYou.vue index cd8ff4f644..28549c0e55 100644 --- a/packages/sylius/theme/pages/Checkout/ThankYou.vue +++ b/packages/theme/pages/Checkout/ThankYou.vue @@ -78,7 +78,7 @@