@somewhatabstract/x 0.1.0 β 0.1.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/README.md +9 -37
- package/package.json +4 -1
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/codeql/codeql-config.yml +0 -5
- package/.github/dependabot.yml +0 -28
- package/.github/workflows/codeql-analysis.yml +0 -71
- package/.github/workflows/dependabot-pr-approval.yml +0 -36
- package/.github/workflows/nodejs.yml +0 -129
- package/.github/workflows/release.yml +0 -95
- package/.vscode/settings.json +0 -19
- package/CHANGELOG.md +0 -23
- package/CODE_OF_CONDUCT.md +0 -76
- package/CONTRIBUTING.md +0 -70
- package/biome.json +0 -39
- package/src/__tests__/build-environment.test.ts +0 -285
- package/src/__tests__/discover-packages.test.ts +0 -196
- package/src/__tests__/errors.test.ts +0 -59
- package/src/__tests__/execute-script.test.ts +0 -1042
- package/src/__tests__/find-matching-bins.test.ts +0 -506
- package/src/__tests__/find-workspace-root.test.ts +0 -73
- package/src/__tests__/is-node-executable.test.ts +0 -125
- package/src/__tests__/resolve-bin-path.test.ts +0 -344
- package/src/__tests__/x-impl.test.ts +0 -314
- package/src/__tests__/x.test.ts +0 -236
- package/src/bin/x.ts +0 -57
- package/src/build-environment.ts +0 -98
- package/src/discover-packages.ts +0 -35
- package/src/errors.ts +0 -10
- package/src/execute-script.ts +0 -56
- package/src/find-matching-bins.ts +0 -72
- package/src/find-workspace-root.ts +0 -24
- package/src/is-node-executable.ts +0 -16
- package/src/resolve-bin-path.ts +0 -48
- package/src/x-impl.ts +0 -96
- package/tsconfig-types.json +0 -5
- package/tsconfig.json +0 -21
- package/tsdown.config.ts +0 -24
- package/vitest.config.ts +0 -10
package/README.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# x
|
|
2
2
|
|
|
3
|
-
Execute any bin defined by any package
|
|
3
|
+
Execute any bin defined by any package within a monorepo without needing to install that package at the root.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
7
|
`x` is a tool for monorepos that allows you to execute binary scripts from any package in your workspace without installing them globally or in your current package. It automatically discovers all packages in your workspace and finds the matching bin script.
|
|
8
8
|
|
|
9
9
|
**Supports multiple package managers:**
|
|
10
|
+
|
|
10
11
|
- π¦ npm workspaces
|
|
11
12
|
- π§Ά Yarn (classic and modern)
|
|
12
13
|
- π pnpm workspaces
|
|
@@ -28,32 +29,16 @@ yarn global add @somewhatabstract/x
|
|
|
28
29
|
|
|
29
30
|
```bash
|
|
30
31
|
# Execute a bin script from any package in the workspace
|
|
31
|
-
x <script-name> [
|
|
32
|
+
x <script-name> [-- <args...>]
|
|
32
33
|
|
|
33
34
|
# Preview what would be executed (dry-run mode)
|
|
34
35
|
x --dry-run <script-name>
|
|
35
36
|
|
|
36
|
-
# Pass arguments to the script
|
|
37
|
-
x
|
|
38
|
-
x eslint src/ --fix
|
|
39
|
-
x jest --watch
|
|
37
|
+
# Pass arguments to the script (use `--` when args might look like x's own options)
|
|
38
|
+
x my-script -- --flag value
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# Run TypeScript compiler from any package that provides it
|
|
46
|
-
x tsc --noEmit
|
|
47
|
-
|
|
48
|
-
# Run ESLint from any package in the workspace
|
|
49
|
-
x eslint src/
|
|
50
|
-
|
|
51
|
-
# Preview which jest binary would be executed
|
|
52
|
-
x --dry-run jest
|
|
53
|
-
|
|
54
|
-
# Run a custom script with arguments
|
|
55
|
-
x my-custom-script arg1 arg2
|
|
56
|
-
```
|
|
41
|
+
This only executes bin scripts defined by packages in your workspace, not their dependencies. The bin must be an executable file with a shebang (on Unix-like systems) or a directly runnable file (on Windows), or a JS script that can be executed with Node.js.
|
|
57
42
|
|
|
58
43
|
## Features
|
|
59
44
|
|
|
@@ -71,7 +56,9 @@ x my-custom-script arg1 arg2
|
|
|
71
56
|
1. **Workspace Detection**: Uses `@manypkg/find-root` to find the workspace root (supports npm, Yarn, pnpm, Lerna, Bun, Rush)
|
|
72
57
|
2. **Package Discovery**: Uses `@manypkg/get-packages` to discover all packages in the workspace
|
|
73
58
|
3. **Bin Matching**: Searches through package.json files to find bins matching your requested script name
|
|
74
|
-
4. **Execution**: Executes the matched script directly via the OS
|
|
59
|
+
4. **Execution**: Executes the matched script either directly via the OS or via Node.js:
|
|
60
|
+
- **Direct OS execution**: On Unix-like systems this requires an executable file with a shebang; on Windows the bin must be a directly runnable file such as a `.exe`, `.cmd`, or `.bat`.
|
|
61
|
+
- **Node.js execution**: If the bin is a JS file, it is executed with Node.js.
|
|
75
62
|
|
|
76
63
|
## Requirements
|
|
77
64
|
|
|
@@ -113,21 +100,6 @@ pnpm build
|
|
|
113
100
|
./dist/x.mjs <script-name>
|
|
114
101
|
```
|
|
115
102
|
|
|
116
|
-
## Architecture
|
|
117
|
-
|
|
118
|
-
The implementation follows a modular design with separate concerns:
|
|
119
|
-
|
|
120
|
-
- `errors.ts` - Custom error types for user-friendly messages
|
|
121
|
-
- `find-workspace-root.ts` - Workspace root detection using @manypkg/find-root
|
|
122
|
-
- `discover-packages.ts` - Package discovery via @manypkg/get-packages
|
|
123
|
-
- `find-matching-bins.ts` - Bin script matching logic
|
|
124
|
-
- `execute-script.ts` - Direct script execution
|
|
125
|
-
- `build-environment.ts` - npm/pnpm environment variable construction
|
|
126
|
-
- `resolve-bin-path.ts` - Bin path resolution with security validation (path traversal protection)
|
|
127
|
-
- `x-impl.ts` - Main orchestration logic
|
|
128
|
-
- `bin/x.ts` - CLI entry point with yargs
|
|
129
|
-
|
|
130
103
|
## License
|
|
131
104
|
|
|
132
105
|
MIT
|
|
133
|
-
|
package/package.json
CHANGED
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
"bin": {
|
|
9
9
|
"x": "./dist/x.mjs"
|
|
10
10
|
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
11
14
|
"type": "module",
|
|
12
|
-
"version": "0.1.
|
|
15
|
+
"version": "0.1.1",
|
|
13
16
|
"description": "Execute any bin defined by any package in a monorepo without needing to install that package",
|
|
14
17
|
"bugs": {
|
|
15
18
|
"url": "https://github.com/somewhatabstract/x/issues"
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
package/.github/dependabot.yml
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: npm
|
|
9
|
-
directory: "/"
|
|
10
|
-
schedule:
|
|
11
|
-
interval: weekly
|
|
12
|
-
day: saturday
|
|
13
|
-
time: "09:00"
|
|
14
|
-
timezone: America/Chicago
|
|
15
|
-
open-pull-requests-limit: 10
|
|
16
|
-
reviewers:
|
|
17
|
-
- somewhatabstract
|
|
18
|
-
|
|
19
|
-
- package-ecosystem: github-actions
|
|
20
|
-
directory: "/"
|
|
21
|
-
schedule:
|
|
22
|
-
interval: weekly
|
|
23
|
-
day: saturday
|
|
24
|
-
time: "09:00"
|
|
25
|
-
timezone: America/Chicago
|
|
26
|
-
open-pull-requests-limit: 10
|
|
27
|
-
reviewers:
|
|
28
|
-
- somewhatabstract
|
|
@@ -1,71 +0,0 @@
|
|
|
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
43
|
-
|
|
44
|
-
# Initializes the CodeQL tools for scanning.
|
|
45
|
-
- name: Initialize CodeQL
|
|
46
|
-
uses: github/codeql-action/init@710e2945787622b429f8982cacb154faa182de18
|
|
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@710e2945787622b429f8982cacb154faa182de18
|
|
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@710e2945787622b429f8982cacb154faa182de18
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: Dependabot Pull Request Approve and Merge
|
|
2
|
-
|
|
3
|
-
on: pull_request_target
|
|
4
|
-
|
|
5
|
-
permissions:
|
|
6
|
-
pull-requests: write
|
|
7
|
-
contents: write
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
dependabot:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
# Checking the actor will prevent your Action run failing on non-Dependabot
|
|
13
|
-
# PRs but also ensures that it only does work for Dependabot PRs.
|
|
14
|
-
if: ${{ github.actor == 'dependabot[bot]' }}
|
|
15
|
-
steps:
|
|
16
|
-
# This first step will fail if there's no metadata and so the approval
|
|
17
|
-
# will not occur.
|
|
18
|
-
- name: Dependabot metadata
|
|
19
|
-
id: dependabot-metadata
|
|
20
|
-
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a
|
|
21
|
-
with:
|
|
22
|
-
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
23
|
-
# Here the PR gets approved.
|
|
24
|
-
- name: Approve a PR
|
|
25
|
-
run: gh pr review --approve "$PR_URL"
|
|
26
|
-
env:
|
|
27
|
-
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
28
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
-
# Finally, this sets the PR to allow auto-merging for patch and minor
|
|
30
|
-
# updates if all checks pass
|
|
31
|
-
- name: Enable auto-merge for Dependabot PRs
|
|
32
|
-
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
|
33
|
-
run: gh pr merge --auto --squash "$PR_URL"
|
|
34
|
-
env:
|
|
35
|
-
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
36
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,129 +0,0 @@
|
|
|
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
25
|
-
|
|
26
|
-
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
|
|
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@6044e13b5dc448c55e2357c09f80417699197238
|
|
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@973e081efd07f23c4e521e7f4c6b15c9257ee924
|
|
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
|
-
coverage:
|
|
59
|
-
name: Update test coverage
|
|
60
|
-
env:
|
|
61
|
-
CI: true
|
|
62
|
-
runs-on: ${{ matrix.os }}
|
|
63
|
-
strategy:
|
|
64
|
-
matrix:
|
|
65
|
-
os: [ubuntu-latest]
|
|
66
|
-
node-version: [20.x]
|
|
67
|
-
steps:
|
|
68
|
-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
69
|
-
|
|
70
|
-
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
|
|
71
|
-
name: Install pnpm
|
|
72
|
-
with:
|
|
73
|
-
run_install: false
|
|
74
|
-
package_json_file: "package.json"
|
|
75
|
-
|
|
76
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
77
|
-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
|
78
|
-
with:
|
|
79
|
-
node-version: ${{ matrix.node-version }}
|
|
80
|
-
cache: "pnpm"
|
|
81
|
-
cache-dependency-path: "pnpm-lock.yaml"
|
|
82
|
-
|
|
83
|
-
- name: Install Dependencies
|
|
84
|
-
shell: bash
|
|
85
|
-
run: pnpm install --frozen-lockfile
|
|
86
|
-
|
|
87
|
-
- name: Run tests with coverage
|
|
88
|
-
run: pnpm coverage
|
|
89
|
-
- name: Upload coverage
|
|
90
|
-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
|
|
91
|
-
env:
|
|
92
|
-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
93
|
-
|
|
94
|
-
build:
|
|
95
|
-
needs: [coverage, lint]
|
|
96
|
-
name: Build
|
|
97
|
-
env:
|
|
98
|
-
CI: true
|
|
99
|
-
runs-on: ${{ matrix.os }}
|
|
100
|
-
strategy:
|
|
101
|
-
matrix:
|
|
102
|
-
os: [ubuntu-latest]
|
|
103
|
-
node-version: [20.x]
|
|
104
|
-
steps:
|
|
105
|
-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
106
|
-
|
|
107
|
-
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
|
|
108
|
-
name: Install pnpm
|
|
109
|
-
with:
|
|
110
|
-
run_install: false
|
|
111
|
-
package_json_file: "package.json"
|
|
112
|
-
|
|
113
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
114
|
-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
|
115
|
-
with:
|
|
116
|
-
node-version: ${{ matrix.node-version }}
|
|
117
|
-
cache: "pnpm"
|
|
118
|
-
cache-dependency-path: "pnpm-lock.yaml"
|
|
119
|
-
|
|
120
|
-
- name: Install Dependencies
|
|
121
|
-
shell: bash
|
|
122
|
-
run: pnpm install --frozen-lockfile
|
|
123
|
-
|
|
124
|
-
- name: Run build
|
|
125
|
-
env:
|
|
126
|
-
# We only want to upload bundle analysis for a PR once,
|
|
127
|
-
# so we only provide a token for the ubuntu-latest job.
|
|
128
|
-
CODECOV_TOKEN: ${{ matrix.os == 'ubuntu-latest' && secrets.CODECOV_TOKEN || '' }}
|
|
129
|
-
run: pnpm build
|
|
@@ -1,95 +0,0 @@
|
|
|
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd
|
|
39
|
-
with:
|
|
40
|
-
fetch-depth: 0
|
|
41
|
-
persist-credentials: false
|
|
42
|
-
|
|
43
|
-
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061
|
|
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@6044e13b5dc448c55e2357c09f80417699197238
|
|
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@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf
|
|
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 used for the bundle analysis
|
|
95
|
-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
package/.vscode/settings.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.formatOnSave": true,
|
|
3
|
-
"editor.defaultFormatter": "biomejs.biome",
|
|
4
|
-
"editor.codeActionsOnSave": {
|
|
5
|
-
"source.fixAll.biome": "explicit"
|
|
6
|
-
},
|
|
7
|
-
"[javascript]": {
|
|
8
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
9
|
-
},
|
|
10
|
-
"[typescript]": {
|
|
11
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
12
|
-
},
|
|
13
|
-
"[typescriptreact]": {
|
|
14
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
15
|
-
},
|
|
16
|
-
"[json]": {
|
|
17
|
-
"editor.defaultFormatter": "biomejs.biome"
|
|
18
|
-
}
|
|
19
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# @somewhatabstract/x
|
|
2
|
-
|
|
3
|
-
## 0.1.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- 2f64864: Implement monorepo script execution tool with multi-package-manager support
|
|
8
|
-
|
|
9
|
-
- Add support for npm, Yarn, pnpm, Lerna, Bun, and Rush workspaces
|
|
10
|
-
- Implement direct script execution without interpreter detection
|
|
11
|
-
- Add dry-run mode for previewing execution
|
|
12
|
-
- Comprehensive test coverage
|
|
13
|
-
|
|
14
|
-
- 2f64864: Support Node-executable script files (.js, .mjs, .cjs)
|
|
15
|
-
|
|
16
|
-
Bin scripts with `.js`, `.mjs`, or `.cjs` extensions are now automatically
|
|
17
|
-
invoked via the Node executable, matching npm/pnpm behavior. Previously, only
|
|
18
|
-
files with a shebang and executable permissions were supported.
|
|
19
|
-
|
|
20
|
-
### Patch Changes
|
|
21
|
-
|
|
22
|
-
- 2f64864: Add test coverage for all source files including the CLI entry point
|
|
23
|
-
- 2f64864: Add Biome for linting and code formatting.
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
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` (or `pnpm i`) 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 to `main`, a release PR is created that bundles all the changes since the last release. When we are ready to release, this bundled PR is merged to `main` which triggers changesets to publish to npm via trusted publishing.
|
|
69
|
-
|
|
70
|
-
[1]:https://github.com/changesets/changesets/blob/main/README.md#documentation
|