Skip to content

Commit

Permalink
chore: remove unused code (#3377)
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 authored Oct 8, 2024
1 parent 7d03185 commit 250bc39
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 180 deletions.
2 changes: 2 additions & 0 deletions .changeset/little-impalas-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
43 changes: 17 additions & 26 deletions packages/console/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,21 @@ import { error, info, warn } from "../src/index";
describe("console", () => {
const args = ["string", 0, true];

it("prints error messages", (t) => {
const errorMock = t.mock.method(console, "error", () => null);

error(...args);

equal(errorMock.mock.calls.length, 1);
deepEqual(errorMock.mock.calls[0].arguments, ["error", ...args]);
});

it("prints info messages", (t) => {
const infoMock = t.mock.method(console, "log", () => null);

info(...args);

equal(infoMock.mock.calls.length, 1);
deepEqual(infoMock.mock.calls[0].arguments, ["info", ...args]);
});

it("prints warning messages", (t) => {
const warnMock = t.mock.method(console, "warn", () => null);

warn(...args);

equal(warnMock.mock.calls.length, 1);
deepEqual(warnMock.mock.calls[0].arguments, ["warn", ...args]);
});
const loggers = [
{ log: error, methodName: "error" as const },
{ log: info, logLevel: "info", methodName: "log" as const },
{ log: warn, methodName: "warn" as const },
];

for (const { log, logLevel, methodName } of loggers) {
const level = logLevel ?? methodName;
it(`prints ${level} messages`, (t) => {
const method = t.mock.method(console, methodName, () => null);

log(...args);

equal(method.mock.calls.length, 1);
deepEqual(method.mock.calls[0].arguments, [level, ...args]);
});
}
});
88 changes: 0 additions & 88 deletions packages/typescript-react-native-compiler/CHANGELOG.md

This file was deleted.

48 changes: 0 additions & 48 deletions packages/typescript-react-native-compiler/README.md

This file was deleted.

5 changes: 2 additions & 3 deletions scripts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { updateApiReadme } from "./commands/updateApiReadme.js";
*/
function init(commands) {
const parser = yargs(process.argv.slice(2));
Object.keys(commands).forEach((name) => {
const { description, command } = commands[name];
for (const [name, { description, command }] of Object.entries(commands)) {
parser.command(name, description, {}, async (args) => {
try {
await command(args, process.argv.slice(3));
Expand All @@ -28,7 +27,7 @@ function init(commands) {
process.exitCode = 1;
}
});
});
}
return parser.help().demandCommand().argv;
}

Expand Down
13 changes: 1 addition & 12 deletions scripts/src/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function workspaceRoot() {
* @param {SpawnOptions=} options
* @returns {Promise<void>}
*/
export function spawn(command, args, options) {
function spawn(command, args, options) {
return new Promise((resolve, reject) => {
/** @type {SpawnOptions} */
const opts = {
Expand Down Expand Up @@ -70,14 +70,3 @@ export function runScript(command, ...args) {
const yarn = os.platform() === "win32" ? "yarn.cmd" : "yarn";
return execute(yarn, command, ...args);
}

/**
* @param {...(() => Promise<void>)} scripts
* @returns {Promise<void>}
*/
export function sequence(...scripts) {
return scripts.reduce(
(result, script) => result.then(() => script()),
Promise.resolve()
);
}
3 changes: 0 additions & 3 deletions scripts/src/require.js

This file was deleted.

0 comments on commit 250bc39

Please sign in to comment.