Skip to content

Instantly share code, notes, and snippets.

@bfollington
Created November 17, 2019 04:25
Show Gist options
  • Save bfollington/6a5b0cd0638ca11b461465dc2e319499 to your computer and use it in GitHub Desktop.
Save bfollington/6a5b0cd0638ca11b461465dc2e319499 to your computer and use it in GitHub Desktop.
Write package.json version to ProjectSettings.asset
const fs = require('fs')
const package = require('./package.json')
const projectSettingsPath = 'ProjectSettings/ProjectSettings.asset'
const re = /bundleVersion:\s(\d\.\d\.\d)$/gm
const fileStr = fs.readFileSync(projectSettingsPath, 'utf8')
const updated = fileStr.replace(re, `bundleVersion: ${package.version}`)
console.log(`bundleVersion: ${package.version}`)
fs.writeFileSync(projectSettingsPath, updated, { encoding: 'utf8' })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment