motionlab 1.0.0

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.
Files changed (2) hide show
  1. package/bin/cli.js +37 -0
  2. package/package.json +14 -0
package/bin/cli.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const INPUT_DIR = 'components';
7
+ const OUTPUT_DIR = 'components/motionlab';
8
+
9
+ const [,, command, target] = process.argv;
10
+
11
+ if (command !== 'add') {
12
+ console.log('Usage: npx motionlab add all');
13
+ process.exit(1);
14
+ }
15
+
16
+ if (target === 'all') {
17
+ addAll();
18
+ } else {
19
+ console.log(`Unknown target: "${target}". Use 'all' to add all components.`);
20
+ process.exit(1);
21
+ }
22
+
23
+ function addAll() {
24
+ const srcDir = path.join(__dirname, '..', INPUT_DIR);
25
+ const destDir = path.join(process.cwd(), 'src', OUTPUT_DIR);
26
+
27
+ fs.mkdirSync(destDir, { recursive: true });
28
+
29
+ const files = fs.readdirSync(srcDir).filter(f => f.endsWith('.tsx'));
30
+
31
+ for (const file of files) {
32
+ fs.copyFileSync(path.join(srcDir, file), path.join(destDir, file));
33
+ console.log(` + ${file}`);
34
+ }
35
+
36
+ console.log(`\nDone! ${files.length} components added to components/${OUTPUT_DIR}/`);
37
+ }
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "motionlab",
3
+ "version": "1.0.0",
4
+ "description": "CLI to add Motionlab Remotion animation components to your project",
5
+ "bin": {
6
+ "motionlab": "./bin/cli.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "minimalist/"
11
+ ],
12
+ "keywords": ["remotion", "animation", "components", "cli"],
13
+ "license": "MIT"
14
+ }