Loading... <iframe src="https://ac.silencetime.com" width=100% height=750></iframe> ### 关于项目 > 项目:❄️ 云空调,便携小空调,为你的夏日带去清凉! > > Github:[air-conditioner](https://github.com/YunYouJun/air-conditioner) > > 作者:[YunYouJun](https://ac.yunyoujun.cn/ "https://ac.yunyoujun.cn") ### 实施 > 嫌麻烦的可以直接按照作者的腾讯开源项目[CloudBase Framework](https://github.com/Tencent/cloudbase-framework)一键链接搭建。<button class=" btn m-b-xs btn-info btn-addon" onclick='window.open("https://console.cloud.tencent.com/tcb/env/index?action=CreateAndDeployCloudBaseProject&appUrl=https%3A%2F%2Fgithub.com%2FYunYouJun%2Fair-conditioner%2F&branch=master","_blank")'><i><i data-feather="cloud"></i></i>部署到腾讯云</button> #### 搭建环境 作者的技术栈选用了 [React](https://zh-hans.reactjs.org/) + [Material-UI](https://material-ui.com/),所以需要node,js环境。因为我对node.js环境没啥需求,所以我选择docker,build完部署到生产环境后删除docker即可。 ```shell docker pull node ``` 运行容器 ```shell docker run \ -tid \ --name node \ --privileged=true \ --restart always \ -v /mnt/sda1/node:/node node:latest ``` 其中`/mnt/sda1/node`目录是宿主机的挂载目录,方便编辑和下载完成的文件 进入容器 `docker exec -it node bash` #### 准备工作 检测环境 ```shell ## 更新 opt update ## 检查node版本 node.js -v ## 检查nmp nmp -v ## 检查yarn版本 yarn --version ``` 正常显示版本号说明环境正常,进行下一步。没有则`apt install`,比如`apt install yarn` ### 开始编辑 ```shell ## 进入项目文件夹 cd node ## 获取目录文件 git clone https://github.com/YunYouJun/air-conditioner.git ## 进入目录 cd air-conditioner ## 安装依赖 yarn add typescript ## 可选环境变量 cp .env.example .env ## 可选关闭广告 REACT_APP_DISABLE_ADSENSE=true ## 开启测试 yarn start ## 请自由编辑内容,并通过http://localhost:3000/测试 yarn build ## ./build ``` #### 部署生产 在宿主机挂载目录,下载build文件夹,上传至nginx网站目录即可。 ### 效果 [静谧时光空调房](https://ac.silencetime.com/) 最后修改:2021 年 05 月 21 日 © 允许规范转载 打赏 赞赏作者 支付宝 赞 0 如果觉得我的文章对你有用,请随意赞赏
1 条评论
没卵用科技