Skip to content
Open
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
18 changes: 0 additions & 18 deletions .config/beemo.ts

This file was deleted.

11 changes: 0 additions & 11 deletions .config/beemo/eslint.ts

This file was deleted.

4 changes: 0 additions & 4 deletions .config/husky/commit-msg

This file was deleted.

9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/node:2": {
"version": "2.1.0",
"resolved": "ghcr.io/devcontainers/features/node@sha256:586c9a6f7dd40bd3ba2cd41e7f2f88dcc31fbe5d1442afcbf07ffbc66b686857",
"integrity": "sha256:586c9a6f7dd40bd3ba2cd41e7f2f88dcc31fbe5d1442afcbf07ffbc66b686857"
}
}
}
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "sqid-javascript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:trixie",
"features": {
"ghcr.io/devcontainers/features/node:2": {
"version": "24",
"nvmVersion": "0.40.7",
"pnpmVersion": "11.22.0"
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.yarn/**/* binary
cjs/**/* binary
dist/**/* binary
esm/**/* binary
package-lock.json binary
yarn.lock binary
86 changes: 57 additions & 29 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,87 @@ name: Continuous Integration
on:
push:
branches:
- master
- main
- next
pull_request:
branches:
- '**'

permissions:
actions: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
security-events: write
statuses: write
contents: read

jobs:
test:
name: Test on node ${{ matrix.node }}
name: Check, test, and build
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22.18.0
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm check
- run: pnpm test:types
- run: pnpm test:code
- run: pnpm build
- uses: actions/upload-artifact@v4
with:
name: package-build
path: |
cjs
esm
dist

package-smoke-test:
name: Node ${{ matrix.node }} package smoke test
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [18]
node: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: package-build
path: .
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies and test
run: |
yarn install --immutable
yarn build
yarn test
- name: Verify CommonJS entry
run: node -e "const Sqids = require('./cjs/sqids.js').default; const sqids = new Sqids(); if (sqids.decode(sqids.encode([1, 2, 3])).join() !== '1,2,3') process.exit(1)"
- name: Verify ESM entry
run: node --input-type=module -e "import Sqids from './esm/sqids.js'; const sqids = new Sqids(); if (sqids.decode(sqids.encode([1, 2, 3])).join() !== '1,2,3') process.exit(1)"
- name: Verify UMD browser global
run: node -e "const fs = require('node:fs'), vm = require('node:vm'); const context = { Blob }; vm.runInNewContext(fs.readFileSync('./dist/sqids.js', 'utf8'), context); const sqids = new context.Sqids(); if (sqids.decode(sqids.encode([1, 2, 3])).join() !== '1,2,3') process.exit(1)"

publish:
name: Publish package to NPM
needs: test
name: Publish package
needs: [test, package-smoke-test]
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
if: github.actor != 'github-actions[bot]' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
permissions:
contents: write
issues: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
- name: Build and release
run: |
yarn install --immutable
yarn build
yarn release
node-version: 22.18.0
cache: pnpm
registry-url: https://registry.npmjs.org
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm release
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 3 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
.vscode
.eslintignore
.eslintrc.js
.prettierignore
.editorconfig
tsconfig.json
babel.config.js
jest.config.js
prettier.config.js
vite.config.ts
webpack.config.js
*.tsbuildinfo

/.yarn/*

!/.yarn/patches
!/.yarn/plugins
!/.yarn/releases
!/.yarn/sdks

# Swap the comments on the following lines if you wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
# !/.yarn/cache
/.pnp.*
# pnpm
.pnpm-store/
pnpm-debug.log*

# Logs
logs/
*.log

# Cache
.eslintcache
.idea
.npm
.vscode
.yarnclean

# Directories
coverage/
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec commitlint --edit "$1"
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
.vscode
.github
.config
.yarn
363 changes: 0 additions & 363 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

8 changes: 0 additions & 8 deletions .yarn/plugins/@yarnpkg/plugin-postinstall-dev.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

Loading
Loading