Overview
motion-core initmotion-core.jsonWhen to run it
- Right after creating a new SvelteKit/Vite + Svelte project so Motion Core files land in predictable locations.
- When you clone a project that already uses Motion Core but the scaffolding or Tailwind tokens are missing.
- Inside CI pipelines to verify the workspace layout by using .
--dry-run
Usage
motion-core init [--dry-run]motion-core init [--dry-run]Options
| Flag | Description |
|---|---|
--dry-run | Print every planned action (config path, directories, dependencies, Tailwind edits) without touching disk. Useful for audits and CI. |
What the command does
- Framework & package manager detection – reads to ensure
package.json. Missing or older Svelte aborts the command. Tailwindsvelte >= 5is allowed but triggers a warning. The CLI walks up the directory tree to locate lockfiles and remember whether to call npm, pnpm, yarn, or bun later.< 4 - Configuration bootstrap – if does not exist the CLI writes the default template (including the JSON Schema URL) and tries to locate your Tailwind CSS file automatically. When the file exists it is left untouched unless you edit it yourself afterwards.
motion-core.json - Workspace scaffolding – guarantees that the directories referenced by your aliases exist (components, helpers, utils, assets) and downloads the shared helper. Every directory or file created is reported in the summary output.
utils/cn.ts - Tailwind token sync – downloads from the registry (or the local cache when offline), inserts the bundle into the configured Tailwind CSS file, keeps a
tokens/motion-core.cssbackup, and avoids duplicating the block if the sentinel.motion-core.bakis already present.@utility card-highlight - Base dependency check – compares the registry’s base dependency map with your . When a package manager was detected the CLI installs missing packages automatically; otherwise it prints the commands you should run manually.
package.json - Summary – prints the detected framework, package manager, whether configuration was created or reused, directories/files touched, dependency changes, and a suggested next command ().
motion-core add glass-pane
Dry-run reporting
motion-core init --dry-run- Where would live.
motion-core.json - Which directories/files would be created.
- Whether Tailwind tokens would be injected and into which file.
- The list of dependencies that would be installed and via which package manager.
This is ideal when you are upgrading Motion Core or reviewing contributions.
Troubleshooting & tips
- “Svelte >=5 is required” – upgrade your dependency before retrying, otherwise components may rely on APIs that are missing in older versions.
- Offline runs – the CLI falls back to cached registry manifests for helpers and tokens. If the cache is empty you will see an error telling you to rerun the command once online.
- Custom folder layout – edit after initialization to point aliases elsewhere, then re-run
motion-core.jsonto recreate missing folders ormotion-core initto sync files into the new paths.motion-core add