chore(create-playwright): nits and cleanups (#9537)

This commit is contained in:
Max Schmitt 2021-10-15 16:39:12 +02:00 committed by GitHub
parent 8c581bc9b5
commit 9031c4d2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 18 deletions

View File

@ -39,7 +39,6 @@ const config = {
name: 'Desktop Chrome',
use: {
...devices['Desktop Chrome'],
},
},
{

View File

@ -35,7 +35,6 @@ const config: PlaywrightTestConfig = {
name: 'Desktop Chrome',
use: {
...devices['Desktop Chrome'],
},
},
{

View File

@ -15,8 +15,8 @@
"license": "MIT",
"scripts": {
"prepublish": "npm run build",
"watch": "cd src && ncc build index.ts --watch --out ../lib && cd ..",
"build": "cd src && ncc build index.ts --minify --out ../lib && cd ..",
"watch": "cd src && ncc build cli.ts --watch --out ../lib && cd ..",
"build": "cd src && ncc build cli.ts --minify --out ../lib && cd ..",
"test": "npx playwright test"
},
"devDependencies": {

View File

@ -0,0 +1,27 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import path from 'path';
import { Generator } from './generator';
(async () => {
const rootDir = path.resolve(process.cwd(), process.argv[2] || '');
const generator = new Generator(rootDir);
await generator.run();
})().catch(error => {
console.error(error);
process.exit(1);
});

View File

@ -29,7 +29,7 @@ export type PromptOptions = {
const PACKAGE_JSON_TEST_SCRIPT_CMD = 'test:e2e';
class Generator {
export class Generator {
packageManager: 'npm' | 'yarn';
constructor(private readonly rootDir: string) {
if (!fs.existsSync(rootDir))
@ -188,11 +188,3 @@ export function commandToRunTests(packageManager: 'npm' | 'yarn', args?: string)
return `npm run ${PACKAGE_JSON_TEST_SCRIPT_CMD}${args ? (' -- ' + args) : ''}`;
}
(async () => {
const rootDir = path.resolve(process.cwd(), process.argv[2] || '');
const generator = new Generator(rootDir);
await generator.run();
})().catch(error => {
console.error(error);
process.exit(1);
});

View File

@ -18,7 +18,7 @@ import { spawn } from 'child_process';
import path from 'path';
import fs from 'fs';
import type { PromptOptions } from '../src';
import type { PromptOptions } from '../src/generator';
type TestFixtures = {
packageManager: 'npm' | 'yarn';

View File

@ -4,7 +4,5 @@
"downlevelIteration": true,
"esModuleInterop": true,
},
"files": [
"src/index.ts"
]
"include": ["src"],
}

View File

@ -18,5 +18,8 @@
},
"compileOnSave": true,
"include": ["packages"],
"exclude": ["packages/*/lib"]
"exclude": [
"packages/*/lib",
"packages/create-playwright/",
],
}