Skip to content

Commit 29603d7

Browse files
authored
chore(gene-tools): update setupNodeEvents configuration (#43)
1 parent 54dc022 commit 29603d7

File tree

11 files changed

+505
-242
lines changed

11 files changed

+505
-242
lines changed

.github/workflows/npm-publish.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Publish to NPM on GH Release Publish
2+
run-name: Publish to NPM ${{ github.event.inputs.version || github.event.release.tag_name }}
23

34
on:
45
workflow_dispatch:

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"@storybook/addon-actions": "6.5.16",
3535
"@storybook/builder-webpack5": "6.5.4",
3636
"@storybook/core-server": "6.5.16",
37-
"@storybook/manager-webpack5": "6.5.4",
3837
"@tanstack/react-query": "5.55.4",
3938
"chalk": "2.4.2",
4039
"classnames": "2.5.1",
@@ -96,6 +95,7 @@
9695
"@babel/runtime": "7.16.7",
9796
"@badeball/cypress-cucumber-preprocessor": "13.0.2",
9897
"@bahmutov/cypress-esbuild-preprocessor": "2.1.5",
98+
"@cypress/webpack-preprocessor": "6.0.2",
9999
"@next/bundle-analyzer": "12.3.4",
100100
"@nrwl/cypress": "15.8.9",
101101
"@nrwl/jest": "15.8.9",
@@ -175,9 +175,11 @@
175175
"tailwindcss": "3.4.14",
176176
"tailwindcss-animate": "1.0.7",
177177
"ts-jest": "29.0.5",
178+
"ts-loader": "9.5.1",
178179
"ts-node": "10.9.1",
179180
"tsconfig-paths-webpack-plugin": "3.5.1",
180181
"typescript": "4.7.4",
182+
"webpack": "5.74.0",
181183
"zod": "3.22.3",
182184
"zod-to-ts": "1.2.0"
183185
},

packages/gene-tools/src/generators/bff-app-generator/files/e2e/cypress.config.ts__tmpl__

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'cypress';
22
import {nxE2EPreset} from '@nrwl/cypress/plugins/cypress-preset';
3-
import * as setupNodeEvents from './src/plugins/index';
3+
import {setupNodeEvents} from './src/plugins';
44

