Skip to content

Commit 1a33eb6

Browse files
committed
Merge branch 'master' into user-as-default-database
2 parents 610ecd2 + 8eca181 commit 1a33eb6

File tree

197 files changed

+13306
-477
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+13306
-477
lines changed

.devcontainer/Dockerfile

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
FROM node:12
7+
8+
# Avoid warnings by switching to noninteractive
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
# The node image includes a non-root user with sudo access. Use the
12+
# "remoteUser" property in devcontainer.json to use it. On Linux, update
13+
# these values to ensure the container user's UID/GID matches your local values.
14+
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
15+
ARG USERNAME=node
16+
ARG USER_UID=1000
17+
ARG USER_GID=$USER_UID
18+
19+
# Configure apt and install packages
20+
RUN apt-get update \
21+
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
22+
#
23+
# Verify git and needed tools are installed
24+
&& apt-get -y install git iproute2 procps \
25+
#
26+
# Remove outdated yarn from /opt and install via package
27+
# so it can be easily updated via apt-get upgrade yarn
28+
&& rm -rf /opt/yarn-* \
29+
&& rm -f /usr/local/bin/yarn \
30+
&& rm -f /usr/local/bin/yarnpkg \
31+
&& apt-get install -y curl apt-transport-https lsb-release \
32+
&& curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \
33+
&& echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
34+
&& apt-get update \
35+
&& apt-get -y install --no-install-recommends yarn tmux locales postgresql \
36+
#
37+
# Install eslint globally
38+
&& npm install -g eslint \
39+
#
40+
# [Optional] Update a non-root user to UID/GID if needed.
41+
&& if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
42+
groupmod --gid $USER_GID $USERNAME \
43+
&& usermod --uid $USER_UID --gid $USER_GID $USERNAME \
44+
&& chown -R $USER_UID:$USER_GID /home/$USERNAME; \
45+
fi \
46+
# [Optional] Add add sudo support for non-root user
47+
&& apt-get install -y sudo \
48+
&& echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
49+
&& chmod 0440 /etc/sudoers.d/$USERNAME \
50+
#
51+
# Clean up
52+
&& apt-get autoremove -y \
53+
&& apt-get clean -y \
54+
&& rm -rf /var/lib/apt/lists/*
55+
56+
RUN curl https://raw.githubusercontent.com/brianc/dotfiles/master/.tmux.conf > ~/.tmux.conf
57+
58+
# install nvm
59+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
60+
61+
# set up a nicer prompt
62+
RUN git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
63+
64+
RUN echo "source $HOME/.bash-git-prompt/gitprompt.sh" >> ~/.bashrc
65+
66+
# Set the locale
67+
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
68+
ENV LANG en_US.UTF-8
69+
ENV LANGUAGE en_US:en
70+
ENV LC_ALL en_US.UTF-8
71+
72+
# Switch back to dialog for any ad-hoc use of apt-get
73+
ENV DEBIAN_FRONTEND=dialog

.devcontainer/devcontainer.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml.
2+
{
3+
"name": "Node.js 12 & Postgres",
4+
"dockerComposeFile": "docker-compose.yml",
5+
"service": "web",
6+
"workspaceFolder": "/workspace",
7+
8+
// Use 'settings' to set *default* container specific settings.json values on container create.
9+
// You can edit these settings after create using File > Preferences > Settings > Remote.
10+
"settings": {
11+
"terminal.integrated.shell.linux": "/bin/bash"
12+
},
13+
14+
// Uncomment the next line if you want start specific services in your Docker Compose config.
15+
// "runServices": [],
16+
17+
// Uncomment the line below if you want to keep your containers running after VS Code shuts down.
18+
// "shutdownAction": "none",
19+
20+
// Uncomment the next line to run commands after the container is created.
21+
// "postCreateCommand": "npm install",
22+
23+
// Uncomment the next line to have VS Code connect as an existing non-root user in the container. See
24+
// https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist.
25+
// "remoteUser": "node",
26+
27+
// Add the IDs of extensions you want installed when the container is created in the array below.
28+
"extensions": [
29+
"dbaeumer.vscode-eslint"
30+
]
31+
}

.devcontainer/docker-compose.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
6+
version: '3'
7+
services:
8+
web:
9+
# Uncomment the next line to use a non-root user for all processes. You can also
10+
# simply use the "remoteUser" property in devcontainer.json if you just want VS Code
11+
# and its sub-processes (terminals, tasks, debugging) to execute as the user. On Linux,
12+
# you may need to update USER_UID and USER_GID in .devcontainer/Dockerfile to match your
13+
# user if not 1000. See https://aka.ms/vscode-remote/containers/non-root for details.
14+
# user: node
15+
16+
build:
17+
context: .
18+
dockerfile: Dockerfile
19+
20+
volumes:
21+
- ..:/workspace:cached
22+
23+
environment:
24+
PGPASSWORD: pass
25+
PGUSER: user
26+
PGDATABASE: data
27+
PGHOST: db
28+
29+
# Overrides default command so things don't shut down after the process ends.
30+
command: sleep infinity
31+
32+
links:
33+
- db
34+
35+
db:
36+
image: postgres
37+
restart: unless-stopped
38+
ports:
39+
- 5432:5432
40+
environment:
41+
POSTGRES_PASSWORD: pass
42+
POSTGRES_USER: user
43+
POSTGRES_DB: data
44+

.eslintrc

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
{
2-
"extends": "standard",
2+
"plugins": [
3+
"node"
4+
],
5+
"extends": [
6+
"standard",
7+
"eslint:recommended",
8+
"plugin:node/recommended"
9+
],
10+
"ignorePatterns": [
11+
"**/*.ts"
12+
],
13+
"parserOptions": {
14+
"ecmaVersion": 2017,
15+
"sourceType": "module"
16+
},
17+
"env": {
18+
"node": true,
19+
"es6": true,
20+
"mocha": true
21+
},
322
"rules": {
4-
"no-new-func": "off"
23+
"space-before-function-paren": "off",
24+
"node/no-unsupported-features/es-syntax": "off",
25+
"node/no-unpublished-require": [
26+
"error",
27+
{
28+
"allowModules": [
29+
"pg"
30+
]
31+
}
32+
]
533
}
634
}

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [brianc]

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ build/
55
node_modules/
66
package-lock.json
77
*.swp
8+
dist
9+
.DS_Store

