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

chore(headless)!: add export field in package.json #4392

Merged
merged 18 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
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
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 @@ -14,7 +14,7 @@ runs:
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
start: npx nx run atomic:prod
start: npm start -w @coveo/atomic
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
wait-on: 'http://localhost:3333'
wait-on-timeout: 600000
install: false
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 @@ -16,7 +16,7 @@ runs:
browser: chrome
command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --'
config-file: cypress-screenshots.config.ts
start: npx nx run atomic:prod
start: npm start -w @coveo/atomic
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
wait-on: 'http://localhost:3333'
wait-on-timeout: 600000
install: false
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/e2e-atomic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
browser: chrome
command-prefix: 'npx -w @coveo/atomic cypress-repeat run -n 3 --until-passes --rerun-failed-only --'
spec: ${{ inputs.spec }}
start: npx nx run atomic:prod
start: npm start -w @coveo/atomic
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
wait-on: 'http://localhost:3333'
wait-on-timeout: 600000
install: false
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/masterbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: ./.github/actions/setup
- uses: ./.github/actions/e2e-iife
# TODO: KIT-3537 - https://coveord.atlassian.net/browse/KIT-3538
# - uses: ./.github/actions/setup
# - uses: ./.github/actions/e2e-iife
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
e2e-atomic-insight-panel-test:
name: 'Run e2e tests on Atomic Insight Panel'
needs: build
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/prbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: ./.github/actions/setup
- uses: ./.github/actions/e2e-iife
# TODO: KIT-3537 - https://coveord.atlassian.net/browse/KIT-3538
# - uses: ./.github/actions/setup
# - uses: ./.github/actions/e2e-iife
e2e-atomic-angular-test:
name: 'Run e2e tests on Atomic Angular'
needs: build
Expand Down
2 changes: 1 addition & 1 deletion packages/atomic-react/commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "commerce",
"type": "module",
"description": "Atomic React Commerce Module",
"main": "../dist/commerce.index.js",
"main": "../dist/cjs/commerce/atomic-react.js",
"module": "../dist/commerce.index.js",
"types": "../dist/commerce.index.d.ts",
"license": "Apache-2.0"
Expand Down
7 changes: 3 additions & 4 deletions packages/atomic-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
"build": "nx build",
"clean": "rimraf -rf dist",
"build:bundles:esm": "tsc -p tsconfig.esm.json",
"build:bundles:cjs": "tsc -p tsconfig.cjs.json",
"build:bundles:iife": "rollup --config rollup.config.mjs",
"build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:cjs\" \"npm run build:bundles:iife\"",
"build:bundles:iife-cjs": "rollup --config rollup.config.mjs",
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
"build:bundles": "concurrently \"npm run build:bundles:esm\" \"npm run build:bundles:iife-cjs\"",
"publish:npm": "npm run-script -w=@coveo/release npm-publish",
"publish:bump": "npm run-script -w=@coveo/release bump",
"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/index.js",
"main": "./dist/cjs/atomic-react.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/atomic-react/recommendation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"private": true,
"name": "recommendation",
"description": "Atomic React Recommendation Module",
"main": "../dist/cjs/recommendation.index.js",
"module": "../dist/recommendation.index.esm.js",
"main": "../dist/cjs/recommendation/atomic-react.js",
"module": "../dist/recommendation.index.js",
"types": "../dist/recommendation.index.d.ts",
"license": "Apache-2.0"
}
41 changes: 41 additions & 0 deletions packages/atomic-react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ const outputIIFE = ({minify}) => ({
plugins: minify ? [terser()] : [],
});

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

/** @returns {import('rollup').OutputOptions} */
const outputIIFERecs = ({minify}) => ({
file: `dist/iife/atomic-react/recommendation${minify ? '.min' : ''}.js`,
Expand Down Expand Up @@ -71,19 +77,48 @@ const plugins = [
}),
];

const pluginsCJS = [
json(),
nodePolyfills(),
typescript(),
commonjs(),
nodeResolve(),
replace({
delimiters: ['', ''],
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
values: {
'process.env.NODE_ENV': JSON.stringify('dev'),
'util.TextEncoder();': 'TextEncoder();',
"import { defineCustomElements } from '@coveo/atomic/loader';": '',
'defineCustomElements();': '',
},
}),
];