55
export default defineConfig({
66
e2e: {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1+
const webpack = require('@cypress/webpack-preprocessor');
12
const {
23
addCucumberPreprocessorPlugin,
34
} = require('@badeball/cypress-cucumber-preprocessor');
4-
const {
5-
preprocessor,
6-
} = require('@badeball/cypress-cucumber-preprocessor/browserify');
75

8-
module.exports = async (on, config) => {
6+
export async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
98
await addCucumberPreprocessorPlugin(on, config);
109

1110
on(
1211
'file:preprocessor',
13-
preprocessor(config, {
14-
typescript: require.resolve('typescript'),
12+
webpack({
13+
webpackOptions: {
14+
resolve: {
15+
extensions: ['.ts', '.js'],
16+
},
17+
module: {
18+
rules: [
19+
{
20+
test: /\.feature$/,
21+
use: [
22+
{
23+
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
24+
options: config,
25+
},
26+
],
27+
},
28+
{
29+
test: /\.tsx?$/,
30+
exclude: /node_modules/,
31+
loader: 'ts-loader',
32+
options: {
33+
transpileOnly: true,
34+
},
35+
},
36+
],
37+
},
38+
},
1539
})
1640
);
1741

@@ -25,5 +49,6 @@ module.exports = async (on, config) => {
2549
}
2650
});
2751

52+
// Make sure to return the config object as it might have been modified by the plugin.
2853
return config;
29-
};
54+
}

packages/gene-tools/src/generators/core-module-generator/files/e2e/cypress.config.ts__tmpl__

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'cypress';
22
import {nxE2EPreset} from '@nrwl/cypress/plugins/cypress-preset';
3-
import * as setupNodeEvents from './src/plugins/index';
3+
import {setupNodeEvents} from './src/plugins';
44

55
export default defineConfig({
66
e2e: {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1+
const webpack = require('@cypress/webpack-preprocessor');
12
const {
23
addCucumberPreprocessorPlugin,
34
} = require('@badeball/cypress-cucumber-preprocessor');
4-
const {
5-
preprocessor,
6-
} = require('@badeball/cypress-cucumber-preprocessor/browserify');
75

8-
module.exports = async (on, config) => {
6+
export async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
98
await addCucumberPreprocessorPlugin(on, config);
109

1110
on(
1211
'file:preprocessor',
13-
preprocessor(config, {
14-
typescript: require.resolve('typescript'),
12+
webpack({
13+
webpackOptions: {
14+
resolve: {
15+
extensions: ['.ts', '.js'],
16+
},
17+
module: {
18+
rules: [
19+
{
20+
test: /\.feature$/,
21+
use: [
22+
{
23+
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
24+
options: config,
25+
},
26+
],
27+
},
28+
{
29+
test: /\.tsx?$/,
30+
exclude: /node_modules/,
31+
loader: 'ts-loader',
32+
options: {
33+
transpileOnly: true,
34+
},
35+
},
36+
],
37+
},
38+
},
1539
})
1640
);
1741

@@ -25,5 +49,6 @@ module.exports = async (on, config) => {
2549
}
2650
});
2751

52+
// Make sure to return the config object as it might have been modified by the plugin.
2853
return config;
29-
};
54+
}

packages/gene-tools/src/generators/module-generator/files/e2e-with-library/cypress.config.ts__tmpl__

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'cypress';
22
import {nxE2EPreset} from '@nrwl/cypress/plugins/cypress-preset';
3-
import * as setupNodeEvents from './src/plugins/index';
3+
import {setupNodeEvents} from './src/plugins';
44

55
export default defineConfig({
66
e2e: {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1+
const webpack = require('@cypress/webpack-preprocessor');
12
const {
23
addCucumberPreprocessorPlugin,
34
} = require('@badeball/cypress-cucumber-preprocessor');
4-
const {
5-
preprocessor,
6-
} = require('@badeball/cypress-cucumber-preprocessor/browserify');
75

8-
module.exports = async (on, config) => {
6+
export async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
98
await addCucumberPreprocessorPlugin(on, config);
109

1110
on(
1211
'file:preprocessor',
13-
preprocessor(config, {
14-
typescript: require.resolve('typescript'),
12+
webpack({
13+
webpackOptions: {
14+
resolve: {
15+
extensions: ['.ts', '.js'],
16+
},
17+
module: {
18+
rules: [
19+
{
20+
test: /\.feature$/,
21+
use: [
22+
{
23+
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
24+
options: config,
25+
},
26+
],
27+
},
28+
{
29+
test: /\.tsx?$/,
30+
exclude: /node_modules/,
31+
loader: 'ts-loader',
32+
options: {
33+
transpileOnly: true,
34+
},
35+
},
36+
],
37+
},
38+
},
1539
})
1640
);
1741

@@ -25,5 +49,6 @@ module.exports = async (on, config) => {
2549
}
2650
});
2751

52+
// Make sure to return the config object as it might have been modified by the plugin.
2853
return config;
29-
};
54+
}

packages/gene-tools/src/generators/nextjs-app-generator/files/e2e/cypress.config.ts__tmpl__

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'cypress';
22
import {nxE2EPreset} from '@nrwl/cypress/plugins/cypress-preset';
3-
import * as setupNodeEvents from './src/plugins/index';
3+
import {setupNodeEvents} from './src/plugins';
44

55
export default defineConfig({
66
e2e: {
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1+
const webpack = require('@cypress/webpack-preprocessor');
12
const {
23
addCucumberPreprocessorPlugin,
34
} = require('@badeball/cypress-cucumber-preprocessor');
4-
const {
5-
preprocessor,
6-
} = require('@badeball/cypress-cucumber-preprocessor/browserify');
75

8-
module.exports = async (on, config) => {
6+
export async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
98
await addCucumberPreprocessorPlugin(on, config);
109

1110
on(
1211
'file:preprocessor',
13-
preprocessor(config, {
14-
typescript: require.resolve('typescript'),
12+
webpack({
13+
webpackOptions: {
14+
resolve: {
15+
extensions: ['.ts', '.js'],
16+
},
17+
module: {
18+
rules: [
19+
{
20+
test: /\.feature$/,
21+
use: [
22+
{
23+
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
24+
options: config,
25+
},
26+
],
27+
},
28+
{
29+
test: /\.tsx?$/,
30+
exclude: /node_modules/,
31+
loader: 'ts-loader',
32+
options: {
33+
transpileOnly: true,
34+
},
35+
},
36+
],
37+
},
38+
},
1539
})
1640
);
1741

@@ -25,5 +49,6 @@ module.exports = async (on, config) => {
2549
}
2650
});
2751

52+
// Make sure to return the config object as it might have been modified by the plugin.
2853
return config;
29-
};
54+
}

0 commit comments

Comments
 (0)