@justeattakeaway/pie-components-config 0.8.0 → 0.10.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/index.js +2 -0
- package/package.json +6 -2
- package/playwright-lit-config.js +54 -0
- package/playwright-lit-visual-config.js +54 -0
- package/tsconfig.json +26 -0
- package/vite.config.js +47 -0
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-components-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Just Eat Takeaway.com - Design System Team",
|
|
7
7
|
"description": "Shared configuration files for PIE components",
|
|
8
8
|
"files": [
|
|
9
|
-
"custom-elements-manifest.config.js"
|
|
9
|
+
"custom-elements-manifest.config.js",
|
|
10
|
+
"vite.config.js",
|
|
11
|
+
"tsconfig.json",
|
|
12
|
+
"playwright-lit-config.js",
|
|
13
|
+
"playwright-lit-visual-config.js"
|
|
10
14
|
],
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"deepmerge-ts": "5.1.0"
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
/* Run tests in files in parallel */
|
|
14
|
+
fullyParallel: true,
|
|
15
|
+
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
16
|
+
forbidOnly: !!process.env.CI,
|
|
17
|
+
/* Retry on CI only */
|
|
18
|
+
retries: process.env.CI ? 2 : 0,
|
|
19
|
+
/* Opt out of parallel tests on CI. */
|
|
20
|
+
workers: '50%',
|
|
21
|
+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
22
|
+
reporter: [['html', { outputFolder: 'lit-browsers-report' }]],
|
|
23
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
24
|
+
use: {
|
|
25
|
+
ctViteConfig: {
|
|
26
|
+
resolve: {
|
|
27
|
+
alias: {
|
|
28
|
+
'@': path.resolve('./src'),
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
33
|
+
trace: 'on',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/* Configure projects for major browsers */
|
|
37
|
+
projects: [
|
|
38
|
+
{
|
|
39
|
+
name: 'component:chrome',
|
|
40
|
+
use: {
|
|
41
|
+
...devices['Desktop Chrome'],
|
|
42
|
+
},
|
|
43
|
+
testMatch: ['**/test/component/*.spec.ts'],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'a11y:chrome',
|
|
47
|
+
use: {
|
|
48
|
+
...devices['Desktop Chrome'],
|
|
49
|
+
},
|
|
50
|
+
testMatch: ['**/test/accessibility/*.spec.ts'],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
},
|
|
33
|
+
|
|
34
|
+
/* Configure projects for major browsers */
|
|
35
|
+
projects: [
|
|
36
|
+
{
|
|
37
|
+
name: 'visual:desktop',
|
|
38
|
+
grepInvert: /@mobile/,
|
|
39
|
+
use: {
|
|
40
|
+
...devices['Desktop Chrome'],
|
|
41
|
+
},
|
|
42
|
+
testMatch: ['**/test/visual/*.spec.ts'],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'visual:mobile',
|
|
46
|
+
grep: /@mobile/,
|
|
47
|
+
use: {
|
|
48
|
+
...devices['Pixel 5'],
|
|
49
|
+
},
|
|
50
|
+
testMatch: ['**/test/visual/*.spec.ts'],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES6",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"lib": ["es2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"inlineSources": true,
|
|
10
|
+
"outDir": "./compiled",
|
|
11
|
+
"strict": true,
|
|
12
|
+
"noUnusedLocals": true,
|
|
13
|
+
"noUnusedParameters": true,
|
|
14
|
+
"noImplicitReturns": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noImplicitAny": true,
|
|
17
|
+
"noImplicitThis": true,
|
|
18
|
+
"moduleResolution": "node",
|
|
19
|
+
"allowSyntheticDefaultImports": true,
|
|
20
|
+
"experimentalDecorators": true,
|
|
21
|
+
"forceConsistentCasingInFileNames": true,
|
|
22
|
+
"allowImportingTsExtensions": true,
|
|
23
|
+
"noEmit": true,
|
|
24
|
+
},
|
|
25
|
+
"exclude": []
|
|
26
|
+
}
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import dts from 'vite-plugin-dts';
|
|
3
|
+
|
|
4
|
+
import { deepmerge } from 'deepmerge-ts';
|
|
5
|
+
|
|
6
|
+
const bundledJetDeps = [
|
|
7
|
+
'@justeattakeaway/pie-components-config',
|
|
8
|
+
'@justeattakeaway/pie-css',
|
|
9
|
+
'@justeattakeaway/pie-webc-testing',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
// https://vitejs.dev/config/
|
|
13
|
+
const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
|
|
14
|
+
build: deepmerge({
|
|
15
|
+
lib: {
|
|
16
|
+
entry: {
|
|
17
|
+
index: 'src/index.ts',
|
|
18
|
+
react: 'src/react.ts',
|
|
19
|
+
},
|
|
20
|
+
formats: ['es'],
|
|
21
|
+
},
|
|
22
|
+
rollupOptions: {
|
|
23
|
+
external: (id) => {
|
|
24
|
+
if (['react', '@lit/react'].includes(id) || /^lit/.test(id)) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (id.startsWith('@justeattakeaway/pie-') && !bundledJetDeps.includes(id)) {
|
|
29
|
+
console.info(`Excluding ${id} from the bundle`);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return false;
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}, build),
|
|
37
|
+
|
|
38
|
+
plugins: deepmerge([dts({
|
|
39
|
+
insertTypesEntry: true,
|
|
40
|
+
outputDir: 'dist',
|
|
41
|
+
rollupTypes: true,
|
|
42
|
+
})], plugins),
|
|
43
|
+
|
|
44
|
+
...rest,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export default sharedConfig;
|