Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Vendure 2.1.1 Migration #271

Merged
merged 26 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
33e6fcf
feat: updated vendure's version to 2.1.1 and removed dependencies on …
dalyathan Oct 19, 2023
5690488
feat: readme and packgae version updated
Oct 20, 2023
25239b3
feat: merged with main
Oct 20, 2023
384b776
feat: run prettier
Oct 20, 2023
d591904
feat: merged with latest from main and tested all queries
Oct 25, 2023
52004fa
feat: removed body parser middlewares in all plugins which had them
Oct 25, 2023
a0ded6a
feat: updatd laetst version number on some packages and changelog cur…
Oct 25, 2023
6633093
feat: tests fro admin ui compilation added
Oct 26, 2023
9e0acea
feat: increase timeout for admi ui compilation test from 60000 to 100000
Oct 26, 2023
60cb518
feat: order export plugin timeout admin ui compilation test timeout v…
Oct 26, 2023
532c5aa
feat: picuqer plugin admin ui compilation test timeout value is incre…
Oct 26, 2023
a6934f9
feat: myparcel plugin admin ui compilation test timeout value is incr…
Oct 26, 2023
74b5491
feat: modify customer order plugin admin ui compilation test timeout …
Oct 26, 2023
b835a8f
feat: primary collection plugin admin ui compilation test timeout val…
Oct 26, 2023
f719672
feat: e-boekhouden plugin admin ui compilation test timeout value is …
Oct 26, 2023
6ed8333
feat: order export plugin admin ui compilation test timeout value is …
Oct 26, 2023
1206b4b
feat: all plugin admin ui compilation test timeout value is increased…
Oct 26, 2023
55d15e9
feat: vitest after all callback added to all tests that destroy the t…
Oct 26, 2023
1cd6711
feat: added timeout to afterAll hoojks
Oct 26, 2023
52f526d
fix: removed dupliocate afterAll hooks and added timeout of 100000 to…
Oct 26, 2023
74db33d
feat: removed custom request context creationa and moved the getFiles…
Oct 27, 2023
8531ab8
Merge branch 'main' into feat/vendure-2.1.1-migration
martijnvdbrug Nov 2, 2023
fb3c53c
Merge remote-tracking branch 'origin/main' into feat/vendure-2.1.1-mi…
martijnvdbrug Nov 2, 2023
13fc45d
feat: kept the middleware while parsing the request body manually
Nov 3, 2023
cbb3fea
feat(sendcloud,picqer): readded middleware
martijnvdbrug Nov 3, 2023
d4bfce5
feat(sendcloud,picqer): middleware fixes
martijnvdbrug Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"@types/sharp": "0.28.0",
"@types/tmp": "0.2.3",
"@typescript-eslint/eslint-plugin": "5.43.0",
"@vendure/admin-ui-plugin": "2.0.9",
"@vendure/asset-server-plugin": "2.0.9",
"@vendure/core": "2.0.9",
"@vendure/email-plugin": "2.0.9",
"@vendure/testing": "2.0.9",
"@vendure/ui-devkit": "2.0.9",
"@vendure/admin-ui-plugin": "2.1.1",
"@vendure/asset-server-plugin": "2.1.1",
"@vendure/core": "2.1.1",
"@vendure/email-plugin": "2.1.1",
"@vendure/testing": "2.1.1",
"@vendure/ui-devkit": "2.1.1",
"aws-sdk": "2.1099.0",
"copyfiles": "2.4.1",
"eslint": "8.0.1",
Expand Down
20 changes: 20 additions & 0 deletions packages/test/src/compile-admin-ui.util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import fs from 'fs';
import path from 'path';
import {
AdminUiExtension,
compileUiExtensions,
} from '@vendure/ui-devkit/compiler';
export default async function getFilesInAdminUiFolder(
dirname: string,
uiExtension: AdminUiExtension
): Promise<string[]> {
fs.rmSync(path.join(dirname, '__admin-ui'), {
recursive: true,
force: true,
});
await compileUiExtensions({
outputPath: path.join(dirname, '__admin-ui'),
extensions: [uiExtension],
}).compile?.();
return fs.readdirSync(path.join(dirname, '__admin-ui/dist'));
}
4 changes: 4 additions & 0 deletions packages/vendure-order-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.3.0 (2023-10-24)

