alexjoverm / typescript-library-starter

Starter kit with zero-config for building a library in TypeScript, featuring RollupJS, Jest, Prettier, TSLint, Semantic Release, and more!
MIT License
4.37k stars 493 forks source link

How to use library version in package.json #329

Closed Yechuanjie closed 4 years ago

Yechuanjie commented 4 years ago

in my src code, I want to get the library version through the package.json

my tsconfig.json

{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "es5",
    "module": "es2015",
    "lib": [
      "es2015",
      "es2016",
      "es2017",
      "dom"
    ],
    "strict": true,
    "sourceMap": true,
    "declaration": true,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "noImplicitAny": false,
    "resolveJsonModule": true,
    "declarationDir": "dist/types",
    "outDir": "dist/lib",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "include": [
    "src"
  ]
}