diff --git a/archive/shanghai-2019/Dockerfile b/archive/shanghai-2019/Dockerfile new file mode 100644 index 0000000..a9410ab --- /dev/null +++ b/archive/shanghai-2019/Dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:bionic + +# Install tools +RUN apt-get update +RUN apt-get install -y build-essential python ninja-build vim git sudo + +# Expose ports used by net tests +ENV NODE_COMMON_PORT=12346 +EXPOSE 12346 +# debug port used by v8 debugger +EXPOSE 5858 +# debug port used by v8 insepctor +EXPOSE 9229 + +# Set up user node-dev: the tests fail when run by the root +RUN adduser --disabled-password --gecos '' node-dev +RUN adduser node-dev sudo +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +USER node-dev +WORKDIR /home/node-dev +ENV HOME /home/node-dev + +# Clone the code and build +RUN git clone --depth=1 https://github.com/nodejs/node.git +WORKDIR /home/node-dev/node +RUN python2 ./configure --ninja +ENV BUILD_WITH ninja +RUN make -j2 test diff --git a/archive/shanghai-2019/README.md b/archive/shanghai-2019/README.md new file mode 100644 index 0000000..3d7c2b4 --- /dev/null +++ b/archive/shanghai-2019/README.md @@ -0,0 +1,5 @@ +# Node.js Code + Learn @ COSCon 2019 + +- [事前准备 (praparation)](./preparation.md) +- [Dockerfile](./Dockerfile) +- [Slides](https://docs.google.com/presentation/d/1NluODLOelMFyui10jSLY8T4M0F444LaG7Ir5u_tfOGM/edit?usp=sharing) diff --git a/archive/shanghai-2019/preparation.md b/archive/shanghai-2019/preparation.md new file mode 100644 index 0000000..cefe32c --- /dev/null +++ b/archive/shanghai-2019/preparation.md @@ -0,0 +1,53 @@ +# 事前准备 + +## 安装环境 + +### MacOS + +1. 从 App Store 安装 Xcode +2. 从命令行运行 + + ``` + xcode-select --install + ``` +3. 推荐安装 ninja。如使用 homebrew: + + ``` + brew install ninja + ``` + +### Ubuntu + +``` +apt-get update +apt-get install -y build-essential python ninja-build make g++ +``` + +### 其他环境 + +UNIX: https://github.com/nodejs/node/blob/master/BUILDING.md#unix-prerequisites +Windows: https://github.com/nodejs/node/blob/master/BUILDING.md#prerequisites + +## 构建与测试 + +全部环境:推荐先 clone Node.js core 的代码。因为体积较大,建议用 `--depth=1`: + +``` +git clone --depth=1 https://github.com/nodejs/node.git +``` + +推荐在参加前先编译(需耗时半个小时到一个小时)和运行一遍测试(会从 npm 下载一些渲染 API 文档需要的包)。MacOS 和 Linux: + +``` +cd node + +# 如果有安装 ninja +python2 ./configure --ninja +BUILD_WITH=ninja make -j2 test + +# 如果没有安装 ninja +python2 ./configure +make -j2 test +``` + +其中 -j2 的 2 可以替换成机器上的 CPU 逻辑核心数。