从Plasmic创建本地代码库

官方文档

创建新仓库时,使用create-plasmic-app,将会自动设置所有内容。要创建项目,在命令行工具中运行如下代码:

npx create-plasmic-app

大约一分半钟,提示安装成功。接着可以根据提示设置项目名称、代码语言、react 框架、集成方案、项目链接。除项目名称和链接外,剩余三项都是用键盘上的/ 箭头来选择。
项目名称随便写一个即可,项目链接是 plasmic 的设计图链接,其他选项都是根据官方推荐的选项。
比如我输入的(仅供参考):

Please specify the project directory
? What is your project named? plasmicdesign
? What language do you want to use? TypeScript
? What React framework do you want to use? Next.js
? Which scheme do you want to use to integrate Plasmic? PlasmicLoader

? What is the URL of your project?
(If you don't have a project yet, create one by going to
https://studio.plasmic.app/starters/simple-light):
 https://studio.plasmic.app/projects/x2MP8nP6DT8WT9iEdA83zr

接着,会提示如下内容:

Let's get started! Here's what we'll do: 
1. Authenticate with Plasmic
2. Create a React/Next/Gatsby repo
3. Integrate with Plasmic

==================================================
AUTHENTICATING WITH PLASMIC
==================================================

If your browser doesn't automatically open, enter the following URL:
https://studio.plasmic.app/auth/plasmic-init/94da7201-bd39-4ccd-951c-36e6fa043bbf

Please log in and authorize Plasmic CLI.
Waiting for token...

此时浏览器会出现一个页面,点击按钮授权。
在这里插入图片描述
授权后,会显示 Plasmic 的代码库在本地电脑中的位置。
接着,会自动创建项目文件,并安装依赖。

Successfully created Plasmic credentials file at /Users/ym/.plasmic.auth

==================================================
CREATING THE PROJECT
==================================================
npx -p create-next-app create-next-app --typescript /Users/ym/plasmicdesign
npx: 1 安装成功,用时 2.924 秒
Creating a new Next.js app in /Users/ym/plasmicdesign.

Using npm.

Installing dependencies:
- react
- react-dom
- next

然后就是全自动的安装过程,不详细说了。
最后出现这行字,说明成功了:

Congrats! We created the Plasmic-connected project at plasmicdesign

然后根据提示,进入设定目录,并启动服务:

cd plasmicdesign
npm run dev

相关链接:Plasmic Studio入门教程

猜你喜欢

转载自blog.csdn.net/ymyz1229/article/details/127490299