@justeattakeaway/pie-components-config 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,8 +11,11 @@ To use the shared config, all you need to do is import and re-export it in your
11
11
 
12
12
  ```js
13
13
  import viteConfig from '@justeattakeaway/pie-components-config/vite.config';
14
+ import getPackageVersion from '@justeattakeaway/pie-monorepo-utils/utils/get-package-version.js';
14
15
 
15
- export default viteConfig;
16
+ export default viteConfig({
17
+ version: getPackageVersion(__dirname),
18
+ });
16
19
  ```
17
20
 
18
21
  You can also override any values by passing in an object which will be merged deeply with the default values.
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export * from './playwright-lit-config.js';
2
- export * from './playwright-lit-visual-config.js';
1
+ // @playwright/test config
2
+ export * from './playwright-native-config.js';
3
+ export * from './playwright-native-visual-config.js';
4
+
3
5
  export * from './vite.config.js';
4
6
  export * from './custom-elements-manifest.config.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-components-config",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "author": "Just Eat Takeaway.com - Design System Team",
package/vite.config.js CHANGED
@@ -5,7 +5,16 @@ import { visualizer } from 'rollup-plugin-visualizer';
5
5
  import { deepmerge } from 'deepmerge-ts';
6
6
 
7
7
  // https://vitejs.dev/config/
8
- const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
8
+ const sharedConfig = ({
9
+ build = {},
10
+ plugins = [],
11
+ dtsConfig = {},
12
+ version = 'missing',
13
+ ...rest
14
+ }) => defineConfig({
15
+ define: {
16
+ __PACKAGE_VERSION__: JSON.stringify(version),
17
+ },
9
18
  build: deepmerge({
10
19
  lib: {
11
20
  entry: {
@@ -20,7 +29,9 @@ const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
20
29
  return true;
21
30
  }
22
31
 
23
- if (id.startsWith('@justeattakeaway/pie-')) {
32
+ // Any imports from pie-webc-core/src/internals are to be included in component bundles.
33
+ // Any imports outside of the internals folder must be externalised.
34
+ if (id.startsWith('@justeattakeaway/pie-') && !id.startsWith('@justeattakeaway/pie-webc-core/src/internals')) {
24
35
  console.info(`Excluding ${id} from the bundle`);
25
36
  return true;
26
37
  }
@@ -29,6 +40,7 @@ const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
29
40
  },
30
41
  },
31
42
  }, build),
43
+
32
44
  test: {
33
45
  dir: '.',
34
46
  environment: 'jsdom',
@@ -39,15 +51,22 @@ const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
39
51
  ],
40
52
  exclude: ['**/node_modules/**'],
41
53
  },
42
- plugins: deepmerge([dts({
43
- insertTypesEntry: true,
44
- outputDir: 'dist',
45
- rollupTypes: true,
46
- }),
47
- visualizer({
48
- gzipSize: true,
49
- brotliSize: true,
50
- })], plugins),
54
+
55
+ plugins: deepmerge(
56
+ [
57
+ dts({
58
+ insertTypesEntry: true,
59
+ outputDir: 'dist',
60
+ rollupTypes: true,
61
+ ...dtsConfig,
62
+ }),
63
+ visualizer({
64
+ gzipSize: true,
65
+ brotliSize: true,
66
+ }),
67
+ ],
68
+ plugins,
69
+ ),
51
70
 
52
71
  ...rest,
53
72
  });
@@ -1,62 +0,0 @@
1
- import { devices } from '@sand4rt/experimental-ct-web';
2
- import path from 'path';
3
-
4
- /**
5
- * See https://playwright.dev/docs/test-configuration
6
- */
7
- export function getPlaywrightConfig () {
8
- return {
9
- /* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
10
- snapshotDir: './__snapshots__',
11
- /* Maximum time one test can run for. */
12
- timeout: 10 * 1000,
13
- testIgnore: '*-react.spec.js',
14
- /* Run tests in files in parallel */
15
- fullyParallel: true,
16
- /* Fail the build on CI if you accidentally left test.only in the source code. */
17
- forbidOnly: !!process.env.CI,
18
- /* Retry on CI only */
19
- retries: process.env.CI ? 2 : 0,
20
- /* Opt out of parallel tests on CI. */
21
- workers: '50%',
22
- /* Reporter to use. See https://playwright.dev/docs/test-reporters */
23
- reporter: [['html', { outputFolder: 'lit-browsers-report' }]],
24
- /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25
- use: {
26
- ctViteConfig: {
27
- resolve: {
28
- alias: {
29
- '@': path.resolve('./src'),
30
- },
31
- },
32
- },
33
- /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
34
- trace: 'on',
35
- testIdAttribute: 'data-test-id',
36
- },
37
-
38
- /* Configure projects for major browsers */
39
- projects: [
40
- {
41
- name: 'component:chrome',
42
- use: {
43
- ...devices['Desktop Chrome'],
44
- },
45
- testMatch: ['**/test/component/*.spec.{js,ts}'],
46
- },
47
- {
48
- name: 'a11y:chrome',
49
- use: {
50
- ...devices['Desktop Chrome'],
51
- },
52
- testMatch: ['**/test/accessibility/*.spec.{js,ts}'],
53
- },
54
- ],
55
- webServer: !process.env.CI ? {
56
- command: 'npx turbo dev --filter=pie-storybook',
57
- url: 'http://localhost:6006',
58
- timeout: 120 * 10000,
59
- reuseExistingServer: !process.env.CI,
60
- } : undefined,
61
- };
62
- }
@@ -1,60 +0,0 @@
1
- import { devices } from '@sand4rt/experimental-ct-web';
2
- import path from 'path';
3
-
4
- /**
5
- * See https://playwright.dev/docs/test-configuration
6
- */
7
- export function getPlaywrightVisualConfig () {
8
- return {
9
- /* Maximum time one test can run for. */
10
- timeout: 10 * 1000,
11
- /* Run tests in files in parallel */
12
- fullyParallel: true,
13
- /* Fail the build on CI if you accidentally left test.only in the source code. */
14
- forbidOnly: !!process.env.CI,
15
- /* Retry on CI only */
16
- retries: process.env.CI ? 2 : 0,
17
- /* Opt out of parallel tests on CI. */
18
- workers: '50%',
19
- /* Reporter to use. See https://playwright.dev/docs/test-reporters */
20
- reporter: [['html', { outputFolder: 'lit-visual-report' }]],
21
- /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
22
- use: {
23
- ctViteConfig: {
24
- resolve: {
25
- alias: {
26
- '@': path.resolve('./src'),
27
- },
28
- },
29
- },
30
- /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
31
- trace: 'on',
32
- testIdAttribute: 'data-test-id',
33
- discovery: {
34
- disallowedHostnames: [
35
- 'unpkg.com'
36
- ],
37
- },
38
- },
39
-
40
- /* Configure projects for major browsers */
41
- projects: [
42
- {
43
- name: 'visual:desktop',
44
- grepInvert: /@mobile/,
45
- use: {
46
- ...devices['Desktop Chrome'],
47
- },
48
- testMatch: ['**/test/visual/*.spec.ts'],
49
- },
50
- {
51
- name: 'visual:mobile',
52
- grep: /@mobile/,
53
- use: {
54
- ...devices['Galaxy S8'],
55
- },
56
- testMatch: ['**/test/visual/*.spec.ts'],
57
- },
58
- ],
59
- };
60
- }