How to use the @instructure/pkg-utils.getPackageJSON 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 / publish-package.js View on Github external
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
const { getPackageJSON } = require('@instructure/pkg-utils')

const { publishPackage } = require('./utils/release')
const { error } = require('./utils/logger')
const { getConfig } = require('./utils/get-config')

try {
  const pkgJSON = getPackageJSON()
  // optional version argument
  // ui-scripts --publish-package 5.12.2
  publishPackage(pkgJSON.name, pkgJSON.version, process.argv[3] || pkgJSON.version, getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}
github instructure / instructure-ui / packages / ui-scripts / lib / publish.js View on Github external
createNPMRCFile
} = require('./utils/npm')
const {
  checkIfGitTagExists,
  checkIfCommitIsReviewed,
  isReleaseCommit
} = require('./utils/git')
const { postGerritReview } = require('./utils/gerrit')
const {
  setupGit,
  checkWorkingDirectory
} = require('./utils/git')
const { getConfig } = require('./utils/config')

try {
  const pkgJSON = getPackageJSON()
  // optional version argument:
  // e.g. ui-scripts --publish alpha
  publish(pkgJSON.name, pkgJSON.version, process.argv[3], getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

async function publish (packageName, currentVersion, preidAndTag, config = {}) {
  setupGit()
  createNPMRCFile(config)
  checkWorkingDirectory()

  let versionToRelease, tag

  if (isReleaseCommit(currentVersion)) {
github instructure / instructure-ui / packages / ui-scripts / lib / tag.js View on Github external
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
const { getPackageJSON, getPackages } = require('@instructure/pkg-utils')
const { runCommandAsync, error, info } = require('@instructure/command-utils')

const { createNPMRCFile } = require('./utils/npm')
const { getConfig } = require('./utils/config')

try {
  // optional fix version argument:
  // e.g. ui-scripts --tag add 5.11.0 rc
  // e.g. ui-scripts --tag rm 5.11.0 latest
  const pkgJSON = getPackageJSON()
  const command = process.argv[3] || 'add'
  const versionToTag = process.argv[4] || pkgJSON.version
  const tag = process.argv[5] || 'latest'

  distTag(command, versionToTag, tag, getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

async function distTag (command, versionToTag, tag, config) {
  createNPMRCFile(config)

  info(`📦  Version to tag as ${tag}: ${versionToTag}`)
  const reply = await confirm('Continue? [y/n]\n')
  if (!['Y', 'y'].includes(reply.trim())) {
github instructure / instructure-ui / packages / ui-scripts / lib / bump.js View on Github external
*/
const { getPackageJSON } = require('@instructure/pkg-utils')
const { error, info } = require('@instructure/command-utils')

const { getConfig } = require('./utils/config')
const {
  commitVersionBump,
  setupGit,
  checkWorkingDirectory
} = require('./utils/git')
const {
  bumpPackages
} = require('./utils/npm')

try {
  const pkgJSON = getPackageJSON()
  // optional release type/version argument: major, minor, patch, [version]
  // e.g. ui-scripts --bump major
  bump(pkgJSON.name, pkgJSON.version, process.argv[3], getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

async function bump (packageName, currentVersion, requestedVersion, config = {}) {
  setupGit()
  checkWorkingDirectory()

  let releaseVersion

  try {
    releaseVersion = await bumpPackages(packageName, requestedVersion)
github instructure / instructure-ui / packages / ui-scripts / lib / deprecate.js View on Github external
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
const { getPackageJSON, getPackages } = require('@instructure/pkg-utils')
const { runCommandAsync, error, info, confirm } = require('@instructure/commmand-utils')

const { createNPMRCFile } = require('./utils/npm')
const { getConfig } = require('./utils/config')

try {
  // optional version and fix version arguments:
  // e.g. ui-scripts --deprecate 5.11.0 5.11.1
  const pkgJSON = getPackageJSON()
  const versionToDeprecate = process.argv[3] || pkgJSON.version
  const fixVersion = process.argv[4]

  deprecate(versionToDeprecate, fixVersion, getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

async function deprecate (versionToDeprecate, fixVersion, config) {
  const message = fixVersion ? `A critical bug was fixed in ${fixVersion}` : ''
  createNPMRCFile(config)

  info(`📦  Version to deprecate: ${versionToDeprecate}`)
  const reply = await confirm('Continue? [y/n]\n')
  if (!['Y', 'y'].includes(reply.trim())) {
github instructure / instructure-ui / packages / ui-scripts / lib / utils / config.js View on Github external
exports.getConfig = function getConfig (pkgJSON) {
  pkgJSON = pkgJSON || getPackageJSON() // eslint-disable-line no-param-reassign
  return (pkgJSON.config && pkgJSON.config['ui-scripts']) ? pkgJSON.config['ui-scripts'] : {}
}
github instructure / instructure-ui / packages / ui-scripts / lib / deploy-docs.js View on Github external
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
const { getPackageJSON } = require('@instructure/pkg-utils')
const { error, info } = require('@instructure/command-utils')

const { publishGithubPages } = require('./utils/gh-pages')
const { getConfig } = require('./utils/config')
const { setupGit, isReleaseCommit, checkWorkingDirectory } = require('./utils/git')

try {
  const pkgJSON = getPackageJSON()
  deployDocs(pkgJSON.name, pkgJSON.version, getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

function deployDocs (packageName, currentVersion, config = {}) {
  setupGit()

  if (isReleaseCommit(currentVersion)) {
    checkWorkingDirectory()
    info(`📖   Deploying documentation for ${currentVersion} of ${packageName}...`)
    try {
      publishGithubPages(config)
    } catch (err) {
      error(err)
github instructure / instructure-ui / packages / ui-scripts / lib / utils / release.js View on Github external
const getReleaseVersion = async function getReleaseVersion (currentVersion) {
  let releaseVersion = currentVersion

  if (await isReleaseCommit(releaseVersion)) {
    await checkIfGitTagExists(releaseVersion)
    await checkIfCommitIsReviewed()
  } else {
    const index = await getCommitIndex()
    await runCommandAsync('standard-version')
    const nextVersion = getPackageJSON().version
    releaseVersion = `${nextVersion}-rc.${index}`
  }

  info(releaseVersion)
  return releaseVersion
}
exports.getReleaseVersion = getReleaseVersion
github instructure / instructure-ui / packages / ui-scripts / lib / post-publish.js View on Github external
const {
 hasJiraConfig,
 getJiraVersion,
 updateJiraIssues
} = require('./utils/jira')
const {
  isReleaseCommit,
  createGitTagForRelease,
  setupGit,
  checkWorkingDirectory,
  getIssuesInCommit,
  getIssuesInRelease
} = require('./utils/git')

try {
  const pkgJSON = getPackageJSON()
  postPublish(pkgJSON.name, pkgJSON.version, getConfig(pkgJSON))
} catch (err) {
  error(err)
  process.exit(1)
}

async function postPublish (packageName, releaseVersion, config = {}) {
  setupGit()

  const jiraProjectKey = `${config.jira_project_key}`

  info(`📦  Running post-publish steps for ${releaseVersion} of ${packageName}...`)

  let jiraVersion = { name: `${packageName} v${releaseVersion}` }
  let issueKeys = []

@instructure/pkg-utils

Utilities for managing node packages in a monorepo.

MIT
Latest version published 1 month ago

Package Health Score

82 / 100
Full package analysis

Similar packages