Skip to content

Commit

Permalink
Merge pull request #168 from Cherry/refactor/simplify-build
Browse files Browse the repository at this point in the history
refactor: simplify cjs/esm build, add initial testing
  • Loading branch information
evanderkoogh authored Sep 16, 2024
2 parents 9aaa5e4 + 0a41148 commit ea41c94
Show file tree
Hide file tree
Showing 18 changed files with 3,750 additions and 1,563 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-ducks-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microlabs/otel-cf-workers': patch
---

fix: refactor to modern build tooling and resolve import issues
5 changes: 5 additions & 0 deletions .changeset/four-students-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microlabs/otel-cf-workers': minor
---

Complete overhaul of the build system thanks to @Cherry
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://editorconfig.org
root = true

[*]
end_of_line = lf
indent_style = tab

[*.{yml,yaml}]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: 'Install NPM Dependencies'
run: 'pnpm install --frozen-lockfile --child-concurrency=10'
- name: 'Check for Errors'
run: 'pnpm check'
- name: 'Run Tests'
run: 'pnpm run ci'
8 changes: 3 additions & 5 deletions .github/workflows/pullrequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: 'Install NPM Dependencies'
run: 'pnpm install --frozen-lockfile --child-concurrency=10'
- name: 'Check for Errors'
run: 'pnpm check'
- name: 'Run Tests'
run: 'pnpm run ci'
8 changes: 1 addition & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,13 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: pnpm/action-setup@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: 'Install NPM Dependencies'
run: 'pnpm install --frozen-lockfile --child-concurrency=10'
- name: Check the build
run: pnpm build
- name: 'Check for Errors'
run: 'pnpm check'
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["EditorConfig.EditorConfig", "esbenp.prettier-vscode"]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
66 changes: 36 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
{
"name": "@microlabs/otel-cf-workers",
"version": "1.0.0-rc.46",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.mts",
"exports": {
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"scripts": {
"clean": "rimraf ./dist versions.json",
"format": "prettier --ignore-unknown --write .",
"build-esm": "tsc",
"build-cjs": "tsc -p tsconfig-cjs.json",
"fix-dist": "echo '{\"type\": \"module\"}' > dist/esm/package.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json",
"build": "run-s -l cs-version build-esm build-cjs fix-dist",
"cs-version": "changeset version && pnpm version --json > versions.json",
"build:src": "tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
"build:versions": "pnpm version --json > versions.json",
"build": "run-s -l build:versions build:src",
"cs-version": "changeset version",
"cs-publish": "changeset publish",
"release": "run-s -l clean cs-version build cs-publish",
"release": "run-s -l clean cs-version build check cs-publish",
"check": "run-s -l check:*",
"check:format": "prettier . --check --ignore-unknown",
"check:type-esm": "tsc --noEmit",
"check:type-cjs": "tsc --noEmit -p tsconfig-cjs.json",
"check:types": "tsc --noEmit",
"watch": "tsc --watch",
"prepare": "husky"
"prepare": "husky",
"test": "vitest run",
"test:dev": "vitest",
"ci": "run-s -l clean build check && pnpm test"
},
"files": [
"dist"
],
"homepage": "https://github.com/evanderkoogh/otel-cf-workers#readme",
"dependencies": {
"@opentelemetry/core": "^1.25.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.52.1",
"@opentelemetry/otlp-exporter-base": "^0.52.1",
"@opentelemetry/otlp-transformer": "^0.52.1",
"@opentelemetry/resources": "^1.25.1",
"@opentelemetry/sdk-trace-base": "^1.25.1",
"@opentelemetry/semantic-conventions": "^1.25.1"
"@opentelemetry/core": "^1.26.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
"@opentelemetry/otlp-exporter-base": "^0.53.0",
"@opentelemetry/otlp-transformer": "^0.53.0",
"@opentelemetry/resources": "^1.26.0",
"@opentelemetry/sdk-trace-base": "^1.26.0",
"@opentelemetry/semantic-conventions": "^1.27.0"
},
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@cloudflare/workers-types": "^4.20240806.0",
"husky": "^9.1.4",
"lint-staged": "^15.2.8",
"@changesets/cli": "^2.27.8",
"@cloudflare/workers-types": "^4.20240909.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"typescript": "^5.5.4"
"rimraf": "^6.0.1",
"tsup": "^8.2.4",
"typescript": "^5.6.2",
"vitest": "^2.1.1"
},
"peerDependencies": {
"@opentelemetry/api": "~1.9.0"
Expand All @@ -63,5 +69,5 @@
"lint-staged": {
"*": "prettier --ignore-unknown --write"
},
"packageManager": "pnpm@8.15.6+sha512.77b89e9be77a2b06ad8f403a19cae5e22976f61023f98ad323d5c30194958ebc02ee0a6ae5d13ee454f6134e4e8caf29a05f0b1a0e1d2b17bca6b6a1f1159f86"
"packageManager": "pnpm@9.10.0"
}
Loading

0 comments on commit ea41c94

Please sign in to comment.