Plasmic CLI Usage
The Plasmic CLI makes it easy to invoke code generation of Plasmic components as you develop your application.
Please consult plasmic -h
for the up-to-date reference!
Here are all the commands and high-level descriptions of what they do.
plasmic auth
Just login to Plasmic. Generate a ~/.plasmic.auth that is connected to a personal API token for your user.
plasmic init
This command will generate a plasmic.json file and .plasmic.auth (if one doesn’t already exist).
plasmic sync
This command will sync designs to local files—this is what powers codegen.
A quick note about generated files
Files in the presentational component library (e.g. PlasmicButton.tsx in plasmic/
) should not be edited, as those changes will be lost next time you run plasmic sync
. Your changes in developer-owned wrapper components (e.g. Button.tsx in src/
) will be unaffected. For these files, we only update imports to reflect any new Plasmic-managed files.
Syncing new projects
For new projects, you will need to manually specify them on the first sync. Your plasmic.json file will be automatically updated to include them.
$ plasmic sync --projects PROJECT_ID
plasmic watch
plasmic watch
will listen for new changes from the Studio and automatically sync when any change is detected.
Note: This will only work for projects where version="latest"
in plasmic.json
.
plasmic fix-imports
When using codegen, you can freely move files around the filesystem (e.g. using git mv
). Use this command to fix import paths and your plasmic.json file.
Note: this is run automatically as part of plasmic sync
.
plasmic info
Query for information about a project, optionally in JSON format. Useful for automation to dump out latest version, version history, etc.
See an example of how to use this in CI/CD scripts.
Have feedback on this page? Let us know on our forum.