create-effect-motion 0.5.0 → 0.6.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.
- package/README.md +5 -5
- package/dist/bin.js +0 -0
- package/dist/create.js +17 -17
- package/package.json +44 -44
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Scaffold a new [effect-motion](https://github.com/julia-script/effect-motion) project:
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
|
-
|
|
7
|
-
# or: npm create effect-motion /
|
|
6
|
+
bun create effect-motion
|
|
7
|
+
# or: npm create effect-motion / pnpm create effect-motion / yarn create effect-motion
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
The prompts ask for a target directory, a package manager, and whether to set up [Biome](https://biomejs.dev) for linting/formatting. The generated project:
|
|
@@ -25,8 +25,8 @@ my-motion-project/
|
|
|
25
25
|
Answering `.` scaffolds into the current directory and names the project after it. A `git init` runs automatically unless the directory already sits inside a repository. Then:
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
bun run studio # preview scenes with hot reload
|
|
29
|
+
bun run render # render targets from motion.config.ts to MP4
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Flags
|
|
@@ -34,7 +34,7 @@ pnpm render # render targets from motion.config.ts to MP4
|
|
|
34
34
|
Every prompt has a flag twin, so the scaffolder runs non-interactively in scripts and CI:
|
|
35
35
|
|
|
36
36
|
```sh
|
|
37
|
-
create-effect-motion my-app --pm
|
|
37
|
+
create-effect-motion my-app --pm bun --no-biome --no-install
|
|
38
38
|
create-effect-motion --yes # accept every default (-y)
|
|
39
39
|
```
|
|
40
40
|
|
package/dist/bin.js
CHANGED
|
File without changes
|
package/dist/create.js
CHANGED
|
@@ -8,24 +8,24 @@ import { MotionCliError, renderForTerminal } from "./MotionCliError.js";
|
|
|
8
8
|
import { VERSION } from "./pins.js";
|
|
9
9
|
import { ensureEmptyDir, resolveProjectDir, scaffoldProject, } from "./scaffold.js";
|
|
10
10
|
const DEFAULT_DIRECTORY = "my-motion-project";
|
|
11
|
-
const PACKAGE_MANAGERS = ["
|
|
12
|
-
/** The manager that invoked us (`
|
|
11
|
+
const PACKAGE_MANAGERS = ["bun", "pnpm", "npm", "yarn"];
|
|
12
|
+
/** The manager that invoked us (`bun create …` etc.), if detectable. */
|
|
13
13
|
const detectPackageManager = () => {
|
|
14
14
|
const agent = process.env.npm_config_user_agent ?? "";
|
|
15
15
|
return PACKAGE_MANAGERS.find((pm) => agent.startsWith(pm));
|
|
16
16
|
};
|
|
17
17
|
const flags = {
|
|
18
|
-
directory: Argument.
|
|
19
|
-
pm: Flag.optional(Flag.
|
|
20
|
-
biome: Flag.
|
|
21
|
-
noBiome: Flag.
|
|
22
|
-
noInstall: Flag.
|
|
23
|
-
yes: Flag.
|
|
18
|
+
directory: Argument.String("directory").pipe(Argument.withDescription('Target directory ("." scaffolds into the current directory)'), Argument.optional),
|
|
19
|
+
pm: Flag.optional(Flag.Literals("pm", PACKAGE_MANAGERS).pipe(Flag.withDescription("Package manager (skips the prompt)"))),
|
|
20
|
+
biome: Flag.Boolean("biome").pipe(Flag.withDefault(false), Flag.withDescription("Set up Biome for linting/formatting (skips the prompt)")),
|
|
21
|
+
noBiome: Flag.Boolean("no-biome").pipe(Flag.withDefault(false), Flag.withDescription("Skip the Biome setup (skips the prompt)")),
|
|
22
|
+
noInstall: Flag.Boolean("no-install").pipe(Flag.withDefault(false), Flag.withDescription("Skip dependency installation")),
|
|
23
|
+
yes: Flag.Boolean("yes").pipe(Flag.withDefault(false), Flag.withAlias("y"), Flag.withDescription("Accept the default answer for every prompt not answered by a flag")),
|
|
24
24
|
};
|
|
25
|
-
const promptDirectory = Prompt.
|
|
25
|
+
const promptDirectory = Prompt.run(Prompt.String({
|
|
26
26
|
message: 'Where should the project be created? ("." for the current directory)',
|
|
27
27
|
default: DEFAULT_DIRECTORY,
|
|
28
|
-
});
|
|
28
|
+
}));
|
|
29
29
|
const promptPackageManager = Effect.suspend(() => {
|
|
30
30
|
const detected = detectPackageManager();
|
|
31
31
|
// detected manager listed first so plain Enter picks it
|
|
@@ -33,15 +33,15 @@ const promptPackageManager = Effect.suspend(() => {
|
|
|
33
33
|
...(detected ? [detected] : []),
|
|
34
34
|
...PACKAGE_MANAGERS.filter((pm) => pm !== detected),
|
|
35
35
|
];
|
|
36
|
-
return Prompt.
|
|
36
|
+
return Prompt.run(Prompt.Select({
|
|
37
37
|
message: "Which package manager?",
|
|
38
38
|
choices: ordered.map((pm) => ({ title: pm, value: pm })),
|
|
39
|
-
});
|
|
39
|
+
}));
|
|
40
40
|
});
|
|
41
|
-
const promptBiome = Prompt.
|
|
41
|
+
const promptBiome = Prompt.run(Prompt.Confirm({
|
|
42
42
|
message: "Add Biome for linting/formatting?",
|
|
43
43
|
initial: true,
|
|
44
|
-
});
|
|
44
|
+
}));
|
|
45
45
|
const runInstall = (pm, dir) => Effect.gen(function* () {
|
|
46
46
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
47
47
|
const command = ChildProcess.make(pm, ["install"], {
|
|
@@ -100,7 +100,7 @@ const handler = (input) => Effect.gen(function* () {
|
|
|
100
100
|
yield* ensureEmptyDir(dir);
|
|
101
101
|
const pm = Option.getOrUndefined(input.pm) ??
|
|
102
102
|
(input.yes
|
|
103
|
-
? (detectPackageManager() ?? "
|
|
103
|
+
? (detectPackageManager() ?? "bun")
|
|
104
104
|
: yield* promptPackageManager);
|
|
105
105
|
// explicit flags win over --yes; --no-biome beats --biome if both are passed
|
|
106
106
|
const biome = input.noBiome
|
|
@@ -136,8 +136,8 @@ const handler = (input) => Effect.gen(function* () {
|
|
|
136
136
|
Effect.catchTag("QuitError", () => Effect.interrupt));
|
|
137
137
|
// registered globally so `--verbose` parses anywhere on the command line;
|
|
138
138
|
// the reporter reads argv directly because it sits outside handler context
|
|
139
|
-
const verboseFlag = GlobalFlag.
|
|
140
|
-
flag: Flag.
|
|
139
|
+
const verboseFlag = GlobalFlag.Setting("verbose")({
|
|
140
|
+
flag: Flag.Boolean("verbose").pipe(Flag.withDefault(false), Flag.withDescription("Print full error cause chains")),
|
|
141
141
|
});
|
|
142
142
|
export const rootCommand = Command.make("create-effect-motion", flags, handler).pipe(Command.withDescription("Scaffold a new effect-motion project"), Command.withGlobalFlags([verboseFlag]));
|
|
143
143
|
export const CLI_VERSION = VERSION;
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
2
|
+
"name": "create-effect-motion",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Scaffold a new effect-motion project — run with `bun create effect-motion` (or npm/pnpm/yarn create)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/julia-script/effect-motion.git",
|
|
10
|
+
"directory": "packages/create-effect-motion"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/julia-script/effect-motion#readme",
|
|
13
|
+
"bugs": "https://github.com/julia-script/effect-motion/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"effect",
|
|
16
|
+
"motion",
|
|
17
|
+
"create",
|
|
18
|
+
"scaffold",
|
|
19
|
+
"template",
|
|
20
|
+
"motion-graphics"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"create-effect-motion": "./dist/bin.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"templates"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.build.json",
|
|
31
|
+
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"check": "tsc --noEmit"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@effect/platform-node": "4.0.0-rc.115",
|
|
37
|
+
"effect": "4.0.0-rc.115"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@biomejs/biome": "^2.5.3",
|
|
41
|
+
"@types/node": "^26.1.1",
|
|
42
|
+
"typescript": "^7.0.2",
|
|
43
|
+
"vitest": "^4.1.10"
|
|
44
|
+
}
|
|
45
|
+
}
|