chore(create-playwright): some nits (#9133)

This commit is contained in:
Joel Einbinder 2021-10-13 17:33:44 -04:00 committed by GitHub
parent a885e95646
commit 9d3513ab13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 23 deletions

View file

@ -1,8 +1,9 @@
# This ignores everything by default, except for package.json and LICENSE and README.md.
# See https://docs.npmjs.com/misc/developers
**/*
!/lib/**/*
/node_modules/
/test-results/
/src/**/*
/tests/**/*
/playwright.config.ts
/tsconfig.json
!index.js
!/assets/**/*
/assets/.eslintrc.js

View file

@ -1,6 +1,7 @@
// Example files here do not need the copyright notice.
module.exports = {
"extends": "../../../.eslintrc.js",
"rules": {
"notice/notice": 0
}
'extends': '../../../.eslintrc.js',
'rules': {
'notice/notice': 0
}
};

View file

@ -1,10 +1,10 @@
// @ts-check
const { devices } = require('@playwright/test');
const path = require('path')
const path = require('path');
/**
* @see https://playwright.dev/docs/test-configuration
* @type{import('@playwright/test').PlaywrightTestConfig}
* @type {import('@playwright/test').PlaywrightTestConfig}
*/
const config = {
// Timeout per test

View file

@ -5,7 +5,6 @@
"requires": true,
"packages": {
"": {
"name": "create-playwright",
"version": "0.1.7",
"license": "MIT",
"bin": {

View file

@ -19,7 +19,7 @@ import fs from 'fs';
import { prompt } from 'enquirer';
import colors from 'ansi-colors';
import { executeCommands, createFiles, determinePackageManager, executeTemplate, determineRootDir, Command, languagetoFileExtension } from './utils';
import { executeCommands, createFiles, determinePackageManager, executeTemplate, Command, languagetoFileExtension } from './utils';
export type PromptOptions = {
testDir: string,
@ -189,7 +189,7 @@ export function commandToRunTests(packageManager: 'npm' | 'yarn', args?: string)
}
(async () => {
const rootDir = determineRootDir();
const rootDir = path.resolve(process.cwd(), process.argv[2] || '');
const generator = new Generator(rootDir);
await generator.run();
})().catch(error => {

View file

@ -55,14 +55,6 @@ export async function createFiles(rootDir: string, files: Map<string, string>, f
}
}
export function determineRootDir() {
const givenPath = process.argv[2];
if (givenPath)
return path.isAbsolute(givenPath) ? process.argv[2] : path.join(process.cwd(), process.argv[2]);
return process.cwd();
}
export function determinePackageManager(rootDir: string): 'yarn' | 'npm' {
if (fs.existsSync(path.join(rootDir, 'yarn.lock')))
return 'yarn';