diff --git a/theatre/core/package.json b/theatre/core/package.json index fb1a609..0e36c8b 100644 --- a/theatre/core/package.json +++ b/theatre/core/package.json @@ -36,10 +36,10 @@ "dist/index.d.ts" ], "scripts": { - "prepack": "cd .. && yarn run prepare" + "prepublish": "cd .. && yarn run ensure-publishing" }, "sideEffects": true, "dependencies": { "@theatre/dataverse": "workspace:*" } -} \ No newline at end of file +} diff --git a/theatre/devEnv/ensurePublishing.js b/theatre/devEnv/ensurePublishing.js new file mode 100644 index 0000000..531bd14 --- /dev/null +++ b/theatre/devEnv/ensurePublishing.js @@ -0,0 +1,5 @@ +if (process.env.THEATRE_IS_PUBLISHING !== 'true') { + throw Error( + `This script may run only when the "prepare" command in root/theatre is running.`, + ) +} diff --git a/theatre/package.json b/theatre/package.json index ea5d4dd..de8f7bd 100644 --- a/theatre/package.json +++ b/theatre/package.json @@ -13,7 +13,11 @@ "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 update-versions build", + "deploy": "cross-env-shell THEATRE_IS_PUBLISHING=true \"yarn run _deploy:steps\"", + "_deploy:steps": "run-s ensure-publishing update-versions build _deploy:core _deploy:studio", + "_deploy:core": "yarn workspace @theatre/core npm publish --access public", + "_deploy:studio": "yarn workspace @theatre/studio npm publish --access public", + "ensure-publishing": "node ./devEnv/ensurePublishing.js", "update-versions": "node -r esbuild-register devEnv/updateVersions.ts" }, "devDependencies": { diff --git a/theatre/studio/package.json b/theatre/studio/package.json index c9dbf53..e779379 100644 --- a/theatre/studio/package.json +++ b/theatre/studio/package.json @@ -36,7 +36,7 @@ "dist/index.d.ts" ], "scripts": { - "prepack": "cd .. && yarn run prepare" + "prepublish": "cd .. && yarn run ensure-publishing" }, "sideEffects": true, "dependencies": { @@ -45,4 +45,4 @@ "peerDependencies": { "@theatre/core": "*" } -} \ No newline at end of file +}