- Updated vendure to 2.1.1

# 2.2.0 (2023-10-03)

- Added Eligible Shipping Method store with value, loading state and error([#265](https://github.com/Pinelab-studio/pinelab-vendure-plugins/pull/265))
Expand Down
2 changes: 1 addition & 1 deletion packages/vendure-order-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-order-client",
"version": "2.2.0",
"version": "2.3.0",
"description": "A tiny, framework agnostic client for managing active orders and checkout with Vendure.",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ describe(

afterAll(async () => {
await server.destroy();
});
}, 100000);
},
{ timeout: 10000 }
);
4 changes: 3 additions & 1 deletion packages/vendure-plugin-admin-ui-helpers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
2 changes: 1 addition & 1 deletion packages/vendure-plugin-admin-ui-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-admin-ui-helpers",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for various admin ui helpers. Cancel button, complete order button etc.",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
4 changes: 3 additions & 1 deletion packages/vendure-plugin-coinbase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
2 changes: 1 addition & 1 deletion packages/vendure-plugin-coinbase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-coinbase",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for Coinbase payments",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
2 changes: 1 addition & 1 deletion packages/vendure-plugin-coinbase/test/coinbase.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Coinbase payments', () => {

afterAll(async () => {
await server.destroy();
});
}, 100000);

it('Should start successfully', async () => {
expect(started).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-customer-managed-groups",
"version": "1.0.2",
"version": "1.1.0",
"description": "This plugin allows customer groups to have 'Group admins', that are allowed to fetch placed orders for everyone in the group.",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,5 +559,5 @@ describe('Customer managed groups', function () {

afterAll(async () => {
await server.destroy();
});
}, 100000);
});
4 changes: 3 additions & 1 deletion packages/vendure-plugin-dutch-postalcode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
2 changes: 1 addition & 1 deletion packages/vendure-plugin-dutch-postalcode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-dutch-postalcode",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for retrieving Dutch addresses by postal code via postcode.tech",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
4 changes: 3 additions & 1 deletion packages/vendure-plugin-e-boekhouden/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
2 changes: 1 addition & 1 deletion packages/vendure-plugin-e-boekhouden/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-e-boekhouden",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for integration with the e-boekhouden accounting platform",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
19 changes: 15 additions & 4 deletions packages/vendure-plugin-e-boekhouden/test/e-boekhouden.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import nock from 'nock';
import { testPaymentMethod } from '../../test/src/test-payment-method';
import { createSettledOrder } from '../../test/src/shop-utils';
import { expect, describe, beforeAll, afterAll, it, vi, test } from 'vitest';

import path from 'path';
import * as fs from 'fs';
import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
import getFilesInAdminUiFolder from '../../test/src/compile-admin-ui.util';
describe('E-boekhouden plugin', function () {
let server: TestServer;
let adminClient: SimpleGraphQLClient;
Expand Down Expand Up @@ -141,9 +144,17 @@ describe('E-boekhouden plugin', function () {
expect(payloads[1]).toContain(eBoekhoudenConfig.contraAccount);
});

afterAll(() => {
return server.destroy();
});
it('Should compile admin', async () => {
const files = await getFilesInAdminUiFolder(
__dirname,
EBoekhoudenPlugin.ui
);
expect(files?.length).toBeGreaterThan(0);
}, 200000);

afterAll(async () => {
await server.destroy();
}, 100000);
});

