@grafana/e2e: correctly exclude dependencies from TypeScript builds (#22732)

* maintains support for Grafana core e2e tests
* avoids producing declaration files in plugin source directories
This commit is contained in:
Steven Vachon
2020-03-11 15:30:29 -04:00
committed by GitHub
parent 5b7bb267cb
commit 4fecf5a7a6
2 changed files with 17 additions and 1 deletions

View File

@@ -1,9 +1,23 @@
const { resolve } = require('path');
const wp = require('@cypress/webpack-preprocessor'); const wp = require('@cypress/webpack-preprocessor');
const anyNodeModules = /node_modules/;
const packageRoot = resolve(`${__dirname}/../../`);
const packageModules = `${packageRoot}/node_modules`;
const webpackOptions = { const webpackOptions = {
module: { module: {
rules: [ rules: [
{ {
include: modulePath => {
if (!anyNodeModules.test(modulePath)) {
// Is a file within the project
return true;
} else {
// Is a file within this package
return modulePath.startsWith(packageRoot) && !modulePath.startsWith(packageModules);
}
},
test: /\.ts$/, test: /\.ts$/,
use: [ use: [
{ {

View File

@@ -1,7 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"declaration": false,
"module": "commonjs",
"types": ["cypress"] "types": ["cypress"]
}, },
"extends": "../tsconfig.json", "extends": "@grafana/tsconfig",
"include": ["**/*.ts"] "include": ["**/*.ts"]
} }