How to use the @instructure/pkg-utils.getPackage function in @instructure/pkg-utils

To help you get started, we’ve selected a few @instructure/pkg-utils 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 instructure / instructure-ui / packages / ui-scripts / lib / utils / npm.js View on Github external
async function syncRootPackageVersion (useProjectVersion) {
  const project = new Project(process.cwd())
  const rootPkg = getPackage()

  let projectVersion

  if (project.isIndependent() || useProjectVersion) {
    projectVersion = project.version
  } else {
    // unfortunately lerna doesn't update lerna.json for canary releases,
    // so we have to do this:
    const pkgs = getChangedPackages()
    projectVersion = pkgs[0].get('version')
  }

  if (projectVersion !== rootPkg.get('version')) {
    rootPkg.set('version', projectVersion)
    await rootPkg.serialize()
  }
github instructure / instructure-ui / packages / babel-plugin-themeable-styles / lib / generateScopedName.js View on Github external
module.exports = function generateScopedName (getComponentId, config, name, filepath, css) {
  const componentId = getComponentId()
  const context = {
    env: ENV,
    resourcePath: filepath,
    context: process.cwd()
  }

  let scopedNamePattern

  if (config && typeof config.generateScopedName === 'function') {
    scopedNamePattern = config.generateScopedName(context, name, filepath, css, componentId)
  } else if (config && typeof config.generateScopedName === 'string') {
    scopedNamePattern = config.generateScopedName
  } else if (UNMANGLED_CLASS_NAMES) {
    const pkg = getPackage({ cwd: path.dirname(filepath) })
    const pkgName = pkg.name.split('/').pop()
    scopedNamePattern = `${pkgName}__[folder]--[local]`
  } else {
    scopedNamePattern = `${componentId}_${loaderUtils.getHashDigest(name, 'md5', 'base52', 4)}`
  }

  scopedNamePattern = scopedNamePattern.replace(/\[local\]/gi, name)

  return loaderUtils.interpolateName(context, scopedNamePattern, { content: css })
}
github instructure / instructure-ui / packages / ui-scripts / lib / install-react.js View on Github external
async function installReact () {
  const pkgInfo = JSON.parse(
    runCommandSync('yarn', ['info', 'react', '--json'], [], { stdio: 'pipe' }).stdout
  ).data

  const latest = pkgInfo['dist-tags'].latest

  let version = `${argv[argv.indexOf('--install-react') + 1]}`.trim()
  version = semver.coerce(version) || latest

  info(`Version: ${version}`)

  let originalResolutions, pkg

  if ([15, 16].includes(semver.major(version))) {
    pkg = getPackage()
    originalResolutions = {...pkg.get('resolutions')}

    pkg.set('resolutions', {
      ...(originalResolutions || {}),
      'react': `^${version}`,
      'react-dom': `^${version}`
    })

    info(`Updating resolutions for React to ${version}...`)

    await pkg.serialize()
  }

  try {
    info(`Installing React...`)
    runCommandSync('yarn', ['--pure-lockfile', '--force'])

@instructure/pkg-utils

Utilities for managing node packages in a monorepo.

MIT
Latest version published 1 day ago

Package Health Score

84 / 100
Full package analysis

Similar packages