Skip to content

Commit

Permalink
[minor] add engines package.json field, add unicorn eslint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Aug 5, 2024
1 parent 749da52 commit 8b2c4a3
Show file tree
Hide file tree
Showing 92 changed files with 1,019 additions and 349 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/tagged-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,3 @@ jobs:
uses: softprops/[email protected]
with:
make_latest: true

- name: latest version
uses: softprops/[email protected]
with:
make_latest: false
tag_name: latest
3 changes: 1 addition & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {defineEslintConfig} from '@virmator/lint/configs/eslint.config.base.mjs'
import {dirname} from 'node:path';
import {fileURLToPath} from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const __dirname = dirname(fileURLToPath(import.meta.url));

export default [
...defineEslintConfig(__dirname),
Expand Down
762 changes: 637 additions & 125 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@virmator/mono-repo-root",
"version": "13.0.5",
"version": "13.1.0",
"private": true,
"type": "module",
"workspaces": [
Expand All @@ -22,8 +22,8 @@
"test:spelling": "virmator spellcheck",
"test:update": "mono-vir for-each-async npm run test:update"
},
"dependencies": {},
"devDependencies": {
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.8.0",
"@stylistic/eslint-plugin": "^2.6.1",
"@stylistic/eslint-plugin-ts": "^2.6.1",
Expand All @@ -34,9 +34,9 @@
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.11.0",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-playwright": "^1.6.2",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-require-extensions": "^0.1.3",
"eslint-plugin-sonarjs": "^1.0.4",
"markdown-code-example-inserter": "^1.0.0",
"mono-vir": "^1.0.1",
Expand All @@ -52,6 +52,9 @@
"typescript-eslint": "^8.0.0",
"virmator": "./"
},
"engines": {
"node": ">=22"
},
"overrides": {
"virmator": "*"
}
Expand Down
9 changes: 6 additions & 3 deletions packages/compile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@virmator/compile",
"version": "13.0.5",
"version": "13.1.0",
"description": "Default TS compile plugin for virmator.",
"keywords": [
"virmator",
Expand Down Expand Up @@ -33,12 +33,12 @@
"dependencies": {
"@augment-vir/common": "^29.3.0",
"@augment-vir/node-js": "^29.3.0",
"@virmator/core": "^13.0.5",
"@virmator/core": "^13.1.0",
"run-time-assertions": "^1.5.2"
},
"devDependencies": {
"@types/node": "^22.1.0",
"@virmator/plugin-testing": "^13.0.5",
"@virmator/plugin-testing": "^13.1.0",
"c8": "^10.1.2",
"chalk": "^5.3.0",
"concurrently": "^8.2.2",
Expand All @@ -50,6 +50,9 @@
"peerDependencies": {
"typescript": "*"
},
"engines": {
"node": ">=22"
},
"publishConfig": {
"access": "public"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/compile/src/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {LogOutputType, runShellCommand} from '@augment-vir/node-js';
import {testPlugin} from '@virmator/plugin-testing';
import {join} from 'node:path';
import {describe, it, TestContext} from 'node:test';
import {virmatorCompilePlugin} from './compile';
import {testFilesDir} from './file-paths.mock';
import {virmatorCompilePlugin} from './compile.js';
import {testFilesDir} from './file-paths.mock.js';

describe(virmatorCompilePlugin.name, () => {
async function testVirmatorCompilePlugin(
Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@virmator/core",
"version": "13.0.5",
"version": "13.1.0",
"description": "Shared core functionality for all virmator plugins and the virmator CLI.",
"keywords": [
"automation",
Expand Down Expand Up @@ -48,6 +48,9 @@
"@types/semver": "^7.5.8",
"esbuild": "^0.23.0"
},
"engines": {
"node": ">=22"
},
"publishConfig": {
"access": "public"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api/copy-configs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {PackageType, VirmatorEnv} from '@virmator/core';
import assert from 'node:assert/strict';
import {join} from 'node:path';
import {describe, it} from 'node:test';
import {flattenConfigs} from './copy-configs';
import {flattenConfigs} from './copy-configs.js';

describe(flattenConfigs.name, () => {
it('flattens the compile configs', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/api/copy-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import {awaitedForEach, extractErrorMessage, MaybePromise} from '@augment-vir/co
import {existsSync} from 'node:fs';
import {mkdir, readFile, writeFile} from 'node:fs/promises';
import {basename, dirname, join} from 'node:path';
import {VirmatorPluginResolvedConfigFile} from '../plugin/plugin-configs';
import {PackageType} from '../plugin/plugin-env';
import {VirmatorPluginResolvedConfigFile} from '../plugin/plugin-configs.js';
import {PackageType} from '../plugin/plugin-env.js';
import {
MonoRepoPackage,
UsedVirmatorPluginCommands,
VirmatorPluginResolvedConfigs,
} from '../plugin/plugin-executor';
import {PluginLogger} from '../plugin/plugin-logger';
} from '../plugin/plugin-executor.js';
import {PluginLogger} from '../plugin/plugin-logger.js';

/**
* Extracts a 1d array of virmator plugin config files from previously calculated used commands and
Expand Down
32 changes: 16 additions & 16 deletions packages/core/src/api/execute-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ import {cpus} from 'node:os';
import {join, resolve} from 'node:path';
import {isRunTimeType} from 'run-time-assertions';
import {PackageJson} from 'type-fest';
import {findClosestPackageDir} from '../augments/index';
import {CallbackWritable} from '../augments/stream/callback-writable';
import {getTerminalColor} from '../colors';
import {hideNoTraceTraces, VirmatorNoTraceError} from '../errors/virmator-no-trace.error';
import {VirmatorPlugin} from '../plugin/plugin';
import {VirmatorPluginResolvedConfigFile} from '../plugin/plugin-configs';
import {PackageType} from '../plugin/plugin-env';
import {findClosestPackageDir} from '../augments/index.js';
import {CallbackWritable} from '../augments/stream/callback-writable.js';
import {getTerminalColor} from '../colors.js';
import {hideNoTraceTraces, VirmatorNoTraceError} from '../errors/virmator-no-trace.error.js';
import {VirmatorPluginResolvedConfigFile} from '../plugin/plugin-configs.js';
import {PackageType} from '../plugin/plugin-env.js';
import {
ExtraRunShellCommandOptions,
MonoRepoPackage,
ValidPackageJson,
VirmatorPluginExecutorParams,
VirmatorPluginResolvedConfigs,
} from '../plugin/plugin-executor';
import {VirmatorPluginCliCommands} from '../plugin/plugin-init';
import {createPluginLogger, PluginLogger} from '../plugin/plugin-logger';
import {copyPluginConfigs} from './copy-configs';
import {installNpmDeps, installPluginNpmDeps} from './install-deps';
import {parseCliArgs} from './parse-args';
} from '../plugin/plugin-executor.js';
import {VirmatorPluginCliCommands} from '../plugin/plugin-init.js';
import {createPluginLogger, PluginLogger} from '../plugin/plugin-logger.js';
import {VirmatorPlugin} from '../plugin/plugin.js';
import {copyPluginConfigs} from './copy-configs.js';
import {installNpmDeps, installPluginNpmDeps} from './install-deps.js';
import {parseCliArgs} from './parse-args.js';

/** Params for executing a plugin command. */
export type ExecuteCommandParams = {
Expand Down Expand Up @@ -132,7 +132,7 @@ async function determinePackageType(
const parentPackages = await getMonoRepoPackages(monoRepoRootPath);

if (
parentPackages.find((monoPackage) => {
parentPackages.some((monoPackage) => {
return join(monoRepoRootPath, monoPackage.relativePath) === cwdPackagePath;
})
) {
Expand Down Expand Up @@ -179,7 +179,7 @@ async function findMonoRepoDir(cwdPackagePath: string) {
const parentPackages = await getMonoRepoPackages(parentPackageDir);

if (
parentPackages.find((monoPackage) => {
parentPackages.some((monoPackage) => {
return join(parentPackageDir, monoPackage.relativePath) === cwdPackagePath;
})
) {
Expand Down Expand Up @@ -350,7 +350,7 @@ export async function executeVirmatorCommand({
const writeStream = new CallbackWritable(log);

/** Force concurrently to use color even though it's being run as a subscript. */
process.env.FORCE_COLOR = '1';
process.env.FORCE_COLOR = '2';

let concurrentlyResults: ReadonlyArray<CloseEvent> = [];
let failed = false;
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './copy-configs';
export * from './execute-command';
export * from './parse-args';
export * from './typescript-config-file';
export * from './virmator-flags';
export * from './copy-configs.js';
export * from './execute-command.js';
export * from './parse-args.js';
export * from './typescript-config-file.js';
export * from './virmator-flags.js';
10 changes: 5 additions & 5 deletions packages/core/src/api/install-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import {awaitedBlockingMap, getObjectTypedEntries, isTruthy} from '@augment-vir/
import {readPackageJson, runShellCommand} from '@augment-vir/node-js';
import * as semver from 'semver';
import {PackageJson} from 'type-fest';
import {VirmatorNoTraceError} from '../errors/virmator-no-trace.error';
import {PackageType} from '../plugin/plugin-env';
import {UsedVirmatorPluginCommands} from '../plugin/plugin-executor';
import {NpmDepType, PluginNpmDeps} from '../plugin/plugin-init';
import {PluginLogger} from '../plugin/plugin-logger';
import {VirmatorNoTraceError} from '../errors/virmator-no-trace.error.js';
import {PackageType} from '../plugin/plugin-env.js';
import {UsedVirmatorPluginCommands} from '../plugin/plugin-executor.js';
import {NpmDepType, PluginNpmDeps} from '../plugin/plugin-init.js';
import {PluginLogger} from '../plugin/plugin-logger.js';

/** Install's a virmator plugin's listed npm deps depending on which command is being run. */
export async function installPluginNpmDeps({
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api/parse-args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NpmDepType, PackageType, VirmatorEnv} from '@virmator/core';
import assert from 'node:assert/strict';
import {join} from 'node:path';
import {describe, it} from 'node:test';
import {calculateUsedCommands} from './parse-args';
import {calculateUsedCommands} from './parse-args.js';

describe(calculateUsedCommands.name, () => {
it('calculates correctly', () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/api/parse-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
import {extractRelevantArgs} from 'cli-args-vir';
import {isRunTimeType} from 'run-time-assertions';
import {Writable} from 'type-fest';
import {accessAtKeys} from '../augments/object/access';
import {VirmatorPlugin} from '../plugin/plugin';
import {UsedVirmatorPluginCommands} from '../plugin/plugin-executor';
import {VirmatorPluginCliCommands} from '../plugin/plugin-init';
import {PluginLogger} from '../plugin/plugin-logger';
import {SetVirmatorFlags, virmatorFlags} from './virmator-flags';
import {accessAtKeys} from '../augments/object/access.js';
import {UsedVirmatorPluginCommands} from '../plugin/plugin-executor.js';
import {VirmatorPluginCliCommands} from '../plugin/plugin-init.js';
import {PluginLogger} from '../plugin/plugin-logger.js';
import {VirmatorPlugin} from '../plugin/plugin.js';
import {SetVirmatorFlags, virmatorFlags} from './virmator-flags.js';

/** All supported sets of args for virmator. */
export type ParsedArgs = {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api/typescript-config-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {MaybePromise, wrapInTry} from '@augment-vir/common';
import {toPosixPath} from '@augment-vir/node-js';
import {rm} from 'node:fs/promises';
import {basename, join, relative} from 'node:path';
import {findClosestNodeModulesDir} from '../augments/index';
import {findClosestNodeModulesDir} from '../augments/index.js';

/**
* Compiles and imports a TS file so it can be used within JS contexts. After the given callback is
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/augments/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './fs/search';
export * from './object/access';
export * from './stream/callback-writable';
export * from './tsconfig/parse-tsconfig';
export * from './fs/search.js';
export * from './object/access.js';
export * from './stream/callback-writable.js';
export * from './tsconfig/parse-tsconfig.js';
2 changes: 1 addition & 1 deletion packages/core/src/augments/object/access.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';
import {accessAtKeys} from './access';
import {accessAtKeys} from './access.js';

describe(accessAtKeys.name, () => {
it('accesses a top member', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/augments/object/access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export function accessAtKeys<T extends AnyObject>(
): T | undefined {
if (!parent) {
return undefined;
} else if (!isLengthAtLeast(keys, 1)) {
return parent;
} else {
} else if (isLengthAtLeast(keys, 1)) {
return accessAtKeys(parent[keys[0]], keys.slice(1));
} else {
return parent;
}
}
4 changes: 2 additions & 2 deletions packages/core/src/augments/stream/callback-writable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Writable} from 'stream';
import {PluginLogger} from '../../plugin/plugin-logger';
import {Writable} from 'node:stream';
import {PluginLogger} from '../../plugin/plugin-logger.js';

/** A {@link Writable} implementation that writes to the provided plugin logger. */
export class CallbackWritable extends Writable {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/augments/tsconfig/parse-tsconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import assert from 'node:assert/strict';
import {basename, join} from 'node:path';
import {describe, it} from 'node:test';
import {assertDefined} from 'run-time-assertions';
import {coreTestFilesDir, monoRepoTestFilesDir} from '../../file-paths.mock';
import {parseTsConfig} from './parse-tsconfig';
import {coreTestFilesDir, monoRepoTestFilesDir} from '../../file-paths.mock.js';
import {parseTsConfig} from './parse-tsconfig.js';

const tsConfigsPath = join(coreTestFilesDir, 'ts-configs');

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/colors.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {describe, it} from 'node:test';
import {assertRunTimeType} from 'run-time-assertions';
import {getTerminalColor, terminalColors} from './colors';
import {getTerminalColor, terminalColors} from './colors.js';

describe(getTerminalColor.name, () => {
it('gets a color', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './virmator-no-trace.error';
export * from './virmator-no-trace.error.js';
2 changes: 1 addition & 1 deletion packages/core/src/errors/virmator-no-trace.error.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';
import {hideNoTraceTraces} from './virmator-no-trace.error';
import {hideNoTraceTraces} from './virmator-no-trace.error.js';

describe('hideNoTraceTraces', () => {
it('should be true', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './api/index';
export * from './augments/index';
export * from './colors';
export * from './errors/index';
export * from './plugin/index';
export * from './api/index.js';
export * from './augments/index.js';
export * from './colors.js';
export * from './errors/index.js';
export * from './plugin/index.js';
12 changes: 6 additions & 6 deletions packages/core/src/plugin/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from './plugin';
export * from './plugin-configs';
export * from './plugin-env';
export * from './plugin-executor';
export * from './plugin-init';
export * from './plugin-logger';
export * from './plugin-configs.js';
export * from './plugin-env.js';
export * from './plugin-executor.js';
export * from './plugin-init.js';
export * from './plugin-logger.js';
export * from './plugin.js';
2 changes: 1 addition & 1 deletion packages/core/src/plugin/plugin-configs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PackageType, VirmatorEnv} from './plugin-env';
import {PackageType, VirmatorEnv} from './plugin-env.js';

/** Definition for a plugin's config file. */
export type VirmatorPluginConfigFile = {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/plugin/plugin-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import type {
import type {LogOutputType, runShellCommand} from '@augment-vir/node-js';
import {ChalkInstance} from 'chalk';
import {EmptyObject, PackageJson, SetRequired} from 'type-fest';
import {VirmatorPluginResolvedConfigFile} from './plugin-configs';
import {PackageType} from './plugin-env';
import {VirmatorPluginResolvedConfigFile} from './plugin-configs.js';
import {PackageType} from './plugin-env.js';
import {
IndividualPluginCommand,
PluginNpmDeps,
VirmatorPluginCliCommands,
VirmatorPluginInit,
} from './plugin-init';
import {PluginLogger} from './plugin-logger';
} from './plugin-init.js';
import {PluginLogger} from './plugin-logger.js';

/** A picked nesting of commands based on which commands are currently in use. */
export type UsedVirmatorPluginCommands<
Expand Down
Loading

0 comments on commit 8b2c4a3

Please sign in to comment.