tshy-after

Auto set package.json after tshy run

MIT 8 个版本
安装
npm install tshy-after
yarn add tshy-after
pnpm add tshy-after
bun add tshy-after
README

tshy-after

NPM version Node.js CI npm download Node.js Version PRs Welcome

Auto set package.json after tshy run

keep types

Set package.types to package.exports['.'].require.types

Auto fix import.meta.url and import.meta.resolve SyntaxError on CJS

SyntaxError: Cannot use 'import.meta' outside a module

e.g.: Get the file's dirname

// src/index.ts

import { fileURLToPath } from 'node:url';
import path from 'node:path';

export function getDirname() {
  if (typeof __dirname !== 'undefined') {
    return __dirname;
  }
  // @ts-ignore
  return path.dirname(fileURLToPath(import.meta.url));
}

License

MIT

Contributors

Contributors

Made with contributors-img.

版本列表
1.4.1 2025-02-02
1.4.0 2024-12-24
1.3.1 2024-12-22
1.3.0 2024-12-22
1.2.0 2024-07-08
1.1.1 2024-07-07
1.1.0 2024-07-07
1.0.0 2023-09-17