.npmignore

-8
This file was deleted.

.travis.yml

+26-24
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
language: node_js
2-
sudo: false
3-
dist: trusty
2+
dist: bionic
3+
44
before_script:
5-
- node script/create-test-tables.js pg://[email protected]:5432/postgres
5+
- node packages/pg/script/create-test-tables.js pg://[email protected]:5432/postgres
6+
67
env:
78
- CC=clang CXX=clang++ npm_config_clang=1 PGUSER=postgres PGDATABASE=postgres
89

10+
node_js:
11+
- lts/dubnium
12+
- lts/erbium
13+
- 13
14+
15+
addons:
16+
postgresql: "10"
17+
918
matrix:
1019
include:
11-
- node_js: "lts/boron"
12-
addons:
13-
postgresql: "9.6"
14-
- node_js: "lts/argon"
15-
addons:
16-
postgresql: "9.6"
17-
- node_js: "9"
18-
addons:
19-
postgresql: "9.6"
20-
- node_js: "10"
20+
- node_js: lts/carbon
2121
addons:
22-
postgresql: "9.6"
23-
- node_js: "lts/carbon"
24-
addons:
25-
postgresql: "9.1"
22+
postgresql: "9.5"
2623
dist: precise
27-
- node_js: "lts/carbon"
28-
addons:
29-
postgresql: "9.2"
30-
- node_js: "lts/carbon"
24+
25+
# different PostgreSQL versions on Node LTS
26+
- node_js: lts/erbium
3127
addons:
3228
postgresql: "9.3"
33-
- node_js: "lts/carbon"
29+
- node_js: lts/erbium
3430
addons:
3531
postgresql: "9.4"
36-
- node_js: "lts/carbon"
32+
- node_js: lts/erbium
3733
addons:
3834
postgresql: "9.5"
39-
- node_js: "lts/carbon"
35+
- node_js: lts/erbium
4036
addons:
4137
postgresql: "9.6"
38+
39+
# PostgreSQL 9.2 only works on precise
40+
- node_js: lts/carbon
41+
addons:
42+
postgresql: "9.2"
43+
dist: precise

0 commit comments

Comments
 (0)