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

add files for code and learn at COSCon 2019 #99

Merged
merged 4 commits into from
Nov 2, 2019
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
28 changes: 28 additions & 0 deletions archive/shanghai-2019/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions archive/shanghai-2019/README.md
Original file line number Diff line number Diff line change
@@ -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)
53 changes: 53 additions & 0 deletions archive/shanghai-2019/preparation.md
Original file line number Diff line number Diff line change
@@ -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 逻辑核心数。