From 1cb4b7b29671313b31f01303bb203dcf3dc5d6bf Mon Sep 17 00:00:00 2001 From: Mathieu Huchet <59565911+tlnd-mhuchet@users.noreply.github.com> Date: Mon, 9 Oct 2023 14:10:15 +0200 Subject: [PATCH 1/5] fix(TFD-16296): Add ellipsis on collapsible panel (#4926) * fix(TFD-16296): Add ellipsis on collapsible panel * changeset --- .changeset/spotty-cups-judge.md | 5 +++++ .../CollapsiblePanel/CollapsiblePanel.module.scss | 7 +++++++ .../src/CollapsiblePanel/CollapsiblePanel.stories.js | 12 ++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 .changeset/spotty-cups-judge.md diff --git a/.changeset/spotty-cups-judge.md b/.changeset/spotty-cups-judge.md new file mode 100644 index 00000000000..acfe1887b5b --- /dev/null +++ b/.changeset/spotty-cups-judge.md @@ -0,0 +1,5 @@ +--- +'@talend/react-components': patch +--- + +fix(TFD-16296): Add ellipsis on collapsible panel header diff --git a/packages/components/src/CollapsiblePanel/CollapsiblePanel.module.scss b/packages/components/src/CollapsiblePanel/CollapsiblePanel.module.scss index 9d5d3bafbfd..e6209d3b2d5 100644 --- a/packages/components/src/CollapsiblePanel/CollapsiblePanel.module.scss +++ b/packages/components/src/CollapsiblePanel/CollapsiblePanel.module.scss @@ -173,6 +173,13 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default; display: flex; align-items: center; justify-content: space-between; + min-width: 0; // trick to avoid conflict between flex and overflow + + > * { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } } } diff --git a/packages/components/src/CollapsiblePanel/CollapsiblePanel.stories.js b/packages/components/src/CollapsiblePanel/CollapsiblePanel.stories.js index 5f82d512400..192752ac0d5 100644 --- a/packages/components/src/CollapsiblePanel/CollapsiblePanel.stories.js +++ b/packages/components/src/CollapsiblePanel/CollapsiblePanel.stories.js @@ -172,6 +172,18 @@ export const Header = () => (

Collapsible Panel Headers

+ + Panel content + Date: Mon, 9 Oct 2023 14:51:37 +0200 Subject: [PATCH 2/5] chore: prepare release (#4923) Co-authored-by: github-actions[bot] --- .changeset/silent-boxes-pretend.md | 6 ------ .changeset/spotty-cups-judge.md | 5 ----- .changeset/twelve-pears-admire.md | 11 ----------- fork/bootstrap-sass/CHANGELOG.md | 11 +++++++++++ fork/bootstrap-sass/package.json | 2 +- packages/components/CHANGELOG.md | 8 ++++++++ packages/components/package.json | 8 ++++---- packages/theme/CHANGELOG.md | 11 +++++++++++ packages/theme/package.json | 4 ++-- tools/scripts-config-react-webpack/CHANGELOG.md | 6 ++++++ tools/scripts-config-react-webpack/package.json | 2 +- 11 files changed, 44 insertions(+), 30 deletions(-) delete mode 100644 .changeset/silent-boxes-pretend.md delete mode 100644 .changeset/spotty-cups-judge.md delete mode 100644 .changeset/twelve-pears-admire.md diff --git a/.changeset/silent-boxes-pretend.md b/.changeset/silent-boxes-pretend.md deleted file mode 100644 index de5442a5244..00000000000 --- a/.changeset/silent-boxes-pretend.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -'@talend/scripts-config-react-webpack': minor -'@talend/bootstrap-theme': minor ---- - -feat: upgrade some webpack loader diff --git a/.changeset/spotty-cups-judge.md b/.changeset/spotty-cups-judge.md deleted file mode 100644 index acfe1887b5b..00000000000 --- a/.changeset/spotty-cups-judge.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@talend/react-components': patch ---- - -fix(TFD-16296): Add ellipsis on collapsible panel header diff --git a/.changeset/twelve-pears-admire.md b/.changeset/twelve-pears-admire.md deleted file mode 100644 index 7c581a2a553..00000000000 --- a/.changeset/twelve-pears-admire.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -'@talend/bootstrap-sass': minor ---- - -* 275e7da72 2023-08-03 feat(TDOPS-4875): use elevation tokens (#4821) -* bfc02c4fb 2023-07-24 feat(ARCH-720): use design-tokens for colors (#4779) -* c18aabb97 2023-01-12 feat(ARCH-662/scripts-core): move to ESM and remove presets (#4531) -* aa5223cf3 2021-12-20 chore(ARCH-404/CI): decrease time needed (#3564) -* 4842bffc2 2021-11-02 chore: wake up the playground to test UMDs (#3428) -* 667cd0a50 2021-10-05 chore: upgrade dependencies (#3459) - diff --git a/fork/bootstrap-sass/CHANGELOG.md b/fork/bootstrap-sass/CHANGELOG.md index f6634c90ed3..768f54ad9ec 100644 --- a/fork/bootstrap-sass/CHANGELOG.md +++ b/fork/bootstrap-sass/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 3.5.0 + +### Minor Changes + +- 9d137cb98: \* 275e7da72 2023-08-03 feat(TDOPS-4875): use elevation tokens (#4821) + - bfc02c4fb 2023-07-24 feat(ARCH-720): use design-tokens for colors (#4779) + - c18aabb97 2023-01-12 feat(ARCH-662/scripts-core): move to ESM and remove presets (#4531) + - aa5223cf3 2021-12-20 chore(ARCH-404/CI): decrease time needed (#3564) + - 4842bffc2 2021-11-02 chore: wake up the playground to test UMDs (#3428) + - 667cd0a50 2021-10-05 chore: upgrade dependencies (#3459) + ## 3.4.8 ### Patch Changes diff --git a/fork/bootstrap-sass/package.json b/fork/bootstrap-sass/package.json index 664cff8d3ce..bf65b31c98b 100644 --- a/fork/bootstrap-sass/package.json +++ b/fork/bootstrap-sass/package.json @@ -1,6 +1,6 @@ { "name": "@talend/bootstrap-sass", - "version": "3.4.8", + "version": "3.5.0", "description": "bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.", "main": "assets/javascripts/bootstrap.js", "style": "assets/stylesheets/_bootstrap.scss", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 120810182cd..4b781da04ce 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,5 +1,13 @@ # @talend/react-components +## 11.4.4 + +### Patch Changes + +- 1cb4b7b29: fix(TFD-16296): Add ellipsis on collapsible panel header +- Updated dependencies [9d137cb98] + - @talend/bootstrap-theme@8.2.0 + ## 11.4.3 ### Patch Changes diff --git a/packages/components/package.json b/packages/components/package.json index 18796b1a444..91395417525 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@popperjs/core": "^2.11.8", - "@talend/bootstrap-theme": "^8.1.3", + "@talend/bootstrap-theme": "^8.2.0", "@talend/design-tokens": "^2.9.0", "@talend/react-a11y": "^1.1.0", "@talend/icons": "^6.60.1", @@ -69,13 +69,13 @@ }, "devDependencies": { "@storybook/addon-actions": "^7.4.1", - "@talend/bootstrap-theme": "^8.1.3", + "@talend/bootstrap-theme": "^8.2.0", "@talend/design-system": "^7.15.1", "@talend/icons": "^6.60.1", "@talend/locales-design-system": "^7.3.0", "@talend/locales-tui-components": "^9.5.0", "@talend/scripts-core": "^15.0.0", - "@talend/scripts-config-react-webpack": "^16.0.0", + "@talend/scripts-config-react-webpack": "^16.1.0", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^12.1.5", "@testing-library/user-event": "^13.5.0", @@ -113,5 +113,5 @@ "publishConfig": { "access": "public" }, - "version": "11.4.3" + "version": "11.4.4" } diff --git a/packages/theme/CHANGELOG.md b/packages/theme/CHANGELOG.md index dc42b903478..439f4ce7055 100644 --- a/packages/theme/CHANGELOG.md +++ b/packages/theme/CHANGELOG.md @@ -1,5 +1,16 @@ # @talend/bootstrap-theme +## 8.2.0 + +### Minor Changes + +- 9d137cb98: feat: upgrade some webpack loader + +### Patch Changes + +- Updated dependencies [9d137cb98] + - @talend/bootstrap-sass@3.5.0 + ## 8.1.3 ### Patch Changes diff --git a/packages/theme/package.json b/packages/theme/package.json index 43237b8f7fb..31dacaaacf0 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -27,7 +27,7 @@ "url": "https://github.com/Talend/ui.git" }, "dependencies": { - "@talend/bootstrap-sass": "^3.4.8", + "@talend/bootstrap-sass": "^3.5.0", "@talend/design-tokens": "^2.9.0", "@talend/icons": "^6.60.1" }, @@ -54,5 +54,5 @@ "publishConfig": { "access": "public" }, - "version": "8.1.3" + "version": "8.2.0" } diff --git a/tools/scripts-config-react-webpack/CHANGELOG.md b/tools/scripts-config-react-webpack/CHANGELOG.md index b689f274d1b..a796a936e2b 100644 --- a/tools/scripts-config-react-webpack/CHANGELOG.md +++ b/tools/scripts-config-react-webpack/CHANGELOG.md @@ -1,5 +1,11 @@ # @talend/scripts-config-react-webpack +## 16.1.0 + +### Minor Changes + +- 9d137cb98: feat: upgrade some webpack loader + ## 16.0.0 ### Major Changes diff --git a/tools/scripts-config-react-webpack/package.json b/tools/scripts-config-react-webpack/package.json index 8991740ebe6..f147a17753b 100644 --- a/tools/scripts-config-react-webpack/package.json +++ b/tools/scripts-config-react-webpack/package.json @@ -1,7 +1,7 @@ { "name": "@talend/scripts-config-react-webpack", "description": "Webpack configuration for @talend/scripts-core", - "version": "16.0.0", + "version": "16.1.0", "license": "Apache-2.0", "main": "index.js", "author": "Talend Frontend ", From 72a8f20dcec49e0e7f92af7391392c4ec020a3ae Mon Sep 17 00:00:00 2001 From: Guillaume NICOLAS Date: Mon, 9 Oct 2023 16:38:05 +0200 Subject: [PATCH 3/5] feat(TDP-12106): rework http interceptors to access request object and return promise (#4899) --- .changeset/brave-birds-report.md | 5 ++ packages/http/README.md | 37 +++++++++++++++ packages/http/src/config.test.ts | 68 +++++++++++++++++++++++++++ packages/http/src/config.ts | 19 +++++--- packages/http/src/http.common.test.ts | 60 ++++++++++++++++++++++- packages/http/src/http.common.ts | 33 +++++++------ packages/http/src/http.types.ts | 5 ++ 7 files changed, 205 insertions(+), 22 deletions(-) create mode 100644 .changeset/brave-birds-report.md diff --git a/.changeset/brave-birds-report.md b/.changeset/brave-birds-report.md new file mode 100644 index 00000000000..72b59e4b0ff --- /dev/null +++ b/.changeset/brave-birds-report.md @@ -0,0 +1,5 @@ +--- +'@talend/http': minor +--- + +feat(TDP-12106): improve interceptors to return a promise, have access to request and a business context from caller diff --git a/packages/http/README.md b/packages/http/README.md index 409eb12fca7..7866d78eb04 100644 --- a/packages/http/README.md +++ b/packages/http/README.md @@ -47,3 +47,40 @@ async function test() { const response = await http.get('/api/v1/my-resource'); } ``` + +## Interceptors + +You can add global response interceptors to catch or modify responses before resolve. + +```es6 +import { addHttpResponseInterceptor, http, HTTP_METHODS } from '@talend/http'; +import type { TalendRequest } from '@talend/http'; + +addHttpResponseInterceptor('my-interceptor', async (response: Response, request: TalendRequest) => { + if (request.method === HTTP_METHODS.GET) { + // your custom logic here + } + + return response; +}); +``` + +You can add multiple interceptors. Each will be called in the order of registration and will receive the same request parameter, but response parameter will be the one returned by previous interceptor. If interceptor returns void, then it'll return received response. + +Once your interceptor is not needed anymore, you can unregister it with `removeHttpResponseInterceptor` function of `@talend/http` package. + +You can identify some requests in interceptor by using `context` property in fetch function config: + +```es6 +import { addHttpResponseInterceptor, http, HTTP_METHODS } from '@talend/http'; + +http.get('/api/v1/data', { context: { intercept: true } }); + +addHttpResponseInterceptor('my-interceptor', async (response: Response, request: TalendRequest) => { + const { context } = request; + if (request.method === HTTP_METHODS.GET && context.intercept) { + // your custom logic here + } + return response; +}); +``` diff --git a/packages/http/src/config.test.ts b/packages/http/src/config.test.ts index 4f2513d6a70..f9d83f0a698 100644 --- a/packages/http/src/config.test.ts +++ b/packages/http/src/config.test.ts @@ -6,7 +6,10 @@ import { removeHttpResponseInterceptor, setDefaultConfig, setDefaultLanguage, + applyInterceptors, } from './config'; +import { HTTP_METHODS, HTTP_STATUS } from './http.constants'; +import { TalendRequest } from './http.types'; describe('Configuration service', () => { describe('setDefaultLanguage', () => { @@ -93,5 +96,70 @@ describe('Configuration service', () => { ); expect(HTTP_RESPONSE_INTERCEPTORS).toEqual({ myInterceptor2: interceptor2 }); }); + it('should apply all interceptors', async () => { + const request: TalendRequest = { + url: '/api/v1/data', + method: HTTP_METHODS.GET, + }; + const response = { + ok: true, + status: HTTP_STATUS.OK, + body: [1, 2, 3], + } as unknown as Response; + + const interceptor1 = jest + .fn() + .mockImplementation((resp, _) => Promise.resolve({ ...resp, body: [...resp.body, 4] })); + addHttpResponseInterceptor('interceptor-1', interceptor1); + + const interceptor2 = jest.fn().mockImplementation((resp, req) => + Promise.resolve({ + ...resp, + body: { interceptor: `interceptor2-${req.method}`, original: resp.body }, + }), + ); + addHttpResponseInterceptor('interceptor-2', interceptor2); + + const interceptedResponse = await applyInterceptors(request, response); + + expect(interceptor1).toHaveBeenCalledWith(response, request); + expect(interceptor2).toHaveBeenLastCalledWith( + expect.objectContaining({ body: [1, 2, 3, 4] }), + request, + ); + expect(interceptedResponse).toEqual({ + ...response, + body: { interceptor: 'interceptor2-GET', original: [1, 2, 3, 4] }, + }); + }); + it('should return response if no interceptors', () => { + const request: TalendRequest = { + url: '/api/v1/data', + method: HTTP_METHODS.GET, + }; + const response = { + ok: true, + status: HTTP_STATUS.OK, + body: [1, 2, 3], + } as unknown as Response; + + expect(applyInterceptors(request, response)).resolves.toEqual(response); + }); + it('should return response if interceptor returns void', async () => { + const request: TalendRequest = { + url: '/api/v1/data', + method: HTTP_METHODS.GET, + }; + const response = { + ok: true, + status: HTTP_STATUS.OK, + body: [1, 2, 3], + } as unknown as Response; + const interceptor = jest.fn().mockImplementation(() => {}); + addHttpResponseInterceptor('interceptor', interceptor); + const gotResponse = await applyInterceptors(request, response); + expect(gotResponse).toEqual(response); + expect(interceptor).toHaveBeenCalledWith(response, request); + }); }); }); diff --git a/packages/http/src/config.ts b/packages/http/src/config.ts index bd12d85b015..dbccd101cc8 100644 --- a/packages/http/src/config.ts +++ b/packages/http/src/config.ts @@ -1,4 +1,4 @@ -import { TalendRequestInit } from './http.types'; +import { TalendRequest, TalendRequestInit } from './http.types'; /** * Storage point for the doc setup using `setDefaultConfig` @@ -7,12 +7,11 @@ export const HTTP: { defaultConfig?: TalendRequestInit | null } = { defaultConfig: null, }; -export const HTTP_RESPONSE_INTERCEPTORS: Record void> = {}; +export type Interceptor = (response: Response, request: TalendRequest) => Promise | void; -export function addHttpResponseInterceptor( - name: string, - interceptor: (response: Response) => void, -) { +export const HTTP_RESPONSE_INTERCEPTORS: Record = {}; + +export function addHttpResponseInterceptor(name: string, interceptor: Interceptor) { if (HTTP_RESPONSE_INTERCEPTORS[name]) { throw new Error(`Interceptor ${name} already exists`); } @@ -26,6 +25,14 @@ export function removeHttpResponseInterceptor(name: string) { delete HTTP_RESPONSE_INTERCEPTORS[name]; } +export function applyInterceptors(request: TalendRequest, response: Response): Promise { + return Object.values(HTTP_RESPONSE_INTERCEPTORS).reduce( + (promise, interceptor) => + promise.then(resp => interceptor(resp, request) || Promise.resolve(response)), + Promise.resolve(response), + ); +} + /** * setDefaultHeader - define a default config to use with the saga http * this default config is stored in this module for the whole application diff --git a/packages/http/src/http.common.test.ts b/packages/http/src/http.common.test.ts index 2905f1d31bb..f4baf5071c6 100644 --- a/packages/http/src/http.common.test.ts +++ b/packages/http/src/http.common.test.ts @@ -1,7 +1,13 @@ import fetchMock from 'fetch-mock'; import { Response, Headers } from 'node-fetch'; -import { HTTP, getDefaultConfig, setDefaultConfig } from './config'; +import { + HTTP, + getDefaultConfig, + setDefaultConfig, + HTTP_RESPONSE_INTERCEPTORS, + addHttpResponseInterceptor, +} from './config'; import { httpFetch, handleBody, encodePayload, handleHttpResponse } from './http.common'; import { HTTP_METHODS, HTTP_STATUS } from './http.constants'; import { TalendHttpError } from './http.types'; @@ -48,7 +54,10 @@ describe('handleBody', () => { const blob = jest.fn(() => Promise.resolve()); - await handleBody({ blob, headers } as any); + await handleBody({ + headers, + clone: jest.fn().mockReturnValue({ blob }), + } as any); expect(blob).toHaveBeenCalled(); }); @@ -71,6 +80,12 @@ describe('handleBody', () => { expect(result.data).toBe(''); }); + it("should manage response's body and return a clone with unused body", async () => { + const result = await handleBody(new Response('ok') as any); + expect(result.data).toBe('ok'); + expect(result.response.bodyUsed).toBe(false); + }); + describe('#handleHttpResponse', () => { it('should handle the response with 2xx code', async () => { const headers = new Headers(); @@ -328,3 +343,44 @@ describe('#httpFetch', () => { expect(mockCalls[0][1]?.headers).toEqual({ Accept: 'application/json' }); }); }); + +describe('#httpFetch with interceptors', () => { + beforeEach(() => { + for (const key in HTTP_RESPONSE_INTERCEPTORS) { + if (HTTP_RESPONSE_INTERCEPTORS.hasOwnProperty(key)) { + delete HTTP_RESPONSE_INTERCEPTORS[key]; + } + } + }); + + afterEach(() => { + fetchMock.restore(); + }); + + it('should call interceptor', async () => { + const interceptor = jest.fn().mockImplementation((res, _) => res); + addHttpResponseInterceptor('interceptor', interceptor); + + const url = '/foo'; + fetchMock.mock(url, { body: defaultBody, status: 200 }); + + await httpFetch(url, {}, HTTP_METHODS.GET, {}); + expect(interceptor).toHaveBeenCalled(); + }); + + it('should have access to context in interceptor', async () => { + const interceptor = jest.fn().mockImplementation((res, _) => res); + addHttpResponseInterceptor('interceptor', interceptor); + + const url = '/foo'; + const context = { async: true }; + const response = { body: defaultBody, status: 200 }; + fetchMock.mock(url, response); + + await httpFetch(url, { context }, HTTP_METHODS.GET, {}); + expect(interceptor).toHaveBeenCalledWith( + expect.anything(), + expect.objectContaining({ url, context, method: HTTP_METHODS.GET }), + ); + }); +}); diff --git a/packages/http/src/http.common.ts b/packages/http/src/http.common.ts index 9ebc4802295..ee6b27e2216 100644 --- a/packages/http/src/http.common.ts +++ b/packages/http/src/http.common.ts @@ -1,4 +1,4 @@ -import { HTTP, HTTP_RESPONSE_INTERCEPTORS } from './config'; +import { applyInterceptors, HTTP } from './config'; import { mergeCSRFToken } from './csrfHandling'; import { HTTP_STATUS, testHTTPCode } from './http.constants'; import { TalendHttpResponse, TalendRequestInit } from './http.types'; @@ -40,17 +40,18 @@ export function encodePayload(headers: HeadersInit, payload: any) { * @return {Promise} A promise that resolves with the result of parsing the body */ export async function handleBody(response: Response) { + const clonedResponse = response.clone(); const { headers } = response; const contentType = headers.get('Content-Type'); if (contentType && contentType.includes('application/json')) { - return response.json().then(data => ({ data, response })); + return clonedResponse.json().then(data => ({ data, response })); } if (contentType && contentType.includes('application/zip')) { - return response.blob().then(data => ({ data, response })); + return clonedResponse.blob().then(data => ({ data, response })); } - return response.text().then(data => ({ data, response })); + return clonedResponse.text().then(data => ({ data, response })); } /** @@ -118,17 +119,21 @@ export async function httpFetch( }, }; - const response = await fetch( - url, - handleCSRFToken({ - ...params, - body: encodePayload(params.headers || {}, payload), - }), - ); - - Object.values(HTTP_RESPONSE_INTERCEPTORS).forEach(interceptor => { - interceptor(response); + const { context, ...init } = handleCSRFToken({ + ...params, + body: encodePayload(params.headers || {}, payload), }); + const response = await fetch(url, init).then(resp => + applyInterceptors( + { + url, + ...init, + context, + }, + resp, + ), + ); + return handleHttpResponse(response); } diff --git a/packages/http/src/http.types.ts b/packages/http/src/http.types.ts index 71294103aba..8c756657030 100644 --- a/packages/http/src/http.types.ts +++ b/packages/http/src/http.types.ts @@ -10,8 +10,13 @@ export type TalendRequestInitSecurity = { export interface TalendRequestInit extends RequestInit { security?: TalendRequestInitSecurity; + context?: Record; } +export type TalendRequest = { + url: string; +} & TalendRequestInit; + export interface TalendHttpError extends Error { response: Response; data: T; From 4628d80d67836630a4fb89d8ef1304a023dc1aff Mon Sep 17 00:00:00 2001 From: Talend bot Date: Mon, 9 Oct 2023 17:45:32 +0200 Subject: [PATCH 4/5] chore: prepare release (#4927) Co-authored-by: github-actions[bot] --- .changeset/brave-birds-report.md | 5 ----- packages/http/CHANGELOG.md | 6 ++++++ packages/http/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/brave-birds-report.md diff --git a/.changeset/brave-birds-report.md b/.changeset/brave-birds-report.md deleted file mode 100644 index 72b59e4b0ff..00000000000 --- a/.changeset/brave-birds-report.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@talend/http': minor ---- - -feat(TDP-12106): improve interceptors to return a promise, have access to request and a business context from caller diff --git a/packages/http/CHANGELOG.md b/packages/http/CHANGELOG.md index 4d7590d03f9..c5f0b9c3b0a 100644 --- a/packages/http/CHANGELOG.md +++ b/packages/http/CHANGELOG.md @@ -1,5 +1,11 @@ # @talend/http +## 2.4.0 + +### Minor Changes + +- 72a8f20dc: feat(TDP-12106): improve interceptors to return a promise, have access to request and a business context from caller + ## 2.3.0 ### Minor Changes diff --git a/packages/http/package.json b/packages/http/package.json index d1d2df89790..f8a3084f390 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -1,6 +1,6 @@ { "name": "@talend/http", - "version": "2.3.0", + "version": "2.4.0", "description": "HTTP helper", "license": "Apache-2.0", "repository": { From cd04f75e88298e9b8bf7fbb7934fe205d0f2a46f Mon Sep 17 00:00:00 2001 From: Jean-Michel FRANCOIS Date: Tue, 10 Oct 2023 10:26:42 +0200 Subject: [PATCH 5/5] chore: upgrade to node 20 (#4922) --- .github/actions/setup-node/action.yml | 32 +++++++++++++++++++ .github/workflows/changeset.yml | 11 ++----- .github/workflows/dependencies.yml | 7 +--- .../design-system-component-testing.yml | 8 ++--- .github/workflows/icons.yml | 8 ++--- .github/workflows/pr-lint.yml | 10 ++---- .github/workflows/pr-playground.yml | 8 ++--- .github/workflows/pr-test.yml | 8 +---- .github/workflows/surge-cleanup.yml | 12 +++---- .github/workflows/tests-cron.yml | 7 +--- .github/workflows/visual-testing.yml | 6 ++-- .github/workflows/yarn-deduplicate.yml | 7 +--- 12 files changed, 54 insertions(+), 70 deletions(-) create mode 100644 .github/actions/setup-node/action.yml diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 00000000000..89bd8521e1a --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,32 @@ +name: 'Setup nodejs' +description: 'Setup nodejs' +author: 'Talend' +secrets: + NPM_TOKEN: + description: 'The NPM token to use' +runs: + using: 'composite' + steps: + - name: Set up Node.js + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d #v3.8.1 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org/' + scope: '@talend' + + - name: Install yarn + shell: bash + run: npm i -g yarn + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + shell: bash + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- diff --git a/.github/workflows/changeset.yml b/.github/workflows/changeset.yml index 5a55cab4a27..91147291ee4 100644 --- a/.github/workflows/changeset.yml +++ b/.github/workflows/changeset.yml @@ -29,14 +29,9 @@ jobs: fetch-depth: 0 persist-credentials: false - - name: Setup Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" - + - name: Use Node.js + uses: ./.github/actions/setup-node + - name: Install Dependencies run: yarn --frozen-lockfile diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 83ec2f60398..be1104fe28e 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -22,12 +22,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + uses: ./.github/actions/setup-node - name: Upgrade dependencies run: | diff --git a/.github/workflows/design-system-component-testing.yml b/.github/workflows/design-system-component-testing.yml index 6eb5a721fe3..f8c47c05f79 100644 --- a/.github/workflows/design-system-component-testing.yml +++ b/.github/workflows/design-system-component-testing.yml @@ -24,12 +24,8 @@ jobs: - name: Checkout repository uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 - - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + - name: Use Node.js + uses: ./.github/actions/setup-node - uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 #v3.3.2 with: diff --git a/.github/workflows/icons.yml b/.github/workflows/icons.yml index c6104b3f400..04d6a4b7b2d 100644 --- a/.github/workflows/icons.yml +++ b/.github/workflows/icons.yml @@ -25,12 +25,8 @@ jobs: persist-credentials: false - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - check-latest: true - cache: "yarn" - + uses: ./.github/actions/setup-node + - name: Download icons run: npx @talend/figma-icons-downloader env: diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index f172765eef0..9dcc3c90db2 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -28,14 +28,8 @@ jobs: fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - check-latest: true - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" - + uses: ./.github/actions/setup-node + - name: Install run: yarn install --frozen-lockfile --ignore-scripts diff --git a/.github/workflows/pr-playground.yml b/.github/workflows/pr-playground.yml index 0798d9371da..374f049c241 100644 --- a/.github/workflows/pr-playground.yml +++ b/.github/workflows/pr-playground.yml @@ -27,12 +27,8 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + uses: ./.github/actions/setup-node + - name: Install and build playground id: build diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index b271fedefb7..f4a95de1790 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -24,13 +24,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - check-latest: true - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + uses: ./.github/actions/setup-node - name: Install run: yarn install --frozen-lockfile diff --git a/.github/workflows/surge-cleanup.yml b/.github/workflows/surge-cleanup.yml index fc3a6106637..4bc6b29e9d9 100644 --- a/.github/workflows/surge-cleanup.yml +++ b/.github/workflows/surge-cleanup.yml @@ -13,10 +13,8 @@ jobs: environment: pull_request_unsafe steps: - - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - - - name: Push to surge - run: npx surge teardown ${{ github.event.pull_request.number }}.talend.surge.sh --token ${{ secrets.SURGE_TOKEN }} + - name: Use Node.js + uses: ./.github/actions/setup-node + + - name: Push to surge + run: npx surge teardown ${{ github.event.pull_request.number }}.talend.surge.sh --token ${{ secrets.SURGE_TOKEN }} diff --git a/.github/workflows/tests-cron.yml b/.github/workflows/tests-cron.yml index 20362c668b7..1641011e9de 100644 --- a/.github/workflows/tests-cron.yml +++ b/.github/workflows/tests-cron.yml @@ -20,12 +20,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac #v4.0.0 - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + uses: ./.github/actions/setup-node - name: Install and tests run: | diff --git a/.github/workflows/visual-testing.yml b/.github/workflows/visual-testing.yml index 95d824a139d..7d2a26b5830 100644 --- a/.github/workflows/visual-testing.yml +++ b/.github/workflows/visual-testing.yml @@ -32,10 +32,8 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - cache: "yarn" + - name: Use Node.js + uses: ./.github/actions/setup-node - name: Install dependencies run: yarn --frozen-lock diff --git a/.github/workflows/yarn-deduplicate.yml b/.github/workflows/yarn-deduplicate.yml index 601eab816fb..d9dfb8526d4 100644 --- a/.github/workflows/yarn-deduplicate.yml +++ b/.github/workflows/yarn-deduplicate.yml @@ -29,12 +29,7 @@ jobs: fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - name: Use Node.js - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org/" - scope: "@talend" - cache: "yarn" + uses: ./.github/actions/setup-node - name: yarn-deduplicate id: deduplicate