Skip to content

🎥 Make videos programmatically with React

add hashbang to files directly instead of add-bin

yuta0801df3c3921bf8f
diff --git a/packages/cli/add-bin.js b/packages/cli/add-bin.js
deleted file mode 100644
index 36adbb511f..0000000000
--- a/packages/cli/add-bin.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-
-const paths = [path.join(__dirname, 'dist', 'index.js')];
-
-const prefix = '#! /usr/bin/env node\n';
-
-paths.forEach((p) => {
- const contents = fs.readFileSync(p, 'utf8');
-
- if (!contents.startsWith(prefix)) {
- fs.writeFileSync(p, prefix + contents);
- }
-});
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 09a3dcf6e6..e57da70e1d 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -9,7 +9,7 @@
"module": "true",
"scripts": {
"test": "eslint src --ext ts,tsx",
- "build": "tsc -d && node add-bin.js",
+ "build": "tsc -d",
"dev": "ts-node src/preview.ts x ../example/src/index.tsx"
},
"files": [
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index 6244574e40..645ff08fe7 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -1,3 +1,5 @@
+#! /usr/bin/env node
+
import xns from 'xns';
import {checkNodeVersion} from './check-version';
import {previewCommand} from './preview';
diff --git a/packages/create-video/add-bin.js b/packages/create-video/add-bin.js
deleted file mode 100644
index 6d84853b09..0000000000
--- a/packages/create-video/add-bin.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const fs = require('fs');
-const path = require('path');
-
-const paths = [path.join(__dirname, 'dist', 'init.js')];
-
-const prefix = '#! /usr/bin/env node\n';
-
-paths.forEach((p) => {
- const contents = fs.readFileSync(p, 'utf8');
-
- if (!contents.startsWith(prefix)) {
- fs.writeFileSync(p, prefix + contents);
- }
-});
diff --git a/packages/create-video/package.json b/packages/create-video/package.json
index ea29322cdb..18212c174b 100644
--- a/packages/create-video/package.json
+++ b/packages/create-video/package.json
@@ -11,7 +11,7 @@
"_template"
],
"scripts": {
- "build": "tsc -d && node add-bin.js"
+ "build": "tsc -d"
},
"author": "",
"license": "SEE LICENSE IN LICENSE.md",
diff --git a/packages/create-video/src/init.ts b/packages/create-video/src/init.ts
index 9c725fd242..49a560a6b8 100644
--- a/packages/create-video/src/init.ts
+++ b/packages/create-video/src/init.ts
@@ -1,3 +1,5 @@
+#! /usr/bin/env node
+
import chalk from 'chalk';
import execa from 'execa';
import fs from 'fs';