Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release #18

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ jobs:
node-version: '20.x'
- run: yarn install --pure-lockfile
- run: yarn lint
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- run: yarn install --pure-lockfile
- run: yarn build
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: release
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-22.04
permissions:
contents: write # semantic-releaseがrepositoryへのpush権限を要求する
issues: read # semantic-releaseがissueを検索できるように
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cat <<EOF > .npmrc
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@YunosukeY:registry=https://npm.pkg.github.com
EOF
- run: yarn install --pure-lockfile
- run: yarn build
- env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn semantic-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
84 changes: 84 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [
{
"type": "refactor",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "major",
"release": "major"
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "fix(deps)",
"section": "update dependency"
},
{
"type": "chore(deps)",
"section": "update dependency"
},
{
"type": "major",
"section": "BREAKING CHANGE"
},
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "chore"
},
{
"type": "docs",
"section": "docs"
},
{
"type": "style",
"section": "style"
},
{
"type": "refactor",
"section": "refactor"
},
{
"type": "perf",
"section": "perf"
},
{
"type": "test",
"section": "test"
}
]
}
}
],
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
"@semantic-release/github"
]
}
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
{
"name": "otel-web-sdk",
"version": "1.0.0",
"version": "0.0.0",
"description": "OpenTelemetry SDK for Brower JS",
"main": "index.js",
"types": "dist/index.d.ts",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"files": [
"dist"
],
"repository": "https://github.com/YunosukeY/otel-web-sdk",
"author": "YunosukeY",
"license": "MIT",
"engines": {
"node": "^20.0.0"
},
"scripts": {
"build": "rollup -c --bundleConfigAsCjs",
"tsc": "tsc --noEmit",
"lint": "yarn lint:eslint && yarn lint:prettier",
"lint:eslint": "eslint --ext .js,.ts src",
Expand All @@ -19,7 +25,12 @@
"fix:prettier": "prettier --write src"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"conventional-changelog-conventionalcommits": "^7.0.2",
"eslint": "^8.0.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
Expand All @@ -28,6 +39,8 @@
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"prettier": "^3.2.5",
"rollup": "^4.12.0",
"semantic-release": "^23.0.2",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down
42 changes: 42 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import typescript from "@rollup/plugin-typescript";

import pkg from "./package.json";

export default [
{
input: "src/index.ts",
output: [
{
file: pkg.module,
format: "es",
sourcemap: "inline",
},
],
plugins: [
// commonjsで書かれた依存ライブラリを読み込めるようにする
nodeResolve(),
commonjs(),

// typescriptによるコンパイル
// rollup用のtsconfigを読み込むことでjsにコンパイルする
//
// targetをes5にしているため、typescriptが可能な範囲で構文の変換が行われる
// これは主にoptional chainingなどtypescriptが先行して導入している構文の変換のため
//
// この時distディレクトリに型定義ファイルを出力する(declarationDirの指定が必要)
typescript({
tsconfig: "tsconfig.rollup.json",
declaration: true,
declarationDir: "dist",
}),

// jsonのimportを処理
json({
compact: true,
}),
],
},
];
6 changes: 6 additions & 0 deletions tsconfig.rollup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext"
}
}
Loading