Skip to content

Commit

Permalink
feat: release (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
YunosukeY committed Feb 24, 2024
1 parent ba6666b commit 6e65043
Show file tree
Hide file tree
Showing 9 changed files with 3,228 additions and 27 deletions.
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
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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'
- run: yarn install --pure-lockfile
- run: yarn build
- env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
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"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# OpenTelemetry SDK for Browser JS

[![CI](https://github.com/YunosukeY/otel-web-sdk/actions/workflows/ci.yaml/badge.svg?branch=master&event=push)](https://github.com/YunosukeY/otel-web-sdk/actions/workflows/ci.yaml)
[![CI](https://github.com/YunosukeY/otel-sdk-web/actions/workflows/ci.yaml/badge.svg?branch=master&event=push)](https://github.com/YunosukeY/otel-sdk-web/actions/workflows/ci.yaml)
27 changes: 23 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
{
"name": "otel-web-sdk",
"version": "1.0.0",
"name": "@kimitsu/otel-sdk-web",
"publishConfig": {
"access": "public"
},
"version": "0.0.0",
"description": "OpenTelemetry SDK for Brower JS",
"main": "index.js",
"repository": "https://github.com/YunosukeY/otel-web-sdk",
"types": "dist/index.d.ts",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/YunosukeY/otel-sdk-web.git"
},
"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 +31,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 +45,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
44 changes: 44 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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({
browser: true,
}),
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

0 comments on commit 6e65043

Please sign in to comment.