Commit aa7e6cf5 by Steven Vachon Committed by GitHub

@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.
parent 3745cccd
#!/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();
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) => { ...@@ -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 @@ ...@@ -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 }) => ({ ...@@ -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/' },
], ],
......
#!/usr/bin/env node
import cli from '../cli/index';
cli();
{ {
"compilerOptions": { "compilerOptions": {
"declarationDir": "dist", "declarationDir": "dist",
"module": "commonjs",
"outDir": "compiled", "outDir": "compiled",
"rootDirs": ["."], "rootDirs": ["."],
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment