Skip to content

Effection v4 #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 61 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
15e49c8
upgrade a bunch of packages including effection
jbolda Jan 20, 2025
4fa40ec
convert files package to effection v4
jbolda Jan 20, 2025
f81828b
migrated changelog
jbolda Jan 20, 2025
0c16f72
migrate apply
jbolda Jan 20, 2025
2a91a7c
describe.skipIf
jbolda Jan 28, 2025
2ce6e4f
test scope experiments
jbolda Jan 29, 2025
c68ab98
Add test adapter based on effection contrib
cowboyd Feb 5, 2025
1d19e9e
swap to execa, compat tests
jbolda Feb 7, 2025
30c80aa
yield* higher packages
jbolda Feb 7, 2025
e98d4e9
yield* and call on command tests
jbolda Feb 7, 2025
f679ffd
prep higher command fn for new sh()
jbolda Feb 7, 2025
433dceb
handle for test suite functions with context
jbolda Feb 10, 2025
0e64956
update adapter to await
jbolda Feb 10, 2025
3081ba9
log out to make sure child is an AsyncIterable
cowboyd Feb 10, 2025
20375cb
pull out execa.pipe handler
jbolda Feb 11, 2025
b502d9d
passing command tests
jbolda Feb 11, 2025
4738875
passing assemble tests
jbolda Feb 11, 2025
e7b12a8
core covector tests passing
jbolda Mar 1, 2025
ed68ca8
clean up typescript config
jbolda Mar 4, 2025
668dbfb
fix typescript project references
jbolda Mar 4, 2025
30ccf4a
fix TS project references circular and all type errors
jbolda Mar 5, 2025
850ac21
fix assemble bumps
jbolda Mar 10, 2025
c403332
fix a bunch of snapshots
jbolda Mar 18, 2025
4e547b6
fix up action and tests
jbolda Mar 18, 2025
27e96a1
build action
jbolda Mar 18, 2025
ad68f83
adjust action file path ref
jbolda Mar 18, 2025
7df10aa
function to main
jbolda Mar 18, 2025
1643f72
swap back to tinyexec...
jbolda Mar 19, 2025
a12dda1
swap to esm for all packages
jbolda Mar 19, 2025
f7b153d
rip out lodash for better esm compat
jbolda Mar 19, 2025
29f0f3a
fix yargs hidebin
jbolda Mar 19, 2025
1066e42
action dist
jbolda Mar 19, 2025
077452e
resolve ts issues
jbolda Mar 20, 2025
046a751
regen action for mjs
jbolda Mar 20, 2025
7dc6781
swap off clone for validation
jbolda Mar 20, 2025
88e0eb2
throw on error of command, then catch
jbolda Mar 20, 2025
710dcbf
fix init and CLI tests
jbolda Mar 20, 2025
ee1045d
swap back to ncc, fix types through to action
jbolda Mar 21, 2025
75ea77a
fix tests
jbolda Mar 21, 2025
76d0985
rebuild action again
jbolda Mar 21, 2025
da6e79e
try copying and deleting wasm before running build
jbolda Mar 21, 2025
3cda500
try web build
jbolda Mar 21, 2025
35c401e
rollup is a failure
jbolda Mar 22, 2025
68bba1a
try with vite
jbolda Mar 22, 2025
1afb1da
try rollup with esbuild
jbolda Mar 24, 2025
c46a370
function call in main
jbolda Mar 24, 2025
9faca22
use wasm plugin for vitest
jbolda Mar 24, 2025
7d0c83a
wasm-pack module requires experimental, back to nodejs bundler
jbolda Mar 24, 2025
752c220
strip ansi for CLI tests in CI
jbolda Mar 24, 2025
4880570
upgrade effection to v4 alpha 7
jbolda Mar 24, 2025
397ce6c
try polyfilling the __dirname
jbolda Mar 24, 2025
52f335b
inject __dirname for cjs toml
jbolda Mar 24, 2025
0e4aeef
more direct inject
jbolda Mar 24, 2025
e9fce42
copy over wasm
jbolda Mar 25, 2025
a317095
cjs plugin, then shim
jbolda Mar 25, 2025
855139a
test e2e using built action to check toml
jbolda Mar 27, 2025
2dd0f6d
build action before test runs
jbolda Mar 27, 2025
3f8194f
set-output gets clipped in CI
jbolda Mar 27, 2025
8025407
commandFailure fix for windows
jbolda Mar 27, 2025
978a734
fixes some windows tests
jbolda Mar 30, 2025
f83e385
upgrade to effection v4 beta
jbolda Jul 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
swap back to ncc, fix types through to action
  • Loading branch information
jbolda committed Mar 21, 2025

Verified

This commit was signed with the committer’s verified signature.
jbolda Jacob Bolda
commit ee1045d4eb83f54e034827e3dbce76adc59d0a5f
1,910 changes: 242 additions & 1,668 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions packages/action/dist/420.index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const id = 420;
export const ids = [420];
export const modules = {

/***/ 18420:
/***/ ((module) => {

module.exports = /*#__PURE__*/JSON.parse('{"name":"covector","version":"0.12.4","license":"Apache-2.0","homepage":"https://github.com/jbolda/covector#readme","author":"Jacob Bolda <[email protected]> (https://www.jacobbolda.com/)","repository":{"type":"git","url":"https://github.com/jbolda/covector.git"},"engines":{"node":">=18"},"type":"module","exports":{"development":"./src/index.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"bin":{"covector":"./bin/covector.mjs"},"files":["bin","dist"],"scripts":{"build":"tsc -b","clean":"rimraf dist tsconfig.tsbuildinfo node_modules","prepublishOnly":"tsc -b","test":"vitest"},"dependencies":{"@clack/prompts":"^0.10.0","@covector/apply":"0.10.0","@covector/assemble":"0.12.0","@covector/changelog":"0.12.0","@covector/command":"0.8.0","@covector/files":"0.8.0","effection":"4.0.0-alpha.4","globby":"^11.1.0","js-yaml":"^4.1.0","pino":"^9.1.0","pino-abstract-transport":"^1.2.0","strip-ansi":"6.0.1","yargs":"^17.7.2"},"devDependencies":{"@covector/types":"0.0.0","@octokit/webhooks-definitions":"^3.67.3","@types/inquirer":"^8.2.6","@types/yargs":"^17.0.33","fixturez":"^1.1.0"},"volta":{"extends":"../../package.json"}}');

/***/ })

};
Binary file modified packages/action/dist/covector_toml_bg.wasm
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/action/dist/file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

const pino = require('./pino')
const { once } = require('events')

module.exports = async function (opts = {}) {
const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false })
delete destOpts.destination
const destination = pino.destination(destOpts)
await once(destination, 'ready')
return destination
}
1 change: 1 addition & 0 deletions packages/action/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions packages/action/dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

167 changes: 167 additions & 0 deletions packages/action/dist/index.js

Large diffs are not rendered by default.

235,708 changes: 0 additions & 235,708 deletions packages/action/dist/index.mjs

This file was deleted.

76 changes: 0 additions & 76 deletions packages/action/dist/package-KZs3gDJ-.mjs

This file was deleted.

