Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 3f19699

Browse files
authored
add files for code and learn at COSCon 2019 (#99)
1 parent f07d32a commit 3f19699

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

archive/shanghai-2019/Dockerfile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ubuntu:bionic
2+
3+
# Install tools
4+
RUN apt-get update
5+
RUN apt-get install -y build-essential python ninja-build vim git sudo
6+
7+
# Expose ports used by net tests
8+
ENV NODE_COMMON_PORT=12346
9+
EXPOSE 12346
10+
# debug port used by v8 debugger
11+
EXPOSE 5858
12+
# debug port used by v8 insepctor
13+
EXPOSE 9229
14+
15+
# Set up user node-dev: the tests fail when run by the root
16+
RUN adduser --disabled-password --gecos '' node-dev
17+
RUN adduser node-dev sudo
18+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
19+
USER node-dev
20+
WORKDIR /home/node-dev
21+
ENV HOME /home/node-dev
22+
23+
# Clone the code and build
24+
RUN git clone --depth=1 https://github.com/nodejs/node.git
25+
WORKDIR /home/node-dev/node
26+
RUN python2 ./configure --ninja
27+
ENV BUILD_WITH ninja
28+
RUN make -j2 test

archive/shanghai-2019/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Node.js Code + Learn @ COSCon 2019
2+
3+
- [事前准备 (praparation)](./preparation.md)
4+
- [Dockerfile](./Dockerfile)
5+
- [Slides](https://docs.google.com/presentation/d/1NluODLOelMFyui10jSLY8T4M0F444LaG7Ir5u_tfOGM/edit?usp=sharing)

archive/shanghai-2019/preparation.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# 事前准备
2+
3+
## 安装环境
4+
5+
### MacOS
6+
7+
1. 从 App Store 安装 Xcode
8+
2. 从命令行运行
9+
10+
```
11+
xcode-select --install
12+
```
13+
3. 推荐安装 ninja。如使用 homebrew:
14+
15+
```
16+
brew install ninja
17+
```
18+
19+
### Ubuntu
20+
21+
```
22+
apt-get update
23+
apt-get install -y build-essential python ninja-build make g++
24+
```
25+
26+
### 其他环境
27+
28+
UNIX: https://github.com/nodejs/node/blob/master/BUILDING.md#unix-prerequisites
29+
Windows: https://github.com/nodejs/node/blob/master/BUILDING.md#prerequisites
30+
31+
## 构建与测试
32+
33+
全部环境:推荐先 clone Node.js core 的代码。因为体积较大,建议用 `--depth=1`
34+
35+
```
36+
git clone --depth=1 https://github.com/nodejs/node.git
37+
```
38+
39+
推荐在参加前先编译(需耗时半个小时到一个小时)和运行一遍测试(会从 npm 下载一些渲染 API 文档需要的包)。MacOS 和 Linux:
40+
41+
```
42+
cd node
43+
44+
# 如果有安装 ninja
45+
python2 ./configure --ninja
46+
BUILD_WITH=ninja make -j2 test
47+
48+
# 如果没有安装 ninja
49+
python2 ./configure
50+
make -j2 test
51+
```
52+
53+
其中 -j2 的 2 可以替换成机器上的 CPU 逻辑核心数。

0 commit comments

Comments
 (0)