mirror of
https://github.com/microsoft/playwright.git
synced 2024-11-28 09:23:42 +03:00
chore(create-playwright): nits and cleanups (#9537)
This commit is contained in:
parent
8c581bc9b5
commit
9031c4d2e4
@ -39,7 +39,6 @@ const config = {
|
||||
name: 'Desktop Chrome',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -35,7 +35,6 @@ const config: PlaywrightTestConfig = {
|
||||
name: 'Desktop Chrome',
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -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": {
|
||||
|
27
packages/create-playwright/src/cli.ts
Normal file
27
packages/create-playwright/src/cli.ts
Normal 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);
|
||||
});
|
10
packages/create-playwright/src/index.ts → packages/create-playwright/src/generator.ts
Executable file → Normal file
10
packages/create-playwright/src/index.ts → packages/create-playwright/src/generator.ts
Executable file → Normal 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);
|
||||
});
|
@ -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';
|
||||
|
@ -4,7 +4,5 @@
|
||||
"downlevelIteration": true,
|
||||
"esModuleInterop": true,
|
||||
},
|
||||
"files": [
|
||||
"src/index.ts"
|
||||
]
|
||||
"include": ["src"],
|
||||
}
|
@ -18,5 +18,8 @@
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": ["packages"],
|
||||
"exclude": ["packages/*/lib"]
|
||||
"exclude": [
|
||||
"packages/*/lib",
|
||||
"packages/create-playwright/",
|
||||
],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user