Skip to content

🎥 Make videos programmatically with React

make a publish script

JonnyBurger014e250608c0
diff --git a/package.json b/package.json
index 006dba5884..d6c624e625 100644
--- a/package.json
+++ b/package.json
@@ -30,8 +30,7 @@
"watchserverless": "turbo watch make --experimental-write-cache --filter='@remotion/lambda' --filter='@remotion/serverless' --filter='@remotion/streaming'",
"makethree": "turbo run make --filter='@remotion/three'",
"watchthree": "turbo watch make --experimental-write-cache --filter='@remotion/three'",
- "release-alpha": "pnpm recursive publish --tag=alpha --no-git-checks && pnpm recursive run --sequential publishprivate",
- "release": "pnpm recursive publish && pnpm recursive run --sequential publishprivate && git push --tags && git push",
+ "release": "pnpm recursive publish && turbo run publishprivate --concurrency=1 && git push --tags && git push",
"cleantypes": "rm -rf packages/**/tsconfig.tsbuildinfo && rm -f packages/tsconfig.tsbuildinfo",
"clean": "turbo run clean && rm -rf packages/**/dist && rm -rf .cache && rm -rf packages/**/tsconfig.tsbuildinfo && rm -f packages/tsconfig.tsbuildinfo && rm -rf packages/**/.turbo && rm -rf .turbo",
"cleanall": "turbo run clean && rm -rf packages/**/dist && rm -rf packages/**/node_modules && rm -rf node_modules && rm -rf .cache && rm -rf packages/**/tsconfig.tsbuildinfo && rm -f packages/tsconfig.tsbuildinfo && rm -rf packages/**/.turbo && rm -rf .turbo"
diff --git a/publish.ts b/publish.ts
new file mode 100644
index 0000000000..62236597ef
--- /dev/null
+++ b/publish.ts
@@ -0,0 +1,29 @@
+import {$} from 'bun';
+import {existsSync, lstatSync, readdirSync, readFileSync} from 'node:fs';
+import {FEATURED_TEMPLATES} from './packages/create-video/src/templates';
+
+const dirs = readdirSync('packages')
+ .filter((dir) =>
+ lstatSync(path.join(process.cwd(), 'packages', dir)).isDirectory(),
+ )
+ .filter((dir) =>
+ existsSync(path.join(process.cwd(), 'packages', dir, 'package.json')),
+ );
+
+for (const dir of dirs) {
+ const localTemplates = FEATURED_TEMPLATES.map(
+ (t) => t.templateInMonorepo,
+ ).filter(Boolean) as string[];
+ if (localTemplates.includes(dir)) {
+ continue;
+ }
+
+ const packagePath = path.join(process.cwd(), 'packages', dir);
+ const packageJsonPath = path.join(packagePath, 'package.json');
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
+ if (packageJson.private) {
+ continue;
+ }
+
+ await $`bun publish`.cwd(packagePath);
+}
diff --git a/turbo.json b/turbo.json
index 921bd68a05..adbdc32f98 100644
--- a/turbo.json
+++ b/turbo.json
@@ -7,6 +7,10 @@
"dependsOn": [],
"outputLogs": "new-only"
},
+ "publishprivate": {
+ "dependsOn": [],
+ "outputLogs": "new-only"
+ },
"clean": {},
"testssr": {
"dependsOn": ["^make", "@remotion/example#bundle"]