3 changes: 3 additions & 0 deletions packages/action/dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
11 changes: 11 additions & 0 deletions packages/action/dist/src/comment/formatGithubComment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { CovectorStatus } from "@covector/types";
import type { webhooks } from "@octokit/openapi-webhooks-types";
type PullRequestEvent = webhooks["pull-request-synchronize"]["post"]["requestBody"]["content"]["application/json"];
export declare function formatComment({ covectored, payload, projectReadmeExists, changeFolder, }: {
covectored: CovectorStatus;
payload: PullRequestEvent;
projectReadmeExists: boolean;
changeFolder: string;
}): string | undefined;
export {};
//# sourceMappingURL=formatGithubComment.d.ts.map
13 changes: 13 additions & 0 deletions packages/action/dist/src/comment/postGithubComment.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { getOctokit } from "@actions/github";
import { Operation } from "effection";
import { Logger } from "@covector/types";
export declare function postGithubComment({ logger, comment, octokit, repo, owner, prNumber: issue_number, artifactOnFailure, }: {
logger: Logger;
comment: string;
octokit: ReturnType<typeof getOctokit>;
repo: string;
owner: string;
prNumber: number;
artifactOnFailure?: boolean;
}): Operation<void>;
//# sourceMappingURL=postGithubComment.d.ts.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { getOctokit } from "@actions/github";
import { type Operation } from "effection";
import type { Logger } from "@covector/types";
import type { webhooks } from "@octokit/openapi-webhooks-types";
type WorkflowRunEvent = webhooks["workflow-run-requested"]["post"]["requestBody"]["content"]["application/json"];
export declare function postGithubCommentFromArtifact({ logger, octokit, token, payload, }: {
logger: Logger;
octokit: ReturnType<typeof getOctokit>;
token: string;
payload: WorkflowRunEvent;
}): Operation<void>;
export {};
//# sourceMappingURL=postGithubCommentFromArtifact.d.ts.map
4 changes: 4 additions & 0 deletions packages/action/dist/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import type { CovectorPublish, Logger } from "@covector/types";
import { type Operation } from "effection";
export declare function run(logger: Logger): Operation<CovectorPublish | void>;
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions packages/action/dist/src/index.d.ts.map
3 changes: 3 additions & 0 deletions packages/action/dist/src/logger.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import build from "pino-abstract-transport";
export default function (opts?: never): import("stream").Transform & build.OnUnknown;
//# sourceMappingURL=logger.d.ts.map
1 change: 1 addition & 0 deletions packages/action/dist/src/logger.d.ts.map
26 changes: 26 additions & 0 deletions packages/action/dist/src/pr/getCommitContext.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { getOctokit } from "@actions/github";
import { Operation } from "effection";
export type CommitResponse = {
repository: Record<string, Commit>;
};
type Commit = {
abbreviatedOid: string;
associatedPullRequests: {
nodes: {
number: number;
author: {
login: string;
};
reviews?: {
nodes: {
author: {
login: string;
};
}[];
};
}[];
};
};
export declare function getCommitContext(client: ReturnType<typeof getOctokit>["graphql"], owner: string, name: string, commits: string[]): Operation<CommitResponse>;
export {};
//# sourceMappingURL=getCommitContext.d.ts.map
1 change: 1 addition & 0 deletions packages/action/dist/src/pr/getCommitContext.d.ts.map
9 changes: 9 additions & 0 deletions packages/action/dist/src/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export declare const commandText: (pkg: {
precommand: string | boolean | null;
command: string | boolean | null;
postcommand: string | boolean | null;
}) => string;
export declare const packageListToArray: (list: string) => string[];
export declare const injectPublishFunctions: Function;
export declare const createReleases: Function;
//# sourceMappingURL=utils.d.ts.map
1 change: 1 addition & 0 deletions packages/action/dist/src/utils.d.ts.map
194 changes: 194 additions & 0 deletions packages/action/dist/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
'use strict'

const EE = require('events')
const { pipeline, PassThrough } = require('stream')
const pino = require('../pino.js')
const build = require('pino-abstract-transport')
const loadTransportStreamBuilder = require('./transport-stream')

// This file is not checked by the code coverage tool,
// as it is not reliable.

/* istanbul ignore file */

/*
* > Multiple targets & pipelines
*
*
* ┌─────────────────────────────────────────────────┐ ┌─────┐
* │ │ │ p │
* │ │ │ i │
* │ target │ │ n │
* │ │ ────────────────────────────────┼────┤ o │
* │ targets │ target │ │ . │
* │ ────────────► │ ────────────────────────────────┼────┤ m │ source
* │ │ target │ │ u │ │
* │ │ ────────────────────────────────┼────┤ l │ │write
* │ │ │ │ t │ ▼
* │ │ pipeline ┌───────────────┐ │ │ i │ ┌────────┐
* │ │ ──────────► │ PassThrough ├───┼────┤ s ├──────┤ │
* │ │ └───────────────┘ │ │ t │ write│ Thread │
* │ │ │ │ r │◄─────┤ Stream │
* │ │ pipeline ┌───────────────┐ │ │ e │ │ │
* │ │ ──────────► │ PassThrough ├───┼────┤ a │ └────────┘
* │ └───────────────┘ │ │ m │
* │ │ │ │
* └─────────────────────────────────────────────────┘ └─────┘
*
*
*
* > One single pipeline or target
*
*
* source
* │
* ┌────────────────────────────────────────────────┐ │write
* │ │ ▼
* │ │ ┌────────┐
* │ targets │ target │ │ │
* │ ────────────► │ ──────────────────────────────┤ │ │
* │ │ │ │ │
* │ ├──────┤ │
* │ │ │ │
* │ │ │ │
* │ OR │ │ │
* │ │ │ │
* │ │ │ │
* │ ┌──────────────┐ │ │ │
* │ targets │ pipeline │ │ │ │ Thread │
* │ ────────────► │ ────────────►│ PassThrough ├─┤ │ Stream │
* │ │ │ │ │ │ │
* │ └──────────────┘ │ │ │
* │ │ │ │
* │ OR │ write│ │
* │ │◄─────┤ │
* │ │ │ │
* │ ┌──────────────┐ │ │ │
* │ pipeline │ │ │ │ │
* │ ──────────────►│ PassThrough ├────────────────┤ │ │
* │ │ │ │ │ │
* │ └──────────────┘ │ └────────┘
* │ │
* │ │
* └────────────────────────────────────────────────┘
*/

