From dfcd2814aeab5618cfcd2204b5adde8de79a3716 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Mon, 28 Jun 2021 12:37:10 +0200 Subject: [PATCH] Build: Implemented theatre.update-versions script --- theatre/core/package.json | 4 ++-- theatre/devEnv/updateVersions.ts | 19 +++++++++++++++++++ theatre/package.json | 5 ++++- theatre/studio/package.json | 4 ++-- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 theatre/devEnv/updateVersions.ts diff --git a/theatre/core/package.json b/theatre/core/package.json index 4f49473..fb1a609 100644 --- a/theatre/core/package.json +++ b/theatre/core/package.json @@ -1,6 +1,6 @@ { "name": "@theatre/core", - "version": "0.4.0-dev.1", + "version": "0.4.0-dev.2", "license": "Apache-2.0", "description": "Motion design editor for the web", "repository": { @@ -42,4 +42,4 @@ "dependencies": { "@theatre/dataverse": "workspace:*" } -} +} \ No newline at end of file diff --git a/theatre/devEnv/updateVersions.ts b/theatre/devEnv/updateVersions.ts new file mode 100644 index 0000000..96e2f12 --- /dev/null +++ b/theatre/devEnv/updateVersions.ts @@ -0,0 +1,19 @@ +import {writeFileSync} from 'fs' +import path from 'path' + +const theatreDir = path.join(__dirname, '..') +const version = require('../package.json').version + +for (const which of ['core', 'studio']) { + const original = require('../' + which + '/package.json') + if (original.version !== version) { + console.log(`Setting version of @theatre/${which} to ${version}`) + + const newJson = {...original} + newJson.version = version + writeFileSync( + path.join(theatreDir, `./${which}/package.json`), + JSON.stringify(newJson, undefined, 2), + ) + } +} diff --git a/theatre/package.json b/theatre/package.json index 43452aa..ea5d4dd 100644 --- a/theatre/package.json +++ b/theatre/package.json @@ -1,4 +1,6 @@ { + "private": true, + "version": "0.4.0-dev.2", "workspaces": [ "./shared", "./core", @@ -11,7 +13,8 @@ "build:dts": "run-s typecheck build:dts:bundle", "build:dts:bundle": "rollup -c devEnv/declarations-bundler/rollup.config.js", "build": "run-p build:dts build:js", - "prepare": "run-s build" + "prepare": "run-s update-versions build", + "update-versions": "node -r esbuild-register devEnv/updateVersions.ts" }, "devDependencies": { "@babel/cli": "^7.14.3", diff --git a/theatre/studio/package.json b/theatre/studio/package.json index 39e7804..c9dbf53 100644 --- a/theatre/studio/package.json +++ b/theatre/studio/package.json @@ -1,6 +1,6 @@ { "name": "@theatre/studio", - "version": "0.4.0-dev.1", + "version": "0.4.0-dev.2", "license": "AGPL-3.0-only", "description": "Motion design editor for the web", "repository": { @@ -45,4 +45,4 @@ "peerDependencies": { "@theatre/core": "*" } -} +} \ No newline at end of file