@somewhatabstract/x 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/codeql/codeql-config.yml +5 -0
- package/.github/workflows/codeql-analysis.yml +71 -0
- package/.github/workflows/nodejs.yml +131 -0
- package/.github/workflows/release.yml +98 -0
- package/CODE_OF_CONDUCT.md +76 -0
- package/CONTRIBUTING.md +70 -0
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/x.d.mts +1 -0
- package/dist/x.mjs +12 -0
- package/package.json +43 -0
- package/src/__tests__/x-impl.test.ts +15 -0
- package/src/bin/x.ts +3 -0
- package/src/x-impl.ts +5 -0
- package/tsconfig-types.json +7 -0
- package/tsconfig.json +29 -0
- package/tsdown.config.ts +24 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Changesets
|
|
2
|
+
|
|
3
|
+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
+
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
+
|
|
7
|
+
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
+
"changelog": "@changesets/cli/changelog",
|
|
4
|
+
"commit": false,
|
|
5
|
+
"fixed": [],
|
|
6
|
+
"linked": [],
|
|
7
|
+
"access": "restricted",
|
|
8
|
+
"baseBranch": "main",
|
|
9
|
+
"updateInternalDependencies": "patch",
|
|
10
|
+
"ignore": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ main ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ main ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '16 7 * * 2'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
37
|
+
# Learn more:
|
|
38
|
+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout repository
|
|
42
|
+
uses: actions/checkout@v5
|
|
43
|
+
|
|
44
|
+
# Initializes the CodeQL tools for scanning.
|
|
45
|
+
- name: Initialize CodeQL
|
|
46
|
+
uses: github/codeql-action/init@v4
|
|
47
|
+
with:
|
|
48
|
+
languages: ${{ matrix.language }}
|
|
49
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
50
|
+
# By default, queries listed here will override any specified in a config file.
|
|
51
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
52
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
53
|
+
|
|
54
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
55
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
56
|
+
- name: Autobuild
|
|
57
|
+
uses: github/codeql-action/autobuild@v4
|
|
58
|
+
|
|
59
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
60
|
+
# 📚 https://git.io/JvXDl
|
|
61
|
+
|
|
62
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
63
|
+
# and modify them (or add more) to build your code if your project
|
|
64
|
+
# uses a compiled language
|
|
65
|
+
|
|
66
|
+
#- run: |
|
|
67
|
+
# make bootstrap
|
|
68
|
+
# make release
|
|
69
|
+
|
|
70
|
+
- name: Perform CodeQL Analysis
|
|
71
|
+
uses: github/codeql-action/analyze@v4
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
name: Node CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
# ready_for_review is useful for when a PR is converted from "draft" to "not
|
|
6
|
+
# draft".
|
|
7
|
+
types: [edited, opened, synchronize, ready_for_review, reopened]
|
|
8
|
+
|
|
9
|
+
push:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint:
|
|
15
|
+
name: Lint and static types check
|
|
16
|
+
env:
|
|
17
|
+
CI: true
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
os: [ubuntu-latest]
|
|
22
|
+
node-version: [20.x]
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
|
|
26
|
+
- uses: pnpm/action-setup@v4
|
|
27
|
+
name: Install pnpm
|
|
28
|
+
with:
|
|
29
|
+
run_install: false
|
|
30
|
+
package_json_file: 'package.json'
|
|
31
|
+
|
|
32
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
33
|
+
uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: ${{ matrix.node-version }}
|
|
36
|
+
cache: 'pnpm'
|
|
37
|
+
cache-dependency-path: 'pnpm-lock.yaml'
|
|
38
|
+
|
|
39
|
+
- name: Install Dependencies
|
|
40
|
+
shell: bash
|
|
41
|
+
run: pnpm install --frozen-lockfile
|
|
42
|
+
|
|
43
|
+
- name: Lint
|
|
44
|
+
run: pnpm lint
|
|
45
|
+
|
|
46
|
+
- name: Static Types
|
|
47
|
+
run: pnpm typecheck
|
|
48
|
+
|
|
49
|
+
- name: Changesets check
|
|
50
|
+
uses: Khan/actions@check-for-changeset-v1
|
|
51
|
+
if: |
|
|
52
|
+
github.actor != 'dependabot[bot]' &&
|
|
53
|
+
github.actor != 'dependabot-preview[bot]' &&
|
|
54
|
+
github.event_name == 'pull_request'
|
|
55
|
+
with:
|
|
56
|
+
exclude: .github/,.storybook/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
coverage:
|
|
60
|
+
name: Update test coverage
|
|
61
|
+
env:
|
|
62
|
+
CI: true
|
|
63
|
+
runs-on: ${{ matrix.os }}
|
|
64
|
+
strategy:
|
|
65
|
+
matrix:
|
|
66
|
+
os: [ubuntu-latest]
|
|
67
|
+
node-version: [20.x]
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
|
|
71
|
+
- uses: pnpm/action-setup@v4
|
|
72
|
+
name: Install pnpm
|
|
73
|
+
with:
|
|
74
|
+
run_install: false
|
|
75
|
+
package_json_file: 'package.json'
|
|
76
|
+
|
|
77
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
78
|
+
uses: actions/setup-node@v4
|
|
79
|
+
with:
|
|
80
|
+
node-version: ${{ matrix.node-version }}
|
|
81
|
+
cache: 'pnpm'
|
|
82
|
+
cache-dependency-path: 'pnpm-lock.yaml'
|
|
83
|
+
|
|
84
|
+
- name: Install Dependencies
|
|
85
|
+
shell: bash
|
|
86
|
+
run: pnpm install --frozen-lockfile
|
|
87
|
+
|
|
88
|
+
- name: Run tests with coverage
|
|
89
|
+
run: pnpm coverage
|
|
90
|
+
- name: Upload coverage
|
|
91
|
+
uses: codecov/codecov-action@v5
|
|
92
|
+
env:
|
|
93
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
build:
|
|
97
|
+
needs: [coverage, lint]
|
|
98
|
+
name: Build
|
|
99
|
+
env:
|
|
100
|
+
CI: true
|
|
101
|
+
runs-on: ${{ matrix.os }}
|
|
102
|
+
strategy:
|
|
103
|
+
matrix:
|
|
104
|
+
os: [ubuntu-latest]
|
|
105
|
+
node-version: [20.x]
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v4
|
|
108
|
+
|
|
109
|
+
- uses: pnpm/action-setup@v4
|
|
110
|
+
name: Install pnpm
|
|
111
|
+
with:
|
|
112
|
+
run_install: false
|
|
113
|
+
package_json_file: 'package.json'
|
|
114
|
+
|
|
115
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
116
|
+
uses: actions/setup-node@v4
|
|
117
|
+
with:
|
|
118
|
+
node-version: ${{ matrix.node-version }}
|
|
119
|
+
cache: 'pnpm'
|
|
120
|
+
cache-dependency-path: 'pnpm-lock.yaml'
|
|
121
|
+
|
|
122
|
+
- name: Install Dependencies
|
|
123
|
+
shell: bash
|
|
124
|
+
run: pnpm install --frozen-lockfile
|
|
125
|
+
|
|
126
|
+
- name: Run build
|
|
127
|
+
env:
|
|
128
|
+
# We only want to upload bundle analysis for a PR once,
|
|
129
|
+
# so we only provide a token for the ubuntu-latest job.
|
|
130
|
+
CODECOV_TOKEN: ${{ matrix.os == 'ubuntu-latest' && secrets.CODECOV_TOKEN || '' }}
|
|
131
|
+
run: pnpm build
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
# This workflow will run changesets depending on two different scenarios:
|
|
9
|
+
#
|
|
10
|
+
# 1. If we are landing a specific commit into main (Author PR), then
|
|
11
|
+
# changesets will check if there are changes verifying the Markdown files
|
|
12
|
+
# generated automatically:
|
|
13
|
+
#
|
|
14
|
+
# a) There are new versions and there's NO Release PR, then the changesets
|
|
15
|
+
# action will create a new Release PR.
|
|
16
|
+
#
|
|
17
|
+
# b) There's a Release PR, then the changesets action will update the
|
|
18
|
+
# existing Release PR with the new commit.
|
|
19
|
+
#
|
|
20
|
+
# NOTE: (in both cases, changesets will modify the new version in
|
|
21
|
+
# package.json for each package, and will remove the MD files as part of the
|
|
22
|
+
# Release PR).
|
|
23
|
+
#
|
|
24
|
+
# 2. If we are landing the Release PR into main, then the changesets action
|
|
25
|
+
# will publish the changes to npm.
|
|
26
|
+
#
|
|
27
|
+
# For more info about this workflow, see:
|
|
28
|
+
# https://github.com/changesets/action#usage
|
|
29
|
+
jobs:
|
|
30
|
+
release:
|
|
31
|
+
name: Release
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
permissions:
|
|
34
|
+
id-token: write # For provenance and trusted publishing
|
|
35
|
+
contents: write # For creating release PRs
|
|
36
|
+
pull-requests: write # For creating release PRs
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v5
|
|
39
|
+
with:
|
|
40
|
+
fetch-depth: 0
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
|
|
43
|
+
- uses: pnpm/action-setup@v4
|
|
44
|
+
name: Install pnpm
|
|
45
|
+
with:
|
|
46
|
+
run_install: false
|
|
47
|
+
package_json_file: package.json
|
|
48
|
+
|
|
49
|
+
- name: Use Node.js 20.x
|
|
50
|
+
uses: actions/setup-node@v6
|
|
51
|
+
with:
|
|
52
|
+
node-version: 20.x
|
|
53
|
+
cache: pnpm
|
|
54
|
+
cache-dependency-path: pnpm-lock.yaml
|
|
55
|
+
|
|
56
|
+
- name: Install Dependencies
|
|
57
|
+
shell: bash
|
|
58
|
+
run: pnpm install --frozen-lockfile
|
|
59
|
+
|
|
60
|
+
- name: ⬆️ Upgrade npm for OIDC support
|
|
61
|
+
shell: bash
|
|
62
|
+
run: |
|
|
63
|
+
# npm trusted publishing requires npm CLI v11.5.1+
|
|
64
|
+
# Node.js 20 shipped with npm 9.x, so we likely need to upgrade
|
|
65
|
+
|
|
66
|
+
# First, let's check the current npm version, and if it's already
|
|
67
|
+
# sufficient, we can skip the upgrade step.
|
|
68
|
+
CURRENT_NPM_VERSION=$(npm --version)
|
|
69
|
+
REQUIRED_NPM_VERSION="11.5.1"
|
|
70
|
+
|
|
71
|
+
# This sorts the version numbers using `sort -V` and then takes
|
|
72
|
+
# the lowest version.
|
|
73
|
+
LOWEST_NPM_VERSION=$(printf '%s\n' "$REQUIRED_NPM_VERSION" "$CURRENT_NPM_VERSION" | sort -V | head -n1)
|
|
74
|
+
|
|
75
|
+
# If the lowest version is the same as the required version, then we
|
|
76
|
+
# don't need to upgrade as that means our current version is newer.
|
|
77
|
+
if [ "$LOWEST_NPM_VERSION" = "$REQUIRED_NPM_VERSION" ]; then
|
|
78
|
+
echo "✅ npm is already at version $CURRENT_NPM_VERSION"
|
|
79
|
+
else
|
|
80
|
+
npm install -g npm@latest && echo "✅ npm upgraded to $(npm --version)"
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
- name: Create Release Pull Request or Publish to npm
|
|
84
|
+
id: changesets
|
|
85
|
+
uses: changesets/action@v1
|
|
86
|
+
with:
|
|
87
|
+
publish: pnpm publish:ci
|
|
88
|
+
env:
|
|
89
|
+
# We use a Personal Access Token here rather than the GITHUB_TOKEN
|
|
90
|
+
# so that it will trigger our other actions. The token has to be on
|
|
91
|
+
# the account of someone with appropriate access levels and given the
|
|
92
|
+
# repo scope.
|
|
93
|
+
GITHUB_TOKEN: ${{ secrets.BOT_PA_TOKEN }}
|
|
94
|
+
# This is the token used to publish to npm when OIDC trusted
|
|
95
|
+
# publishing isn't yet setup
|
|
96
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
97
|
+
# This is used for the bundle analysis
|
|
98
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at jeff[at]somewhatabstract[dot]com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Contributing to `x`
|
|
2
|
+
|
|
3
|
+
🙇Thank you for your interest in contributing to this 📦.
|
|
4
|
+
|
|
5
|
+
Whether raising an issue, reviewing a pull request, or implementing a change, the participation of others is a wonderful 🎁. Read on to find out how you can get involved.
|
|
6
|
+
|
|
7
|
+
📖 Be sure to read our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
8
|
+
|
|
9
|
+
## 🛑 Bugs And Feature Requests
|
|
10
|
+
|
|
11
|
+
If you find a bug or want to make enhancements to the project, head on over to the [🔗Issues](https://github.com/somewhatabstract/x/issues) section and raise an issue. The issue templates will guide you in providing details that will help others help you.
|
|
12
|
+
|
|
13
|
+
## 💻 Code Changes
|
|
14
|
+
|
|
15
|
+
### ⓵ Making your first change
|
|
16
|
+
|
|
17
|
+
Look for bugs or feature requests with the [good first issue](https://github.com/somewhatabstract/x/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or [help wanted](https://github.com/somewhatabstract/x/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+) labels and have a go at implementing a change. Once your change is ready, you can submit a pull request.
|
|
18
|
+
|
|
19
|
+
### 🎬 Getting Started
|
|
20
|
+
|
|
21
|
+
To work in the `x` repository, follow these steps:
|
|
22
|
+
|
|
23
|
+
1. Clone the repository
|
|
24
|
+
- `gh repo clone somewhatabstract/x`
|
|
25
|
+
- -or-
|
|
26
|
+
- `git clone git@github.com:somewhatabstract/x.git`
|
|
27
|
+
2. Install `pnpm`
|
|
28
|
+
- `corepack enable pnpm`
|
|
29
|
+
- `corepack prepare pnpm --activate`
|
|
30
|
+
3. Run `pnpm install` to install the dependencies
|
|
31
|
+
|
|
32
|
+
You can now work on `x`. We prefer [🔗Visual Studio Code](https://code.visualstudio.com/) as our development environment (it's cross-platform and awesome), but please use what you feel comfortable with (we'll even forgive you for using vim).
|
|
33
|
+
|
|
34
|
+
### 🧪 Code Quality
|
|
35
|
+
|
|
36
|
+
#### Manual
|
|
37
|
+
|
|
38
|
+
We love code reviews. If there are open pull requests, please feel free to review them and provide feedback. Feedback is a gift and code reviews are often a bottleneck in getting new things released. Jump in, even if you don't know anything; you probably know more than you think.
|
|
39
|
+
|
|
40
|
+
💭**REMEMBER** Be kind and considerate. Folks are volunteering their time and code reviews are a moment of vulnerability where a criticism of the code can easily become a criticism of the individual that wrote it.
|
|
41
|
+
|
|
42
|
+
1. Take your time
|
|
43
|
+
2. Consider how you might receive the feedback you are giving if it were attached to code you wrote
|
|
44
|
+
3. Favor asking questions over prescribing solutions.
|
|
45
|
+
|
|
46
|
+
#### Automated
|
|
47
|
+
|
|
48
|
+
To ensure code quality, we use TypeScript, biome, and vitest. These are all executed when you submit a pull request to ensure contributions meet our code quality standards.
|
|
49
|
+
|
|
50
|
+
To execute these operations outside of a pull request, you can use `pnpm`.
|
|
51
|
+
|
|
52
|
+
- `pnpm typecheck`
|
|
53
|
+
- `pnpm lint`
|
|
54
|
+
- `pnpm test`
|
|
55
|
+
|
|
56
|
+
If you make changes that change snapshots, you may need to run tests with the `-u` vitest option and commit the updated snapshot files along with the rest of your contribution.
|
|
57
|
+
|
|
58
|
+
💭**REMEMBER** If you would like to contribute code changes to the project, first make sure there's a corresponding issue for the change you wish to make.
|
|
59
|
+
|
|
60
|
+
## 📦 Build And Publish
|
|
61
|
+
|
|
62
|
+
Anyone can create a local build of the distributed code by running `pnpm build`.
|
|
63
|
+
|
|
64
|
+
Running the build will execute tests first.
|
|
65
|
+
|
|
66
|
+
### Publishing
|
|
67
|
+
|
|
68
|
+
Publishing is automated through our use of [changesets][1]. When a PR is merged, a release PR is created that bundles all the changes since the last release. This PR is then merged and the changeset is published to npm.
|
|
69
|
+
|
|
70
|
+
[1]:https://github.com/changesets/changesets/blob/main/README.md#documentation
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeff Yates
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/dist/x.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/x.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@somewhatabstract/x",
|
|
3
|
+
"private": false,
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"bin": {
|
|
8
|
+
"x": "./dist/x.mjs"
|
|
9
|
+
},
|
|
10
|
+
"version": "0.0.1",
|
|
11
|
+
"description": "Execute any bin defined by any package in a monorepo without needing to install that package",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/somewhatabstract/x/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": "https://github.com/somewhatabstract/x",
|
|
16
|
+
"author": "Jeff Yates <jeff@somewhatabstract.com>",
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">= 20",
|
|
21
|
+
"npm": "please-use-pnpm",
|
|
22
|
+
"yarn": "please-use-pnpm"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@changesets/cli": "^2.29.8",
|
|
26
|
+
"@codecov/rollup-plugin": "^1.9.1",
|
|
27
|
+
"@types/node": "^20.19.29",
|
|
28
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
29
|
+
"tsdown": "0.20.0-beta.3",
|
|
30
|
+
"typescript": "^5.9.3",
|
|
31
|
+
"vitest": "^4.0.17"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsdown",
|
|
35
|
+
"dev": "tsdown --watch",
|
|
36
|
+
"lint": "echo \"No linting configured\"",
|
|
37
|
+
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
38
|
+
"typewatch": "pnpm typecheck --watch",
|
|
39
|
+
"test": "vitest",
|
|
40
|
+
"coverage": "vitest run --coverage",
|
|
41
|
+
"publish:ci": "git diff --stat --exit-code HEAD && pnpm build && changeset publish"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {describe, expect, it, vi} from "vitest";
|
|
2
|
+
import { xImpl } from "../x-impl";
|
|
3
|
+
|
|
4
|
+
describe("xImpl", () => {
|
|
5
|
+
it("should log 'Hello, world!'", () => {
|
|
6
|
+
// Arrange
|
|
7
|
+
const consoleSpy = vi.spyOn(console, "log");
|
|
8
|
+
|
|
9
|
+
// Act
|
|
10
|
+
xImpl();
|
|
11
|
+
|
|
12
|
+
// Assert
|
|
13
|
+
expect(consoleSpy).toHaveBeenCalledWith("Hello, world!");
|
|
14
|
+
});
|
|
15
|
+
});
|
package/src/bin/x.ts
ADDED
package/src/x-impl.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"lib": [
|
|
5
|
+
"es2023"
|
|
6
|
+
],
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"module": "preserve",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"types": [
|
|
12
|
+
"node"
|
|
13
|
+
],
|
|
14
|
+
"typeRoots": [
|
|
15
|
+
"./node_modules/@types"
|
|
16
|
+
],
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"declaration": true,
|
|
20
|
+
"emitDeclarationOnly": true,
|
|
21
|
+
"esModuleInterop": true,
|
|
22
|
+
"isolatedModules": true,
|
|
23
|
+
"verbatimModuleSyntax": true,
|
|
24
|
+
"skipLibCheck": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"src"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/tsdown.config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {codecovRollupPlugin} from "@codecov/rollup-plugin";
|
|
2
|
+
import {defineConfig} from "tsdown";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
entry: ["./src/bin/x.ts"],
|
|
6
|
+
platform: "node",
|
|
7
|
+
sourcemap: false,
|
|
8
|
+
dts: {
|
|
9
|
+
oxc: true,
|
|
10
|
+
tsconfig: "tsconfig-types.json"
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
process.env.CODECOV_TOKEN
|
|
14
|
+
? // This plugin provides bundle analysis from codecov, but does
|
|
15
|
+
// not work locally without additional config, and it does not
|
|
16
|
+
// output size info to the console.
|
|
17
|
+
codecovRollupPlugin({
|
|
18
|
+
enableBundleAnalysis: true, // true when CODECOV_TOKEN set
|
|
19
|
+
bundleName: "x",
|
|
20
|
+
uploadToken: process.env.CODECOV_TOKEN,
|
|
21
|
+
})
|
|
22
|
+
: undefined,
|
|
23
|
+
],
|
|
24
|
+
});
|