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
5 changes: 5 additions & 0 deletions .changeset/bundled-typescript-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@team-plain/cli": patch
---

Ship a bundled ESM build of the CLI, now written in TypeScript, in place of the raw source, and publish it under the MIT licence.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ updates:
- "*"
update-types:
- "major"
ignore:
# Tracks the minimum supported runtime in engines.node, not latest.
- dependency-name: "@types/node"
update-types:
- "version-update:semver-major"
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ jobs:
- name: Check formatting
run: pnpm format:check

- name: Typecheck
run: pnpm typecheck

- name: Build
run: pnpm build

- name: Check the built CLI stays within its size limit
run: pnpm exec size-limit

- name: Check the package for publishing problems
run: pnpm exec publint --strict

test:
name: Test (Node ${{ matrix.node }})
runs-on: ubuntu-latest
Expand All @@ -52,17 +64,20 @@ jobs:
cache: true
require-lockfile: true

- name: Pack the CLI
run: pnpm pack --pack-destination "$RUNNER_TEMP"
- name: Build and pack the CLI
run: |
pnpm build
pnpm pack --pack-destination "$RUNNER_TEMP"

# Customers run the CLI on their own Node.js, not the one in .nvmrc.
- name: Set up Node.js ${{ matrix.node }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node }}

# Node.js 22 needs the flag to run TypeScript; on 24 it's on by default.
- name: Test
run: node --test
run: node --experimental-strip-types --test test/*.test.ts

- name: Install the packed CLI and run it
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.DS_Store
.DS_Store
dist
8 changes: 8 additions & 0 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "@team-plain/cli",
"path": "dist/index.mjs",
"limit": "5 kB",
"brotli": false
}
]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Not Just Tickets Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"includes": ["**/*.js", "**/*.json", "**/*.md", "**/*.yml"]
"includes": ["**/*.ts", "**/*.json", "**/*.yml", "!**/dist"]
}
}
20 changes: 14 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,41 @@
"private": false,
"version": "1.0.0",
"description": "CLI for interacting with the Plain API",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/team-plain/cli.git"
},
"type": "module",
"main": "./src/index.js",
"bin": {
"plain": "./src/index.js"
"plain": "./dist/index.mjs"
},
"files": [
"src"
"dist"
],
"engines": {
"node": ">=22.12.0"
},
"scripts": {
"build": "tsdown",
"typecheck": "tsc",
"lint": "biome lint .",
"format": "biome format --write .",
"format:check": "biome format .",
"check": "biome check --write .",
"test": "pnpm build && node --test test/*.test.ts",
"changeset": "changeset",
"release": "changeset publish",
"test": "node --test"
"release": "pnpm build && changeset publish"
},
"devDependencies": {
"@biomejs/biome": "^2.5.14",
"@changesets/cli": "^3.0.3"
"@changesets/cli": "^3.0.3",
"@size-limit/file": "^14.1.0",
"@types/node": "^22.20.4",
"publint": "^0.3.24",
"size-limit": "^14.1.0",
"tsdown": "^0.23.0",
"typescript": "^7.0.2"
},
"dependencies": {
"@team-plain/graphql": "^3.2.0",
Expand Down
Loading
Loading