Skip to content
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
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_size = 2

Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: bun
directory: /
schedule:
interval: weekly
groups:
all-deps:
patterns:
- '*'
ignore:
# @types/node only arrives transitively; don't chase its majors
- dependency-name: '@types/node'
update-types: ['version-update:semver-major']

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI
on:
push:
branches: [master]
pull_request:

permissions:
contents: read

jobs:
test:
name: Test (${{ matrix.os }}, React ${{ matrix.react }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
react: [19]
include:
# The suite needs Testing Library 16, which supports React 18+
- os: ubuntu-latest
react: 18
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2

- run: bun install --frozen-lockfile

- name: Use React ${{ matrix.react }}
if: matrix.react != 19
run: bun add -d react@^${{ matrix.react }} react-dom@^${{ matrix.react }}

- run: bun run typecheck
- run: bun run format:check
- run: bun test
- run: bun run build

package:
name: Package smoke test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v7
with:
node-version: 24

- run: bun install --frozen-lockfile

# npm pack runs the prepare script, the same path as a git install
- run: npm pack --pack-destination "$RUNNER_TEMP"

# Install the tarball into a bare consumer and load both module formats under Node
- name: require() and import() the packed tarball
working-directory: ${{ runner.temp }}
run: |
mkdir consumer && cd consumer
npm init -y > /dev/null
npm install ../react-smoothie-*.tgz react
node -e "const m = require('react-smoothie'); if (typeof m.default !== 'function' || !m.TimeSeries) process.exit(1)"
node --input-type=module -e "import S, { TimeSeries } from 'react-smoothie'; if (typeof S !== 'function' || !TimeSeries) process.exit(1)"
46 changes: 24 additions & 22 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,67 @@
# Publishes to npm on version tags. Keep this file name: the npm Trusted
# Publisher entry for react-smoothie is bound to it.
name: Build and Publish
on: [push, pull_request]
on:
push:
tags: ['v*']

permissions:
contents: read

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
cache: npm

# Install dependencies and Build
- run: npm ci
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2

# Test
- run: npm test
- run: bun install --frozen-lockfile
- run: bun run typecheck
- run: bun test
- run: bun run build

publishNpm:
name: Publish Npm
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
# Required for npm Trusted Publishing (OIDC); also enables provenance
# Required for npm Trusted Publishing (OIDC) and provenance
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
# npm still does the publish: Trusted Publishing and provenance are npm features
- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
registry-url: 'https://registry.npmjs.org'

# The tag must match the version being published
- name: Check tag matches package version
run: test "$GITHUB_REF_NAME" = "v$(node -p "require('./package.json').version")"

# Install dependencies and Build
- run: npm ci
- run: bun install --frozen-lockfile

# Publish via Trusted Publishing (configured on npmjs.com; no token needed).
# npm publish runs the prepare script, which builds dist/.
# Prerelease versions go to the "next" dist-tag so "latest" stays on stable.
- name: Publish
run: |
case "$GITHUB_REF_NAME" in
*-*) npm publish --tag next ;;
*) npm publish ;;
*-*) npm publish --provenance --tag next ;;
*) npm publish --provenance ;;
esac

release:
name: GitHub Release
needs: publishNpm
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v7

# Create a GitHub Release for the tag with generated notes
- name: Create release
Expand Down
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@

# Generated dist files
/dist/

# Generated test files
/test

# Generated example files
example.js
example.d.ts
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"printWidth": 120,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "es5"
"trailingComma": "es5",
"endOfLine": "auto"
}
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "Launch Development Server",
"type": "shell",
"command": "npm",
"command": "bun",
"args": ["run", "dev"],
"presentation": {
"panel": "shared"
Expand All @@ -16,9 +16,9 @@
"group": "build"
},
{
"label": "Compile to CommonJS",
"label": "Build CommonJS + ESM",
"type": "shell",
"command": "npm",
"command": "bun",
"args": ["run", "build"],
"presentation": {
"panel": "shared"
Expand Down
Loading
Loading