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

test: add package compatibility tests using publint #4446

Merged
merged 47 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4c3d793
type module everywhere
louis-bompart Sep 19, 2024
8896adb
Apply suggestions from code review
louis-bompart Sep 19, 2024
d4f9150
lint&ut
louis-bompart Sep 20, 2024
d65b94c
e2e should be fine
louis-bompart Sep 20, 2024
ad2e6f8
Update packages/atomic/tsconfig.storybook.json
louis-bompart Sep 20, 2024
bbae835
fix typedoc
louis-bompart Sep 20, 2024
c6264b8
deps
louis-bompart Sep 20, 2024
8d232fd
make react uses proper path
louis-bompart Sep 20, 2024
062e6e7
missing patch
louis-bompart Sep 20, 2024
6d8345d
tweak-cypresses
louis-bompart Sep 20, 2024
4c48774
fixlint
louis-bompart Sep 20, 2024
4c5d357
fix errors and add script check
alexprudhomme Sep 20, 2024
7c7e7fa
Delete action.yml
alexprudhomme Sep 20, 2024
a4ebfab
Update packages-compatibility.mjs
alexprudhomme Sep 20, 2024
395a91c
typo
alexprudhomme Sep 20, 2024
872438d
typo
alexprudhomme Sep 20, 2024
3dc0016
fix most errors atomic-react
alexprudhomme Sep 20, 2024
38f7b3a
Update packages/atomic/.storybook/main.mts
louis-bompart Sep 20, 2024
39fe585
Update package.json
alexprudhomme Sep 20, 2024
480b5bb
typo ahh
alexprudhomme Sep 20, 2024
95c6b60
Revert "typo ahh"
alexprudhomme Sep 20, 2024
c999749
Update package.json
alexprudhomme Sep 20, 2024
daadc1d
fix headless type defintions
alexprudhomme Sep 20, 2024
b70bdde
changes forgotten
alexprudhomme Sep 20, 2024
b2de421
Merge branch 'master' into type=module
louis-bompart Sep 20, 2024
2207b51
use @coveo/atomic-storybook-utils
louis-bompart Sep 20, 2024
015040f
fix errors (#4444)
alexprudhomme Sep 20, 2024
8795d9c
Merge branch 'type=module' into type=module-headless-types
alexprudhomme Sep 20, 2024
921168c
remove script
alexprudhomme Sep 20, 2024
4db6223
test: add package compatibility tests using publint and are the types…
alexprudhomme Sep 20, 2024
0715277
Merge branch 'master' into KIT-3596
alexprudhomme Sep 24, 2024
3d0fc63
Merge branch 'master' into KIT-3596
fbeaudoincoveo Sep 25, 2024
78f5bda
Fix typos
fbeaudoincoveo Sep 25, 2024
97cbe45
Fix another typo
fbeaudoincoveo Sep 25, 2024
44c6ee2
Update description
fbeaudoincoveo Sep 25, 2024
f7858d1
Fix error display
fbeaudoincoveo Sep 25, 2024
2869bb9
Add attw check
fbeaudoincoveo Sep 25, 2024
b551c24
Improvements to script
fbeaudoincoveo Sep 26, 2024
a08c38f
Merge branch 'master' into KIT-3596
fbeaudoincoveo Sep 26, 2024
cdee62a
Fix typos
fbeaudoincoveo Sep 26, 2024
fca54e1
Only run publint scan
fbeaudoincoveo Sep 26, 2024
58d9c32
Remove attw
fbeaudoincoveo Sep 26, 2024
7a27083
remove jest.config change from old merge
alexprudhomme Sep 26, 2024
d21fb11
Merge branch 'master' into KIT-3596
fbeaudoincoveo Oct 16, 2024
f33c442
Merge branch 'KIT-3596' of github.com:coveo/ui-kit into KIT-3596
fbeaudoincoveo Oct 16, 2024
19a73d5
Apply review comments
fbeaudoincoveo Oct 16, 2024
bc80970
Merge branch 'master' into KIT-3596
alexprudhomme Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/actions/e2e-atomic-insight-panel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
with:
browser: chrome
command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --'
config-file: cypress-insight-panel.config.ts
config-file: cypress-insight-panel.config.mjs
start: npm start -w @coveo/atomic
wait-on: 'http://localhost:3333/ping'
wait-on-timeout: 600000
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/e2e-atomic-screenshots/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
with:
browser: chrome
command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --'
config-file: cypress-screenshots.config.ts
config-file: cypress-screenshots.config.mjs
start: npm start -w @coveo/atomic
wait-on: 'http://localhost:3333/ping'
wait-on-timeout: 600000
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/prbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: ./.github/actions/setup
- run: npm test
package-compatibility:
name: 'Are packages compatible?'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: ./.github/actions/setup
- run: npm run package:compatibility
e2e-atomic-csp-test:
name: 'Run e2e tests on Atomic CSP'
needs: build
Expand Down
44 changes: 43 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"e2e": "nx run-many --target=e2e",
"lint:check": "eslint . && cspell **/*.md --no-progress --show-suggestions --show-context && prettier --check '**/*.{css,pcss,html,md,yml,ts,tsx,js,mjs,json}'",
"lint:fix": "eslint --fix . && prettier --write '**/*.{css,pcss,html,md,yml,ts,tsx,js,mjs,json}'",
"packages-compatability": "node ./scripts/ci/package-compatability.mjs",
"pr:report": "node ./scripts/reports/pr-report.mjs",
"report:bundle-size:time-series": "node ./scripts/reports/bundle-size/time-series.mjs",
"commit": "git-cz",
Expand Down Expand Up @@ -83,6 +84,7 @@
"patch-package": "8.0.0",
"prettier": "3.3.3",
"prettier-plugin-tailwindcss": "0.6.5",
"publint": "0.2.11",
"react-syntax-highlighter": "15.5.0",
"rimraf": "5.0.9",
"semver": "7.6.3",
Expand Down
13 changes: 8 additions & 5 deletions packages/atomic-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@coveo/atomic-react",
"sideEffects": false,
"type": "module",
"version": "3.0.2",
"description": "React specific wrapper for the Atomic component library",
"repository": {
Expand All @@ -11,6 +12,7 @@
"scripts": {
"build": "nx build",
"clean": "rimraf -rf dist",
"build:addExtensions": "fix-esm-import-path src/components/stencil-generated",
"build:bundles:esm": "tsc -p tsconfig.esm.json",
"build:bundles:iife-cjs": "rollup --config rollup.config.mjs --bundleConfigAsCjs",
"build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:iife-cjs\"",
Expand All @@ -19,7 +21,7 @@
"promote:npm:latest": "node ../../scripts/deploy/update-npm-tag.mjs latest",
"build:assets": "ncp ../atomic/dist/atomic/assets dist/assets && ncp ../atomic/dist/atomic/lang dist/lang "
},
"main": "./dist/cjs/atomic-react.js",
"main": "./dist/cjs/atomic-react.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
Expand All @@ -31,8 +33,8 @@
"@coveo/atomic": "3.1.1"
},
"devDependencies": {
"@coveo/rollup-plugin-replace-with-ast": "1.0.0",
"@coveo/release": "1.0.0",
"@coveo/rollup-plugin-replace-with-ast": "1.0.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-node-resolve": "^15.0.0",
Expand All @@ -42,6 +44,7 @@
"@types/node": "20.14.12",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"fix-esm-import-path": "1.10.0",
"ncp": "2.0.0",
"react": "18.3.1",
"react-dom": "18.3.1",
Expand All @@ -60,17 +63,17 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/cjs/atomic-react.js"
"require": "./dist/cjs/atomic-react.cjs"
},
"./commerce": {
"types": "./dist/commerce.index.d.ts",
"import": "./dist/commerce.index.js",
"require": "./dist/cjs/commerce/atomic-react.js"
"require": "./dist/cjs/commerce/atomic-react.cjs"
},
"./recommendation": {
"types": "./dist/recommendation.index.d.ts",
"import": "./dist/recommendation.index.js",
"require": "./dist/cjs/recommendation/atomic-react.js"
"require": "./dist/cjs/recommendation/atomic-react.cjs"
}
}
}
6 changes: 5 additions & 1 deletion packages/atomic-react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
"dependsOn": ["^build", "clean"],
"executor": "nx:run-commands",
"options": {
"commands": ["npm run build:bundles", "npm run build:assets"],
"commands": [
"npm run build:addExtensions",
"npm run build:bundles",
"npm run build:assets"
],
"parallel": false,
"cwd": "packages/atomic-react"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const commonExternal = [

/** @returns {import('rollup').OutputOptions} */
const outputCJS = ({useCase}) => ({
file: `dist/cjs/${useCase}atomic-react.js`,
file: `dist/cjs/${useCase}atomic-react.cjs`,
format: 'cjs',
});

Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-react/src/commerce.index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './components/commerce/index';
export * from './components/commerce/index.js';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {JSX, i18n} from '@coveo/atomic';
import React, {useEffect, useRef} from 'react';
import {AtomicCommerceInterface} from '../stencil-generated/commerce';
import {AtomicCommerceInterface} from '../stencil-generated/commerce/index.js';

type ExecuteRequest = HTMLAtomicCommerceInterfaceElement['executeFirstRequest'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {renderToString} from 'react-dom/server';
import {
AtomicCommerceProductList,
AtomicProductLink,
} from '../stencil-generated/commerce';
} from '../stencil-generated/commerce/index.js';

interface Template {
contentTemplate: JSX.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {renderToString} from 'react-dom/server';
import {
AtomicCommerceRecommendationList,
AtomicProductLink,
} from '../stencil-generated/commerce';
} from '../stencil-generated/commerce/index.js';

interface Template {
contentTemplate: JSX.Element;
Expand Down
8 changes: 4 additions & 4 deletions packages/atomic-react/src/components/commerce/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from '../stencil-generated/commerce/index';
export * from '../stencil-generated/commerce/index.js';
export {CommerceBindings, i18n} from '@coveo/atomic';

// Important: Re-exporting under the same name (eg: "AtomicCommerceInterface") shadows the original component
// and should wrap it nicely for users of the library
export {InterfaceWrapper as AtomicCommerceInterface} from './CommerceInterfaceWrapper';
export {ListWrapper as AtomicCommerceProductList} from './CommerceProductListWrapper';
export {ListWrapper as AtomicCommerceRecommendationList} from './CommerceRecommendationListWrapper';
export {InterfaceWrapper as AtomicCommerceInterface} from './CommerceInterfaceWrapper.js';
export {ListWrapper as AtomicCommerceProductList} from './CommerceProductListWrapper.js';
export {ListWrapper as AtomicCommerceRecommendationList} from './CommerceRecommendationListWrapper.js';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
buildRecommendationEngine,
} from '@coveo/headless/recommendation';
import React, {useEffect, useRef} from 'react';
import {AtomicRecsInterface} from '../stencil-generated/search';
import {AtomicRecsInterface} from '../stencil-generated/search/index.js';

type GetRecommendations = HTMLAtomicRecsInterfaceElement['getRecommendations'];
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import type {Result} from '@coveo/headless/recommendation';
import React, {useEffect, useRef} from 'react';
import {createRoot} from 'react-dom/client';
import {renderToString} from 'react-dom/server';
import {AtomicRecsList, AtomicResultLink} from '../stencil-generated/search';
import {
AtomicRecsList,
AtomicResultLink,
} from '../stencil-generated/search/index.js';

interface Template {
contentTemplate: JSX.Element;
Expand Down
6 changes: 3 additions & 3 deletions packages/atomic-react/src/components/recommendation/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from '../stencil-generated/search';
export * from '../stencil-generated/search/index.js';
export {RecsBindings, i18n} from '@coveo/atomic';

// Important: Re-exporting under the same name (eg: "AtomicRecsInterface") shadows the original component
// and should wrap it nicely for users of the library
export {RecsInterfaceWrapper as AtomicRecsInterface} from './RecsInterfaceWrapper';
export {RecsListWrapper as AtomicRecsList} from './RecsListWrapper';
export {RecsInterfaceWrapper as AtomicRecsInterface} from './RecsInterfaceWrapper.js';
export {RecsListWrapper as AtomicRecsList} from './RecsListWrapper.js';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {FoldedResult} from '@coveo/headless';
import React, {useEffect, useRef} from 'react';
import {createRoot} from 'react-dom/client';
import {renderToString} from 'react-dom/server';
import {AtomicFoldedResultList} from '../stencil-generated/search';
import {AtomicFoldedResultList} from '../stencil-generated/search/index.js';

/**
* The properties of the AtomicFoldedResultList component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import type {Result} from '@coveo/headless';
import React, {useEffect, useRef} from 'react';
import {createRoot} from 'react-dom/client';
import {renderToString} from 'react-dom/server';
import {AtomicResultLink, AtomicResultList} from '../stencil-generated/search';
import {
AtomicResultLink,
AtomicResultList,
} from '../stencil-generated/search/index.js';

interface Template {
contentTemplate: JSX.Element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {FoldedResult, Result} from '@coveo/headless';
import React, {useEffect, useRef} from 'react';
import {createRoot} from 'react-dom/client';
import {renderToString} from 'react-dom/server';
import {AtomicSearchBoxInstantResults} from '../stencil-generated/search';
import {AtomicSearchBoxInstantResults} from '../stencil-generated/search/index.js';

/**
* The properties of the AtomicSearchBoxInstantResults component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getSampleSearchEngineConfiguration,
} from '@coveo/headless';
import React, {useEffect, useRef} from 'react';
import {AtomicSearchInterface} from '../stencil-generated/search';
import {AtomicSearchInterface} from '../stencil-generated/search/index.js';

type ExecuteSearch = HTMLAtomicSearchInterfaceElement['executeFirstSearch'];
/**
Expand Down
10 changes: 5 additions & 5 deletions packages/atomic-react/src/components/search/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from '../stencil-generated/search/index';
export * from '../stencil-generated/search/index.js';
export {Bindings, i18n} from '@coveo/atomic';

// Important: Re-exporting under the same name (eg: "AtomicSearchInterface") shadows the original component
// and should wrap it nicely for users of the library
export {SearchInterfaceWrapper as AtomicSearchInterface} from './SearchInterfaceWrapper';
export {ResultListWrapper as AtomicResultList} from './ResultListWrapper';
export {FoldedResultListWrapper as AtomicFoldedResultList} from './FoldedResultListWrapper';
export {SearchBoxInstantResultsWrapper as AtomicSearchBoxInstantResults} from './SearchBoxInstantResultsWrapper';
export {SearchInterfaceWrapper as AtomicSearchInterface} from './SearchInterfaceWrapper.js';
export {ResultListWrapper as AtomicResultList} from './ResultListWrapper.js';
export {FoldedResultListWrapper as AtomicFoldedResultList} from './FoldedResultListWrapper.js';
export {SearchBoxInstantResultsWrapper as AtomicSearchBoxInstantResults} from './SearchBoxInstantResultsWrapper.js';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
/* tslint:disable */
/* auto-generated react proxies */
import { createReactComponent } from './react-component-lib';
import { createReactComponent } from './react-component-lib/index.js';

import type { JSX } from '@coveo/atomic';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { createElement } from 'react';

import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils';
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs } from './utils/index.js';

export interface HTMLStencilElement extends HTMLElement {
componentOnReady(): Promise<this>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';

import { OverlayEventDetail } from './interfaces';
import { StencilReactForwardedRef, attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils';
import { OverlayEventDetail } from './interfaces.js';
import { StencilReactForwardedRef, attachProps, dashToPascalCase, defineCustomElement, setRef } from './utils/index.js';

interface OverlayElement extends HTMLElement {
present: () => Promise<void>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { createReactComponent } from './createComponent';
export { createOverlayComponent } from './createOverlayComponent';
export { createReactComponent } from './createComponent.js';
export { createOverlayComponent } from './createOverlayComponent.js';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { camelToDashCase } from './case';
import { camelToDashCase } from './case.js';

export const attachProps = (node: HTMLElement, newProps: any, oldProps: any = {}) => {
// some test frameworks don't render DOM elements, so we test here to make sure we are dealing with DOM first
Expand Down
Loading
Loading