Skip to content

Commit

Permalink
fix: upgrade deps (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongaar authored Dec 5, 2022
1 parent 8decd74 commit 5aea859
Show file tree
Hide file tree
Showing 20 changed files with 1,144 additions and 268 deletions.
15 changes: 8 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
{
"name": "Node.js & TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:16-bullseye",
"customizations": {
"vscode": {
"extensions": ["esbenp.prettier-vscode"]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
"features": {
"ghcr.io/devcontainers/features/docker-from-docker:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
Expand All @@ -19,7 +16,11 @@
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},
"customizations": {
"vscode": {
"extensions": ["esbenp.prettier-vscode"]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
Expand Down
8 changes: 4 additions & 4 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
- ~~tempy (only in --dev)~~
- ~~rc~~
- ~~normalize-url~~
- codecov
- nyc
- ava
- sinon
- ~~codecov~~
- ~~nyc~~
- ~~ava (still needed)~~
- ~~sinon (still needed)~~

## TypeScript conversion

Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@
},
"dependencies": {
"@semantic-release/error": "^3.0.0",
"aggregate-error": "^3.0.0",
"aggregate-error": "^4.0.1",
"cosmiconfig": "^8.0.0",
"execa": "^5.0.0",
"fs-extra": "^10.0.0",
"execa": "^6.1.0",
"fs-extra": "^11.1.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.15",
"lodash": "^4.17.21",
"nerf-dart": "^1.0.0",
"npm": "^8.3.0",
"read-pkg": "^5.0.0",
"npm": "^9.1.3",
"read-pkg": "^7.1.0",
"registry-auth-token": "^5.0.1",
"semver": "^7.1.2"
"semver": "^7.3.8"
},
"devDependencies": {
"@semantic-release/changelog": "6.0.1",
"@semantic-release/changelog": "6.0.2",
"@semantic-release/git": "10.0.1",
"@types/dockerode": "3.3.14",
"@types/env-ci": "3.1.1",
"@types/fs-extra": "9.0.13",
"@types/js-yaml": "^4",
"@types/lodash": "4.14.190",
"@types/node": "18.11.9",
"@types/prettier": "2",
"@types/js-yaml": "4.0.5",
"@types/lodash": "4.14.191",
"@types/node": "18.11.10",
"@types/prettier": "2.7.1",
"@types/semantic-release": "17.2.4",
"@types/semver": "7.3.13",
"@types/sinon": "10.0.13",
Expand All @@ -74,16 +74,16 @@
"delay": "5.0.0",
"dockerode": "3.3.4",
"get-stream": "6.0.1",
"got": "11.8.5",
"got": "12.5.3",
"husky": "8.0.2",
"lint-staged": "13.0.4",
"moker": "0.4.4",
"p-retry": "4.6.2",
"lint-staged": "13.1.0",
"moker": "0.5.1",
"p-retry": "5.1.2",
"prettier": "2.8.0",
"semantic-release": "19.0.5",
"sinon": "15.0.0",
"stream-buffers": "3.0.2",
"tempy": "1.0.1",
"tempy": "3.0.0",
"ts-node": "10.9.1",
"typescript": "4.9.3"
},
Expand Down
2 changes: 1 addition & 1 deletion src/add-channel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import execa from "execa";
import type { PackageJson } from "read-pkg";
import type { AddChannelContext } from "./definitions/context.js";
import type { PluginConfig } from "./definitions/pluginConfig.js";
import { execa } from "./execa.js";
import { getChannel } from "./get-channel.js";
import { getRegistry } from "./get-registry.js";
import { getReleaseInfo } from "./get-release-info.js";
Expand Down
6 changes: 3 additions & 3 deletions src/execa.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import ogExeca from "execa";
import { execa as ogExeca, Options } from "execa";

let execImplementation: typeof ogExeca;

setExecaImplementation(ogExeca);

export default function execa(
export function execa(
file: string,
args?: readonly string[],
options?: ogExeca.Options
options?: Options
) {
return execImplementation(file, args, options);
}
Expand Down
9 changes: 4 additions & 5 deletions src/get-pkg.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import AggregateError from "aggregate-error";
import { resolve } from "node:path";
import readPkg from "read-pkg";
import { readPackage } from "read-pkg";
import type { CommonContext } from "./definitions/context.js";
import type { PluginConfig } from "./definitions/pluginConfig.js";
import { getError } from "./get-error.js";
Expand All @@ -10,7 +9,7 @@ export async function getPkg(
{ cwd }: { cwd: CommonContext["cwd"] }
) {
try {
const pkg = await readPkg({
const pkg = await readPackage({
cwd: pkgRoot ? resolve(cwd, String(pkgRoot)) : cwd,
});

Expand All @@ -21,9 +20,9 @@ export async function getPkg(
return pkg;
} catch (error: any) {
if (error.code === "ENOENT") {
throw new AggregateError([getError("ENOPKG")]);
throw getError("ENOPKG");
}

throw new AggregateError([error]);
throw error;
}
}
2 changes: 1 addition & 1 deletion src/get-yarn-version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CommonContext } from "./definitions/context.js";
import execa from "./execa.js";
import { execa } from "./execa.js";

export async function getYarnVersion({ cwd }: { cwd: CommonContext["cwd"] }) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/prepare.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import execa from "execa";
import fs from "fs-extra";
import { resolve } from "node:path";
import type { PrepareContext } from "./definitions/context.js";
import type { PluginConfig } from "./definitions/pluginConfig.js";
import { execa } from "./execa.js";

const TARBALL_FILENAME = "%s-%v.tgz";

Expand Down
2 changes: 1 addition & 1 deletion src/publish.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import execa from "execa";
import path from "node:path";
import type { PackageJson } from "read-pkg";
import type { PublishContext } from "./definitions/context.js";
import type { PluginConfig } from "./definitions/pluginConfig.js";
import { execa } from "./execa.js";
import { getChannel } from "./get-channel.js";
import { getRegistry } from "./get-registry.js";
import { getReleaseInfo } from "./get-release-info.js";
Expand Down
2 changes: 1 addition & 1 deletion src/verify-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AggregateError from "aggregate-error";
import type { PackageJson } from "read-pkg";
import { isDefaultRegistry } from "./definitions/constants.js";
import type { CommonContext } from "./definitions/context.js";
import execa from "./execa.js";
import { execa } from "./execa.js";
import { getError } from "./get-error.js";
import { getRegistry } from "./get-registry.js";
import { getToken } from "./get-token.js";
Expand Down
6 changes: 3 additions & 3 deletions src/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export async function verify(
pluginConfig: PluginConfig,
context: VerifyConditionsContext
) {
const errors = verifyConfig(pluginConfig);
let errors = verifyConfig(pluginConfig);

try {
verifyYarn(context);
} catch (error: any) {
errors.push(...error);
errors = [...errors, ...(error.errors ? error.errors : [error])];
}

try {
Expand All @@ -27,7 +27,7 @@ export async function verify(
await verifyAuth(pkg, context);
}
} catch (error: any) {
errors.push(...error);
errors = [...errors, ...(error.errors ? error.errors : [error])];
}

if (errors.length > 0) {
Expand Down
18 changes: 9 additions & 9 deletions test/get-pkg.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import test from "ava";
import fs from "fs-extra";
import { resolve } from "node:path";
import { directory } from "tempy";
import { temporaryDirectory } from "tempy";
import { getPkg } from "../src/get-pkg.js";

test("Verify name and version then return parsed package.json", async (t) => {
const cwd = directory();
const cwd = temporaryDirectory();
const pkg = { name: "package", version: "0.0.0" };
await fs.outputJson(resolve(cwd, "package.json"), pkg);

Expand All @@ -16,7 +16,7 @@ test("Verify name and version then return parsed package.json", async (t) => {
});

test("Verify name and version then return parsed package.json from a sub-directory", async (t) => {
const cwd = directory();
const cwd = temporaryDirectory();
const pkgRoot = "dist";
const pkg = { name: "package", version: "0.0.0" };
await fs.outputJson(resolve(cwd, pkgRoot, "package.json"), pkg);
Expand All @@ -28,29 +28,29 @@ test("Verify name and version then return parsed package.json from a sub-directo
});

test("Throw error if missing package.json", async (t) => {
const cwd = directory();
const cwd = temporaryDirectory();

const [error] = await t.throwsAsync<any>(getPkg({}, { cwd }));
const error = await t.throwsAsync<any>(getPkg({}, { cwd }));

t.is(error.name, "SemanticReleaseError");
t.is(error.code, "ENOPKG");
});

test("Throw error if missing package name", async (t) => {
const cwd = directory();
const cwd = temporaryDirectory();
await fs.outputJson(resolve(cwd, "package.json"), { version: "0.0.0" });

const [error] = await t.throwsAsync<any>(getPkg({}, { cwd }));
const error = await t.throwsAsync<any>(getPkg({}, { cwd }));

t.is(error.name, "SemanticReleaseError");
t.is(error.code, "ENOPKGNAME");
});

test("Throw error if package.json is malformed", async (t) => {
const cwd = directory();
const cwd = temporaryDirectory();
await fs.writeFile(resolve(cwd, "package.json"), "{name: 'package',}");

const [error] = await t.throwsAsync<any>(getPkg({}, { cwd }));
const error = await t.throwsAsync<any>(getPkg({}, { cwd }));

t.is(error.name, "JSONError");
});
6 changes: 3 additions & 3 deletions test/get-yarn-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from "ava";
import fs from "fs-extra";
import yaml from "js-yaml";
import { resolve } from "node:path";
import { directory } from "tempy";
import { temporaryDirectory } from "tempy";
import type { Yarnrc } from "../src/definitions/yarnrc.js";
import { getYarnConfig } from "../src/get-yarn-config.js";
import { createContext } from "./helpers/create-context.js";
Expand All @@ -21,7 +21,7 @@ test("Read from .yarnrc.yml", async (t) => {

test("Read from .yarnrc.yml in parent directory", async (t) => {
const { logger } = createContext();
const parent = directory();
const parent = temporaryDirectory();
const cwd = resolve(parent, "subdir");
await fs.outputFile(
resolve(cwd, ".yarnrc.yml"),
Expand All @@ -42,7 +42,7 @@ test("Read from .yarnrc.yml in parent directory", async (t) => {

test("Read from .yarnrc.yml in current directory", async (t) => {
const { logger } = createContext();
const parent = directory();
const parent = temporaryDirectory();
const cwd = resolve(parent, "subdir");
await fs.outputFile(
resolve(cwd, ".yarnrc.yml"),
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/create-context.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { spy } from "sinon";
import { WritableStreamBuffer } from "stream-buffers";
import { directory } from "tempy";
import { temporaryDirectory } from "tempy";
import type { BranchSpec } from "../../src/definitions/context.js";

export function createContext() {
return {
cwd: directory(),
cwd: temporaryDirectory(),
logger: { log: spy(), error: spy(), success: spy() },
stdout: new WritableStreamBuffer(),
stderr: new WritableStreamBuffer(),
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/create-execa-implementation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ExecaError, ExecaReturnValue } from "execa";
import execa from "execa";
import { execa } from "execa";
import { setExecaImplementation } from "../../src/execa.js";

const DEFAULT_PAYLOAD = {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/npm-registry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import delay from "delay";
import Docker from "dockerode";
import execa from "execa";
import { execa } from "execa";
import getStream from "get-stream";
import got from "got";
import { dirname, resolve } from "node:path";
Expand Down
14 changes: 8 additions & 6 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from "ava";
import execa from "execa";
import { execa } from "execa";
import fs from "fs-extra";
import { resolve } from "node:path";
import { createContext } from "./helpers/create-context.js";
Expand Down Expand Up @@ -89,7 +89,9 @@ test("Throws error if NPM token is invalid", async (t) => {
};
await fs.outputJson(resolve(cwd, "package.json"), pkg);

const [error] = await t.throwsAsync<any>(
const {
errors: [error],
} = await t.throwsAsync<any>(
mod.verifyConditions(
{},
{
Expand Down Expand Up @@ -208,7 +210,7 @@ test("Throw SemanticReleaseError Array if config option are not valid in verifyC
const tarballDir = 42;
const pkgRoot = 42;

const [...errors] = await t.throwsAsync<any>(
const { errors } = await t.throwsAsync<any>(
mod.verifyConditions(
{},
{
Expand Down Expand Up @@ -493,7 +495,7 @@ test("Throw SemanticReleaseError Array if config option are not valid in publish
const tarballDir = 42 as any;
const pkgRoot = 42 as any;

const [...errors] = await t.throwsAsync<any>(
const { errors } = await t.throwsAsync<any>(
mod.publish(
{ npmPublish, tarballDir, pkgRoot },
{
Expand Down Expand Up @@ -586,7 +588,7 @@ test("Throw SemanticReleaseError Array if config option are not valid in prepare
const tarballDir = 42 as any;
const pkgRoot = 42 as any;

const [...errors] = await t.throwsAsync<any>(
const { errors } = await t.throwsAsync<any>(
mod.prepare(
{ npmPublish, tarballDir, pkgRoot },
{
Expand Down Expand Up @@ -814,7 +816,7 @@ test("Throw SemanticReleaseError Array if config option are not valid in addChan
const tarballDir = 42 as any;
const pkgRoot = 42 as any;

const [...errors] = await t.throwsAsync<any>(
const { errors } = await t.throwsAsync<any>(
mod.addChannel(
{ npmPublish, tarballDir, pkgRoot },
{
Expand Down
Loading

0 comments on commit 5aea859

Please sign in to comment.