diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index fe21683..535c0c5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -23,7 +23,7 @@ jobs: PAT_GPR: ${{ secrets.PAT_GPR_ADMIN }} strategy: matrix: - node: [15.x, 16.x] + node: [15.x, 16.0.0] steps: - id: checkout name: Checkout branch diff --git a/package.json b/package.json index 8ea440c..1e13569 100644 --- a/package.json +++ b/package.json @@ -120,10 +120,10 @@ "fix:format": "prettier --write .", "fix:style": "yarn check:style --fix --cache", "test": "bash ./tools/scripts/jest.sh", - "build": "node ./tools/cli/build.ts", - "prepack": "toggle-scripts -postinstall && yarn build", + "build": "node ./tools/cli/build-pkg.ts", + "prepack": "toggle-scripts -postinstall && NODE_ENV=production yarn build", "postpack": "toggle-scripts +postinstall", - "release": "node ./tools/cli/release.ts", + "release": "NODE_ENV=production node ./tools/cli/release.ts", "prepublishOnly": "toggle-scripts -prepack", "postpublish": "toggle-scripts +prepack" }, @@ -200,12 +200,11 @@ "prettier-plugin-sh": "0.7.1", "read-pkg": "7.0.0", "replace-in-file": "6.2.0", + "resolve-tspaths": "0.1.1", "rimraf": "3.0.2", "shelljs": "0.8.4", "ts-jest": "27.0.5", "ts-node": "10.2.1", - "ts-patch": "1.4.4", - "tsc-alias": "1.3.10", "tsc-prog": "2.2.1", "tsconfig": "7.0.0", "tsconfig-paths": "3.11.0", diff --git a/tools/cli/build-pkg.ts b/tools/cli/build-pkg.ts new file mode 100755 index 0000000..210cd18 --- /dev/null +++ b/tools/cli/build-pkg.ts @@ -0,0 +1,209 @@ +#!/usr/bin/env ts-node + +import LogLevel from '@flex-development/log/enums/log-level.enum' +import type { TrextOptions } from '@flex-development/trext' +import { trext } from '@flex-development/trext' +import ncc from '@vercel/ncc' +import fs from 'fs/promises' +import path from 'node:path' +import replace from 'replace-in-file' +import rimraf from 'rimraf' +import type { BuildOptions as TsBuildOptions } from 'tsc-prog' +import * as tsc from 'tsc-prog' +import { logDiagnostics } from 'tsc-prog/dist/utils/log' +import ts from 'typescript' +import type { Argv } from 'yargs' +import type { BuildOptions } from '../helpers/build' +import build, { args as bargs } from '../helpers/build' +import logger from '../helpers/logger' +import { $PACKAGE, $WNS } from '../helpers/pkg' +import type { TsRemapOptions } from '../helpers/ts-remap' +import tsRemap from '../helpers/ts-remap' +import tsconfigCascade from '../helpers/tsconfig-cascade' + +/** + * @file CLI - Package Build Workflow + * @module tools/cli/build-pkg + */ + +export type BuildPkgOptions = BuildOptions & { + /** + * Specify module build formats. + * + * @default ['cjs','esm','types'] + */ + formats?: ('cjs' | 'esm' | 'types')[] + + /** @see BuildPkgOptions.formats */ + f?: BuildPkgOptions['formats'] +} + +export type BuildPkgArgs = Argv +export type BuildPkgArgv = Exclude> + +export type BuildModuleFormatOptions = { + build: TsBuildOptions + trext: TrextOptions<'js', 'cjs' | 'mjs'> + remap: TsRemapOptions +} + +/** @property {string[]} BUILD_FORMATS - Module build formats */ +const BUILD_FORMATS: BuildPkgOptions['formats'] = ['cjs', 'esm', 'types'] + +/** @property {BuildPkgArgs} args - CLI arguments parser */ +const args = bargs + .option('formats', { + alias: 'f', + choices: BUILD_FORMATS, + default: BUILD_FORMATS, + describe: 'specify module build format(s)', + type: 'array' + }) + .alias('version', 'v') + .pkgConf('build-pkg') as BuildPkgArgs + +/** + * Executes the package build workflow. + * + * @async + * @return {Promise} Empty promise when complete + */ +async function buildPackage(): Promise { + await build(args.argv, async (argv, context) => { + const { dryRun, env, formats = [] } = argv + const { cwd, pwd } = context + + // Build project, convert output extensions, create bundles + for (const format of formats) { + // Remove stale build directory + !dryRun && rimraf.sync(format) + logger(argv, `remove stale ${format} directory`) + + // Get config file suffix + const suffix: `${string}.json` = `prod.${format}.json` + + // Get output extension + const extension: 'cjs' | 'mjs' = `${format === 'cjs' ? 'c' : 'm'}js` + + // Get module format build options + // See: https://github.com/jeremyben/tsc-prog + // See: https://github.com/flex-development/trext + const options: BuildModuleFormatOptions = (() => { + const tsconfig = (() => { + const { include = [] } = tsconfigCascade([[cwd, 'prod.json']]) + const { compilerOptions = {}, exclude = [] } = tsconfigCascade([ + [pwd, 'json'], + [pwd, 'prod.json'], + [pwd, suffix] + ]) + + compilerOptions.outDir = format + delete compilerOptions.rootDir + + return { compilerOptions, exclude, include } + })() + + return { + build: { ...tsconfig, basePath: cwd, clean: { outDir: true } }, + remap: { + compilerOptions: { ...tsconfig.compilerOptions, baseUrl: '../..' }, + dryRun, + verbose: !!JSON.parse(`${process.env['GITHUB_ACTIONS'] || 'false'}`) + }, + trext: { + absolute: /@flex-development/, + babel: { sourceMaps: 'inline' as const }, + from: 'js', + pattern: /.js$/, + to: extension + } + } as BuildModuleFormatOptions + })() + + // Build project + if (!dryRun) { + // Log compilation start + logger(argv, 'compilation started') + + // Create TypeScript program + const program = tsc.createProgramFromConfig(options.build) + + // Compile project + const emit = program.emit( + undefined, + undefined, + undefined, + format === 'types' + ) + + // Get all diagnostics + const diagnostics = [ + ...ts.getPreEmitDiagnostics(program), + ...emit.diagnostics + ] + + // Log diagnostics + logDiagnostics(diagnostics, true) + + // Throw error if files weren't emitted + if (!program.getCompilerOptions().noEmit && emit.emitSkipped) { + throw new Error('compilation failed') + } + + // Log compilation result + if (diagnostics.length > 0) { + const message = `compilation done with ${diagnostics.length} errors` + logger(argv, message, [], LogLevel.WARN) + } else logger(argv, 'compilation successful') + } + + // Transform paths + tsRemap(options.remap) + + if (format !== 'types') { + // Create bundles + // See: https://github.com/vercel/ncc + const BUNDLES = [$WNS, `${$WNS}.min`].map(async name => { + const bundle = `${format}/${name}.${options.trext.to}` + const filename = 'src/index.ts' + + if (!dryRun) { + const { code } = await ncc(`${cwd}/${filename}`, { + esm: format === 'esm', + externals: [ + ...Object.keys($PACKAGE?.optionalDependencies ?? {}), + ...Object.keys($PACKAGE?.peerDependencies ?? {}) + ], + filename, + minify: path.extname(name) === '.min', + production: env === 'production', + quiet: true, + target: options.build.compilerOptions?.target, + // ! type check already performed above + transpileOnly: true + }) + + await fs.writeFile(bundle, code, { flag: 'wx+' }) + await fs.copyFile(`${format}/index.d.ts`, `${format}/${name}.d.ts`) + await replace.replaceInFile({ + files: bundle, + from: ';// CONCATENATED MODULE: ./src/', + to: ';// CONCATENATED MODULE: ../src/' + }) + } + + return bundle + }) + + // Complete bundle promises + logger(argv, `bundle ${format}`, await Promise.all(BUNDLES)) + + // Convert TypeScript output to .cjs or .mjs + !dryRun && (await trext<'js', typeof extension>(format, options.trext)) + logger(argv, `use .${extension} extensions`) + } + } + }) +} + +buildPackage() diff --git a/tools/cli/build.ts b/tools/cli/build.ts deleted file mode 100755 index 5154c23..0000000 --- a/tools/cli/build.ts +++ /dev/null @@ -1,312 +0,0 @@ -#!/usr/bin/env node - -import LogLevel from '@flex-development/log/enums/log-level.enum' -import type { TrextOptions } from '@flex-development/trext' -import { trext } from '@flex-development/trext' -// @ts-expect-error ts(7016) -import ncc from '@vercel/ncc' -import ch from 'chalk' -import fs from 'fs/promises' -import path from 'path' -import replace from 'replace-in-file' -import sh from 'shelljs' -import type { ReplaceTscAliasPathsOptions } from 'tsc-alias' -import { replaceTscAliasPaths as tsTransformPaths } from 'tsc-alias' -import type { BuildOptions as TsBuildOptions, TsConfig } from 'tsc-prog' -import tsc from 'tsc-prog' -import { loadSync as tsconfigLoad } from 'tsconfig/dist/tsconfig' -import { inspect } from 'util' -import type { Argv } from 'yargs' -import yargs from 'yargs' -import { hideBin } from 'yargs/helpers' -import exec from '../helpers/exec' -import logger from '../helpers/logger' -import { $PACKAGE, $WNS, $WORKSPACE } from '../helpers/pkg' -import tsconfigCascade from '../helpers/tsconfig-cascade' - -/** - * @file CLI - Package Build Workflow - * @module tools/cli/build - */ - -export type BuildOptions = { - /** - * See the commands that running `build` would run. - * - * @default false - */ - dryRun?: boolean - - /** - * Name of build environment. - * - * @default 'production' - */ - env?: 'development' | 'production' | 'test' - - /** - * Specify module build formats. - * - * @default ['cjs','esm','types'] - */ - formats?: ('cjs' | 'esm' | 'types')[] - - /** - * Run preliminary `yarn install` if package contains build scripts. - * - * @default false - */ - install?: boolean - - /** - * Create tarball at specified path. - * - * @default '%s-%v.tgz' - */ - out?: string - - /** - * Run `prepack` script. - * - * @default false - */ - prepack?: boolean - - /** - * Pack the project once build is complete. - * - * @default false - */ - tarball?: boolean -} - -export type BuildArgs = Argv -export type BuildArgv = Exclude> - -export type BuildModuleFormatOptions = { - alias: ReplaceTscAliasPathsOptions - build: TsBuildOptions - trext: TrextOptions<'js', 'cjs' | 'mjs'> -} - -/** @property {string[]} BUILD_FORMATS - Module build formats */ -const BUILD_FORMATS: BuildOptions['formats'] = ['cjs', 'esm', 'types'] - -/** @property {string} COMMAND_PACK - Base pack command */ -const COMMAND_PACK: string = 'yarn pack' - -/** @property {string} CWD - Current working directory */ -const CWD: string = process.cwd() - -/** @property {string} PWD - Project working directory */ -const PWD: string = process.env.PROJECT_CWD as string - -const args = yargs(hideBin(process.argv), CWD) - .usage('$0 [options]') - .option('dryRun', { - alias: 'd', - default: false, - describe: 'see the commands that running `build` would run', - type: 'boolean' - }) - .option('env', { - alias: 'e', - choices: ['production', 'test', 'development'], - default: 'production', - describe: 'name of build environment', - requiresArg: true, - type: 'string' - }) - .option('formats', { - alias: 'f', - choices: BUILD_FORMATS, - default: BUILD_FORMATS, - describe: 'specify module build format(s)', - type: 'array' - }) - .option('install', { - alias: 'i', - default: false, - describe: 'run `yarn install` if package contains build scripts', - type: 'boolean' - }) - .option('out', { - alias: 'o', - default: '%s-%v.tgz', - describe: 'create tarball at specified path', - requiresArg: true, - type: 'string' - }) - .option('prepack', { - alias: 'p', - default: false, - describe: 'run `prepack` script', - type: 'boolean' - }) - .option('tarball', { - alias: 't', - default: false, - describe: 'pack the project once build is complete', - type: 'boolean' - }) - .alias('version', 'v') - .alias('help', 'h') - .pkgConf('build') - .wrap(98) as BuildArgs - -const argv: BuildArgv = await args.argv -const { dryRun, env, formats = [], tarball } = argv - -// Log workflow start -logger( - argv, - 'starting build workflow', - [$WORKSPACE, `[dry=${dryRun}]`], - LogLevel.INFO -) - -try { - // Type check source code - exec('yarn check:types', dryRun) - logger(argv, 'type check source code') - - // Set environment variables - exec(`node ${PWD}/tools/cli/loadenv.cjs -c ${env}`, dryRun) - logger(argv, `set ${env} environment variables`) - - // Build project, convert output extensions, create bundles - for (const format of formats) { - // Get config file suffix - const suffix: `${string}.json` = `prod.${format}.json` - - // Get module format build options - // See: https://github.com/justkey007/tsc-alias#usage - // See: https://github.com/jeremyben/tsc-prog - // See: https://github.com/flex-development/trext - const options: BuildModuleFormatOptions = { - alias: { - configFile: `tsconfig.prod.${format}.json`, - outDir: `./${format}`, - silent: false - }, - build: { - ...((): TsConfig => { - const { compilerOptions = {}, exclude = [] } = tsconfigCascade([ - [PWD, 'json'], - [PWD, 'prod.json'], - [PWD, suffix] - ]) - - return { - compilerOptions, - exclude, - include: tsconfigLoad(PWD, 'tsconfig.prod.json').config.include - } - })(), - basePath: CWD, - clean: { outDir: true } - }, - trext: { - babel: { sourceMaps: 'inline' as const }, - from: 'js', - pattern: /.js$/, - to: `${format === 'cjs' ? 'c' : 'm'}js` - } - } - - // Build project - !dryRun && tsc.build(options.build) - - // Transform paths - !dryRun && tsTransformPaths(options.alias) - dryRun && logger(argv, `build ${format}`) - - if (format !== 'types') { - // Create bundles - // See: https://github.com/vercel/ncc - const BUNDLES = [$WNS, `${$WNS}.min`].map(async name => { - const bundle = `${format}/${name}.${options.trext.to}` - const filename = 'src/index.ts' - - if (!dryRun) { - const { code } = await ncc(`${CWD}/${filename}`, { - esm: format === 'esm', - externals: Object.keys($PACKAGE?.peerDependencies ?? {}), - filename, - minify: path.extname(name) === '.min', - production: env === 'production', - quiet: true, - target: options.build.compilerOptions?.target, - // ! @vercel/ncc not compatible with typescript@4.5.0-beta - transpileOnly: true - }) - - await fs.writeFile(bundle, code, { flag: 'wx+' }) - await fs.copyFile(`${format}/index.d.ts`, `${format}/${name}.d.ts`) - await replace.replaceInFile({ - files: bundle, - from: ';// CONCATENATED MODULE: ./src/', - to: ';// CONCATENATED MODULE: ../src/' - }) - } - - return bundle - }) - - // Complete bundle promises - logger(argv, `bundle ${format}`, await Promise.all(BUNDLES)) - - // Convert TypeScript output to .cjs or .mjs - !dryRun && (await trext<'js', 'cjs' | 'mjs'>(format, options.trext)) - logger(argv, `use .${options.trext.to} extensions`) - } - } - - // Pack project - if (tarball) { - const { install, out: outFile, prepack } = argv - - // Pack command flags - const flags = [ - `${dryRun ? '--dry-run' : ''}`, - `--out ${outFile}`, - `${install ? '--install-if-needed' : ''}` - ] - - // Check if package has postinstall and prepack scripts - const has_postinstall = typeof $PACKAGE.scripts?.postinstall === 'string' - const has_prepack = typeof $PACKAGE.scripts?.prepack === 'string' - - // Check if prepack script should be disabled - const disable_prepack = has_prepack && !prepack - - // Disable postinstall script - has_postinstall && exec('toggle-scripts -postinstall', dryRun) - has_postinstall && logger(argv, 'disable postinstall script') - - // Disable prepack script - disable_prepack && exec('toggle-scripts -prepack', dryRun) - disable_prepack && logger(argv, 'disable prepack script') - - // Execute pack command - exec(`${COMMAND_PACK} ${flags.join(' ')}`.trim(), dryRun) - logger(argv, 'create tarball') - - // Renable postinstall script - has_postinstall && exec('toggle-scripts +postinstall', dryRun) - has_postinstall && logger(argv, 'renable postinstall script') - - // Renable prepack script - disable_prepack && exec('toggle-scripts +prepack', dryRun) - disable_prepack && logger(argv, 'renable prepack script') - } -} catch (err) { - const error = err as Error & { code?: number; stderr?: string } - - if (!error.stderr) logger(argv, error.message, [], LogLevel.ERROR) - sh.echo(error.stderr || ch.red(inspect(error, false, null))) - sh.exit(error?.code ?? 1) -} - -// Log workflow end -logger(argv, 'build workflow complete', [$WORKSPACE], LogLevel.INFO) diff --git a/tools/cli/release.ts b/tools/cli/release.ts index 38a1cec..fcc8a51 100755 --- a/tools/cli/release.ts +++ b/tools/cli/release.ts @@ -5,8 +5,8 @@ import type { IGreaseOptions } from '@flex-development/grease/interfaces' import LogLevel from '@flex-development/log/enums/log-level.enum' import ch from 'chalk' import merge from 'lodash.merge' +import { inspect } from 'node:util' import sh from 'shelljs' -import { inspect } from 'util' import type { Argv } from 'yargs' import yargs from 'yargs' import { hideBin } from 'yargs/helpers' @@ -75,7 +75,7 @@ export type ReleaseOptions = { export type ReleaseArgs = Argv export type ReleaseArgv = Exclude> -const args = yargs(hideBin(process.argv), process.env.INIT_CWD) +const args = yargs(hideBin(process.argv), process.env['INIT_CWD']) .usage('$0 [options]') .option('commitAll', { alias: 'a', @@ -130,15 +130,15 @@ const argv: ReleaseArgv = await args.argv const options: IGreaseOptions = { commitAll: true, gitTagFallback: false, - gitdir: process.env.PROJECT_CWD, + gitdir: process.env['PROJECT_CWD'], lernaPackage: $WNS, releaseAssets: ['./*.tgz'], releaseBranchWhitelist: ['release/*'], releaseCommitMessageFormat: `release: ${$WORKSPACE}@{{currentTag}}`, scripts: { - postchangelog: `yarn pack -o %s-%v.tgz ${(argv.d && '-n') || ''}`.trim(), + postchangelog: `yarn pack -o %s-%v.tgz ${(argv['d'] && '-n') || ''}`.trim(), postcommit: 'git pnv', - postgreaser: 'yarn clean:build && rimraf ./*.tgz', + postgreaser: 'yarn clean:build', prerelease: 'yarn test --no-cache' }, // `continuous-deployment` workflow will create new tag @@ -173,7 +173,8 @@ logger( ) // Run release workflow -grease(merge({}, options, argv)).catch(error => { +// @ts-expect-error Property 'default' does not exist on type +grease.default(merge({}, options, argv)).catch((error: any) => { if (error.stderr) return else sh.echo(ch.bold.red(inspect(error, false, null))) }) diff --git a/tools/helpers/build.ts b/tools/helpers/build.ts new file mode 100644 index 0000000..59d0663 --- /dev/null +++ b/tools/helpers/build.ts @@ -0,0 +1,232 @@ +#!/usr/bin/env ts-node + +import LogLevel from '@flex-development/log/enums/log-level.enum' +import ch from 'chalk' +import { inspect } from 'node:util' +import sh from 'shelljs' +import type { Argv } from 'yargs' +import yargs from 'yargs' +import { hideBin } from 'yargs/helpers' +import exec from './exec' +import logger from './logger' +import { $PACKAGE, $WORKSPACE } from './pkg' + +/** + * @file Helpers - build + * @module tools/helpers/build + */ + +export type BuildOptions = { + /** + * See the commands that running `build` would run. + * + * @default false + */ + dryRun?: boolean + + /** @see BuildOptions.dryRun */ + d?: BuildOptions['dryRun'] + + /** + * Name of build environment. + * + * @default process.env.NODE_ENV + */ + env?: 'development' | 'production' | 'test' + + /** @see BuildOptions.env */ + e?: BuildOptions['env'] + + /** + * Run preliminary `yarn install` if package contains build scripts. + * + * @default false + */ + install?: boolean + + /** @see BuildOptions.install */ + i?: BuildOptions['install'] + + /** + * Create tarball at specified path. + * + * @default '%s-%v.tgz' + */ + out?: string + + /** @see BuildOptions.out */ + o?: BuildOptions['out'] + + /** + * Run `prepack` script. + * + * @default false + */ + prepack?: boolean + + /** @see BuildOptions.prepack */ + p?: BuildOptions['prepack'] + + /** + * Pack the project once build is complete. + * + * @default false + */ + tarball?: boolean + + /** @see BuildOptions.tarball */ + t?: BuildOptions['tarball'] +} + +export type BuildArgs = Argv +export type BuildArgv = BuildArgs['argv'] + +export type BuildContext = { + cwd: ReturnType + pwd: string +} + +export type BuildWorflow = { + (argv: O, context: BuildContext): any +} + +/** @property {BuildContext} context - Build context */ +export const CONTEXT: BuildContext = { + cwd: process.cwd(), + pwd: process.env['PROJECT_CWD'] as string +} + +/** @property {BuildArgs} args - Project working directory */ +export const args = yargs(hideBin(process.argv), CONTEXT.cwd) + .usage('$0 [options]') + .option('dryRun', { + alias: 'd', + default: false, + describe: 'see the commands that running `build` would run', + type: 'boolean' + }) + .option('env', { + alias: 'e', + choices: ['production', 'test', 'development'], + default: process.env['NODE_ENV'], + describe: 'node environment', + requiresArg: true, + type: 'string' + }) + .option('install', { + alias: 'i', + default: false, + describe: 'run `yarn install` if package contains build scripts', + type: 'boolean' + }) + .option('out', { + alias: 'o', + default: '%s-%v.tgz', + describe: 'create tarball at specified path', + requiresArg: true, + type: 'string' + }) + .option('prepack', { + alias: 'p', + default: false, + describe: 'run `prepack` script', + type: 'boolean' + }) + .option('tarball', { + alias: 't', + default: false, + describe: 'pack the project once build is complete', + type: 'boolean' + }) + .alias('help', 'h') + .wrap(98) as BuildArgs + +/** + * Executes a build `workflow`. + * + * @template O - Shape of build options + * + * @async + * @param {O | Promise} [argv] - Build options + * @param {BuildWorflow} [workflow] - Workflow function + * @return {Promise} Empty promise when complete + */ +async function build( + argv: O | Promise, + workflow?: BuildWorflow +): Promise { + const { dryRun, env, tarball } = (argv = await argv) + + // Log workflow start + logger( + argv, + 'starting build workflow', + [$WORKSPACE, `[env=${env},dry=${dryRun}]`], + LogLevel.INFO + ) + + try { + // Type check source code + exec(`tsc -p ${CONTEXT.cwd}/tsconfig.prod.json --noEmit`, dryRun) + logger(argv, 'type check source code') + + // Set environment variables + if (env) { + exec(`node ${CONTEXT.pwd}/tools/cli/loadenv.cjs -c ${env}`, dryRun) + logger(argv, `set ${env} environment variables`) + } + + // Execute build workflow + if (workflow) await workflow(argv, CONTEXT) + + // Pack project + if (tarball) { + const { install, out: outFile, prepack } = argv + + // Pack command flags + const flags = [ + `${dryRun ? '--dry-run' : ''}`, + `--out ${outFile}`, + `${install ? '--install-if-needed' : ''}` + ] + + // Check if package has postinstall and prepack scripts + const has_postinstall = typeof $PACKAGE.scripts?.postinstall === 'string' + const has_prepack = typeof $PACKAGE.scripts?.prepack === 'string' + + // Check if prepack script should be disabled + const disable_prepack = has_prepack && !prepack + + // Disable postinstall script + has_postinstall && exec('toggle-scripts -postinstall', dryRun) + has_postinstall && logger(argv, 'disable postinstall script') + + // Disable prepack script + disable_prepack && exec('toggle-scripts -prepack', dryRun) + disable_prepack && logger(argv, 'disable prepack script') + + // Execute pack command + exec(`yarn pack ${flags.join(' ')}`.trim(), dryRun) + logger(argv, 'create tarball') + + // Renable postinstall script + has_postinstall && exec('toggle-scripts +postinstall', dryRun) + has_postinstall && logger(argv, 'renable postinstall script') + + // Renable prepack script + disable_prepack && exec('toggle-scripts +prepack', dryRun) + disable_prepack && logger(argv, 'renable prepack script') + } + } catch (err) { + const error = err as Error & { code?: number; stderr?: string } + + if (!error.stderr) logger(argv, error.message, [], LogLevel.ERROR) + sh.echo(error.stderr || ch.red(inspect(error, false, null))) + sh.exit(error?.code ?? 1) + } + + // Log workflow end + logger(argv, 'build workflow complete', [$WORKSPACE], LogLevel.INFO) +} + +export default build diff --git a/tools/helpers/ts-remap.ts b/tools/helpers/ts-remap.ts new file mode 100644 index 0000000..5cad6a8 --- /dev/null +++ b/tools/helpers/ts-remap.ts @@ -0,0 +1,132 @@ +import LogLevel from '@flex-development/log/enums/log-level.enum' +import path from 'node:path' +import { inspect } from 'node:util' +import replace from 'replace-in-file' +import { applyChanges } from 'resolve-tspaths/dist/steps/applyChanges' +import { computeAliases } from 'resolve-tspaths/dist/steps/computeAliases' +import { generateChanges } from 'resolve-tspaths/dist/steps/generateChanges' +import { getFilesToProcess } from 'resolve-tspaths/dist/steps/getFilesToProcess' +import type { Alias, Change, ProgramPaths } from 'resolve-tspaths/dist/types' +import { TSConfigPropertyError } from 'resolve-tspaths/dist/utils/errors' +import { TsConfig } from 'tsc-prog' +import logger from './logger' + +/** + * @file Helpers - tsRemap + * @module tools/helpers/tsRemap + */ + +export type TsRemapOptions = { + /** + * TypeScript compiler options. + */ + compilerOptions: TsConfig['compilerOptions'] + + /** + * Current working directory. + * + * @default process.cwd() + */ + cwd?: string + + /** + * Do **not** emit any file changes. + */ + dryRun?: boolean + + /** + * List of file extensions in `tsconfig.outDir` that should be processed. + * + * @default 'js,d.ts' + */ + ext?: string + + /** + * Location of source directory (relative to `cwd`). + * + * @default 'src' + */ + src?: string + + /** + * Print verbose logs to the console. + */ + verbose?: boolean +} + +export type TsRemapResult = { + aliases: Alias[] + changes: Change[] + paths: Pick +} + +/** + * Replaces `options.compilerOptions.paths` with relative paths. + * + * @param {TsRemapOptions} options - Transformation options + * @return {TsRemapResult | null} Result object or null + * @throws {Error} + */ +const tsRemap = (options: TsRemapOptions): TsRemapResult | null => { + // Get transformation options + const { + compilerOptions = {}, + dryRun, + cwd = process.cwd(), + ext = 'js,d.ts', + src = 'src', + verbose + } = options + + // Handle missing properties + if (!compilerOptions.baseUrl) { + throw new TSConfigPropertyError('resolvePaths', 'compilerOptions.baseUrl') + } else if (!compilerOptions.outDir) { + throw new TSConfigPropertyError('resolvePaths', 'compilerOptions.outDir') + } + + // Get program paths + const basePath = path.resolve(cwd, compilerOptions.baseUrl) + const outPath = path.resolve(compilerOptions.outDir) + const srcPath = path.resolve(cwd, src) + + // Get path aliases + const aliases = computeAliases(basePath, { compilerOptions }) + + // Get files to process + const files = getFilesToProcess(outPath, ext) + + // Generate path transformations + const changes = generateChanges(files, aliases, { outPath, srcPath }) + const $changes = `${changes.length} file${changes.length === 1 ? '' : 's'}` + logger({}, `found ${$changes} using compilerOptions.paths`, [], LogLevel.INFO) + + // Log changes + if (verbose) { + for (const change of changes) { + const changes = [inspect(change.changes, false, null)] + logger({}, ` ${change.file}`, changes, LogLevel.DEBUG) + } + } + + // Apply path transformations + if (!dryRun) { + applyChanges(changes) + + replace.sync({ + files: `${outPath}/**/*`, + from: new RegExp(`(../.*)?${process.env['NODE_MODULES']}/`), + to: '' + }) + + if (changes.length > 0) logger({}, 'resolve compilerOptions.paths') + } + + return { + aliases, + changes, + paths: { basePath, outPath, srcPath } + } +} + +export default tsRemap diff --git a/tsconfig.json b/tsconfig.json index 95ba46b..a69def5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,6 @@ "baseUrl": "./", "checkJs": false, "esModuleInterop": true, - "exactOptionalPropertyTypes": true, "forceConsistentCasingInFileNames": true, "lib": ["esnext"], "module": "es2022", diff --git a/tsconfig.prod.json b/tsconfig.prod.json index 90ce7e8..6690ba8 100644 --- a/tsconfig.prod.json +++ b/tsconfig.prod.json @@ -2,6 +2,7 @@ "compilerOptions": { "declaration": true, "declarationMap": true, + "exactOptionalPropertyTypes": true, "inlineSourceMap": true, "inlineSources": true, "noEmit": false, diff --git a/yarn.lock b/yarn.lock index 75cb570..1489bbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -843,12 +843,11 @@ __metadata: read-pkg: 7.0.0 replace-in-file: 6.2.0 resolve-cwd: 3.0.0 + resolve-tspaths: 0.1.1 rimraf: 3.0.2 shelljs: 0.8.4 ts-jest: 27.0.5 ts-node: 10.2.1 - ts-patch: 1.4.4 - tsc-alias: 1.3.10 tsc-prog: 2.2.1 tsconfig: 7.0.0 tsconfig-paths: 3.11.0 @@ -1215,26 +1214,6 @@ __metadata: languageName: node linkType: hard -"@jfonx/console-utils@npm:^1.0.3": - version: 1.0.3 - resolution: "@jfonx/console-utils@npm:1.0.3" - dependencies: - colors: ^1.3.3 - checksum: e894bff674fe01480c57cf8e1c42b1127547d11315862f20b775ecf5144aed36de15a1054a3de322a886f32c7c5f083a63131eaf493ed53f38015d5e6ab11edb - languageName: node - linkType: hard - -"@jfonx/file-utils@npm:^3.0.1": - version: 3.0.1 - resolution: "@jfonx/file-utils@npm:3.0.1" - dependencies: - "@jfonx/console-utils": ^1.0.3 - comment-json: ^4.1.0 - find-up: ^4.1.0 - checksum: cfa4cf8bb585dcfa033d703b272ca59081049d94c8bfd30ceb5d6b3c247a252021d0c90cce6e6e98c0926a858c6b35a2d4be2e42fb399764b1aa59a99fb4437a - languageName: node - linkType: hard - "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -2221,7 +2200,7 @@ __metadata: languageName: node linkType: hard -"ansi-colors@npm:^4.1.1": +"ansi-colors@npm:4.1.1, ansi-colors@npm:^4.1.1": version: 4.1.1 resolution: "ansi-colors@npm:4.1.1" checksum: 138d04a51076cb085da0a7e2d000c5c0bb09f6e772ed5c65c53cb118d37f6c5f1637506d7155fb5f330f0abcf6f12fa2e489ac3f8cdab9da393bf1bb4f9a32b0 @@ -2290,7 +2269,7 @@ __metadata: languageName: node linkType: hard -"anymatch@npm:3.1.2, anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": +"anymatch@npm:3.1.2, anymatch@npm:^3.0.3": version: 3.1.2 resolution: "anymatch@npm:3.1.2" dependencies: @@ -2381,13 +2360,6 @@ __metadata: languageName: node linkType: hard -"array-timsort@npm:^1.0.3": - version: 1.0.3 - resolution: "array-timsort@npm:1.0.3" - checksum: fd4b5b0911214bdc8b5699ed10d309685551b518b3819c611c967cff59b87aee01cf591a10e36a3f14dbff696984bd6682b845f6fdbf1217195e910f241a4f78 - languageName: node - linkType: hard - "array-union@npm:^2.1.0": version: 2.1.0 resolution: "array-union@npm:2.1.0" @@ -2577,13 +2549,6 @@ __metadata: languageName: node linkType: hard -"binary-extensions@npm:^2.0.0": - version: 2.2.0 - resolution: "binary-extensions@npm:2.2.0" - checksum: ccd267956c58d2315f5d3ea6757cf09863c5fc703e50fbeb13a7dc849b812ef76e3cf9ca8f35a0c48498776a7478d7b4a0418e1e2b8cb9cb9731f2922aaad7f8 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -2612,7 +2577,7 @@ __metadata: languageName: node linkType: hard -"braces@npm:^3.0.1, braces@npm:~3.0.2": +"braces@npm:^3.0.1": version: 3.0.2 resolution: "braces@npm:3.0.2" dependencies: @@ -2830,25 +2795,6 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^3.5.0": - version: 3.5.2 - resolution: "chokidar@npm:3.5.2" - dependencies: - anymatch: ~3.1.2 - braces: ~3.0.2 - fsevents: ~2.3.2 - glob-parent: ~5.1.2 - is-binary-path: ~2.1.0 - is-glob: ~4.0.1 - normalize-path: ~3.0.0 - readdirp: ~3.6.0 - dependenciesMeta: - fsevents: - optional: true - checksum: d1fda32fcd67d9f6170a8468ad2630a3c6194949c9db3f6a91b16478c328b2800f433fb5d2592511b6cb145a47c013ea1cce60b432b1a001ae3ee978a8bffc2d - languageName: node - linkType: hard - "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -3033,13 +2979,6 @@ __metadata: languageName: node linkType: hard -"colors@npm:^1.3.3": - version: 1.4.0 - resolution: "colors@npm:1.4.0" - checksum: 98aa2c2418ad87dedf25d781be69dc5fc5908e279d9d30c34d8b702e586a0474605b3a189511482b9d5ed0d20c867515d22749537f7bc546256c6014f3ebdcec - languageName: node - linkType: hard - "combined-stream@npm:^1.0.8": version: 1.0.8 resolution: "combined-stream@npm:1.0.8" @@ -3049,10 +2988,10 @@ __metadata: languageName: node linkType: hard -"commander@npm:^6.2.1": - version: 6.2.1 - resolution: "commander@npm:6.2.1" - checksum: d7090410c0de6bc5c67d3ca41c41760d6d268f3c799e530aafb73b7437d1826bbf0d2a3edac33f8b57cc9887b4a986dce307fa5557e109be40eadb7c43b21742 +"commander@npm:8.2.0": + version: 8.2.0 + resolution: "commander@npm:8.2.0" + checksum: e868805bc266777f7a9c8a740e15b9e02b8148d8251f577ea9b9ef373ac0bdeb77b9b60cfc033592c9e1affea89993be08c13c623f0c619f9bf152c0e4d12cb0 languageName: node linkType: hard @@ -3063,19 +3002,6 @@ __metadata: languageName: node linkType: hard -"comment-json@npm:^4.1.0": - version: 4.1.1 - resolution: "comment-json@npm:4.1.1" - dependencies: - array-timsort: ^1.0.3 - core-util-is: ^1.0.2 - esprima: ^4.0.1 - has-own-prop: ^2.0.0 - repeat-string: ^1.6.1 - checksum: 8437a04be25c45255583e91ab0bbe90e3a40ed0bff2112123dc29ce48494e80c1e2de87f5f4ae24f7cf9ac421392925f2c4cbe1cde489eafcc3c60c5284edb3e - languageName: node - linkType: hard - "comment-parser@npm:1.2.4": version: 1.2.4 resolution: "comment-parser@npm:1.2.4" @@ -3374,7 +3300,7 @@ __metadata: languageName: node linkType: hard -"core-util-is@npm:^1.0.2, core-util-is@npm:~1.0.0": +"core-util-is@npm:~1.0.0": version: 1.0.3 resolution: "core-util-is@npm:1.0.3" checksum: 9de8597363a8e9b9952491ebe18167e3b36e7707569eed0ebf14f8bba773611376466ae34575bca8cfe3c767890c859c74056084738f09d4e4a6f902b2ad7d99 @@ -3662,13 +3588,6 @@ __metadata: languageName: node linkType: hard -"detect-file@npm:^1.0.0": - version: 1.0.0 - resolution: "detect-file@npm:1.0.0" - checksum: 1861e4146128622e847abe0e1ed80fef01e78532665858a792267adf89032b7a9c698436137707fcc6f02956c2a6a0052d6a0cef5be3d4b76b1ff0da88e2158a - languageName: node - linkType: hard - "detect-indent@npm:^6.0.0": version: 6.1.0 resolution: "detect-indent@npm:6.1.0" @@ -4449,15 +4368,6 @@ __metadata: languageName: node linkType: hard -"expand-tilde@npm:^2.0.0, expand-tilde@npm:^2.0.2": - version: 2.0.2 - resolution: "expand-tilde@npm:2.0.2" - dependencies: - homedir-polyfill: ^1.0.1 - checksum: 2efe6ed407d229981b1b6ceb552438fbc9e5c7d6a6751ad6ced3e0aa5cf12f0b299da695e90d6c2ac79191b5c53c613e508f7149e4573abfbb540698ddb7301a - languageName: node - linkType: hard - "expect@npm:^24.1.0": version: 24.9.0 resolution: "expect@npm:24.9.0" @@ -4535,7 +4445,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.1.1": +"fast-glob@npm:3.2.7, fast-glob@npm:^3.1.1": version: 3.2.7 resolution: "fast-glob@npm:3.2.7" dependencies: @@ -4629,16 +4539,6 @@ __metadata: languageName: node linkType: hard -"find-node-modules@npm:^2.1.0": - version: 2.1.2 - resolution: "find-node-modules@npm:2.1.2" - dependencies: - findup-sync: ^4.0.0 - merge: ^2.1.0 - checksum: c8db6065d100d5fbd3d0202451ab379362e7efd9b7bf382e8df92348ea4e89e4971c52541c59b78ce5b5bcfa1bceb4ded0b57a5564c3a3574909a9f17085b58c - languageName: node - linkType: hard - "find-up@npm:^2.0.0, find-up@npm:^2.1.0": version: 2.1.0 resolution: "find-up@npm:2.1.0" @@ -4677,18 +4577,6 @@ __metadata: languageName: node linkType: hard -"findup-sync@npm:^4.0.0": - version: 4.0.0 - resolution: "findup-sync@npm:4.0.0" - dependencies: - detect-file: ^1.0.0 - is-glob: ^4.0.0 - micromatch: ^4.0.2 - resolve-dir: ^1.0.1 - checksum: 94131e1107ad63790ed00c4c39ca131a93ea602607bd97afeffd92b69a9a63cf2c6f57d6db88cb753fe748ac7fde79e1e76768ff784247026b7c5ebf23ede3a0 - languageName: node - linkType: hard - "flat-cache@npm:^3.0.4": version: 3.0.4 resolution: "flat-cache@npm:3.0.4" @@ -4769,7 +4657,7 @@ __metadata: languageName: node linkType: hard -"fsevents@^2.3.2, fsevents@~2.3.2": +fsevents@^2.3.2: version: 2.3.2 resolution: "fsevents@npm:2.3.2" dependencies: @@ -4778,7 +4666,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@^2.3.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin": +"fsevents@patch:fsevents@^2.3.2#~builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=1cc4b2" dependencies: @@ -4958,7 +4846,7 @@ __metadata: languageName: node linkType: hard -"glob-parent@npm:^5.1.2, glob-parent@npm:~5.1.2": +"glob-parent@npm:^5.1.2": version: 5.1.2 resolution: "glob-parent@npm:5.1.2" dependencies: @@ -4990,41 +4878,6 @@ __metadata: languageName: node linkType: hard -"global-modules@npm:^1.0.0": - version: 1.0.0 - resolution: "global-modules@npm:1.0.0" - dependencies: - global-prefix: ^1.0.1 - is-windows: ^1.0.1 - resolve-dir: ^1.0.0 - checksum: 10be68796c1e1abc1e2ba87ec4ea507f5629873b119ab0cd29c07284ef2b930f1402d10df01beccb7391dedd9cd479611dd6a24311c71be58937beaf18edf85e - languageName: node - linkType: hard - -"global-prefix@npm:^1.0.1": - version: 1.0.2 - resolution: "global-prefix@npm:1.0.2" - dependencies: - expand-tilde: ^2.0.2 - homedir-polyfill: ^1.0.1 - ini: ^1.3.4 - is-windows: ^1.0.1 - which: ^1.2.14 - checksum: 061b43470fe498271bcd514e7746e8a8535032b17ab9570517014ae27d700ff0dca749f76bbde13ba384d185be4310d8ba5712cb0e74f7d54d59390db63dd9a0 - languageName: node - linkType: hard - -"global-prefix@npm:^3.0.0": - version: 3.0.0 - resolution: "global-prefix@npm:3.0.0" - dependencies: - ini: ^1.3.5 - kind-of: ^6.0.2 - which: ^1.3.1 - checksum: 8a82fc1d6f22c45484a4e34656cc91bf021a03e03213b0035098d605bfc612d7141f1e14a21097e8a0413b4884afd5b260df0b6a25605ce9d722e11f1df2881d - languageName: node - linkType: hard - "globals@npm:^11.1.0": version: 11.12.0 resolution: "globals@npm:11.12.0" @@ -5041,7 +4894,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.2, globby@npm:^11.0.3": +"globby@npm:^11.0.3": version: 11.0.4 resolution: "globby@npm:11.0.4" dependencies: @@ -5108,13 +4961,6 @@ __metadata: languageName: node linkType: hard -"has-own-prop@npm:^2.0.0": - version: 2.0.0 - resolution: "has-own-prop@npm:2.0.0" - checksum: ca6336e85ead2295c9603880cbc199e2d3ff7eaea0e9035d68fbc79892e9cf681abc62c0909520f112c671dad9961be2173b21dff951358cc98425c560e789e0 - languageName: node - linkType: hard - "has-symbols@npm:^1.0.1, has-symbols@npm:^1.0.2": version: 1.0.2 resolution: "has-symbols@npm:1.0.2" @@ -5186,15 +5032,6 @@ __metadata: languageName: node linkType: hard -"homedir-polyfill@npm:^1.0.1": - version: 1.0.3 - resolution: "homedir-polyfill@npm:1.0.3" - dependencies: - parse-passwd: ^1.0.0 - checksum: 18dd4db87052c6a2179d1813adea0c4bfcfa4f9996f0e226fefb29eb3d548e564350fa28ec46b0bf1fbc0a1d2d6922ceceb80093115ea45ff8842a4990139250 - languageName: node - linkType: hard - "hosted-git-info@npm:^2.1.4": version: 2.8.9 resolution: "hosted-git-info@npm:2.8.9" @@ -5388,7 +5225,7 @@ __metadata: languageName: node linkType: hard -"ini@npm:^1.3.2, ini@npm:^1.3.4, ini@npm:^1.3.5": +"ini@npm:^1.3.2, ini@npm:^1.3.4": version: 1.3.8 resolution: "ini@npm:1.3.8" checksum: dfd98b0ca3a4fc1e323e38a6c8eb8936e31a97a918d3b377649ea15bdb15d481207a0dda1021efbd86b464cae29a0d33c1d7dcaf6c5672bee17fa849bc50a1b3 @@ -5471,15 +5308,6 @@ __metadata: languageName: node linkType: hard -"is-binary-path@npm:~2.1.0": - version: 2.1.0 - resolution: "is-binary-path@npm:2.1.0" - dependencies: - binary-extensions: ^2.0.0 - checksum: 84192eb88cff70d320426f35ecd63c3d6d495da9d805b19bc65b518984b7c0760280e57dbf119b7e9be6b161784a5a673ab2c6abe83abb5198a432232ad5b35c - languageName: node - linkType: hard - "is-boolean-object@npm:^1.1.0": version: 1.1.2 resolution: "is-boolean-object@npm:1.1.2" @@ -5642,7 +5470,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -5836,7 +5664,7 @@ __metadata: languageName: node linkType: hard -"is-windows@npm:^1.0.1, is-windows@npm:^1.0.2": +"is-windows@npm:^1.0.2": version: 1.0.2 resolution: "is-windows@npm:1.0.2" checksum: 438b7e52656fe3b9b293b180defb4e448088e7023a523ec21a91a80b9ff8cdb3377ddb5b6e60f7c7de4fa8b63ab56e121b6705fe081b3cf1b828b0a380009ad7 @@ -7284,13 +7112,6 @@ __metadata: languageName: node linkType: hard -"merge@npm:^2.1.0": - version: 2.1.1 - resolution: "merge@npm:2.1.1" - checksum: 9c36b0e25aa53b3f7305d7cf0f330397f1142cf311802b681e5619f12e986a790019b8246c1c0df21701c8652449f9046b0129551030097ef563d1958c823249 - languageName: node - linkType: hard - "micromark@npm:~2.11.0": version: 2.11.4 resolution: "micromark@npm:2.11.4" @@ -7322,7 +7143,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4": +"micromatch@npm:^4.0.4": version: 4.0.4 resolution: "micromatch@npm:4.0.4" dependencies: @@ -7661,7 +7482,7 @@ __metadata: languageName: node linkType: hard -"normalize-path@npm:^3.0.0, normalize-path@npm:~3.0.0": +"normalize-path@npm:^3.0.0": version: 3.0.0 resolution: "normalize-path@npm:3.0.0" checksum: 88eeb4da891e10b1318c4b2476b6e2ecbeb5ff97d946815ffea7794c31a89017c70d7f34b3c2ebf23ef4e9fc9fb99f7dffe36da22011b5b5c6ffa34f4873ec20 @@ -8000,13 +7821,6 @@ __metadata: languageName: node linkType: hard -"parse-passwd@npm:^1.0.0": - version: 1.0.0 - resolution: "parse-passwd@npm:1.0.0" - checksum: 4e55e0231d58f828a41d0f1da2bf2ff7bcef8f4cb6146e69d16ce499190de58b06199e6bd9b17fbf0d4d8aef9052099cdf8c4f13a6294b1a522e8e958073066e - languageName: node - linkType: hard - "parse5@npm:6.0.1": version: 6.0.1 resolution: "parse5@npm:6.0.1" @@ -8093,7 +7907,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^2.0.4, picomatch@npm:^2.2.1, picomatch@npm:^2.2.3": +"picomatch@npm:^2.0.4, picomatch@npm:^2.2.3": version: 2.3.0 resolution: "picomatch@npm:2.3.0" checksum: 16818720ea7c5872b6af110760dee856c8e4cd79aed1c7a006d076b1cc09eff3ae41ca5019966694c33fbd2e1cc6ea617ab10e4adac6df06556168f13be3fca2 @@ -8448,15 +8262,6 @@ __metadata: languageName: node linkType: hard -"readdirp@npm:~3.6.0": - version: 3.6.0 - resolution: "readdirp@npm:3.6.0" - dependencies: - picomatch: ^2.2.1 - checksum: 1ced032e6e45670b6d7352d71d21ce7edf7b9b928494dcaba6f11fba63180d9da6cd7061ebc34175ffda6ff529f481818c962952004d273178acd70f7059b320 - languageName: node - linkType: hard - "rechoir@npm:^0.6.2": version: 0.6.2 resolution: "rechoir@npm:0.6.2" @@ -8566,16 +8371,6 @@ __metadata: languageName: node linkType: hard -"resolve-dir@npm:^1.0.0, resolve-dir@npm:^1.0.1": - version: 1.0.1 - resolution: "resolve-dir@npm:1.0.1" - dependencies: - expand-tilde: ^2.0.0 - global-modules: ^1.0.0 - checksum: ef736b8ed60d6645c3b573da17d329bfb50ec4e1d6c5ffd6df49e3497acef9226f9810ea6823b8ece1560e01dcb13f77a9f6180d4f242d00cc9a8f4de909c65c - languageName: node - linkType: hard - "resolve-from@npm:5.0.0, resolve-from@npm:^5.0.0": version: 5.0.0 resolution: "resolve-from@npm:5.0.0" @@ -8599,6 +8394,19 @@ __metadata: languageName: node linkType: hard +"resolve-tspaths@npm:0.1.1": + version: 0.1.1 + resolution: "resolve-tspaths@npm:0.1.1" + dependencies: + ansi-colors: 4.1.1 + commander: 8.2.0 + fast-glob: 3.2.7 + bin: + resolve-tspaths: dist/main.js + checksum: 528e44f433a419f24c1b2e5215b673db0854fd03ba68bea9ffa270ae00deab1db530884a920ec2e83976870af79cfe2b0553bd7187b25af89618f36dae3caba2 + languageName: node + linkType: hard + "resolve-url@npm:^0.2.1": version: 0.2.1 resolution: "resolve-url@npm:0.2.1" @@ -8840,7 +8648,7 @@ __metadata: languageName: node linkType: hard -"shelljs@npm:0.8.4, shelljs@npm:^0.8.4": +"shelljs@npm:0.8.4": version: 0.8.4 resolution: "shelljs@npm:0.8.4" dependencies: @@ -9692,42 +9500,6 @@ __metadata: languageName: node linkType: hard -"ts-patch@npm:1.4.4": - version: 1.4.4 - resolution: "ts-patch@npm:1.4.4" - dependencies: - chalk: ^4.1.0 - glob: ^7.1.7 - global-prefix: ^3.0.0 - minimist: ^1.2.5 - resolve: ^1.20.0 - shelljs: ^0.8.4 - strip-ansi: ^6.0.0 - peerDependencies: - typescript: ">2.7.0" - bin: - ts-patch: bin/cli.js - checksum: 527c30b891594c83466f7dc200912f816b4dc71a10dba2fbd964ce98287e52f580460d0962e4fa8751e0b8ec2b45b019eb52a4e4c31b05c988f2447d790eb07f - languageName: node - linkType: hard - -"tsc-alias@npm:1.3.10": - version: 1.3.10 - resolution: "tsc-alias@npm:1.3.10" - dependencies: - "@jfonx/console-utils": ^1.0.3 - "@jfonx/file-utils": ^3.0.1 - chokidar: ^3.5.0 - commander: ^6.2.1 - find-node-modules: ^2.1.0 - globby: ^11.0.2 - normalize-path: ^3.0.0 - bin: - tsc-alias: dist/bin/index.js - checksum: 2a08378933159972d717923e2c73781092765c6f6e783cf23cea651a842c7e0d751551010a48c3396b52ae4c639a9196a09cd774381dbbf0d6aad9dfce27c588 - languageName: node - linkType: hard - "tsc-prog@npm:2.2.1": version: 2.2.1 resolution: "tsc-prog@npm:2.2.1" @@ -10186,7 +9958,7 @@ typescript@^4.4.3: languageName: node linkType: hard -"which@npm:^1.2.14, which@npm:^1.2.9, which@npm:^1.3.1": +"which@npm:^1.2.9": version: 1.3.1 resolution: "which@npm:1.3.1" dependencies: