Skip to content

Haroenv/package-json.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

package-json.macro

Build Status

Usage

Imagine the following package.json:

{
  "version": "1.0.0",
  "license": "MIT",
  "author": {
    "name": "Haroen Viaene"
  },
  "_forTesting": {
    "isNull": null,
    "array": [
      "hi",
      {
        "object": true
      }
    ]
  }
}

Then with this code, you'll avoid getting the whole json object in your source code

import packageJson from '../src/macro'

const version = packageJson('version')
const name = packageJson('name')
const object = packageJson('_forTesting.array[1].object')

           

const version = '1.0.0';
const name = 'package-json.macro';
const object = true;

About

babel macro for reading only part of package.json

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published