Skip to content

Commit

Permalink
Add Node.js support for generation
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Apr 19, 2024
1 parent eb18149 commit 186279d
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Setup Node.js
description: Setup Node.js and install dependencies.

inputs:
node_version:
description: The Node.js version.
required: false
default: '20'
registry_url:
description: The Node.js package registry URL.
required: false
default: https://registry.npmjs.org
install_dependencies:
description: Install dependencies.
required: false
default: 'true'

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'true'
with:
cache: npm
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Setup Node.js without cache
uses: actions/setup-node@v4
if: inputs.install_dependencies == 'false'
with:
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
- name: Install dependencies
if: inputs.install_dependencies == 'true'
shell: bash
run: npm ci
4 changes: 4 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ jobs:
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Setup Node.js
uses: ./.github/actions/setup-node
- name: Format
run: bundle exec rake format
- name: Format with Prettier
run: npm run format
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
if: always()
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,14 @@ jobs:
uses: ./.github/actions/setup
with:
install_dependencies: 'false'
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
install_dependencies: 'false'
- name: Normalize Gemfile.lock
run: bundle install
- name: Normalize package-lock.json
run: npm install
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
Expand Down
150 changes: 150 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,153 @@ build-iPhoneSimulator/

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*

# Build directories
package

# Environment versions file
.versions

# Tern
.tern-project
.tern-port

# npm config
.npmrc

# Temporary development files
tmp

# Yarn lockfile (only package-lock.json supported)
yarn.lock

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"endOfLine": "lf"
}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ $ git clone [email protected]:seamapi/ruby-next.git

### Requirements

You will need [Ruby] with [Bundler].
You will need [Ruby] with [Bundler] and [Node.js] with [npm].

Be sure that all commands run under the correct Ruby version, e.g.,
if using [rbenv], install the correct version with

```
$ rbenv install
$ npm install
```

Install the development dependencies with
Expand All @@ -80,6 +81,8 @@ $ bundle install
```

[bundler]: https://bundler.io/
[Node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/
[ruby]: https://www.ruby-lang.org/
[rbenv]: https://github.com/rbenv/rbenv

Expand Down
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@seamapi/ruby",
"private": true,
"type": "module",
"scripts": {
"format": "prettier --write --ignore-path .gitignore ."
},
"devDependencies": {
"prettier": "^3.2.5"
}
}

0 comments on commit 186279d

Please sign in to comment.