module.exports = async function ({ targets, pipelines, levels, dedupe }) {
const targetStreams = []

// Process targets
if (targets && targets.length) {
targets = await Promise.all(targets.map(async (t) => {
const fn = await loadTransportStreamBuilder(t.target)
const stream = await fn(t.options)
return {
level: t.level,
stream
}
}))

targetStreams.push(...targets)
}

// Process pipelines
if (pipelines && pipelines.length) {
pipelines = await Promise.all(
pipelines.map(async (p) => {
let level
const pipeDests = await Promise.all(
p.map(async (t) => {
// level assigned to pipeline is duplicated over all its targets, just store it
level = t.level
const fn = await loadTransportStreamBuilder(t.target)
const stream = await fn(t.options)
return stream
}
))

return {
level,
stream: createPipeline(pipeDests)
}
})
)
targetStreams.push(...pipelines)
}

// Skip building the multistream step if either one single pipeline or target is defined and
// return directly the stream instance back to TreadStream.
// This is equivalent to define either:
//
// pino.transport({ target: ... })
//
// OR
//
// pino.transport({ pipeline: ... })
if (targetStreams.length === 1) {
return targetStreams[0].stream
} else {
return build(process, {
parse: 'lines',
metadata: true,
close (err, cb) {
let expected = 0
for (const transport of targetStreams) {
expected++
transport.stream.on('close', closeCb)
transport.stream.end()
}

function closeCb () {
if (--expected === 0) {
cb(err)
}
}
}
})
}

// TODO: Why split2 was not used for pipelines?
function process (stream) {
const multi = pino.multistream(targetStreams, { levels, dedupe })
// TODO manage backpressure
stream.on('data', function (chunk) {
const { lastTime, lastMsg, lastObj, lastLevel } = this
multi.lastLevel = lastLevel
multi.lastTime = lastTime
multi.lastMsg = lastMsg
multi.lastObj = lastObj

// TODO handle backpressure
multi.write(chunk + '\n')
})
}

/**
* Creates a pipeline using the provided streams and return an instance of `PassThrough` stream
* as a source for the pipeline.
*
* @param {(TransformStream|WritableStream)[]} streams An array of streams.
* All intermediate streams in the array *MUST* be `Transform` streams and only the last one `Writable`.
* @returns A `PassThrough` stream instance representing the source stream of the pipeline
*/
function createPipeline (streams) {
const ee = new EE()
const stream = new PassThrough({
autoDestroy: true,
destroy (_, cb) {
ee.on('error', cb)
ee.on('closed', cb)
}
})

pipeline(stream, ...streams, function (err) {
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
ee.emit('error', err)
return
}

ee.emit('closed')
})

return stream
}
}
170 changes: 170 additions & 0 deletions packages/action/dist/worker1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
'use strict'

const { realImport, realRequire } = require('real-require')
const { workerData, parentPort } = require('worker_threads')
const { WRITE_INDEX, READ_INDEX } = require('./indexes')
const { waitDiff } = require('./wait')

const {
dataBuf,
filename,
stateBuf
} = workerData

let destination

const state = new Int32Array(stateBuf)
const data = Buffer.from(dataBuf)

async function start () {
let worker
try {
if (filename.endsWith('.ts') || filename.endsWith('.cts')) {
// TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ).
if (!process[Symbol.for('ts-node.register.instance')]) {
realRequire('ts-node/register')
} else if (process.env.TS_NODE_DEV) {
realRequire('ts-node-dev')
}
// TODO: Support ES imports once tsc, tap & ts-node provide better compatibility guarantees.
// Remove extra forwardslash on Windows
worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', '')))
} else {
worker = (await realImport(filename))
}
} catch (error) {
// A yarn user that tries to start a ThreadStream for an external module
// provides a filename pointing to a zip file.
// eg. require.resolve('pino-elasticsearch') // returns /foo/pino-elasticsearch-npm-6.1.0-0c03079478-6915435172.zip/bar.js
// The `import` will fail to try to load it.
// This catch block executes the `require` fallback to load the module correctly.
// In fact, yarn modifies the `require` function to manage the zipped path.
// More details at https://github.com/pinojs/pino/pull/1113
// The error codes may change based on the node.js version (ENOTDIR > 12, ERR_MODULE_NOT_FOUND <= 12 )
if ((error.code === 'ENOTDIR' || error.code === 'ERR_MODULE_NOT_FOUND') &&
filename.startsWith('file://')) {
worker = realRequire(decodeURIComponent(filename.replace('file://', '')))
} else if (error.code === undefined || error.code === 'ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING') {
// When bundled with pkg, an undefined error is thrown when called with realImport
// When bundled with pkg and using node v20, an ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING error is thrown when called with realImport
// More info at: https://github.com/pinojs/thread-stream/issues/143
worker = realRequire(decodeURIComponent(filename.replace(process.platform === 'win32' ? 'file:///' : 'file://', '')))
} else {
throw error
}
}

// Depending on how the default export is performed, and on how the code is
// transpiled, we may find cases of two nested "default" objects.
// See https://github.com/pinojs/pino/issues/1243#issuecomment-982774762
if (typeof worker === 'object') worker = worker.default
if (typeof worker === 'object') worker = worker.default

destination = await worker(workerData.workerData)

destination.on('error', function (err) {
Atomics.store(state, WRITE_INDEX, -2)
Atomics.notify(state, WRITE_INDEX)

Atomics.store(state, READ_INDEX, -2)
Atomics.notify(state, READ_INDEX)

parentPort.postMessage({
code: 'ERROR',
err
})
})

destination.on('close', function () {
// process._rawDebug('worker close emitted')
const end = Atomics.load(state, WRITE_INDEX)
Atomics.store(state, READ_INDEX, end)
Atomics.notify(state, READ_INDEX)
setImmediate(() => {
process.exit(0)
})
})
}

// No .catch() handler,
// in case there is an error it goes
// to unhandledRejection
start().then(function () {
parentPort.postMessage({
code: 'READY'
})

process.nextTick(run)
})

function run () {
const current = Atomics.load(state, READ_INDEX)
const end = Atomics.load(state, WRITE_INDEX)

// process._rawDebug(`pre state ${current} ${end}`)

if (end === current) {
if (end === data.length) {
waitDiff(state, READ_INDEX, end, Infinity, run)
} else {
waitDiff(state, WRITE_INDEX, end, Infinity, run)
}
return
}

// process._rawDebug(`post state ${current} ${end}`)

if (end === -1) {
// process._rawDebug('end')
destination.end()
return
}

const toWrite = data.toString('utf8', current, end)
// process._rawDebug('worker writing: ' + toWrite)

const res = destination.write(toWrite)

if (res) {
Atomics.store(state, READ_INDEX, end)
Atomics.notify(state, READ_INDEX)
setImmediate(run)
} else {
destination.once('drain', function () {
Atomics.store(state, READ_INDEX, end)
Atomics.notify(state, READ_INDEX)
run()
})
}
}

process.on('unhandledRejection', function (err) {
parentPort.postMessage({
code: 'ERROR',
err
})
process.exit(1)
})

process.on('uncaughtException', function (err) {
parentPort.postMessage({
code: 'ERROR',
err
})
process.exit(1)
})

process.once('exit', exitCode => {
if (exitCode !== 0) {
process.exit(exitCode)
return
}
if (destination?.writableNeedDrain && !destination?.writableEnded) {
parentPort.postMessage({
code: 'WARNING',
err: new Error('ThreadStream: process exited before destination stream was drained. this may indicate that the destination stream try to write to a another missing stream')
})
}

process.exit(0)
})
4 changes: 2 additions & 2 deletions packages/action/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { main } from "effection";
import { run } from "./src";
import { run } from "./src/index.ts";
import { pino } from "pino";
import logStream from "./src/logger";
import logStream from "./src/logger.ts";

