Skip to content

Commit 32ecad1

Browse files
authored
Merge pull request #1 from codenote-net/init
Init node.js project
2 parents 8a0b6da + e34e4bf commit 32ecad1

File tree

5 files changed

+348
-0
lines changed

5 files changed

+348
-0
lines changed

.gitignore

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/node,linux,macos,windows
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,linux,macos,windows
3+
4+
### Linux ###
5+
*~
6+
7+
# temporary files which can be created if a process still has a handle open of a deleted file
8+
.fuse_hidden*
9+
10+
# KDE directory preferences
11+
.directory
12+
13+
# Linux trash folder which might appear on any partition or disk
14+
.Trash-*
15+
16+
# .nfs files are created when an open file is removed but is still being accessed
17+
.nfs*
18+
19+
### macOS ###
20+
# General
21+
.DS_Store
22+
.AppleDouble
23+
.LSOverride
24+
25+
# Icon must end with two \r
26+
Icon
27+
28+
# Thumbnails
29+
._*
30+
31+
# Files that might appear in the root of a volume
32+
.DocumentRevisions-V100
33+
.fseventsd
34+
.Spotlight-V100
35+
.TemporaryItems
36+
.Trashes
37+
.VolumeIcon.icns
38+
.com.apple.timemachine.donotpresent
39+
40+
# Directories potentially created on remote AFP share
41+
.AppleDB
42+
.AppleDesktop
43+
Network Trash Folder
44+
Temporary Items
45+
.apdisk
46+
47+
### macOS Patch ###
48+
# iCloud generated files
49+
*.icloud
50+
51+
### Node ###
52+
# Logs
53+
logs
54+
*.log
55+
npm-debug.log*
56+
yarn-debug.log*
57+
yarn-error.log*
58+
lerna-debug.log*
59+
.pnpm-debug.log*
60+
61+
# Diagnostic reports (https://nodejs.org/api/report.html)
62+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
63+
64+
# Runtime data
65+
pids
66+
*.pid
67+
*.seed
68+
*.pid.lock
69+
70+
# Directory for instrumented libs generated by jscoverage/JSCover
71+
lib-cov
72+
73+
# Coverage directory used by tools like istanbul
74+
coverage
75+
*.lcov
76+
77+
# nyc test coverage
78+
.nyc_output
79+
80+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
81+
.grunt
82+
83+
# Bower dependency directory (https://bower.io/)
84+
bower_components
85+
86+
# node-waf configuration
87+
.lock-wscript
88+
89+
# Compiled binary addons (https://nodejs.org/api/addons.html)
90+
build/Release
91+
92+
# Dependency directories
93+
node_modules/
94+
jspm_packages/
95+
96+
# Snowpack dependency directory (https://snowpack.dev/)
97+
web_modules/
98+
99+
# TypeScript cache
100+
*.tsbuildinfo
101+
102+
# Optional npm cache directory
103+
.npm
104+
105+
# Optional eslint cache
106+
.eslintcache
107+
108+
# Optional stylelint cache
109+
.stylelintcache
110+
111+
# Microbundle cache
112+
.rpt2_cache/
113+
.rts2_cache_cjs/
114+
.rts2_cache_es/
115+
.rts2_cache_umd/
116+
117+
# Optional REPL history
118+
.node_repl_history
119+
120+
# Output of 'npm pack'
121+
*.tgz
122+
123+
# Yarn Integrity file
124+
.yarn-integrity
125+
126+
# dotenv environment variable files
127+
.env
128+
.env.development.local
129+
.env.test.local
130+
.env.production.local
131+
.env.local
132+
133+
# parcel-bundler cache (https://parceljs.org/)
134+
.cache
135+
.parcel-cache
136+
137+
# Next.js build output
138+
.next
139+
out
140+
141+
# Nuxt.js build / generate output
142+
.nuxt
143+
dist
144+
145+
# Gatsby files
146+
.cache/
147+
# Comment in the public line in if your project uses Gatsby and not Next.js
148+
# https://nextjs.org/blog/next-9-1#public-directory-support
149+
# public
150+
151+
# vuepress build output
152+
.vuepress/dist
153+
154+
# vuepress v2.x temp and cache directory
155+
.temp
156+
157+
# Docusaurus cache and generated files
158+
.docusaurus
159+
160+
# Serverless directories
161+
.serverless/
162+
163+
# FuseBox cache
164+
.fusebox/
165+
166+
# DynamoDB Local files
167+
.dynamodb/
168+
169+
# TernJS port file
170+
.tern-port
171+
172+
# Stores VSCode versions used for testing VSCode extensions
173+
.vscode-test
174+
175+
# yarn v2
176+
.yarn/cache
177+
.yarn/unplugged
178+
.yarn/build-state.yml
179+
.yarn/install-state.gz
180+
.pnp.*
181+
182+
### Node Patch ###
183+
# Serverless Webpack directories
184+
.webpack/
185+
186+
# Optional stylelint cache
187+
188+
# SvelteKit build / generate output
189+
.svelte-kit
190+
191+
### Windows ###
192+
# Windows thumbnail cache files
193+
Thumbs.db
194+
Thumbs.db:encryptable
195+
ehthumbs.db
196+
ehthumbs_vista.db
197+
198+
# Dump file
199+
*.stackdump
200+
201+
# Folder config file
202+
[Dd]esktop.ini
203+
204+
# Recycle Bin used on file shares
205+
$RECYCLE.BIN/
206+
207+
# Windows Installer files
208+
*.cab
209+
*.msi
210+
*.msix
211+
*.msm
212+
*.msp
213+
214+
# Windows shortcuts
215+
*.lnk
216+
217+
# End of https://www.toptal.com/developers/gitignore/api/node,linux,macos,windows