export default defineConfig([
{
input: 'src/index.ts',
output: [outputIIFE({minify: true}), outputIIFE({minify: false})],
external: commonExternal,
plugins,
},
{
input: 'src/index.ts',
output: [outputCJS({useCase: ''})],
external: commonExternal,
plugins: pluginsCJS,
},
{
input: 'src/recommendation.index.ts',
output: [outputIIFERecs({minify: true}), outputIIFERecs({minify: false})],
external: commonExternal,
plugins,
},
{
input: 'src/recommendation.index.ts',
output: [outputCJS({useCase: 'recommendation/'})],
external: commonExternal,
plugins: pluginsCJS,
},
{
input: 'src/commerce.index.ts',
output: [
Expand All @@ -93,4 +128,10 @@ export default defineConfig([
external: commonExternal,
plugins,
},
{
input: 'src/commerce.index.ts',
output: [outputCJS({useCase: 'commerce/'})],
external: commonExternal,
plugins: pluginsCJS,
},
]);
8 changes: 0 additions & 8 deletions packages/atomic-react/tsconfig.cjs.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/atomic-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"experimentalDecorators": true,
"esModuleInterop": true,
"lib": ["dom", "es2015"],
"moduleResolution": "node",
"moduleResolution": "Bundler",
"module": "ES2022",
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
Expand Down
3 changes: 2 additions & 1 deletion packages/atomic/cypress/e2e/external.cypress.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {RouteAlias, setupIntercept} from '../fixtures/fixture-common';

describe('External Test Suite', () => {
// TODO: https://coveord.atlassian.net/browse/KIT-3540 - rewrite in playwright
describe.skip('External Test Suite', () => {
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
describe('when modifying state of a component (search box) that is a child of an atomic-external component', () => {
beforeEach(() => {
setupIntercept();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
} from '../common-assertions';
import {setLanguage, getRecommendations} from './recs-interface-utils';

describe('Recs Interface Component', () => {
// TODO: https://coveord.atlassian.net/browse/KIT-3540 - rewrite in playwright
describe.skip('Recs Interface Component', () => {
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
const engineError =
'You have to call "initialize" on the atomic-recs-interface component before modifying the props or calling other public methods.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const addRecsList =
const numberOfRecs = 3;
const numberOfRecsPerPage = 1;

describe('Recs Interface Component', () => {
// TODO: https://coveord.atlassian.net/browse/KIT-3540 - rewrite in playwright
describe.skip('Recs Interface Component', () => {
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
describe('before recommendation have loaded', () => {
beforeEach(() => {
new TestRecsFixture()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import {
SearchEngine,
Suggestion,
} from '@coveo/headless';
import {
QuerySetSection,
QuerySuggestionSection,
} from '@coveo/headless/dist/definitions/state/state-sections';
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
import {Component, Element, Prop, State, h} from '@stencil/core';
import SearchIcon from '../../../../images/search.svg';
import {
Expand Down Expand Up @@ -66,9 +62,10 @@ export class AtomicSearchBoxQuerySuggestions {
}

private initialize(): SearchBoxSuggestions {
const engine = this.bindings.engine as SearchEngine<
QuerySuggestionSection & QuerySetSection
>;
const engine = this.bindings.engine as SearchEngine<{
querySet: string;
querySuggest: string;
}>;
const {registerQuerySuggest, fetchQuerySuggestions} =
loadQuerySuggestActions(engine);

Expand Down
4 changes: 2 additions & 2 deletions packages/atomic/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"declaration": false,
"experimentalDecorators": true,
"lib": ["dom", "es2020", "ESNext.Collection"],
"moduleResolution": "node",
"moduleResolution": "Bundler",
"module": "ES2022",
"resolveJsonModule": true,
"useDefineForClassFields": false,
"module": "esnext",
"target": "es2019",
alexprudhomme marked this conversation as resolved.
Show resolved Hide resolved
"noUnusedLocals": true,
"noUnusedParameters": true,
Expand Down
10 changes: 0 additions & 10 deletions packages/headless/case-assist/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions packages/headless/commerce/package.json

This file was deleted.

Loading
Loading