const stream = logStream();
const logger = pino(stream);
13 changes: 7 additions & 6 deletions packages/action/package.json
Original file line number Diff line number Diff line change
@@ -2,28 +2,29 @@
"name": "action",
"version": "0.12.4",
"main": "./dist/index.mjs",
"type": "module",
"license": "Apache-2.0",
"homepage": "https://github.com/jbolda/covector#readme",
"author": "Jacob Bolda <me@jacobbolda.com> (https://www.jacobbolda.com/)",
"scripts": {
"run:source": "node --import=tsx index.ts",
"pkg": "pkgroll",
"run-source": "ncc run index.ts",
"pkg": "ncc build index.ts -o dist -m",
"postpkg": "cp ../toml/pkg/covector_toml_bg.wasm ./dist",
"build": "echo noop",
"test": "vitest",
"clean": "echo noop"
},
"devDependencies": {
"dependencies": {
"@actions/artifact": "^2.1.7",
"@actions/core": "^1.10.1",
"@actions/github": "^5.1.1",
"effection": "4.0.0-alpha.4",
"js-yaml": "^4.1.0"
},
"dependencies": {
"devDependencies": {
"@covector/types": "0.0.0",
"@octokit/webhooks-definitions": "^3.67.3",
"pkgroll": "^2.11.2",
"@octokit/openapi-webhooks-types": "^10.3.0",
"@vercel/ncc": "^0.38.1",
"fixturez": "^1.1.0"
},
"volta": {
5 changes: 4 additions & 1 deletion packages/action/src/comment/formatGithubComment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { Config, CovectorStatus, PackageFile } from "@covector/types";
import type { PullRequestEvent } from "@octokit/webhooks-definitions/schema";
import type { webhooks } from "@octokit/openapi-webhooks-types";

type PullRequestEvent =
webhooks["pull-request-synchronize"]["post"]["requestBody"]["content"]["application/json"];

export function formatComment({
covectored,
4 changes: 2 additions & 2 deletions packages/action/src/comment/postGithubComment.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DefaultArtifactClient } from "@actions/artifact";
import fs from "node:fs/promises";
import path from "node:path";
import type { GitHub } from "@actions/github/lib/utils";
import type { getOctokit } from "@actions/github";
import { call, Operation } from "effection";
import { Logger } from "@covector/types";

@@ -16,7 +16,7 @@ export function* postGithubComment({
}: {
logger: Logger;
comment: string;
octokit: InstanceType<typeof GitHub>;
octokit: ReturnType<typeof getOctokit>;
repo: string;
owner: string;
prNumber: number;
11 changes: 7 additions & 4 deletions packages/action/src/comment/postGithubCommentFromArtifact.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { postGithubComment } from "./postGithubComment";
import { postGithubComment } from "./postGithubComment.ts";
import { DefaultArtifactClient } from "@actions/artifact";
import fs from "node:fs/promises";
import path from "node:path";
import type { GitHub } from "@actions/github/lib/utils";
import type { getOctokit } from "@actions/github";
import { call, type Operation } from "effection";
import type { WorkflowRunEvent } from "@octokit/webhooks-definitions/schema";
import type { Logger } from "@covector/types";
import type { webhooks } from "@octokit/openapi-webhooks-types";

type WorkflowRunEvent =
webhooks["workflow-run-requested"]["post"]["requestBody"]["content"]["application/json"];

export function* postGithubCommentFromArtifact({
logger,
@@ -14,7 +17,7 @@ export function* postGithubCommentFromArtifact({
payload,
}: {
logger: Logger;
octokit: InstanceType<typeof GitHub>;
octokit: ReturnType<typeof getOctokit>;
token: string;
payload: WorkflowRunEvent;
}): Operation<void> {
41 changes: 24 additions & 17 deletions packages/action/src/index.ts
Original file line number Diff line number Diff line change
@@ -6,26 +6,29 @@ import {
packageListToArray,
injectPublishFunctions,
createReleases,
} from "./utils";
import { postGithubComment } from "./comment/postGithubComment";
} from "./utils.ts";
import { postGithubComment } from "./comment/postGithubComment.ts";
import fs from "fs";

import type { webhooks } from "@octokit/openapi-webhooks-types";
import type {
PullRequestEvent,
WorkflowRunEvent,
} from "@octokit/webhooks-definitions/schema";
import type {
Covector,
CovectorStatus,
CovectorVersion,
CovectorPublish,
Logger,
} from "@covector/types";
import { formatComment } from "./comment/formatGithubComment";
import { formatComment } from "./comment/formatGithubComment.ts";
import { call, type Operation } from "effection";
import { CommitResponse, getCommitContext } from "./pr/getCommitContext";
import { postGithubCommentFromArtifact } from "./comment/postGithubCommentFromArtifact";
import { CommitResponse, getCommitContext } from "./pr/getCommitContext.ts";
import { postGithubCommentFromArtifact } from "./comment/postGithubCommentFromArtifact.ts";

type PullRequestEvent =
webhooks["pull-request-synchronize"]["post"]["requestBody"]["content"]["application/json"];
type WorkflowRunEvent =
webhooks["workflow-run-requested"]["post"]["requestBody"]["content"]["application/json"];

export function* run(logger: Logger): Operation<void> {
export function* run(logger: Logger): Operation<CovectorPublish | void> {
try {
const cwd =
core.getInput("cwd") === "" ? process.cwd() : core.getInput("cwd");
@@ -182,11 +185,11 @@ export function* run(logger: Logger): Operation<void> {

function* createContext({ commits }: { commits: string[] }): Operation<
() => Operation<{
context: Record<string, string>;
context: Record<string, Record<string, string>>;
changeContext: Record<string, string>;
}>
> {
let shas = {};
let shas = {} as Record<string, Record<string, string>>;
try {
const octokit = github.getOctokit(token);
const prContext: CommitResponse = yield* getCommitContext(
@@ -221,8 +224,11 @@ export function* run(logger: Logger): Operation<void> {
}
const context = { ...shas };

return function* defineContexts() {
const changeContext = {};
return function* defineContexts(): Operation<{
context: Record<string, Record<string, string>>;
changeContext: Record<string, string>;
}> {
const changeContext = {} as Record<string, string>;
return { context, changeContext };
};
}
@@ -233,7 +239,8 @@ export function* run(logger: Logger): Operation<void> {
command,
filterPackages,
cwd,
...(core.getInput("recognizeContributors") ? { createContext } : {}),
createContext,
// ...(core.getInput("recognizeContributors") ? { createContext } : {}),
});
core.setOutput("templatePipe", covectored.pipeTemplate);

@@ -361,7 +368,7 @@ export function* run(logger: Logger): Operation<void> {
);
} else {
// primarily runs publish
let covectored: CovectorPublish;
let covectored: Covector["preview"];
const branchName = github?.context?.payload?.pull_request?.head?.ref;
let identifier;
let versionTemplate;
@@ -411,7 +418,7 @@ export function* run(logger: Logger): Operation<void> {
branchTag,
});

if (covectored.commandsRan) {
if ("commandsRan" in covectored && covectored.commandsRan) {
let packagesPublished: any = Object.entries(
covectored.commandsRan
).reduce((pub: string[], pkg: any[]) => {
4 changes: 2 additions & 2 deletions packages/action/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "fs";
import type { ConfigFile, Logger, FunctionPipe } from "@covector/types";
import type { GitHub } from "@actions/github/lib/utils";
import type { getOctokit } from "@actions/github";

export const commandText = (pkg: {
precommand: string | boolean | null;
@@ -94,7 +94,7 @@ export const createReleases = curry(
}: {
logger: Logger;
core: { [k: string]: Function };
octokit: InstanceType<typeof GitHub>;
octokit: ReturnType<typeof getOctokit>;
owner: string;
repo: string;
targetCommitish: string;
3 changes: 2 additions & 1 deletion packages/action/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"references": [{ "path": "../types" }, { "path": "../covector" }],
"include": ["src"],
"compilerOptions": {
"rootDir": "src",
"rootDir": ".",
"outDir": "dist"
}
}
1 change: 1 addition & 0 deletions packages/covector/package.json
Original file line number Diff line number Diff line change
@@ -49,6 +49,7 @@
},
"devDependencies": {
"@covector/types": "0.0.0",
"@octokit/webhooks-definitions": "^3.67.3",
"@types/inquirer": "^8.2.6",
"@types/yargs": "^17.0.33",
"fixturez": "^1.1.0"
5 changes: 2 additions & 3 deletions packages/covector/src/add.ts
Original file line number Diff line number Diff line change
@@ -7,12 +7,11 @@ import {
select,
text,
} from "@clack/prompts";
import { type Logger } from "@covector/types";
import type { Logger, Covector, ConfigFile } from "@covector/types";
import { writeFile } from "fs/promises";
import { existsSync } from "fs";
import { join } from "path";
import { configFile } from "@covector/files";
import type { ConfigFile } from "@covector/types";
import { sh } from "@covector/command";
import { call, type Operation } from "effection";

@@ -26,7 +25,7 @@ export const add = function* ({
cwd?: string;
changeFolder?: string;
yes: boolean;
}): Operation<{ response: "complete" | "skipped" }> {
}): Operation<Covector["add"]> {
const config: ConfigFile = yield* configFile({ cwd });
let packageBumps: { [k: string]: { bump: string; changeTag?: string } } = {};

7 changes: 3 additions & 4 deletions packages/covector/src/arbitrary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { type Logger } from "@covector/types";
import { attemptCommands, confirmCommandsToRun } from "@covector/command";
import {
configFile,
@@ -12,7 +11,7 @@ import {
pipeChangelogToCommands,
} from "@covector/changelog";

import type { CommandsRan, Covector } from "@covector/types";
import type { Logger, Covector, CommandsRan } from "@covector/types";
import { call, type Operation } from "effection";

export function* arbitrary({
@@ -29,7 +28,7 @@ export function* arbitrary({
cwd?: string;
filterPackages?: string[];
modifyConfig?: (c: any) => Promise<any>;
}): Operation<Covector> {
}): Operation<Covector["arbitrary"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
const pre = yield* readPreFile({ cwd, changeFolder: config.changeFolder });
@@ -135,5 +134,5 @@ export function* arbitrary({
logger.info({ msg: "==== result ===", renderAsYAML: pkgCommandsRan });
}

return { commandsRan: postCommandsRan, pipeTemplate };
return { commandsRan: postCommandsRan, pipeTemplate, response: "complete" };
}
9 changes: 5 additions & 4 deletions packages/covector/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import { covector } from "./run.ts";
import type { Covector } from "@covector/types";
import { pino } from "pino";
import logStream from "./logger.ts";

export function* cli(argv: readonly string[]): Generator<any, any, any> {
export function* cli(argv: readonly string[]) {
const { command, directory, yes, dryRun, cwd } = parseOptions(argv);
const stream = logStream();
const logger = pino(stream);
return yield* covector({
return covector({
logger,
command,
changeFolder: directory,
@@ -19,7 +20,7 @@ export function* cli(argv: readonly string[]): Generator<any, any, any> {
}

function parseOptions(argv: readonly string[]): {
command: string;
command: keyof Covector;
dryRun: boolean;
yes?: boolean;
directory?: string;
@@ -69,7 +70,7 @@ function parseOptions(argv: readonly string[]): {
.parseSync();

return {
command: String(rawOptions._[0]),
command: String(rawOptions._[0]) as keyof Covector,
cwd: rawOptions.cwd,
dryRun: rawOptions.dryRun,
yes: rawOptions.yes as boolean | undefined,
6 changes: 2 additions & 4 deletions packages/covector/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { type Logger } from "@covector/types";
import { configFile } from "@covector/files";

import type { Covector } from "@covector/types";
import type { Logger, Covector } from "@covector/types";
import { call, type Operation } from "effection";

export function* config({
@@ -12,7 +10,7 @@ export function* config({
logger: Logger;
cwd?: string;
modifyConfig?: (c: any) => Promise<any>;
}): Operation<Covector> {
}): Operation<Covector["config"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
delete config.file;
7 changes: 3 additions & 4 deletions packages/covector/src/init.ts
Original file line number Diff line number Diff line change
@@ -5,8 +5,7 @@ import type { Dir } from "fs";
import path from "path";
import { Operation, all, call } from "effection";
import { readPkgFile } from "@covector/files";
import type { PackageFile } from "@covector/types";
import { type Logger } from "@covector/types";
import type { Logger, Covector, PackageFile } from "@covector/types";

function* reader(pkg: string, cwd: string): Operation<PackageFile | undefined> {
try {
@@ -25,7 +24,7 @@ export const init = function* init({
cwd?: string;
changeFolder?: string;
yes: boolean;
}): Generator<any, any, any> {
}): Operation<Covector["init"]> {
const pkgs = yield* call(() => packageFiles({ cwd }));
let packages: {
[k: string]: { path: string; manager: string; dependencies?: string[] };
@@ -301,7 +300,7 @@ export const init = function* init({

// It seems to get stuck on Windows and not close with the resume //
process.exit();
return "complete";
return { response: "complete" };
};

const packageFiles = async ({ cwd = process.cwd() }) => {
14 changes: 8 additions & 6 deletions packages/covector/src/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { type Logger } from "@covector/types";
import { attemptCommands, confirmCommandsToRun } from "@covector/command";
import {
configFile,
@@ -15,10 +14,9 @@ import {
import { apply, changesConsideringParents } from "@covector/apply";

import type {
CommandsRan,
Logger,
Covector,
PackageFile,
PkgPublish,
CommandsRan,
PkgVersion,
} from "@covector/types";
import { call, type Operation } from "effection";
@@ -41,7 +39,7 @@ export function* preview({
modifyConfig?: (c: any) => Promise<any>;
previewVersion?: string;
branchTag?: string;
}): Operation<Covector> {
}): Operation<Covector["preview"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
const pre = yield* readPreFile({ cwd, changeFolder: config.changeFolder });
@@ -185,5 +183,9 @@ export function* preview({
dryRun,
});

return { commandsRan: commandsAttempted, pipeTemplate: publishCommands };
return {
commandsRan: commandsAttempted,
pipeTemplate: publishCommands,
response: "complete",
};
}
5 changes: 2 additions & 3 deletions packages/covector/src/publish.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { type Logger } from "@covector/types";
import { attemptCommands, confirmCommandsToRun } from "@covector/command";
import {
configFile,
@@ -12,7 +11,7 @@ import {
pipeChangelogToCommands,
} from "@covector/changelog";

import type { CommandsRan, CovectorPublish } from "@covector/types";
import type { Logger, Covector, CommandsRan } from "@covector/types";
import { call, type Operation } from "effection";

export function* publish({
@@ -29,7 +28,7 @@ export function* publish({
cwd?: string;
filterPackages?: string[];
modifyConfig?: (c: any) => Promise<any>;
}): Operation<CovectorPublish> {
}): Operation<Covector["publish"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
const pre = yield* readPreFile({ cwd, changeFolder: config.changeFolder });
26 changes: 15 additions & 11 deletions packages/covector/src/run.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import { preview } from "./preview.ts";
import { publish } from "./publish.ts";
import { arbitrary } from "./arbitrary.ts";

export function* covector({
export function* covector<C extends keyof Covector>({
// shared
logger,
command,
@@ -28,7 +28,7 @@ export function* covector({
createContext,
}: {
logger: Logger;
command: string;
command: C;
dryRun?: boolean;
logs?: boolean;
cwd?: string;
@@ -39,27 +39,31 @@ export function* covector({
changeFolder?: string;
yes?: boolean;
createContext?: ChangeContext<any>;
}): Operation<Covector> {
}): Operation<Covector[C]> {
// TS isn't playing nice with the intesection, this return type is appropriate for downstream consumers
// but TS is not happy with it. It expects the returns of each function to match the full intersection
// of Covector[C], but they don't. So we cast to unknown and then to the appropriate type.
// The cast hurts type safety, but we ensure the types at the function level, so it's okay.
if (command === "init") {
return yield* init({
logger: logger.child({ command: "init" }),
cwd,
changeFolder,
yes,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "add") {
return yield* add({
logger: logger.child({ command: "add" }),
cwd,
changeFolder,
yes,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "config") {
return yield* config({
logger: logger.child({ command: "config" }),
cwd,
modifyConfig,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "status") {
return yield* status({
logger: logger.child({ command: "status" }),
@@ -70,7 +74,7 @@ export function* covector({
filterPackages,
modifyConfig,
branchTag,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "version") {
return yield* version({
logger: logger.child({ command: "version" }),
@@ -80,7 +84,7 @@ export function* covector({
filterPackages,
modifyConfig,
createContext,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "preview") {
return yield* preview({
logger: logger.child({ command: "preview" }),
@@ -91,7 +95,7 @@ export function* covector({
modifyConfig,
previewVersion,
branchTag,
});
}) as unknown as Operation<Covector[C]>;
} else if (command === "publish") {
return yield* publish({
logger: logger.child({ command: "publish" }),
@@ -100,7 +104,7 @@ export function* covector({
cwd,
filterPackages,
modifyConfig,
});
}) as unknown as Operation<Covector[C]>;
} else {
return yield* arbitrary({
logger: logger.child({ command: "arbitrary" }),
@@ -109,6 +113,6 @@ export function* covector({
cwd,
filterPackages,
modifyConfig,
});
}) as unknown as Operation<Covector[C]>;
}
}
6 changes: 3 additions & 3 deletions packages/covector/src/status.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Logger } from "@covector/types";
import type { Logger, Covector } from "@covector/types";
import { confirmCommandsToRun } from "@covector/command";
import {
configFile,
@@ -18,7 +18,7 @@ import {
validateApply,
} from "@covector/apply";

import type { CovectorStatus, PackageFile } from "@covector/types";
import type { CovectorStatus } from "@covector/types";
import { call, type Operation } from "effection";

export function* status({
@@ -39,7 +39,7 @@ export function* status({
modifyConfig?: (c: any) => Promise<any>;
branchTag?: string;
logs?: boolean;
}): Operation<CovectorStatus> {
}): Operation<Covector["status"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
const pre = yield* readPreFile({ cwd, changeFolder: config.changeFolder });
8 changes: 4 additions & 4 deletions packages/covector/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { type Logger } from "@covector/types";
import { attemptCommands } from "@covector/command";
import {
configFile,
@@ -14,8 +13,9 @@ import { fillChangelogs } from "@covector/changelog";
import { apply, changesConsideringParents } from "@covector/apply";

import type {
Logger,
Covector,
CommandsRan,
CovectorVersion,
ChangeContext,
ConfigFile,
} from "@covector/types";
@@ -37,7 +37,7 @@ export function* version({
filterPackages?: string[];
modifyConfig?: (c: ConfigFile) => Promise<ConfigFile>;
createContext?: ChangeContext<any>;
}): Operation<CovectorVersion> {
}): Operation<Covector["version"]> {
const rawConfig = yield* configFile({ cwd });
const config = yield* call(() => modifyConfig(rawConfig));
const pre = yield* readPreFile({ cwd, changeFolder: config.changeFolder });
@@ -154,5 +154,5 @@ export function* version({
logger.info({ msg: "==== result ===", renderAsYAML: pkgCommandsRan });
}

return { commandsRan, pipeTemplate };
return { commandsRan, pipeTemplate, response: "complete" };
}
4 changes: 2 additions & 2 deletions packages/toml/package.json
Original file line number Diff line number Diff line change
@@ -25,14 +25,14 @@
"default": "./dist/index.js"
},
"scripts": {
"prebuild": "wasm-pack build --release --no-pack --target nodejs",
"prebuild": "wasm-pack build --release --target nodejs",
"build": "tsc -b",
"postbuild": "cp ./pkg/covector_toml_bg.wasm ../action/dist",
"clean": "rimraf dist tsconfig.tsbuildinfo node_modules",
"test": "vitest"
},
"devDependencies": {
"wasm-pack": "^0.12.1"
"wasm-pack": "^0.13.1"
},
"volta": {
"extends": "../../package.json"
16 changes: 11 additions & 5 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -275,18 +275,24 @@ export type CovectorStatus =
export type CovectorVersion = {
commandsRan: CommandsRan;
pipeTemplate: object;
response: string;
};
export type CovectorPublish = {
commandsRan: CommandsRan;
pipeTemplate: object;
response: string;
};

export type Covector =
| CovectorStatus
| CovectorVersion
| CovectorPublish
| { response: string };
export type Covector = {
init: { response: string };
add: { response: "complete" | "skipped" };
config: { response: string };
status: CovectorStatus;
version: CovectorVersion;
preview: CovectorPublish | { response: string };
publish: CovectorPublish;
arbitrary: CovectorPublish | { response: string };
};

export interface FunctionPipe extends PkgPublish {
pkgCommandsRan: PkgCommandsRan;

Unchanged files with check annotations Beta

checksWithObject()
)
);
expect(covectored).toMatchSnapshot();

Check failure on line 42 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs version

Error: Snapshot `integration test for complex commands > prod > runs version 1` mismatched - Expected + Received @@ -12,6 +12,7 @@ "postcommand": false, "precommand": false, }, }, "pipeTemplate": {}, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:42:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 42 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs version

Error: Snapshot `integration test for complex commands > prod > runs version 1` mismatched - Expected + Received @@ -12,6 +12,7 @@ "postcommand": false, "precommand": false, }, }, "pipeTemplate": {}, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:42:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
const changelogTauriCore = yield* captureError(
loadFile(path.join("/tauri/", "CHANGELOG.md"), fullIntegration)
checksWithObject()
)
);
expect(covectored).toMatchSnapshot();

Check failure on line 278 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs test

Error: Snapshot `integration test for complex commands > prod > runs test 1` mismatched - Expected + Received @@ -134,6 +134,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:278:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 278 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs test

Error: Snapshot `integration test for complex commands > prod > runs test 1` mismatched - Expected + Received @@ -134,6 +134,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:278:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
});
it("runs build", function* () {
checksWithObject()
)
);
expect(covectored).toMatchSnapshot();

Check failure on line 369 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs build

Error: Snapshot `integration test for complex commands > prod > runs build 1` mismatched - Expected + Received @@ -114,6 +114,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:369:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 369 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > prod > runs build

Error: Snapshot `integration test for complex commands > prod > runs build 1` mismatched - Expected + Received @@ -114,6 +114,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:369:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
});
});
checksWithObject()
)
);
expect(covectored).toMatchSnapshot();

Check failure on line 412 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > dry run > runs version

Error: Snapshot `integration test for complex commands > dry run > runs version 1` mismatched - Expected + Received @@ -12,6 +12,7 @@ "postcommand": false, "precommand": false, }, }, "pipeTemplate": {}, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:412:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 412 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > dry run > runs version

Error: Snapshot `integration test for complex commands > dry run > runs version 1` mismatched - Expected + Received @@ -12,6 +12,7 @@ "postcommand": false, "precommand": false, }, }, "pipeTemplate": {}, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:412:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
const changelogTauriCore = yield* captureError(
loadFile(path.join("/tauri/", "CHANGELOG.md"), fullIntegration)
checksWithObject()
)
);
expect(covectored).toMatchSnapshot();

Check failure on line 578 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > dry run > runs test

Error: Snapshot `integration test for complex commands > dry run > runs test 1` mismatched - Expected + Received @@ -125,6 +125,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:578:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 578 in packages/covector/test/integration/complex.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/integration/complex.test.ts > integration test for complex commands > dry run > runs test

Error: Snapshot `integration test for complex commands > dry run > runs test 1` mismatched - Expected + Received @@ -125,6 +125,7 @@ "versionPatch": 0, }, }, }, }, + "response": "complete", } ❯ packages/covector/test/integration/complex.test.ts:578:26 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
});
it("runs build", function* () {
);
expect(status).toMatchObject({ code: 0 });
expect(out).toBe(

Check failure on line 16 in packages/covector/test/cli/command-status.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/cli/command-status.test.ts > integration test for init command > runs version for prod

AssertionError: expected '' to be '[info] There are no changes.\n[info] …' // Object.is equality - Expected + Received - [info] There are no changes. - [info] There is 2 packages ready to publish which includes package-one@2.3.1, package-two@1.9.0 - ❯ packages/covector/test/cli/command-status.test.ts:16:17 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23

Check failure on line 16 in packages/covector/test/cli/command-status.test.ts

GitHub Actions / test (windows-latest)

packages/covector/test/cli/command-status.test.ts > integration test for init command > runs version for prod

AssertionError: expected '' to be '[info] There are no changes.\n[info] …' // Object.is equality - Expected + Received - [info] There are no changes. - [info] There is 2 packages ready to publish which includes package-one@2.3.1, package-two@1.9.0 - ❯ packages/covector/test/cli/command-status.test.ts:16:17 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23

Check failure on line 16 in packages/covector/test/cli/command-status.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/cli/command-status.test.ts > integration test for init command > runs version for prod

AssertionError: expected '' to be '[info] There are no changes.\n[info] …' // Object.is equality - Expected + Received - [info] There are no changes. - [info] There is 2 packages ready to publish which includes package-one@2.3.1, package-two@1.9.0 - ❯ packages/covector/test/cli/command-status.test.ts:16:17 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23
"[info] There are no changes.\n" +
"[info] There is 2 packages ready to publish which includes package-one@2.3.1, package-two@1.9.0\n"
);
14900
);
expect(responded).toMatchSnapshot();

Check failure on line 26 in packages/covector/test/cli/command-init.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/cli/command-init.test.ts > integration test for init command > runs on a workspace

Error: Snapshot `integration test for init command > runs on a workspace 1` mismatched - Expected + Received - "◆ What is the url to your GitHub repo? - ◆ should we include GitHub Action workflows? - ◆ What is the name of your default branch? - " + "" ❯ packages/covector/test/cli/command-init.test.ts:26:23 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 26 in packages/covector/test/cli/command-init.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/cli/command-init.test.ts > integration test for init command > runs on a workspace

Error: Snapshot `integration test for init command > runs on a workspace 1` mismatched - Expected + Received - "◆ What is the url to your GitHub repo? - ◆ should we include GitHub Action workflows? - ◆ What is the name of your default branch? - " + "" ❯ packages/covector/test/cli/command-init.test.ts:26:23 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
expect(status.code).toBe(0);
// let's do a check to confirm it sets the config file correctly
]
);
expect(responded).toMatchSnapshot();

Check failure on line 47 in packages/covector/test/cli/command-init.test.ts

GitHub Actions / test (macos-latest)

packages/covector/test/cli/command-init.test.ts > integration test for init command > sets gitSiteUrl default to repo url

Error: Snapshot `integration test for init command > sets gitSiteUrl default to repo url 1` mismatched - Expected + Received - "◆ What is the url to your GitHub repo? - ◆ should we include GitHub Action workflows? - ◆ What is the name of your default branch? - " + "" ❯ packages/covector/test/cli/command-init.test.ts:47:23 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19

Check failure on line 47 in packages/covector/test/cli/command-init.test.ts

GitHub Actions / test (ubuntu-latest)

packages/covector/test/cli/command-init.test.ts > integration test for init command > sets gitSiteUrl default to repo url

Error: Snapshot `integration test for init command > sets gitSiteUrl default to repo url 1` mismatched - Expected + Received - "◆ What is the url to your GitHub repo? - ◆ should we include GitHub Action workflows? - ◆ What is the name of your default branch? - " + "" ❯ packages/covector/test/cli/command-init.test.ts:47:23 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19
expect(status.code).toBe(0);
// let's do a check to confirm it sets the config file correctly
(keys = ["command"]) =>
(received, expected) => {
if (received.msg !== expected.msg || received.level !== expected.level) {
assert.deepEqual(received, expected);

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (macos-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs with changes

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { command: 'version', …(2) } - Expected + Received Object { - "command": "version", - "level": 30, - "msg": ".changes/first-change.md was deleted", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at /Users/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///Users/runner/work/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (/Users/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (/Users/runner/work/covector/covector/packages/action/src/index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (/Users/runner/work/covector/covector/packages/changelog/src/index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (/Users/runner/work/covector/covector/packages/changelog/src/index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (macos-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs for no change

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { Object (msg, renderAsYAML, ...) } - Expected + Received Object { - "level": 30, - "msg": "covector version output", - "renderAsYAML": "# Version Updates - - Merging this PR will release new versions of the following packages based on your change files. - - ", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at /Users/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///Users/runner/work/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (/Users/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (/Users/runner/work/covector/covector/packages/action/src/index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (/Users/runner/work/covector/covector/packages/changelog/src/index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (/Users/runner/work/covector/covector/packages/changelog/src/index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (windows-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs with changes

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { command: 'version', …(2) } - Expected + Received Object { - "command": "version", - "level": 30, - "msg": ".changes/first-change.md was deleted", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at D:\\a\\covector\\covector\\packages\\action\\src\\pr\\getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///D:/a/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (D:\\a\\covector\\covector\\packages\\action\\src\\pr\\getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (D:\\a\\covector\\covector\\packages\\action\\src\\index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (D:\\a\\covector\\covector\\packages\\changelog\\src\\index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (D:\\a\\covector\\covector\\packages\\changelog\\src\\index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (windows-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs for no change

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { Object (msg, renderAsYAML, ...) } - Expected + Received Object { - "level": 30, - "msg": "covector version output", - "renderAsYAML": "# Version Updates - - Merging this PR will release new versions of the following packages based on your change files. - - ", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at D:\\a\\covector\\covector\\packages\\action\\src\\pr\\getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///D:/a/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (D:\\a\\covector\\covector\\packages\\action\\src\\pr\\getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (D:\\a\\covector\\covector\\packages\\action\\src\\index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (D:\\a\\covector\\covector\\packages\\changelog\\src\\index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (D:\\a\\covector\\covector\\packages\\changelog\\src\\index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (ubuntu-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs with changes

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { command: 'version', …(2) } - Expected + Received Object { - "command": "version", - "level": 30, - "msg": ".changes/first-change.md was deleted", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at /home/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///home/runner/work/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (/home/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (/home/runner/work/covector/covector/packages/action/src/index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (/home/runner/work/covector/covector/packages/changelog/src/index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (/home/runner/work/covector/covector/packages/changelog/src/index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5

Check failure on line 13 in packages/action/test/helpers.ts

GitHub Actions / test (ubuntu-latest)

packages/action/test/e2e.test.ts > full e2e test > of version > outputs for no change

AssertionError: expected { level: 50, err: { …(3) }, …(1) } to deeply equal { Object (msg, renderAsYAML, ...) } - Expected + Received Object { - "level": 30, - "msg": "covector version output", - "renderAsYAML": "# Version Updates - - Merging this PR will release new versions of the following packages based on your change files. - - ", + "err": Object { + "message": "client is not a function", + "stack": "TypeError: client is not a function + at /home/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:62:5 + at Object.[Symbol.iterator] (file:///home/runner/work/covector/covector/node_modules/effection/src/lib/call.ts:78:29) + at Module.getCommitContext (/home/runner/work/covector/covector/packages/action/src/pr/getCommitContext.ts:61:27) + at getCommitContext.next (<anonymous>) + at createContext (/home/runner/work/covector/covector/packages/action/src/index.ts:195:52) + at createContext.next (<anonymous>) + at applyChanges (/home/runner/work/covector/covector/packages/changelog/src/index.ts:196:38) + at applyChanges.next (<anonymous>) + at Module.fillChangelogs (/home/runner/work/covector/covector/packages/changelog/src/index.ts:56:33) + at fillChangelogs.next (<anonymous>)", + "type": "TypeError", + }, + "level": 50, + "msg": "client is not a function", } ❯ packages/action/test/helpers.ts:13:14 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5
}
for (let key of keys) {
if (expected?.[key]) assert.deepEqual(received?.[key], expected?.[key]);
describe("tinyexec compatibility checks", () => {
itPromises("handles multiple pipes with function syntax", async () => {
const result = await x("echo", ["this\nthing"]).pipe("grep", ["this"]);
expect(result.stdout.trim()).toBe("this");

Check failure on line 12 in packages/command/test/sh.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/sh.test.ts > tinyexec compatibility checks > handles multiple pipes with function syntax

AssertionError: expected 'this thing' to be 'this' // Object.is equality Expected: "this" Received: "this thing" ❯ packages/command/test/sh.test.ts:12:34
});
describe("with `shell: true`", () => {
nodeOptions: { shell: true },
}
);
expect(result.stdout.trim()).toBe("but this");

Check failure on line 31 in packages/command/test/sh.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/sh.test.ts > tinyexec compatibility checks > with `shell: true` > multiple pipes

AssertionError: expected '"but this"' to be 'but this' // Object.is equality Expected: "but this" Received: ""but this"" ❯ packages/command/test/sh.test.ts:31:36
});
});
});
false,
logger
);
expect(out).toBe("this\r\nthing");

Check failure on line 107 in packages/command/test/sh.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/sh.test.ts > sh > shell defined > defines pwsh as shell

AssertionError: expected 'this\nthing' to be 'this\r\nthing' // Object.is equality - Expected + Received - this + this thing ❯ packages/command/test/sh.test.ts:107:21 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23
});
}
});
if (process.env.shell && process.env.shell.includes("bash.exe")) {
expect(out).toBe("but actually this");
} else {
expect(out).toBe("this thing | echo but actually this");

Check failure on line 176 in packages/command/test/sh.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/sh.test.ts > sh > pipe commands when win32 > considers piped commands, uses fallback to shell

AssertionError: expected 'but actually this' to be 'this thing | echo but actually this' // Object.is equality Expected: "this thing | echo but actually this" Received: "but actually this" ❯ packages/command/test/sh.test.ts:176:23 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23
}
});
)
);
// pwsh doesn't handle pipes with echo
expect(result.message).toBe(

Check failure on line 212 in packages/command/test/sh.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/sh.test.ts > sh > pipe commands when win32 > considers piped commands, defines pwsh as shell

AssertionError: expected 'Process exited with non-zero status (…' to be 'spawn echo this thing | echo but actu…' // Object.is equality Expected: "spawn echo this thing | echo but actually this ENOENT" Received: "Process exited with non-zero status (1)" ❯ packages/command/test/sh.test.ts:212:32 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23
"spawn echo this thing | echo but actually this ENOENT"
);
}); // TODO increase timeout to 60s, windows seems to take forever
})
);
expect(errored.message).toBe("spawn boop ENOENT");

Check failure on line 39 in packages/command/test/commandFailure.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/commandFailure.test.ts > attemptCommand fails > fails a function

AssertionError: expected 'Process exited with non-zero status (…' to be 'spawn boop ENOENT' // Object.is equality Expected: "spawn boop ENOENT" Received: "Process exited with non-zero status (1)" ❯ packages/command/test/commandFailure.test.ts:39:29 ❯ helpers/test-adapter.ts:65:16 ❯ after node_modules/effection/src/lib/task.ts:254:19 ❯ node_modules/effection/src/lib/task.ts:216:26 ❯ Object.with node_modules/effection/src/lib/context.ts:17:23
});
it("retries a failed function", function* () {
function isShallowError(received, expected) {
if (received.msg !== expected.msg) {
throw new Error(

Check failure on line 112 in packages/command/test/commandFailure.test.ts

GitHub Actions / test (windows-latest)

packages/command/test/commandFailure.test.ts > attemptCommand fails > retries a failed function

Error: expected msg "'boop' is not recognized as an internal or external command, operable program or batch file." doesn't match the received one "'boop' is not recognized as an internal or external command," ❯ isShallowError packages/command/test/commandFailure.test.ts:112:11 ❯ check node_modules/pino-test/pino-test.js:48:5 ❯ Proxy.consecutive node_modules/pino-test/pino-test.js:122:5
`expected msg "${expected.msg}" doesn't match the received one "${received.msg}"`
);
}