Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/bs / src / scripts / distPackageDeps.ts
Size: Mime:
import { resolveToRoot } from '../resolveToRoot'
import { read, write } from 'flipfile'
import { config } from '@skava/di'

const pkg = config.get('package')

function create(requirePath: string) {
  const resolvedPath = resolveToRoot(requirePath)
  write(resolvedPath, JSON.stringify(pkg, undefined, 2))
}
function tryRequireOrCreate(requirePath: string) {
  const resolvedPath = resolveToRoot(requirePath)

  try {
    return require.resolve(resolvedPath)
  } catch (requireException) {
    create(requirePath)
    return require.resolve(resolvedPath)
  }
}

const distPkgPath = tryRequireOrCreate(process.env.OUTPUT_PACKAGE_JSON_PATH)
const distPkg = require(distPkgPath)

console.log({ distPkgPath, distPkg })
// distPkg.env.FEATURE = Boolean(process.env.FEATURE)
// distPkg.env.QA = Boolean(process.env.QA)
// distPkg.env.PREPROD = Boolean(process.env.PREPROD)
distPkg.dependencies = pkg.dependencies

write(distPkgPath, JSON.stringify(distPkg, undefined, 2))