Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update display about make_env_init to install needed nodejs env #55

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions display/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ RESET := $(shell tput -Txterm sgr0)
# We need nodejs 10.x to run gitbook, this target will install nodejs 10.x
################################################################################
env_install:
chmod +x ./scripts/install-nodejs.sh
./scripts/install-nodejs.sh
chmod +x ./scripts/install_nodejs.sh
./scripts/install_nodejs.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个改动个人觉得没有必要,因为习惯是在终端使用 -install-nodejs, 习惯在 python 中使用 _install_nodejs


## init nodejs 10.x env
init_env: env_install
Expand Down
7 changes: 4 additions & 3 deletions display/README_DISPLAY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ Tasks:

```

其中,`make init_env` 还在测试,您可以自己根据自身系统,安装 nodejs 10。
其中,您可以直接使用`make init_env`进行nvm和nodejs 10 的安装,也可以自己根据自身系统,自行安装 nodejs 10。
如果是Windows系统,您可以使用管理员权限打开命令行,然后输入命令。

然后您可以依次进行 `make init` 初始化 gitbook 运行环境(make init 运行一次即可)。

环境准备妥当后,您可以多次执行 `make generate`,更改相关配置或者`book.json`后,只需重新运行`make generate` 即可重新部署。
环境准备妥当后,您可以多次执行 `make serve`,更改相关配置或者`book.json`后,只需重新运行`make serve` 即可重新部署。

成功后命令行输出如下所示:

Expand All @@ -52,7 +53,7 @@ Serving book on http://localhost:4000

## Future TODO List:

[ ] 一键自动创建环境
[] 一键自动创建环境

[ ] (本地创建环境不好弄的话)docker 一键部署 gitbook 以及上传

Expand Down
5 changes: 5 additions & 0 deletions display/scripts/install_nodejs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion


# 检查是否已经安装了 nvm
check_nvm_installed() {
if [ -s "$NVM_DIR/nvm.sh" ]; then
Expand Down