@revideo/cli 0.5.11-beta.1106 → 0.10.1-alpha.1114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ const program = new commander_1.Command();
9
9
  program
10
10
  .name('revideo')
11
11
  .description('CLI to interact with the revideo service')
12
- .version('0.5.10');
12
+ .version('0.10.1');
13
13
  program
14
14
  .command('serve')
15
15
  .description('Exposes a render endpoint to render videos from a project file. Automatically rebuilds the project when the project file changes. Use for local development.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revideo/cli",
3
- "version": "0.5.11-beta.1106+9c3bdcff",
3
+ "version": "0.10.1-alpha.1114+a2107462",
4
4
  "description": "A CLI for revideo",
5
5
  "main": "dist/index.js",
6
6
  "author": "revideo",
@@ -25,14 +25,14 @@
25
25
  "typescript": "^5.4.3"
26
26
  },
27
27
  "dependencies": {
28
- "@revideo/renderer": "^0.5.11-beta.1106+9c3bdcff",
29
- "@revideo/telemetry": "^0.5.11-beta.1106+9c3bdcff",
30
- "@revideo/vite-plugin": "^0.5.11-beta.1106+9c3bdcff",
28
+ "@revideo/renderer": "^0.10.1-alpha.1114+a2107462",
29
+ "@revideo/telemetry": "^0.10.1-alpha.1114+a2107462",
30
+ "@revideo/vite-plugin": "^0.10.1-alpha.1114+a2107462",
31
31
  "chokidar": "^3.5.3",
32
32
  "commander": "^12.0.0",
33
33
  "cors": "^2.8.5",
34
34
  "express": "^4.19.2",
35
35
  "uuid": "^9.0.1"
36
36
  },
37
- "gitHead": "9c3bdcff4698b09821a624dfa2b3efdf39599dc6"
37
+ "gitHead": "a2107462c7d925ec577eba40a988db00268c2463"
38
38
  }
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.launchEditor = launchEditor;
7
- const vite_plugin_1 = __importDefault(require("@revideo/vite-plugin"));
8
- const vite_1 = require("vite");
9
- async function launchEditor(projectPath, port) {
10
- const server = await (0, vite_1.createServer)({
11
- configFile: false,
12
- plugins: [
13
- (0, vite_plugin_1.default)({
14
- project: projectPath,
15
- buildForEditor: false,
16
- }),
17
- ],
18
- build: {
19
- minify: false,
20
- rollupOptions: {
21
- output: {
22
- entryFileNames: '[name].js',
23
- },
24
- },
25
- },
26
- server: {
27
- port: parseInt(port),
28
- },
29
- });
30
- return server.listen();
31
- }
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.player = exports.createHotReloader = exports.buildProject = void 0;
7
- const vite_plugin_1 = __importDefault(require("@revideo/vite-plugin"));
8
- const chokidar_1 = require("chokidar");
9
- const fs_1 = require("fs");
10
- const vite_1 = require("vite");
11
- const YELLOW_DOT = '\u001b[33m•\u001b[0m';
12
- const GREEN_CHECK = '\u001b[32m✔\u001b[0m';
13
- const RED_CROSS = '\u001b[31m✘\u001b[0m';
14
- const fileNotFoundMessage = (filePath) => `${YELLOW_DOT} File ${filePath} not found. Building project...`;
15
- const fileNotFoundAfterBuildingMessage = (filePath, padding) => `\r${RED_CROSS} File ${filePath} still not found after building project...`.padEnd(padding, ' ') + '\n';
16
- const fileChangedMessage = (filePath) => `${YELLOW_DOT} File ${filePath} has changed. Rebuilding...`;
17
- const successMessage = (time, padding) => `\r${GREEN_CHECK} Project built successfully. ${time}ms`.padEnd(padding, ' ') + '\n';
18
- async function buildProject() {
19
- try {
20
- await (0, vite_1.build)({
21
- configFile: false,
22
- plugins: [(0, vite_plugin_1.default)({ project: process.env.PROJECT_FILE })],
23
- build: {
24
- outDir: 'dist',
25
- rollupOptions: {
26
- output: {
27
- entryFileNames: '[name].js',
28
- chunkFileNames: '[name].js',
29
- assetFileNames: '[name].[ext]',
30
- },
31
- },
32
- },
33
- });
34
- }
35
- catch (error) {
36
- console.error('Error building project:', error);
37
- throw error;
38
- }
39
- }
40
- exports.buildProject = buildProject;
41
- /**
42
- * Watches the given directory for changes and rebuilds the project on each change.
43
- * @param dir - Directory to watch for changes.
44
- */
45
- async function createHotReloader(dir) {
46
- const watcher = (0, chokidar_1.watch)(dir, {
47
- ignored: ['**/*.meta'],
48
- });
49
- watcher.on('change', async (path) => {
50
- const rebuildingMessage = fileChangedMessage(path);
51
- process.stdout.write(rebuildingMessage);
52
- const start = Date.now();
53
- try {
54
- await buildProject();
55
- process.stdout.write(successMessage(Date.now() - start, rebuildingMessage.length + 1));
56
- }
57
- catch (e) {
58
- // TODO: Add more detailed error message
59
- console.error('Error building project. Try to run `npm run build` manually and check for errors.');
60
- }
61
- });
62
- }
63
- exports.createHotReloader = createHotReloader;
64
- async function player(req, res) {
65
- let path = `./dist/${req.params[0]}`;
66
- if (req.params[0] === 'project.js') {
67
- const playerFileName = (process.env.PROJECT_FILE ?? '')
68
- .split('/')
69
- .pop()
70
- ?.replace('.ts', '.js');
71
- path = `./dist/${playerFileName}`;
72
- }
73
- let buildTime = undefined;
74
- let error = false;
75
- // Check if the file exists and build the project if it doesn't.
76
- await fs_1.promises.access(path).catch(async () => {
77
- buildTime = Date.now();
78
- process.stdout.write(fileNotFoundMessage(path));
79
- await buildProject().catch(() => {
80
- res.status(500).send('Error building project');
81
- });
82
- });
83
- // If the file still doesn't exist, send an error response.
84
- await fs_1.promises.access(path).catch(() => {
85
- process.stdout.write(fileNotFoundAfterBuildingMessage(path, fileNotFoundMessage(path).length + 1));
86
- res.status(404).send(`File ${path} not found`);
87
- error = true;
88
- });
89
- if (error) {
90
- return;
91
- }
92
- // If we built the project, update the log message.
93
- if (buildTime) {
94
- process.stdout.write(successMessage(Date.now() - buildTime, fileNotFoundMessage(path).length + 1));
95
- }
96
- return res.sendFile(path, { root: './' });
97
- }
98
- exports.player = player;