Sha256: 6c248f9993f0fa0d4b2515d9bf7ff3999e14c8860b0036b23256e01c3c2ea7e0
Contents?: true
Size: 1.84 KB
Versions: 7
Compression:
Stored size: 1.84 KB
Contents
require 'json' module Shipit class DeploySpec module NpmDiscovery def discover_dependencies_steps discover_package_json || super end def discover_package_json npm_install if yarn? || npm? end def npm_install [js_command('install --no-progress')] end def discover_review_checklist discover_yarn_checklist || discover_npm_checklist || super end def discover_yarn_checklist [%(<strong>Don't forget version and tag before publishing!</strong> You can do this with:<br/> yarn version --new-version <strong><major|minor|patch></strong> && git push --tags</pre>)] if yarn? end def discover_npm_checklist [%(<strong>Don't forget version and tag before publishing!</strong> You can do this with:<br/> npm version <strong><major|minor|patch></strong> && git push --tags</pre>)] if npm? end def npm? public? end def public? file = package_json return false unless file.exist? JSON.parse(file.read)['private'].blank? end def package_json file('package.json') end def yarn? yarn_lock.exist? && public? end def yarn_lock file('./yarn.lock') end def discover_npm_package publish_npm_package if yarn? || npm? end def discover_deploy_steps discover_npm_package || super end def publish_npm_package check_tags = 'assert-npm-version-tag' # `yarn publish` requires user input, so always use npm. publish = 'npm publish' [check_tags, publish] end def js_command(command_args) runner = if yarn? 'yarn' else 'npm' end "#{runner} #{command_args}" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems