How to use pkginfo - 3 common examples

To help you get started, we’ve selected a few pkginfo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topcoat / resin / src / bin / index.js View on Github external
#!/usr/bin/env node
/* eslint-disable no-console */
import program from 'commander';
import pkginfo from 'pkginfo';
import fs from 'fs';
import resin from '../lib/index.js';

pkginfo(module, 'version', 'description');

function list(val) {
  const result = val.replace(/(^(?:"|')?\[)|(](?:"|')?$)/g, '').split(',');
  return result.map((item) => item.trim().replace(/(^(?:"|')?)|((?:"|')?$)/g, ''));
}

program
  .description(module.exports.description)
  .usage('[options] ')
  .option('-v, --no-vars', 'Passing this flag will skip using the postcss-css-variables plugin.')
  .option('-e, --no-extend', 'Passing this flag will skip using the postcss-inherit plugin.')
  .option('-n, --namespace ', 'Namespace to use as a prefix for classes.', '')
  .option('-u, --urlprefix ', 'String to prepend to urls.', '')
  .option('-b, --browsers ', 'Browser string to pass to autoprefixer.', 'last 2 version')
  .option('-a, --no-autoprefixer', 'Passing this flag will disable autoprefixer.')
  .option('-d, --debug',
github mwolson / jest-webpack-alias / lib / webpackInfo.js View on Github external
function read(pmodule, dir) {
  var packageJson = pkginfo.read(pmodule, dir);
  var pkgJsonFile = packageJson.dir; // misleading name from pkginfo library
  var pkgJsonDir = path.dirname(pkgJsonFile);

  var profile = _.get(packageJson['package'], 'jest-webpack-alias.profile');
  var configFile = _.get(packageJson['package'], 'jest-webpack-alias.configFile', 'webpack.config.js');
  var webpackFile = path.join(pkgJsonDir, configFile);
  var webpackSettings = extractES6DefaultExportsObject(require(webpackFile));

  if (profile) {
    if (!_.isArray(webpackSettings)) {
      throw new Error(genProfileError(profile, webpackFile + ' does not export an array'));
    }
    webpackSettings = _.find(webpackSettings, ['name', profile]);
    if (!webpackSettings) {
      throw new Error(genProfileError(profile, webpackFile + ' does not contain this profile'));
    }
github angrykoala / yamp / app / xejs_loader.ts View on Github external
import Xejs from 'xejs';
import pkginfo from 'pkginfo';

pkginfo(module, "version");
const version = module.exports.version;

function getDate(): string {
    const date = new Date();
    const day = date.getDate();
    const month = date.getMonth() + 1;
    const year = date.getFullYear();
    return day + "/" + month + "/" + year;
}

export default class XejsLoader {
    public loadFile(file: string): Promise {
        const options = this.generateOptions();
        const loader = new Xejs(options);
        return loader.render(file);
    }

pkginfo

An easy way to expose properties on a module from a package.json

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular pkginfo functions