const openSessionMock = `<?xml version="1.0" encoding="utf-8"?>
Expand Down
4 changes: 3 additions & 1 deletion packages/vendure-plugin-goedgepickt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// TODO set correct version number + date and the changes you've made connected to the PR. See this example for the correct format: https://github.com/Pinelab-studio/pinelab-vendure-plugins/blob/main/packages/vendure-plugin-invoices/CHANGELOG.md
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
2 changes: 1 addition & 1 deletion packages/vendure-plugin-goedgepickt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-goedgepickt",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for integration with the Goedgepickt order picking platform",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { GoedgepicktConfigEntity } from './api/goedgepickt-config.entity';
import path from 'path';
import { AdminUiExtension } from '@vendure/ui-devkit/compiler';
import { customFields } from './api/custom-fields';
import { createRawBodyMiddleWare } from '../../util/src/raw-body';

@VendurePlugin({
imports: [PluginCommonModule],
Expand All @@ -35,7 +34,6 @@ import { createRawBodyMiddleWare } from '../../util/src/raw-body';
resolvers: [GoedgepicktResolver],
},
configuration: (config: RuntimeVendureConfig) => {
config.apiOptions.middleware.push(createRawBodyMiddleWare('/goedgepickt*'));
config.shippingOptions.fulfillmentHandlers.push(goedgepicktHandler);
config.authOptions.customPermissions.push(goedgepicktPermission);
config.customFields.Order.push(...customFields.Order!);
Expand Down
24 changes: 10 additions & 14 deletions packages/vendure-plugin-goedgepickt/test/goedgepickt.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { addItem, createSettledOrder } from '../../test/src/shop-utils';
import { testPaymentMethod } from '../../test/src/test-payment-method';
import gql from 'graphql-tag';
import { expect, describe, beforeAll, afterAll, it, vi, test } from 'vitest';
import getFilesInAdminUiFolder from '../../test/src/compile-admin-ui.util';
describe('Goedgepickt plugin', function () {
const defaultChannelToken = 'e2e-default-channel';
let server: TestServer;
Expand Down Expand Up @@ -398,22 +399,17 @@ describe('Goedgepickt plugin', function () {
expect(payload).toBeDefined();
});

it.skip('Should compile admin', async () => {
fs.rmSync(path.join(__dirname, '__admin-ui'), {
recursive: true,
force: true,
});
await compileUiExtensions({
outputPath: path.join(__dirname, '__admin-ui'),
extensions: [GoedgepicktPlugin.ui],
}).compile?.();
const files = fs.readdirSync(path.join(__dirname, '__admin-ui/dist'));
it('Should compile admin', async () => {
const files = await getFilesInAdminUiFolder(
__dirname,
GoedgepicktPlugin.ui
);
expect(files?.length).toBeGreaterThan(0);
}, 240000);
}, 200000);

afterAll(() => {
return server.destroy();
});
afterAll(async () => {
await server.destroy();
}, 100000);

async function findVariantBySku(sku: string): Promise<ProductVariant | null> {
const ctx = await server.app
Expand Down
4 changes: 4 additions & 0 deletions packages/vendure-plugin-google-cloud-tasks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.0 (2023-10-24)

- Updated vendure to 2.1.1

# 1.1.2 (2023-09-26)

- Added `onJobFailure` option to inspect errors from failed jobs([#262](https://github.com/Pinelab-studio/pinelab-vendure-plugins/pull/262))
5 changes: 2 additions & 3 deletions packages/vendure-plugin-google-cloud-tasks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-google-cloud-tasks",
"version": "1.1.2",
"version": "1.2.0",
"description": "Vendure plugin for using worker jobs with Google Cloud Tasks",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand All @@ -24,8 +24,7 @@
"start": "yarn ts-node test/dev-server.ts"
},
"dependencies": {
"@google-cloud/tasks": "^3.1.2",
"body-parser": "^1.20.2"
"@google-cloud/tasks": "^3.1.2"
},
"gitHead": "476f36da3aafea41fbf21c70774a30306f1d238f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
VendurePlugin,
} from '@vendure/core';
import { CloudTasksJobQueueStrategy } from './cloud-tasks-job-queue.strategy';
import { json } from 'body-parser';
import { CloudTasksHandler } from './cloud-tasks.handler';
import { CloudTaskOptions, ROUTE } from './types';
import { JobRecord } from '@vendure/core/dist/plugin/default-job-queue-plugin/job-record.entity';
Expand All @@ -17,16 +16,6 @@ import { JobRecord } from '@vendure/core/dist/plugin/default-job-queue-plugin/jo
config.jobQueueOptions.jobQueueStrategy = new CloudTasksJobQueueStrategy(
CloudTasksPlugin.options
);
config.apiOptions.middleware = [
{
route: `/${ROUTE}`,
beforeListen: true,
handler: json({
limit: CloudTasksPlugin.options.bodySizeLimit || '1mb',
}),
},
...config.apiOptions.middleware,
];
return config;
},
compatibility: '^2.0.0',
Expand Down
7 changes: 3 additions & 4 deletions packages/vendure-plugin-google-cloud-tasks/test/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ describe('CloudTasks job queue e2e', () => {
started = true;
}, 60000);

afterAll(async () => {
await server.destroy();
});

it('Should start successfully', async () => {
expect(started).toBe(true);
});
Expand Down Expand Up @@ -158,4 +154,7 @@ describe('CloudTasks job queue e2e', () => {
);
expect(res.status).toBe(200);
});
afterAll(async () => {
await server.destroy();
}, 100000);
});
3 changes: 3 additions & 0 deletions packages/vendure-plugin-google-storage-assets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.1.0 (2023-10-24)

- Updated vendure to 2.1.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-google-storage-assets",
"version": "1.0.2",
"version": "1.1.0",
"description": "Vendure plugin for uploading assets to Google storage",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
4 changes: 4 additions & 0 deletions packages/vendure-plugin-invoices/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.0 (2023-10-24)

- Updated vendure to 2.1.1

# 1.1.0 (2023-08-14)

- Allow specifying invoice template storage in DB by specifying DB engine: INVOICES_PLUGIN_DB_ENGINE=mysql ([#243](https://github.com/Pinelab-studio/pinelab-vendure-plugins/pull/243))
2 changes: 1 addition & 1 deletion packages/vendure-plugin-invoices/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pinelab/vendure-plugin-invoices",
"version": "1.1.2",
"version": "1.2.0",
"description": "Vendure plugin for invoice generation",
"author": "Martijn van de Brug <[email protected]>",
"homepage": "https://pinelab-plugins.com/",
Expand Down
21 changes: 15 additions & 6 deletions packages/vendure-plugin-invoices/test/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import {
getConfigQuery,
upsertConfigMutation,
} from '../src/ui/queries.graphql';
import path from 'path';
import * as fs from 'fs';
import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
import getFilesInAdminUiFolder from '../../test/src/compile-admin-ui.util';

describe('Invoices plugin', function () {
let server: TestServer;
Expand Down Expand Up @@ -112,7 +116,7 @@ describe('Invoices plugin', function () {

it('Gets all invoices after 3s', async () => {
// Give the worker some time to process
await new Promise((resolve) => setTimeout(resolve, 3000));
await new Promise((resolve) => setTimeout(resolve, 4000));
const result = await adminClient.query<InvoicesQuery>(getAllInvoicesQuery);
invoice = result.invoices.items[0];
expect(result.invoices.totalItems).toBe(1);
Expand All @@ -131,7 +135,7 @@ describe('Invoices plugin', function () {
await server.app
.get(InvoiceService)
.createAndSaveInvoice(channel.id as string, invoice.orderCode);
} catch (e) {
} catch (e: any) {
expect(e.message).toContain('was already created');
}
});
Expand Down Expand Up @@ -165,7 +169,7 @@ describe('Invoices plugin', function () {

it('Has incremental invoice number', async () => {
await createSettledOrder(shopClient as any, 3);
await new Promise((resolve) => setTimeout(resolve, 2000));
await new Promise((resolve) => setTimeout(resolve, 4000));
const result = await adminClient.query<InvoicesQuery>(getAllInvoicesQuery);
const newInvoice = result.invoices.items[0];
const oldInvoice = result.invoices.items[1];
Expand Down Expand Up @@ -200,7 +204,12 @@ describe('Invoices plugin', function () {
expect(res.status).toBe(403);
});

afterAll(() => {
return server.destroy();
});
it('Should compile admin', async () => {
const files = await getFilesInAdminUiFolder(__dirname, InvoicePlugin.ui);
expect(files?.length).toBeGreaterThan(0);
}, 200000);

afterAll(async () => {
await server.destroy();
}, 100000);
});
Loading
Loading