README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# GitHub RAG Examples
2+
3+
A Node.js project that demonstrates running TypeScript files natively without transpilation using Node.js v22.15.0+ and the experimental type stripping feature.
4+
5+
## Prerequisites
6+
7+
- Node.js v22.15.0 or higher
8+
- npm (comes with Node.js)
9+
10+
## Setup
11+
12+
1. Clone this repository:
13+
```bash
14+
git clone https://github.com/codenote-net/github-rag-examples.git
15+
cd github-rag-examples
16+
```
17+
18+
2. Install dependencies:
19+
```bash
20+
npm install
21+
```
22+
23+
## Running TypeScript Natively
24+
25+
This project is configured to run TypeScript files directly with Node.js without the need for transpilation, using the `--experimental-strip-types` flag.
26+
27+
### Basic TypeScript Example
28+
29+
Run the basic example:
30+
31+
```bash
32+
npm start
33+
```
34+
35+
This executes the `src/index.ts` file directly using Node.js.
36+
37+
## GitHub Repository Clone Script
38+
39+
This project includes a script to clone a GitHub repository using a GitHub App installation token. The script uses the x-access-token authentication method as described in the [GitHub documentation](https://docs.github.com/ja/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation).
40+
41+
### Usage
42+
43+
1. Set the required environment variables:
44+
45+
```bash
46+
export GITHUB_TOKEN="your_github_app_installation_token"
47+
export REPO_OWNER="repository_owner"
48+
export REPO_NAME="repository_name"
49+
export CLONE_DIR="./cloned-repo" # Optional, defaults to './cloned-repo'
50+
```
51+
52+
2. Run the clone script:
53+
54+
```bash
55+
npm run clone
56+
```
57+
58+
This will clone the specified repository using the GitHub App installation token with the specified branch or tag.
59+
60+
## How It Works
61+
62+
Starting with Node.js v22.6.0, Node.js has experimental support for TypeScript syntax through "type stripping". This allows you to run valid TypeScript code directly in Node.js without the need to transpile it first.
63+
64+
From Node.js v23.6.0 onwards, type stripping is enabled by default, but this project explicitly uses the flag for compatibility with Node.js v22.x.
65+
66+
## Project Structure
67+
68+
- `/src` - TypeScript source files
69+
- `package.json` - Project configuration

package-lock.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "github-rag-examples",
3+
"version": "1.0.0",
4+
"description": "GitHub RAG (Retrieval Augmented Generation) examples using Node.js",
5+
"main": "src/index.ts",
6+
"scripts": {
7+
"start": "node --experimental-strip-types src/index.ts",
8+
"test": "echo \"Error: no test specified\" && exit 1",
9+
"dev": "node --experimental-strip-types --watch src/index.ts"
10+
},
11+
"keywords": [
12+
"github",
13+
"rag",
14+
"node",
15+
"typescript"
16+
],
17+
"author": "Tadashi Shigeoka",
18+
"license": "MIT",
19+
"engines": {
20+
"node": ">=22.15.0"
21+
},
22+
"devDependencies": {
23+
"@types/node": "22.15.0"
24+
}
25+
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log("Hello github-rag-examples");

0 commit comments

Comments
 (0)