Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rhseung authored Oct 17, 2024
0 parents commit aaf425d
Show file tree
Hide file tree
Showing 19 changed files with 146,810 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Release on version change

on:
push:
paths:
- 'package.json'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
run: npm install

- name: Build the project
run: npm run build

- name: Get package name and version
id: package_info
run: |
name=$(jq -r '.name' < package.json)
version=$(jq -r '.version' < package.json)
echo "name=$name" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check if version is prerelease
id: prerelease_check
run: |
if [[ "${{ steps.package_info.outputs.version }}" == *"-"* ]]; then
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Prepare files for zipping
run: |
mkdir -p ${{ steps.package_info.outputs.name }} # {name} ํด๋” ์ƒ์„ฑ
cp -r dist/preserve/* ${{ steps.package_info.outputs.name }}/ # ์†Œ์Šค์ฝ”๋“œ๋ฅผ {name} ํด๋”๋กœ ์ด๋™
- name: Zip {name} folder
run: |
zip -r ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}.zip ${{ steps.package_info.outputs.name }}
- name: Rename index.js to {name}.js
run: mv dist/all/index.js dist/all/${{ steps.package_info.outputs.name }}.js

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub Token ์„ค์ •
with:
tag_name: v${{ steps.package_info.outputs.version }} # ๋ฆด๋ฆฌ์ฆˆ ํƒœ๊ทธ
release_name: v${{ steps.package_info.outputs.version }} # ๋ฆด๋ฆฌ์ฆˆ ์ด๋ฆ„
body: |
Automated release for version ${{ steps.package_info.outputs.version }}.
draft: false
prerelease: ${{ steps.prerelease_check.outputs.prerelease }} # prerelease ๊ฐ’ ๋™์  ์„ค์ •

- name: Upload {name}.js to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub Token ์„ค์ •
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/all/${{ steps.package_info.outputs.name }}.js
asset_name: ${{ steps.package_info.outputs.name }}.js
asset_content_type: application/javascript

- name: Upload {name}-{version}.zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub Token ์„ค์ •
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}.zip
asset_name: ${{ steps.package_info.outputs.name }}-${{ steps.package_info.outputs.version }}.zip
asset_content_type: application/zip
131 changes: 131 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
### Node template
# 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

# 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.*

5 changes: 5 additions & 0 deletions .idea/.gitignore

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

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

14 changes: 14 additions & 0 deletions .idea/ts-module-template.iml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "tsx",
"type": "node",
"request": "launch",
"program": "${file}",
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"skipFiles": [
"<node_internals>/**",
"${workspaceFolder}/node_modules/**"
]
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Hyunseung Ryu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ๐Ÿงฉ typescript-module

TypeScript๋ฅผ ์‚ฌ์šฉํ•œ ๋ชจ๋“ˆ์„ ์‰ฝ๊ฒŒ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ํ…œํ”Œ๋ฆฟ ๋ ˆํฌ์ง€ํ† ๋ฆฌ.

- Bot App: [`๋ฉ”์‹ ์ €๋ด‡R`](https://github.com/MessengerBotTeam/msgbot-old-release/releases/tag/0.7.36a) (0.7.36a ๋ฒ„์ „ ์ด์ƒ)
- CI/CD: [`GitHub Actions`](https://github.com/features/actions)
- Module Bundler: [`Rollup`](https://rollupjs.org/)
- Test: [`Vitest`](https://vitest.dev/)
- Execute: [`TSX`](https://tsx.is/)
- Runtime: [`Node.js`](https://nodejs.org/en)

## ๐Ÿ“œ features
- `npm run build:all-in-one`: `src` ํด๋”์˜ ๋ชจ๋“  ์†Œ์Šค๋ฅผ ํ•˜๋‚˜์˜ `.js`, `.d.ts` ํŒŒ์ผ๋กœ ๋งŒ๋“ค์–ด `dist/all`์— ๋นŒ๋“œ
- `npm run build:no-all-in-one`: `src` ํด๋”์˜ ๊ฐ ํŒŒ์ผ๋“ค์„ ํŒŒ์ผ ๊ตฌ์กฐ๋ฅผ ์œ ์ง€ํ•œ ์ฑ„ `.js`, `.d.ts` ํŒŒ์ผ๋กœ ๋ณ€ํ™˜ํ•ด `dist/preserve`์— ๋นŒ๋“œ
- `package.json`์— `version` ํ‚ค๊ฐ€ ๋ณ€๊ฒฝ๋œ ์ฑ„๋กœ ํ‘ธ์‰ฌํ•˜๋ฉด ์ž๋™์œผ๋กœ ํ•ด๋‹น ๋ฒ„์ „์œผ๋กœ ๋ฆด๋ฆฌ์ฆˆ ์ƒ์„ฑ. (`v1.0.0-alpha` ์ฒ˜๋Ÿผ ์“ฐ๋ฉด prerelease๋กœ ์„ค์ •๋จ)

> [!NOTE]
> `package.json` ์—์„œ `directories` ํ‚ค๋ฅผ ์ˆ˜์ •ํ•˜์—ฌ ๋นŒ๋“œ ํƒ€๊ฒŸ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅ
## โœ… prepare
1. ๋ ˆํฌ์ง€ํ† ๋ฆฌ ์„ค์ •์—์„œ `GitHub Actions` ๊ฐ€ ์ ์ ˆํ•œ ๊ถŒํ•œ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.
- `Settings > Actions > General` ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
- `Workflow permissions` ์—์„œ `Read and write permissions` ๋ฅผ ์„ ํƒํ•˜๊ณ  ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
2. `package.json` ํŒŒ์ผ์„ ์—ด์–ด `name`, `version`, `description`, `author`, `license` ๋“ฑ์˜ ํ•„๋“œ๋ฅผ ์ ์ ˆํžˆ ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.
3. `npm install` ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์˜์กด์„ฑ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
Loading

0 comments on commit aaf425d

Please sign in to comment.