@grafana/e2e: fix empty bundle files (#22607)

* Minor changes

* Revert CLI to JavaScript

... as Rollup is only accepts ESM modules and TypeScript would need to use the new incremental builds feature which causes weird Redux module errors.
pull/22522/head
Steven Vachon 5 years ago committed by GitHub
parent 3745cccde6
commit aa7e6cf55f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      packages/grafana-e2e/bin/grafana-e2e.js
  2. 17
      packages/grafana-e2e/cli.js
  3. 1
      packages/grafana-e2e/package.json
  4. 4
      packages/grafana-e2e/rollup.config.ts
  5. 5
      packages/grafana-e2e/src/bin/grafana-e2e.ts
  6. 1
      packages/grafana-e2e/tsconfig.json

@ -1,10 +1,3 @@
#!/usr/bin/env node #!/usr/bin/env node
// This file is used only for internal executions require('../cli')();
require('ts-node').register({
project: `${__dirname}/../tsconfig.json`,
transpileOnly: true,
});
require('../src/cli/index.ts').default();

@ -1,16 +1,15 @@
import { resolve, sep } from 'path'; const execa = require('execa');
import execa, { Options } from 'execa'; const program = require('commander');
import program from 'commander'; const { resolve, sep } = require('path');
const cypress = (commandName: string) => { const cypress = commandName => {
// Support running an unpublished dev build // Support running an unpublished dev build
const parentPath = resolve(`${__dirname}/../`); const dirname = __dirname.split(sep).pop();
const parentDirname = parentPath.split(sep).pop(); const projectPath = resolve(`${__dirname}${dirname === 'dist' ? '/..' : ''}`);
const projectPath = resolve(`${parentPath}${parentDirname === 'dist' ? '/..' : ''}`);
const cypressOptions = [commandName, '--env', `CWD=${process.cwd()}`, `--project=${projectPath}`]; const cypressOptions = [commandName, '--env', `CWD=${process.cwd()}`, `--project=${projectPath}`];
const execaOptions: Options = { const execaOptions = {
cwd: __dirname, cwd: __dirname,
stdio: 'inherit', stdio: 'inherit',
}; };
@ -20,7 +19,7 @@ const cypress = (commandName: string) => {
.catch(error => console.error(error.message)); .catch(error => console.error(error.message));
}; };
export default () => { module.exports = () => {
const configOption = '-c, --config <path>'; const configOption = '-c, --config <path>';
const configDescription = 'path to JSON file where configuration values are set; defaults to "cypress.json"'; const configDescription = 'path to JSON file where configuration values are set; defaults to "cypress.json"';

@ -5,6 +5,7 @@
"version": "6.7.0-pre", "version": "6.7.0-pre",
"description": "Grafana End-to-End Test Library", "description": "Grafana End-to-End Test Library",
"keywords": [ "keywords": [
"cli",
"grafana", "grafana",
"e2e", "e2e",
"typescript" "typescript"

@ -20,8 +20,8 @@ const buildCjsPackage = ({ env }) => ({
copy({ copy({
flatten: false, flatten: false,
targets: [ targets: [
{ src: 'compiled/bin/**/*.*', dest: 'dist/' }, { src: 'bin/**/*.*', dest: 'dist/bin/' },
{ src: 'compiled/cli/**/*.*', dest: 'dist/' }, { src: 'cli.js', dest: 'dist/' },
{ src: 'cypress.json', dest: 'dist/' }, { src: 'cypress.json', dest: 'dist/' },
{ src: 'cypress/**/*.+(js|ts)', dest: 'dist/cypress/' }, { src: 'cypress/**/*.+(js|ts)', dest: 'dist/cypress/' },
], ],

@ -1,5 +0,0 @@
#!/usr/bin/env node
import cli from '../cli/index';
cli();

@ -1,7 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"declarationDir": "dist", "declarationDir": "dist",
"module": "commonjs",
"outDir": "compiled", "outDir": "compiled",
"rootDirs": ["."], "rootDirs": ["."],
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],

Loading…
Cancel
Save