Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-wdio

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-wdio - npm Package Compare versions

Comparing version 8.1.0 to 8.2.0

20

build/index.js

@@ -5,4 +5,6 @@ import fs from 'node:fs/promises';

import semver from 'semver';
import hasYarn from 'has-yarn';
import { readPackageUp } from 'read-pkg-up';
import { Command } from 'commander';
import { runProgram, shouldUseYarn, getPackageVersion } from './utils.js';
import { runProgram, getPackageVersion } from './utils.js';
import { ASCII_ROBOT, PROGRAM_TITLE, UNSUPPORTED_NODE_VERSION, DEFAULT_NPM_TAG } from './constants.js';

@@ -43,5 +45,2 @@ const WDIO_COMMAND = 'wdio';

export async function createWebdriverIO(opts) {
const useYarn = typeof opts.useYarn === 'boolean'
? opts.useYarn
: await shouldUseYarn();
const npmTag = opts.npmTag.startsWith('@') ? opts.npmTag : `@${opts.npmTag}`;

@@ -53,3 +52,16 @@ const root = path.resolve(process.cwd(), projectDir || '');

}
/**
* check if a package.json exists and if not create one
*/
const project = await readPackageUp({ cwd: root });
if (!project) {
await fs.writeFile(path.resolve(root, 'package.json'), JSON.stringify({
name: 'my-new-project',
type: 'module'
}, null, 2));
}
console.log(`\nInstalling ${chalk.bold('@wdio/cli')} to initialize project...`);
const useYarn = typeof opts.useYarn === 'boolean'
? opts.useYarn
: await hasYarn(root);
const logLevel = opts.verbose ? 'trace' : 'error';

@@ -56,0 +68,0 @@ const command = useYarn ? 'yarnpkg' : 'npm';

24

build/utils.js

@@ -9,11 +9,13 @@ import url from 'node:url';

export const colorIt = chalk.rgb(234, 89, 6);
process.on('SIGINT', () => printAndExit(undefined, 'SIGINT'));
export function runProgram(command, args, options) {
const child = spawn(command, args, { stdio: 'inherit', ...options });
return new Promise((resolve, reject) => {
return new Promise((resolve, rejects) => {
let error;
child.on('error', (e) => (error = e));
child.on('close', code => {
child.on('close', (code, signal) => {
if (code !== 0) {
return reject(new Error((error && error.message) ||
`Error calling: ${command} ${args.join(' ')}`));
const errorMessage = (error && error.message) || `Error calling: ${command} ${args.join(' ')}`;
printAndExit(errorMessage, signal);
return rejects(errorMessage);
}

@@ -24,7 +26,2 @@ resolve();

}
/* c8 ignore start */
export function shouldUseYarn() {
return runProgram('yarnpkg', ['--version'], { stdio: 'ignore' }).then(() => true, () => false);
}
/* c8 ignore end */
export async function getPackageVersion() {

@@ -41,1 +38,10 @@ try {

}
function printAndExit(error, signal) {
if (signal === 'SIGINT') {
console.log('\n\nGoodbye 👋');
}
else {
console.log(`\n\n⚠️ Ups, something went wrong${error ? `: ${error}` : ''}!`);
}
process.exit(1);
}
{
"name": "create-wdio",
"version": "8.1.0",
"version": "8.2.0",
"description": "Install and setup a WebdriverIO project with all its dependencies in a single run",

@@ -42,22 +42,24 @@ "author": "Christian Bromann <mail@bromann.dev>",

"@types/cross-spawn": "^6.0.2",
"@types/node": "^18.7.23",
"@types/semver": "^7.3.12",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@vitest/coverage-c8": "^0.25.0",
"@types/node": "^18.11.13",
"@types/semver": "^7.3.13",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"@vitest/coverage-c8": "^0.25.7",
"c8": "^7.12.0",
"eslint": "^8.24.0",
"eslint": "^8.29.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-unicorn": "^45.0.0",
"eslint-plugin-unicorn": "^45.0.1",
"npm-run-all": "^4.1.5",
"release-it": "^15.4.2",
"typescript": "^4.8.4",
"vitest": "^0.25.0"
"release-it": "^15.5.1",
"typescript": "^4.9.4",
"vitest": "^0.25.7"
},
"dependencies": {
"chalk": "^5.0.1",
"commander": "^9.4.0",
"chalk": "^5.2.0",
"commander": "^9.4.1",
"cross-spawn": "^7.0.3",
"semver": "^7.3.7"
"has-yarn": "^3.0.0",
"read-pkg-up": "^9.1.0",
"semver": "^7.3.8"
}
}

@@ -17,8 +17,8 @@ /// <reference types="vitest" />

exclude: ['**/build/**', '__mocks__', '**/*.test.ts'],
lines: 100,
functions: 82,
branches: 84,
statements: 100
lines: 98,
functions: 80,
branches: 77,
statements: 98
}
}
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc