chore: add better-sqlite3 dependency (#26168)

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
This commit is contained in:
Ryan Manuel
2023-03-23 17:01:13 +00:00
committed by GitHub
parent f790fb22da
commit bbe90abee7
49 changed files with 318 additions and 105 deletions
+1
View File
@@ -57,6 +57,7 @@ module.exports = {
rules: {
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-console': 'off',
},
},
],
+4
View File
@@ -11,6 +11,10 @@ _Released 03/28/2023 (PENDING)_
**Misc:**
- Made some minor styling updates to the Debug page. Addresses [#26041](https://github.com/cypress-io/cypress/issues/26041).
**Dependency Updates:**
- Added [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3) to support storing test run information which will be sent when recording to the Cloud
## 12.8.1
+2 -2
View File
@@ -41,7 +41,7 @@
"ensure-deps": "./scripts/ensure-dependencies.sh",
"get-next-version": "node scripts/get-next-version.js",
"postinstall": "node ./scripts/run-postInstall.js",
"lint": "lerna run lint --no-bail --concurrency 2",
"lint": "lerna run lint --no-bail --concurrency 2 && eslint --ext .js,.ts,.json, scripts",
"prepare-release-artifacts": "node ./scripts/prepare-release-artifacts.js",
"npm-release": "node scripts/npm-release.js",
"prestart": "yarn ensure-deps",
@@ -276,4 +276,4 @@
"sharp": "0.29.3",
"vue-template-compiler": "2.6.12"
}
}
}
@@ -3,6 +3,7 @@ import Debug from 'debug'
import { _connectAsync, _getDelayMsForRetry } from './protocol'
import * as errors from '../errors'
import { create, CriClient } from './cri-client'
import type { ProtocolManager } from '@packages/types'
const debug = Debug('cypress:server:browsers:browser-cri-client')
@@ -91,7 +92,7 @@ const retryWithIncreasingDelay = async <T>(retryable: () => Promise<T>, browserN
export class BrowserCriClient {
currentlyAttachedTarget: CriClient | undefined
private constructor (private browserClient: CriClient, private versionInfo, public host: string, public port: number, private browserName: string, private onAsynchronousError: Function) {}
private constructor (private browserClient: CriClient, private versionInfo, public host: string, public port: number, private browserName: string, private onAsynchronousError: Function, private protocolManager?: ProtocolManager) {}
/**
* Factory method for the browser cri client. Connects to the browser and then returns a chrome remote interface wrapper around the
@@ -103,14 +104,14 @@ export class BrowserCriClient {
* @param onAsynchronousError callback for any cdp fatal errors
* @returns a wrapper around the chrome remote interface that is connected to the browser target
*/
static async create (hosts: string[], port: number, browserName: string, onAsynchronousError: Function, onReconnect?: (client: CriClient) => void): Promise<BrowserCriClient> {
static async create (hosts: string[], port: number, browserName: string, onAsynchronousError: Function, onReconnect?: (client: CriClient) => void, protocolManager?: ProtocolManager): Promise<BrowserCriClient> {
const host = await ensureLiveBrowser(hosts, port, browserName)
return retryWithIncreasingDelay(async () => {
const versionInfo = await CRI.Version({ host, port, useHostName: true })
const browserClient = await create(versionInfo.webSocketDebuggerUrl, onAsynchronousError, undefined, undefined, onReconnect)
return new BrowserCriClient(browserClient, versionInfo, host!, port, browserName, onAsynchronousError)
return new BrowserCriClient(browserClient, versionInfo, host!, port, browserName, onAsynchronousError, protocolManager)
}, browserName, port)
}
@@ -149,6 +150,12 @@ export class BrowserCriClient {
throw new Error(`Could not find url target in browser ${url}. Targets were ${JSON.stringify(targets)}`)
}
await this.protocolManager?.connectToBrowser({
target: target.targetId,
host: this.host,
port: this.port,
})
this.currentlyAttachedTarget = await create(target.targetId, this.onAsynchronousError, this.host, this.port)
return this.currentlyAttachedTarget
@@ -181,6 +188,12 @@ export class BrowserCriClient {
])
if (target) {
await this.protocolManager?.connectToBrowser({
target: target.targetId,
host: this.host,
port: this.port,
})
this.currentlyAttachedTarget = await create(target.targetId, this.onAsynchronousError, this.host, this.port)
}
}
@@ -189,6 +202,7 @@ export class BrowserCriClient {
* Closes the browser client socket as well as the socket for the currently attached page target
*/
close = async () => {
this.protocolManager?.close()
if (this.currentlyAttachedTarget) {
await this.currentlyAttachedTarget.close()
}
+4 -11
View File
@@ -20,7 +20,7 @@ import type { Browser, BrowserInstance } from './types'
import { BrowserCriClient } from './browser-cri-client'
import type { CriClient } from './cri-client'
import type { Automation } from '../automation'
import type { BrowserLaunchOpts, BrowserNewTabOpts, RunModeVideoApi } from '@packages/types'
import type { BrowserLaunchOpts, BrowserNewTabOpts, ProtocolManager, RunModeVideoApi } from '@packages/types'
import memory from './memory'
const debug = debugModule('cypress:server:browsers:chrome')
@@ -569,9 +569,8 @@ export = {
/**
* Clear instance state for the chrome instance, this is normally called in on kill or on exit.
*/
clearInstanceState () {
clearInstanceState (protocolManager?: ProtocolManager) {
debug('closing remote interface client')
// Do nothing on failure here since we're shutting down anyway
browserCriClient?.close().catch()
browserCriClient = undefined
@@ -640,12 +639,6 @@ export = {
this._handleDownloads(pageCriClient, options.downloadsFolder, automation),
])
await options.protocolManager?.connectToBrowser({
target: pageCriClient.targetId,
host: browserCriClient.host,
port: browserCriClient.port,
})
await this._navigateUsingCRI(pageCriClient, url)
await this._handlePausedRequests(pageCriClient)
@@ -715,7 +708,7 @@ export = {
// navigate to the actual url
if (!options.onError) throw new Error('Missing onError in chrome#open')
browserCriClient = await BrowserCriClient.create(['127.0.0.1'], port, browser.displayName, options.onError, onReconnect)
browserCriClient = await BrowserCriClient.create(['127.0.0.1'], port, browser.displayName, options.onError, onReconnect, options.protocolManager)
la(browserCriClient, 'expected Chrome remote interface reference', browserCriClient)
@@ -734,7 +727,7 @@ export = {
launchedBrowser.browserCriClient = browserCriClient
launchedBrowser.kill = (...args) => {
this.clearInstanceState()
this.clearInstanceState(options.protocolManager)
debug('closing chrome')
+17 -7
View File
@@ -3,8 +3,9 @@ import { NodeVM } from 'vm2'
import Debug from 'debug'
import CDP from 'chrome-remote-interface'
import type { ProtocolManager, AppCaptureProtocolInterface } from '@packages/types'
// TODO(protocol): This is basic for now but will evolve as we progress with the protocol wor
import Database from 'better-sqlite3'
import path from 'path'
import os from 'os'
const debug = Debug('cypress:server:protocol')
@@ -19,9 +20,13 @@ const setupProtocol = async (url?: string): Promise<AppCaptureProtocolInterface
}
if (script) {
const cypressProtocolDirectory = path.join(os.tmpdir(), 'cypress', 'protocol')
// TODO(protocol): Handle any errors here appropriately. Likely, we will want to handle all errors in the initialization process similarly (e.g. downloading, file permissions, etc.)
await fs.ensureDir(cypressProtocolDirectory)
const vm = new NodeVM({
console: 'inherit',
sandbox: { Debug, CDP },
sandbox: { nodePath: path, Debug, CDP, Database, CY_PROTOCOL_DIR: cypressProtocolDirectory, betterSqlite3Binding: path.join(require.resolve('better-sqlite3/build/Release/better_sqlite3.node')) },
})
const { AppCaptureProtocol } = vm.run(script)
@@ -34,6 +39,7 @@ const setupProtocol = async (url?: string): Promise<AppCaptureProtocolInterface
class ProtocolManagerImpl implements ProtocolManager {
private protocol: AppCaptureProtocolInterface | undefined
private db: Database
protocolEnabled (): boolean {
return !!this.protocol
@@ -45,16 +51,15 @@ class ProtocolManagerImpl implements ProtocolManager {
this.protocol = await setupProtocol(url)
}
connectToBrowser (options) {
async connectToBrowser (options) {
debug('connecting to browser for new spec')
this.protocol?.connectToBrowser(options)
return this.protocol?.connectToBrowser(options)
}
beforeSpec (spec) {
debug('initializing new spec %O', spec)
this.protocol?.beforeSpec(spec)
// Initialize DB here
}
afterSpec () {
@@ -66,6 +71,11 @@ class ProtocolManagerImpl implements ProtocolManager {
debug('initialize new test %O', test)
this.protocol?.beforeTest(test)
}
close () {
debug('closing')
this.protocol?.close()
}
}
export default ProtocolManagerImpl
+3
View File
@@ -4,6 +4,7 @@
"private": true,
"main": "index.js",
"scripts": {
"build": "electron-rebuild -o better-sqlite3",
"build-prod": "tsc || echo 'built, with type errors'",
"check-ts": "tsc --noEmit && yarn -s tslint",
"clean-deps": "rimraf node_modules",
@@ -37,6 +38,7 @@
"ansi_up": "5.0.0",
"ast-types": "0.13.3",
"base64url": "^3.0.1",
"better-sqlite3": "8.2.0",
"black-hole-stream": "0.0.1",
"bluebird": "3.7.2",
"bundle-require": "3.0.4",
@@ -138,6 +140,7 @@
"@cypress/json-schemas": "5.39.0",
"@cypress/sinon-chai": "2.9.1",
"@cypress/webpack-dev-server": "0.0.0-development",
"@electron/rebuild": "3.2.10",
"@ffprobe-installer/ffprobe": "1.1.0",
"@packages/config": "0.0.0-development",
"@packages/data-context": "0.0.0-development",
@@ -0,0 +1,40 @@
/* global Debug, CDP, CY_PROTOCOL_DIR, betterSqlite3Binding, nodePath, Database */
const AppCaptureProtocol = class {
constructor () {
this.Debug = Debug
this.CDP = CDP
this.CY_PROTOCOL_DIR = CY_PROTOCOL_DIR
this.betterSqlite3Binding = betterSqlite3Binding
this.nodePath = nodePath
this.Database = Database
this.connectToBrowser = this.connectToBrowser.bind(this)
this.beforeSpec = this.beforeSpec.bind(this)
this.afterSpec = this.afterSpec.bind(this)
this.beforeTest = this.beforeTest.bind(this)
}
async connectToBrowser ({
target,
host,
port,
}) {
return Promise.resolve()
}
beforeSpec (spec) {
}
afterSpec (spec) {
}
beforeTest (test) {
}
}
module.exports = {
AppCaptureProtocol,
}
@@ -4,6 +4,7 @@ import { expect, proxyquire, sinon } from '../../spec_helper'
import * as protocol from '../../../lib/browsers/protocol'
import { stripAnsi } from '@packages/errors'
import net from 'net'
import { ProtocolManager } from '@packages/types'
const HOST = '127.0.0.1'
const PORT = 50505
@@ -22,7 +23,7 @@ describe('lib/browsers/cri-client', function () {
Version: sinon.SinonStub
}
let onError: sinon.SinonStub
let getClient: () => ReturnType<typeof BrowserCriClient.create>
let getClient: (protocolManager?: ProtocolManager) => ReturnType<typeof BrowserCriClient.create>
beforeEach(function () {
sinon.stub(protocol, '_connectAsync')
@@ -47,7 +48,7 @@ describe('lib/browsers/cri-client', function () {
'chrome-remote-interface': criImport,
})
getClient = () => browserCriClient.BrowserCriClient.create(['127.0.0.1'], PORT, 'Chrome', onError)
getClient = (protocolManager) => browserCriClient.BrowserCriClient.create(['127.0.0.1'], PORT, 'Chrome', onError, undefined, protocolManager)
})
context('.create', function () {
@@ -151,6 +152,27 @@ describe('lib/browsers/cri-client', function () {
expect(client).to.be.equal(mockPageClient)
})
it('creates a page client when the passed in url is found and notifies the protocol manager', async function () {
const mockPageClient = {}
const protocolManager: any = {
connectToBrowser: sinon.stub().resolves(),
}
send.withArgs('Target.getTargets').resolves({ targetInfos: [{ targetId: '1', url: 'http://foo.com' }, { targetId: '2', url: 'http://bar.com' }] })
criClientCreateStub.withArgs('1', onError, HOST, PORT).resolves(mockPageClient)
const browserClient = await getClient(protocolManager)
const client = await browserClient.attachToTargetUrl('http://foo.com')
expect(client).to.be.equal(mockPageClient)
expect(protocolManager.connectToBrowser).to.be.calledWith({
host: HOST,
port: PORT,
target: '1',
})
})
it('retries when the passed in url is not found', async function () {
sinon.stub(protocol, '_getDelayMsForRetry')
.onFirstCall().returns(100)
@@ -558,10 +558,6 @@ describe('lib/browsers/chrome', () => {
kill: sinon.stub().returns(),
}
const protocolManager = {
connectToBrowser: sinon.stub().resolves(),
}
let onInitializeNewBrowserTabCalled = false
const options = {
...openOpts,
@@ -572,7 +568,6 @@ describe('lib/browsers/chrome', () => {
onInitializeNewBrowserTab: () => {
onInitializeNewBrowserTabCalled = true
},
protocolManager,
}
sinon.stub(chrome, '_getBrowserCriClient').returns(browserCriClient)
@@ -588,11 +583,6 @@ describe('lib/browsers/chrome', () => {
expect(chrome._navigateUsingCRI).to.be.called
expect(chrome._handleDownloads).to.be.called
expect(onInitializeNewBrowserTabCalled).to.be.true
expect(protocolManager.connectToBrowser).to.be.calledWith({
host: 'http://localhost',
port: 1234,
target: '1234',
})
})
})
@@ -6,7 +6,7 @@ import { exec } from 'child_process'
import originalResolvePackagePath from 'resolve-package-path'
import proxyquire from 'proxyquire'
describe('lib/cloud/api', () => {
describe('lib/cloud/environment', () => {
beforeEach(() => {
delete process.env.CYPRESS_API_URL
process.env.CYPRESS_ENV_DEPENDENCIES = base64url.encode(JSON.stringify({
@@ -0,0 +1,109 @@
import '../../spec_helper'
import ProtocolManager from '../../../lib/cloud/protocol'
import path from 'path'
describe('lib/cloud/protocol', () => {
beforeEach(() => {
process.env.CYPRESS_LOCAL_PROTOCOL_PATH = path.join(__dirname, '..', '..', 'support', 'fixtures', 'cloud', 'protocol', 'test-protocol.js')
})
afterEach(() => {
delete process.env.CYPRESS_LOCAL_PROTOCOL_PATH
})
it('should be able to setup the protocol', async () => {
const protocolManager = new ProtocolManager()
await protocolManager.setupProtocol()
const protocol = (protocolManager as any).protocol
expect(protocolManager.protocolEnabled()).to.be.true
expect(protocol.Debug).not.to.be.undefined
expect(protocol.CDP).not.to.be.undefined
expect(protocol.CY_PROTOCOL_DIR).not.to.be.undefined
expect(protocol.betterSqlite3Binding).not.to.be.undefined
expect(protocol.nodePath).not.to.be.undefined
expect(protocol.Database).not.to.be.undefined
})
it('should be able to connect to the browser', async () => {
const protocolManager = new ProtocolManager()
await protocolManager.setupProtocol()
const protocol = (protocolManager as any).protocol
sinon.stub(protocol, 'connectToBrowser').resolves()
await protocolManager.connectToBrowser({
target: 'target',
host: 'host',
port: 1234,
})
expect(protocol.connectToBrowser).to.be.calledWith({
target: 'target',
host: 'host',
port: 1234,
})
})
it('should be able to initialize a new spec', async () => {
const protocolManager = new ProtocolManager()
await protocolManager.setupProtocol()
const protocol = (protocolManager as any).protocol
sinon.stub(protocol, 'beforeSpec').resolves()
await protocolManager.beforeSpec({
name: 'spec',
relative: 'relative',
absolute: 'absolute',
})
expect(protocol.beforeSpec).to.be.calledWith({
name: 'spec',
relative: 'relative',
absolute: 'absolute',
})
})
it('should be able to initialize a new test', async () => {
const protocolManager = new ProtocolManager()
await protocolManager.setupProtocol()
const protocol = (protocolManager as any).protocol
sinon.stub(protocol, 'beforeTest').resolves()
await protocolManager.beforeTest({
id: 'id',
title: 'test',
wallClockStartedAt: 1234,
})
expect(protocol.beforeTest).to.be.calledWith({
id: 'id',
title: 'test',
wallClockStartedAt: 1234,
})
})
it('should be able to clean up after a spec', async () => {
const protocolManager = new ProtocolManager()
await protocolManager.setupProtocol()
const protocol = (protocolManager as any).protocol
sinon.stub(protocol, 'afterSpec').resolves()
await protocolManager.afterSpec()
expect(protocol.afterSpec).to.be.called
})
})
+2 -1
View File
@@ -3,10 +3,11 @@ import type { SpecFile } from '.'
// TODO(protocol): This is basic for now but will evolve as we progress with the protocol work
export interface AppCaptureProtocolInterface {
connectToBrowser (options: { target: string, host: string, port: number }): void
connectToBrowser (options: { target: string, host: string, port: number }): Promise<void>
beforeSpec (spec: SpecFile & { instanceId: string }): void
afterSpec (): void
beforeTest (test: { id: string, title: string, wallClockStartedAt: number }): void
close(): void
}
export interface ProtocolManager extends AppCaptureProtocolInterface {
-2
View File
@@ -14,8 +14,6 @@ const { Octokit } = require('@octokit/core')
const { createAppAuth } = require('@octokit/auth-app')
const { stripIndent } = require('common-tags')
/* eslint-disable no-console */
const { npm, binary } = getNameAndBinary(process.argv)
la(is.unemptyString(npm), 'missing npm url')
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs-extra')
const { join } = require('path')
const glob = require('glob')
-2
View File
@@ -5,8 +5,6 @@ const fs = require('fs')
const path = require('path')
let electron_notarize = require('electron-notarize')
/* eslint-disable no-console */
module.exports = async function (params) {
// Only notarize the app on Mac OS.
if (process.platform !== 'darwin') {
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
require('@packages/ts/register')
const command = process.argv[2]
+1 -3
View File
@@ -63,6 +63,7 @@ const getDependencyPathsToKeep = async (buildAppDir) => {
'openbsd',
'sunos',
'win32'].map((platform) => path.join(unixBuildAppDir, `node_modules/default-gateway/${platform}.js`)),
path.join(unixBuildAppDir, 'node_modules/vm2/lib/bridge.js'),
])
let esbuildResult
let newEntryPointsFound = true
@@ -132,12 +133,10 @@ const createServerEntryPointBundle = async (buildAppDir) => {
],
})
// eslint-disable-next-line no-console
console.log(`copying server entry point bundle from ${path.join(workingDir, 'index.js')} to ${path.join(buildAppDir, 'packages', 'server', 'index.js')}`)
await fs.copy(path.join(workingDir, 'index.js'), path.join(buildAppDir, 'packages', 'server', 'index.js'))
// eslint-disable-next-line no-console
console.log(`compiling server entry point bundle to ${path.join(buildAppDir, 'packages', 'server', 'index.jsc')}`)
// Use bytenode to compile the entry point bundle. This will save time on the v8 compile step and ensure the integrity of the entry point
@@ -171,7 +170,6 @@ const buildEntryPointAndCleanup = async (buildAppDir) => {
...serverEntryPointBundleDependencies,
]
// eslint-disable-next-line no-console
console.log(`potentially removing ${potentiallyRemovedDependencies.length} dependencies`)
// 4. Remove all dependencies that are in the snapshot but not in the list of kept dependencies from the binary
+2 -1
View File
@@ -121,7 +121,8 @@ export async function buildCypressApp (options: BuildCypressAppOpts) {
fs.writeJsonSync(meta.distDir('package.json'), {
...packageJsonContents,
scripts: {
postinstall: 'patch-package',
// After the `yarn --production` install, we need to patch packages and trigger a server build to rebuild native bindings for `better-sqlite3`
postinstall: 'patch-package && yarn workspace @packages/server build',
},
}, { spaces: 2 })
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
// store the cwd
const cwd = process.cwd()
@@ -22,11 +22,8 @@ const rewritePackageNames = (fileStr, buildRoot, filePath, onFound) => {
const replaceString = `${match[1]}${replaceWith}${afterPkg}`
// eslint-disable-next-line no-console
console.log()
// eslint-disable-next-line no-console
console.log('resolve:', chalk.grey(pkgPath), '\nfrom:', chalk.grey(filePath))
// eslint-disable-next-line no-console
console.log(chalk.yellow(`@packages/${pkg}`), '->', chalk.green(replaceWith))
onFound && onFound(replaceString)
-2
View File
@@ -13,12 +13,10 @@ const nodeVersion = process.versions.node.split('.')
// check just major version for now
if (nodeVersionNeeded[0] !== nodeVersion[0]) {
/* eslint-disable no-console */
console.error('🛑 .node-version specified %s', nodeVersionNeededString)
console.error('but current Node is %s', process.versions.node)
/* eslint-enable no-console */
process.exit(1)
}
// eslint-disable-next-line no-console
console.log('✅ current Node version of %s matches the version specified in the .node-version file', process.versions.node)
-1
View File
@@ -9,6 +9,5 @@ if (isMainLinux) {
assert.ok(process.env.COLUMNS === '100', `process.env.COLUMNS=${process.env.COLUMNS} must be set to 100 for snapshots to pass`)
/* eslint-disable no-console */
console.log('stdout.isTTY?', process.stdout.isTTY)
console.log('stderr.isTTY?', process.stderr.isTTY)
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const glob = require('glob')
const path = require('path')
const fsExtra = require('fs-extra')
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs').promises
async function loadInternalTaskData () {
-1
View File
@@ -23,7 +23,6 @@ debug('starting the CLI in dev mode with args %o', {
const exit = ({ exitCode }) => {
if (typeof exitCode !== 'number') {
// eslint-disable-next-line no-console
console.error(`missing exit code from execa (received ${exitCode})`)
process.exit(1)
}
-2
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-console */
const path = require('path')
const semver = require('semver')
const bumpCb = require('conventional-recommended-bump')
-1
View File
@@ -1,3 +1,2 @@
// generate a unique key for each platform+arch combo in CI
// eslint-disable-next-line no-console
console.log(`${process.platform}-${process.arch}`)
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { validatePrTitle } = require('./validate-pr-title')
const { validateChangelog } = require('../../semantic-commits/validate-changelog')
const { getLinkedIssues } = require('../../semantic-commits/get-linked-issues')
@@ -61,7 +61,6 @@ const getVersions = async ({ core }) => {
core.setOutput('latest_beta_version', betaData.version)
core.setOutput('description', description)
} catch (err) {
// eslint-disable-next-line no-console
console.log('Errored checking for new Chrome versions:', err.stack)
core.setOutput('has_update', 'false')
}
@@ -96,7 +95,6 @@ const updatePRTitle = async ({ context, github, baseBranch, branchName, descript
})
if (!data.length) {
// eslint-disable-next-line no-console
console.log('Could not find PR for branch:', branchName)
return
+3 -1
View File
@@ -98,7 +98,9 @@ export async function syncRemoteGraphQL () {
// TODO(tim): fix
await fs.ensureDir(path.join(monorepoPaths.pkgGraphql, 'src/gen'))
await fs.promises.writeFile(path.join(monorepoPaths.pkgGraphql, 'schemas/cloud.graphql'), body)
} catch {}
} catch (error) {
console.error('Could not sync remote GraphQL schema', error)
}
}
/**
-3
View File
@@ -173,19 +173,16 @@ export const execAsync = async (
const { silent } = options
if (!silent) {
// eslint-disable-next-line no-console
console.log(command)
}
const result = await execAsyncLocal(command, options)
if (!silent && typeof result.stdout === 'string' && result.stdout.length) {
// eslint-disable-next-line no-console
console.log(result.stdout)
}
if (!silent && typeof result.stderr === 'string' && result.stderr.length) {
// eslint-disable-next-line no-console
console.error(result.stderr)
}
-2
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-console */
/*
Usage - All arguments are required
--from <path> local path to repository to import
-1
View File
@@ -2,7 +2,6 @@
* To easily test if your release will apply locally, you can run:
* yarn test-npm-package-release-script
*/
/* eslint-disable no-console */
const execa = require('execa')
const fs = require('fs')
const semverSortNewestFirst = require('semver/functions/rcompare')
-1
View File
@@ -11,7 +11,6 @@ if (!/^\d+\.\d+\.\d+$/.test(args.version)) {
throw new Error('A valid semantic version (X.Y.Z) must be passed in `--version`.')
}
// eslint-disable-next-line no-console
const log = (...args) => console.log('🏗', ...args)
const exec = args['dry-run'] ?
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const childProcess = require('child_process')
const _ = require('lodash')
const { Octokit } = require('@octokit/core')
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const childProcess = require('child_process')
/**
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const { userFacingChanges } = require('./change-categories')
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const fs = require('fs')
const path = require('path')
const { validateChangelog } = require('./validate-changelog')
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { userFacingChanges } = require('./change-categories')
const { parseChangelog } = require('./parse-changelog')
-1
View File
@@ -75,7 +75,6 @@ packlist({ path: currentPackageDir })
const output = `${JSON.stringify(cliPackageConfig, null, 2) }\n`
// eslint-disable-next-line no-console
console.log('Writing to CLI package.json for', exportName)
fs.writeFileSync(path.join(cliPath, 'package.json'), output, 'utf-8')
-1
View File
@@ -76,7 +76,6 @@ program
})
const log = (msg) => {
// eslint-disable-next-line no-console
console.log(msg)
}
@@ -350,7 +350,6 @@ describe('update browser version github action', () => {
})
expect(github.pulls.update).not.to.be.called
// eslint-disable-next-line no-console
expect(console.log).to.be.calledWith('Could not find PR for branch:', 'some-branch-name')
})
})
-4
View File
@@ -373,7 +373,6 @@ describe('semantic release', () => {
execaStub.returns({ stdout: 'the stdout' })
await releasePackages(['package-1', 'package-2'])
/* eslint-disable no-console */
expect(console.log).to.be.calledWith('Released package-1 successfully:')
expect(console.log).to.be.calledWith('Released package-2 successfully:')
expect(console.log).to.be.calledWith('the stdout')
@@ -408,7 +407,6 @@ describe('semantic release', () => {
await releasePackages(['package-1', 'package-2'])
/* eslint-disable no-console */
expect(console.log).to.be.calledWith('Releasing package-1 failed:')
expect(console.log).to.be.calledWith('could not release package-1')
expect(console.log).to.be.calledWith('Released package-2 successfully:')
@@ -422,7 +420,6 @@ describe('semantic release', () => {
execaStub.returns({ stdout: 'the stdout' })
await releasePackages(['package-1', 'package-2'])
/* eslint-disable no-console */
expect(console.log).to.be.calledWith('\nAll packages released successfully')
/* eslint-enable no-console */
})
@@ -443,7 +440,6 @@ describe('semantic release', () => {
await releasePackages(['package-1', 'package-2', 'package-3'])
/* eslint-disable no-console */
expect(console.log).to.be.calledWith(`
The following packages failed to release:
- package-1
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
const { expect, use } = require('chai')
const sinonChai = require('sinon-chai')
const sinon = require('sinon')
-2
View File
@@ -5,8 +5,6 @@ const path = require('path')
const fs = require('fs')
const execa = require('execa')
/* eslint-disable no-console */
function getNameAndBinary (args = process.argv) {
const options = minimist(args)
-2
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-console */
// this is a safety script to ensure that Mocha tests ran, by checking:
// 1. that there are N test results in the reports dir (or at least 1, if N is not set)
// 2. each of them contains 0 failures and >0 tests
-2
View File
@@ -1,5 +1,3 @@
/* eslint-disable no-console */
const _ = require('lodash')
const minimist = require('minimist')
const Promise = require('bluebird')
+88 -15
View File
@@ -2519,6 +2519,26 @@
global-agent "^3.0.0"
global-tunnel-ng "^2.7.1"
"@electron/rebuild@3.2.10":
version "3.2.10"
resolved "https://registry.yarnpkg.com/@electron/rebuild/-/rebuild-3.2.10.tgz#adc9443179709d4e4b93a68fac6a08b9a3b9e5e6"
integrity sha512-SUBM6Mwi3yZaDFQjZzfGKpYTtOp9m60glounwX6tfGeVc/ZOl4jbquktUcyy7gYSLDWFLtKkftkY2xgMJZLQgg==
dependencies:
"@malept/cross-spawn-promise" "^2.0.0"
chalk "^4.0.0"
debug "^4.1.1"
detect-libc "^2.0.1"
fs-extra "^10.0.0"
got "^11.7.0"
lzma-native "^8.0.5"
node-abi "^3.0.0"
node-api-version "^0.1.4"
node-gyp "^9.0.0"
ora "^5.1.0"
semver "^7.3.5"
tar "^6.0.5"
yargs "^17.0.1"
"@electron/universal@1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-1.0.5.tgz#b812340e4ef21da2b3ee77b2b4d35c9b86defe37"
@@ -4823,6 +4843,13 @@
dependencies:
cross-spawn "^7.0.1"
"@malept/cross-spawn-promise@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@malept/cross-spawn-promise/-/cross-spawn-promise-2.0.0.tgz#d0772de1aa680a0bfb9ba2f32b4c828c7857cb9d"
integrity sha512-1DpKU0Z5ThltBwjNySMC14g0CkbyhCaz9FkhxqNsZI6uAPJXFS8cMXlBKo26FJ8ZuW6S9GCMcR9IO5k2X5/9Fg==
dependencies:
cross-spawn "^7.0.1"
"@malept/flatpak-bundler@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@malept/flatpak-bundler/-/flatpak-bundler-0.4.0.tgz#e8a32c30a95d20c2b1bb635cc580981a06389858"
@@ -9318,6 +9345,14 @@ before-after-hook@^2.0.0, before-after-hook@^2.2.0:
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e"
integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==
better-sqlite3@8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-8.2.0.tgz#4ef6185b88992723de7e00cfa67585ac59f320bd"
integrity sha512-8eTzxGk9535SB3oSNu0tQ6I4ZffjVCBUjKHN9QeeIFtphBX0sEd0NxAuglBNR9TO5ThnxBB7GqzfcYo9kjadJQ==
dependencies:
bindings "^1.5.0"
prebuild-install "^7.1.0"
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
@@ -12705,7 +12740,7 @@ detect-libc@^1.0.3:
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
detect-libc@^2.0.0:
detect-libc@^2.0.0, detect-libc@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.1.tgz#e1897aa88fa6ad197862937fbc0441ef352ee0cd"
integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==
@@ -16337,6 +16372,23 @@ got@11.8.5:
p-cancelable "^2.0.0"
responselike "^2.0.0"
got@^11.7.0:
version "11.8.6"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a"
integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==
dependencies:
"@sindresorhus/is" "^4.0.0"
"@szmarczak/http-timer" "^4.0.5"
"@types/cacheable-request" "^6.0.1"
"@types/responselike" "^1.0.0"
cacheable-lookup "^5.0.3"
cacheable-request "^7.0.2"
decompress-response "^6.0.0"
http2-wrapper "^1.0.0-beta.5.2"
lowercase-keys "^2.0.0"
p-cancelable "^2.0.0"
responselike "^2.0.0"
got@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/got/-/got-8.3.2.tgz#1d23f64390e97f776cac52e5b936e5f514d2e937"
@@ -20244,6 +20296,15 @@ lz-string@^1.4.4:
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
lzma-native@^8.0.5:
version "8.0.6"
resolved "https://registry.yarnpkg.com/lzma-native/-/lzma-native-8.0.6.tgz#3ea456209d643bafd9b5d911781bdf0b396b2665"
integrity sha512-09xfg67mkL2Lz20PrrDeNYZxzeW7ADtpYFbwSQh9U8+76RIzx5QsJBMy8qikv3hbUPfpy6hqwxt6FcGK81g9AA==
dependencies:
node-addon-api "^3.1.0"
node-gyp-build "^4.2.1"
readable-stream "^3.6.0"
macos-release@^2.2.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.5.0.tgz#067c2c88b5f3fb3c56a375b2ec93826220fa1ff2"
@@ -20968,6 +21029,11 @@ minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.
dependencies:
yallist "^4.0.0"
minipass@^4.0.0:
version "4.2.5"
resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.5.tgz#9e0e5256f1e3513f8c34691dd68549e85b2c8ceb"
integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==
minizlib@^1.2.1:
version "1.3.3"
resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d"
@@ -21875,10 +21941,10 @@ node-abi@^2.7.0:
dependencies:
semver "^5.4.1"
node-abi@^3.3.0:
version "3.30.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.30.0.tgz#d84687ad5d24ca81cdfa912a36f2c5c19b137359"
integrity sha512-qWO5l3SCqbwQavymOmtTVuCWZE23++S+rxyoHjXqUmPyzRcaoI4lA2gO55/drddGnedAyjA7sk76SfQ5lfUMnw==
node-abi@^3.0.0, node-abi@^3.3.0:
version "3.33.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.33.0.tgz#8b23a0cec84e1c5f5411836de6a9b84bccf26e7f"
integrity sha512-7GGVawqyHF4pfd0YFybhv/eM9JwTtPqx0mAanQ146O3FlSh3pA24zf9IRQTOsfTSqXTNzPSP5iagAJ94jjuVog==
dependencies:
semver "^7.3.5"
@@ -21897,6 +21963,13 @@ node-addon-api@^4.2.0:
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-4.3.0.tgz#52a1a0b475193e0928e98e0426a0d1254782b77f"
integrity sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==
node-api-version@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/node-api-version/-/node-api-version-0.1.4.tgz#1ed46a485e462d55d66b5aa1fe2821720dedf080"
integrity sha512-KGXihXdUChwJAOHO53bv9/vXcLmdUsZ6jIptbvYvkpKfth+r7jw44JkVxQFA3kX5nQjzjmGu1uAu/xNNLNlI5g==
dependencies:
semver "^7.3.5"
node-dir@^0.1.10:
version "0.1.17"
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5"
@@ -21971,10 +22044,10 @@ node-forge@^1:
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==
node-gyp-build@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
integrity sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==
node-gyp-build@^4.2.1, node-gyp-build@^4.3.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055"
integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==
node-gyp@^5.0.2:
version "5.1.1"
@@ -24053,7 +24126,7 @@ prebuild-install@^5.2.4, prebuild-install@^5.3.5:
tunnel-agent "^0.6.0"
which-pm-runs "^1.0.0"
prebuild-install@^7.0.0:
prebuild-install@^7.0.0, prebuild-install@^7.1.0:
version "7.1.1"
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==
@@ -28234,14 +28307,14 @@ tar@^4.4.10, tar@^4.4.12, tar@^4.4.8:
safe-buffer "^5.1.2"
yallist "^3.0.3"
tar@^6.0.2, tar@^6.1.0, tar@^6.1.11, tar@^6.1.2:
version "6.1.11"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
tar@^6.0.2, tar@^6.0.5, tar@^6.1.0, tar@^6.1.11, tar@^6.1.2:
version "6.1.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.13.tgz#46e22529000f612180601a6fe0680e7da508847b"
integrity sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==
dependencies:
chownr "^2.0.0"
fs-minipass "^2.0.0"
minipass "^3.0.0"
minipass "^4.0.0"
minizlib "^2.1.1"
mkdirp "^1.0.3"
yallist "^4.0.0"