Skip to content

Commit 5747ccf

Browse files
authored
Merge pull request #1 from seamapi/node-support
Add Node.js support
2 parents ad28e5d + 707a50d commit 5747ccf

13 files changed

Lines changed: 274 additions & 4 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@ ARG VARIANT="3"
22

33
FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
44

5+
ARG NODE_VERSION="20"
56
ARG POETRY_VERSION="1.8.2"
67
ARG POETRY_SRC="https://install.python-poetry.org"
78

9+
# https://github.com/microsoft/vscode-dev-containers/blob/main/containers/go/.devcontainer/base.Dockerfile
10+
ENV USERNAME=vscode
11+
ENV LIBRARY_SCRIPTS_SRC="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/containers/go/.devcontainer/library-scripts/node-debian.sh"
12+
ENV NVM_DIR=/usr/local/share/nvm
13+
ENV NVM_SYMLINK_CURRENT=true \
14+
PATH=${NVM_DIR}/current/bin:${PATH}
15+
RUN mkdir /tmp/library-scripts \
16+
&& curl -fsSL -o /tmp/library-scripts/node-debian.sh "${LIBRARY_SCRIPTS_SRC}"
17+
RUN bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}" \
18+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* \
19+
&& rm -rf /tmp/library-scripts
20+
821
USER vscode
922
WORKDIR /home/vscode
1023

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"build": {
55
"dockerfile": "Dockerfile",
66
"args": {
7+
"NODE_VERSION": "20",
78
"POETRY_VERSION": "1.8.2",
89
"VARIANT": "3.12"
910
}
@@ -17,6 +18,6 @@
1718
"ms-python.python",
1819
"EditorConfig.EditorConfig"
1920
],
20-
"postCreateCommand": "poetry install",
21+
"postCreateCommand": "poetry install && npm install",
2122
"remoteUser": "vscode"
2223
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
seami/** linguist-generated
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Setup Node.js
3+
description: Setup Node.js and install dependencies.
4+
5+
inputs:
6+
node_version:
7+
description: The Node.js version.
8+
required: false
9+
default: '20'
10+
registry_url:
11+
description: The Node.js package registry URL.
12+
required: false
13+
default: https://registry.npmjs.org
14+
install_dependencies:
15+
description: Install dependencies.
16+
required: false
17+
default: 'true'
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
if: inputs.install_dependencies == 'true'
25+
with:
26+
cache: npm
27+
node-version: ${{ inputs.node_version }}
28+
registry-url: ${{ inputs.registry_url }}
29+
- name: Setup Node.js without cache
30+
uses: actions/setup-node@v4
31+
if: inputs.install_dependencies == 'false'
32+
with:
33+
node-version: ${{ inputs.node_version }}
34+
registry-url: ${{ inputs.registry_url }}
35+
- name: Install dependencies
36+
if: inputs.install_dependencies == 'true'
37+
shell: bash
38+
run: npm ci

.github/workflows/format.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ jobs:
2929
passphrase: ${{ secrets.GPG_PASSPHRASE }}
3030
- name: Setup
3131
uses: ./.github/actions/setup
32+
- name: Setup Node.js
33+
uses: ./.github/actions/setup-node
3234
- name: Format
3335
run: make format
36+
- name: Format with Prettier
37+
run: npm run format
3438
- name: Commit
3539
uses: stefanzweifel/git-auto-commit-action@v5
3640
if: always()
3741
with:
38-
commit_message: Run format
42+
commit_message: 'ci: Format code'
3943
commit_user_name: ${{ secrets.GIT_USER_NAME }}
4044
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
4145
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>

.github/workflows/generate.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,20 @@ jobs:
3131
uses: ./.github/actions/setup
3232
with:
3333
install_dependencies: 'false'
34+
- name: Setup Node.js
35+
uses: ./.github/actions/setup-node
36+
with:
37+
install_dependencies: 'false'
3438
- name: Normalize poetry.lock
3539
run: poetry lock --no-update
40+
- name: Normalize package-lock.json
41+
run: npm install
42+
- name: Generate code
43+
run: npm run generate
3644
- name: Commit
3745
uses: stefanzweifel/git-auto-commit-action@v5
3846
with:
39-
commit_message: Generate code
47+
commit_message: 'ci: Generate code'
4048
commit_user_name: ${{ secrets.GIT_USER_NAME }}
4149
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
4250
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>

.gitignore

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,153 @@ cython_debug/
171171
# and can be added to the global gitignore or merged into this file. For a more nuclear
172172
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
173173
#.idea/
174+
175+
# Build directories
176+
package
177+
178+
# Environment versions file
179+
.versions
180+
181+
# Tern
182+
.tern-project
183+
.tern-port
184+
185+
# npm config
186+
.npmrc
187+
188+
# Temporary development files
189+
tmp
190+
191+
# Yarn lockfile (only package-lock.json supported)
192+
yarn.lock
193+
194+
# Logs
195+
logs
196+
*.log
197+
npm-debug.log*
198+
yarn-debug.log*
199+
yarn-error.log*
200+
lerna-debug.log*
201+
.pnpm-debug.log*
202+
203+
# Diagnostic reports (https://nodejs.org/api/report.html)
204+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
205+
206+
# Runtime data
207+
pids
208+
*.pid
209+
*.seed
210+
*.pid.lock
211+
212+
# Directory for instrumented libs generated by jscoverage/JSCover
213+
lib-cov
214+
215+
# Coverage directory used by tools like istanbul
216+
coverage
217+
*.lcov
218+
219+
# nyc test coverage
220+
.nyc_output
221+
222+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
223+
.grunt
224+
225+
# Bower dependency directory (https://bower.io/)
226+
bower_components
227+
228+
# node-waf configuration
229+
.lock-wscript
230+
231+
# Compiled binary addons (https://nodejs.org/api/addons.html)
232+
build/Release
233+
234+
# Dependency directories
235+
node_modules/
236+
jspm_packages/
237+
238+
# Snowpack dependency directory (https://snowpack.dev/)
239+
web_modules/
240+
241+
# TypeScript cache
242+
*.tsbuildinfo
243+
244+
# Optional npm cache directory
245+
.npm
246+
247+
# Optional eslint cache
248+
.eslintcache
249+
250+
# Optional stylelint cache
251+
.stylelintcache
252+
253+
# Microbundle cache
254+
.rpt2_cache/
255+
.rts2_cache_cjs/
256+
.rts2_cache_es/
257+
.rts2_cache_umd/
258+
259+
# Optional REPL history
260+
.node_repl_history
261+
262+
# Output of 'npm pack'
263+
*.tgz
264+
265+
# Yarn Integrity file
266+
.yarn-integrity
267+
268+
# dotenv environment variable files
269+
.env
270+
.env.development.local
271+
.env.test.local
272+
.env.production.local
273+
.env.local
274+
275+
# parcel-bundler cache (https://parceljs.org/)
276+
.cache
277+
.parcel-cache
278+
279+
# Next.js build output
280+
.next
281+
out
282+
283+
# Nuxt.js build / generate output
284+
.nuxt
285+
dist
286+
287+
# Gatsby files
288+
.cache/
289+
# Comment in the public line in if your project uses Gatsby and not Next.js
290+
# https://nextjs.org/blog/next-9-1#public-directory-support
291+
# public
292+
293+
# vuepress build output
294+
.vuepress/dist
295+
296+
# vuepress v2.x temp and cache directory
297+
.temp
298+
.cache
299+
300+
# Docusaurus cache and generated files
301+
.docusaurus
302+
303+
# Serverless directories
304+
.serverless/
305+
306+
# FuseBox cache
307+
.fusebox/
308+
309+
# DynamoDB Local files
310+
.dynamodb/
311+
312+
# TernJS port file
313+
.tern-port
314+
315+
# Stores VSCode versions used for testing VSCode extensions
316+
.vscode-test
317+
318+
# yarn v2
319+
.yarn/cache
320+
.yarn/unplugged
321+
.yarn/build-state.yml
322+
.yarn/install-state.gz
323+
.pnp.*

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"jsxSingleQuote": true,
5+
"endOfLine": "lf"
6+
}

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,17 @@ Clone the project with
6767
Requirements
6868
~~~~~~~~~~~~
6969

70-
You will need `Python 3`_ and Poetry_.
70+
You will need `Python 3`_ and Poetry_ and Node.js_ with npm_.
7171

7272
Install the development dependencies with
7373

7474
::
7575

7676
$ poetry install
77+
$ npm install
7778

79+
.. _Node.js: https://nodejs.org/
80+
.. _npm: https://www.npmjs.com/
7881
.. _Poetry: https://poetry.eustace.io/
7982
.. _Python 3: https://www.python.org/
8083

0 commit comments

Comments
 (0)