buildx-cli 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,21 +1,11 @@
1
1
  {
2
2
  "name": "buildx-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool for BuildX API with authentication and schema synchronization",
5
5
  "type": "module",
6
- "main": "dist/index.js",
6
+ "main": "index.js",
7
7
  "bin": {
8
- "buildx": "dist/index.js"
9
- },
10
- "scripts": {
11
- "clean": "rimraf build",
12
- "build": "yarn clean && rollup -c",
13
- "dev": "tsx src/index.ts",
14
- "start": "node dist/index.js",
15
- "test": "jest",
16
- "lint": "eslint src/**/*.ts",
17
- "format": "prettier --write src/**/*.ts",
18
- "prepublishOnly": "npm run build"
8
+ "buildx": "index.js"
19
9
  },
20
10
  "keywords": [
21
11
  "cli",
@@ -66,4 +56,4 @@
66
56
  "engines": {
67
57
  "node": ">=16.0.0"
68
58
  }
69
- }
59
+ }
@@ -1,242 +0,0 @@
1
- name: Auto Publish and Deploy Documentation
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- paths-ignore:
8
- - '**.md'
9
- - 'README.md'
10
- workflow_dispatch:
11
-
12
- permissions:
13
- contents: write
14
- packages: write
15
- pages: write
16
- id-token: write
17
-
18
- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20
- concurrency:
21
- group: "pages"
22
- cancel-in-progress: false
23
-
24
- jobs:
25
- publish:
26
- runs-on: ubuntu-latest
27
- environment: production
28
- steps:
29
- - name: Checkout code
30
- uses: actions/checkout@v4
31
- with:
32
- fetch-depth: 0
33
- token: ${{ secrets.GITHUB_TOKEN }}
34
-
35
- - name: Setup Node.js
36
- uses: actions/setup-node@v4
37
- with:
38
- node-version: '22'
39
- registry-url: 'https://registry.npmjs.org'
40
- cache: 'yarn'
41
-
42
- - name: Check if NPM_TOKEN is set
43
- run: |
44
- if [ -z "$NPM_TOKEN" ]; then
45
- echo "NPM_TOKEN is not set"
46
- exit 1
47
- fi
48
- echo "NPM_TOKEN is set"
49
- echo "Token length: ${#NPM_TOKEN}"
50
- env:
51
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52
-
53
- - name: Setup npm authentication
54
- run: |
55
- echo "Setting up npm authentication..."
56
- npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
57
- echo "NPM authentication configured"
58
- echo "Testing authentication..."
59
- npm whoami
60
- env:
61
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
62
-
63
- - name: Install dependencies with dev dependencies
64
- run: yarn install
65
-
66
- - name: Run validate
67
- run: yarn validate
68
-
69
- - name: Determine version bump type
70
- id: version-bump
71
- run: |
72
- # Get the last commit message
73
- COMMIT_MSG=$(git log -1 --pretty=%B)
74
- echo "Commit message: $COMMIT_MSG"
75
-
76
- # Check for version bump indicators in commit message
77
- if echo "$COMMIT_MSG" | grep -q "\[major\]\|\[breaking\]"; then
78
- echo "bump_type=major" >> $GITHUB_OUTPUT
79
- echo "Version bump: MAJOR (from commit message)"
80
- elif echo "$COMMIT_MSG" | grep -q "\[minor\]\|\[feature\]"; then
81
- echo "bump_type=minor" >> $GITHUB_OUTPUT
82
- echo "Version bump: MINOR (from commit message)"
83
- elif echo "$COMMIT_MSG" | grep -q "\[patch\]\|\[fix\]\|\[bug\]"; then
84
- echo "bump_type=patch" >> $GITHUB_OUTPUT
85
- echo "Version bump: PATCH (from commit message)"
86
- else
87
- echo "bump_type=patch" >> $GITHUB_OUTPUT
88
- echo "Version bump: PATCH (automatic fallback)"
89
- fi
90
-
91
- - name: Bump version and publish
92
- run: |
93
- # Configure git
94
- git config --local user.email "action@github.com"
95
- git config --local user.name "GitHub Action"
96
-
97
- # Get bump type
98
- BUMP_TYPE=${{ steps.version-bump.outputs.bump_type }}
99
-
100
- # Show current version
101
- CURRENT_VERSION=$(node -p "require('./package.json').version")
102
- echo "Current version: $CURRENT_VERSION"
103
-
104
- # Show package info
105
- PACKAGE_NAME=$(node -p "require('./package.json').name")
106
- echo "Package name: $PACKAGE_NAME"
107
-
108
- # Check npm registry
109
- echo "NPM registry: $(npm config get registry)"
110
-
111
- # Check if logged in
112
- echo "NPM whoami:"
113
- npm whoami || echo "Not logged in to npm"
114
-
115
- # Bump version using yarn (without git operations)
116
- yarn version --$BUMP_TYPE --message "chore: bump version to $NEW_VERSION [skip ci]"
117
-
118
- # Get new version
119
- NEW_VERSION=$(node -p "require('./package.json').version")
120
- echo "New version: $NEW_VERSION"
121
-
122
- # Build project
123
- yarn build
124
-
125
- # Push changes
126
- git push origin HEAD:main
127
-
128
- # Create and push tag
129
- git push origin "v$NEW_VERSION"
130
-
131
- # Publish to npm using yarn with public access
132
- echo "Publishing to npm..."
133
- echo "Package: $PACKAGE_NAME"
134
- echo "Version: $NEW_VERSION"
135
-
136
- npm publish ./build --access public
137
-
138
- echo "✅ Published version $NEW_VERSION to npm"
139
- env:
140
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
141
-
142
- - name: Generate documentation
143
- run: |
144
- echo "Generating documentation..."
145
- yarn docs:clean
146
- yarn docs
147
- echo "✅ Documentation generated"
148
-
149
- - name: Commit and push documentation
150
- run: |
151
- # Configure git
152
- git config --local user.email "action@github.com"
153
- git config --local user.name "GitHub Action"
154
-
155
- # Check if there are changes in docs
156
- if git diff --quiet docs/; then
157
- echo "No documentation changes to commit"
158
- else
159
- # Add documentation changes
160
- git add docs/
161
-
162
- # Get the new version
163
- NEW_VERSION=$(node -p "require('./package.json').version")
164
-
165
- # Commit with [doc] tag
166
- git commit -m "[doc] Update documentation for version $NEW_VERSION"
167
-
168
- # Push documentation changes
169
- git push origin HEAD:main
170
-
171
- echo "✅ Documentation committed and pushed"
172
- fi
173
-
174
- - name: Update develop branch with new version
175
- run: |
176
- # Configure git
177
- git config --local user.email "action@github.com"
178
- git config --local user.name "GitHub Action"
179
-
180
- # Get the new version that was just published
181
- NEW_VERSION=$(node -p "require('./package.json').version")
182
- echo "Updating develop branch with version: $NEW_VERSION"
183
-
184
- # Fetch all branches
185
- git fetch origin
186
-
187
- # Checkout develop branch
188
- git checkout develop
189
-
190
- # Now merge the documentation changes from main
191
- echo "Merging documentation changes from main..."
192
-
193
- # Try to merge with strategy to handle conflicts
194
- if git merge origin/main --no-edit -m "chore: merge docs from main [skip ci]" --strategy=recursive -X theirs; then
195
- echo "✅ Merge successful"
196
- else
197
- echo "⚠️ Merge conflict detected, resolving..."
198
-
199
- # Check if there are conflicts
200
- if git diff --name-only --diff-filter=U | grep -q .; then
201
- echo "Resolving conflicts by keeping main version for docs..."
202
-
203
- # For docs conflicts, keep the main version
204
- git checkout --theirs docs/
205
- git add docs/
206
-
207
- # For package.json conflicts, keep the develop version (with updated version)
208
- git checkout --ours package.json
209
- git add package.json
210
-
211
- # Complete the merge
212
- git commit -m "chore: resolve merge conflicts, keep main docs and develop version [skip ci]"
213
- else
214
- echo "No conflicts to resolve"
215
- fi
216
- fi
217
-
218
- # Push all changes to develop
219
- git push origin develop
220
-
221
- echo "✅ Updated develop branch with version $NEW_VERSION and documentation changes"
222
-
223
- - name: Setup Pages
224
- uses: actions/configure-pages@v5
225
-
226
- - name: Build with Jekyll
227
- uses: actions/jekyll-build-pages@v1
228
- with:
229
- source: ./docs/api/html
230
- destination: ./_site
231
-
232
- - name: Upload artifact
233
- uses: actions/upload-pages-artifact@v3
234
-
235
- - name: Deploy to GitHub Pages
236
- id: deployment
237
- uses: actions/deploy-pages@v4
238
-
239
- - name: Cleanup uncommitted changes
240
- run: |
241
- git clean -f
242
- echo "✅ Cleanup completed"
@@ -1,182 +0,0 @@
1
- name: Create Pull Request for Deployment
2
- on:
3
- push:
4
- branches:
5
- - develop
6
- - staging
7
- - feature/*
8
- paths-ignore:
9
- - '**.md'
10
- - 'docs/**'
11
- - 'README.md'
12
-
13
- permissions:
14
- contents: write
15
- pull-requests: write
16
-
17
- jobs:
18
- create-pr:
19
- runs-on: ubuntu-latest
20
-
21
- steps:
22
- - name: Checkout code
23
- uses: actions/checkout@v4
24
- with:
25
- fetch-depth: 0
26
- token: ${{ secrets.GITHUB_TOKEN }}
27
-
28
- - name: Setup Node.js
29
- uses: actions/setup-node@v4
30
- with:
31
- node-version: '22'
32
- cache: 'yarn'
33
-
34
- - name: Install dependencies
35
- run: yarn install --frozen-lockfile
36
-
37
- - name: Run validate
38
- run: yarn validate
39
-
40
- - name: Build project
41
- run: yarn build
42
-
43
- - name: Fetch main and develop
44
- run: |
45
- git fetch origin main
46
- git fetch origin develop
47
-
48
- - name: Check diff
49
- id: diff
50
- run: |
51
- COUNT=$(git rev-list --right-only --count origin/main...origin/develop)
52
- echo "commits_ahead=$COUNT"
53
- echo "commits_ahead=$COUNT" >> "$GITHUB_OUTPUT"
54
-
55
- - name: Get repository collaborators
56
- id: collaborators
57
- if: steps.diff.outputs.commits_ahead != '0'
58
- run: |
59
- # Get all collaborators with write/admin access
60
- COLLABORATORS=$(gh api repos/${{ github.repository }}/collaborators --jq '.[] | select(.permissions.admin == true or .permissions.maintain == true or .permissions.push == true) | .login' | tr '\n' ',' | sed 's/,$//')
61
- echo "collaborators=$COLLABORATORS" >> $GITHUB_OUTPUT
62
-
63
- # Get team members using GraphQL (more efficient)
64
- TEAM_MEMBERS=$(gh api graphql -F query='
65
- query($org: String!) {
66
- organization(login: $org) {
67
- teams(first: 100) {
68
- nodes {
69
- members(first: 100) {
70
- nodes {
71
- login
72
- }
73
- }
74
- }
75
- }
76
- }
77
- }' -F org="${{ github.repository_owner }}" --jq '.data.organization.teams.nodes[].members.nodes[].login' 2>/dev/null | tr '\n' ',' | sed 's/,$//' || echo "")
78
-
79
- echo "team_members=$TEAM_MEMBERS" >> $GITHUB_OUTPUT
80
-
81
- - name: Check if PR creator is the only eligible reviewer
82
- id: check_eligibility
83
- if: steps.diff.outputs.commits_ahead != '0'
84
- env:
85
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86
- run: |
87
- PR_CREATOR="${{ github.actor }}"
88
- COLLABORATORS="${{ steps.collaborators.outputs.collaborators }}"
89
- TEAM_MEMBERS="${{ steps.collaborators.outputs.team_members }}"
90
-
91
- # Combine all eligible reviewers
92
- ALL_REVIEWERS=""
93
- if [ ! -z "$COLLABORATORS" ]; then
94
- ALL_REVIEWERS="$COLLABORATORS"
95
- fi
96
- if [ ! -z "$TEAM_MEMBERS" ]; then
97
- if [ ! -z "$ALL_REVIEWERS" ]; then
98
- ALL_REVIEWERS="$ALL_REVIEWERS,$TEAM_MEMBERS"
99
- else
100
- ALL_REVIEWERS="$TEAM_MEMBERS"
101
- fi
102
- fi
103
-
104
- # Remove duplicates and the PR creator
105
- UNIQUE_REVIEWERS=$(echo "$ALL_REVIEWERS" | tr ',' '\n' | grep -v "^$PR_CREATOR$" | sort -u | tr '\n' ',' | sed 's/,$//')
106
-
107
- # Count unique reviewers (excluding PR creator)
108
- REVIEWER_COUNT=$(echo "$UNIQUE_REVIEWERS" | tr ',' '\n' | grep -v "^$" | wc -l)
109
-
110
- echo "reviewer_count=$REVIEWER_COUNT" >> $GITHUB_OUTPUT
111
- echo "unique_reviewers=$UNIQUE_REVIEWERS" >> $GITHUB_OUTPUT
112
- echo "pr_creator=$PR_CREATOR" >> $GITHUB_OUTPUT
113
-
114
- # Check if PR creator is the only eligible reviewer
115
- if [ "$REVIEWER_COUNT" -eq 0 ]; then
116
- echo "is_only_reviewer=true" >> $GITHUB_OUTPUT
117
- echo "Auto-assigning deployment PR to $PR_CREATOR (only eligible reviewer)"
118
- else
119
- echo "is_only_reviewer=false" >> $GITHUB_OUTPUT
120
- echo "Deployment PR has $REVIEWER_COUNT other eligible reviewers: $UNIQUE_REVIEWERS"
121
- fi
122
-
123
- - name: Create deployment PR
124
- if: steps.diff.outputs.commits_ahead != '0'
125
- env:
126
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127
- run: |
128
- set -euo pipefail
129
-
130
- BRANCH="deploy/${{ github.ref_name }}-${{ github.sha }}"
131
-
132
- git config --global user.name "github-actions"
133
- git config --global user.email "github-actions@github.com"
134
-
135
- git checkout -b "$BRANCH" refs/remotes/origin/develop
136
- git push -u origin "$BRANCH"
137
-
138
- # Ensure labels exist
139
- gh label create deployment --description "Deployment PR" --color "#1d76db" --force || true
140
- gh label create auto-generated --description "Created by GitHub Action" --color "#ededed" --force || true
141
- gh label create auto-assigned --description "Auto-assigned to author" --color "#0366d6" --force || true
142
-
143
- # Determine assignee and reviewers based on eligibility check
144
- if [ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ]; then
145
- ASSIGNEE="${{ steps.check_eligibility.outputs.pr_creator }}"
146
- LABELS="deployment,auto-generated,auto-assigned"
147
- REVIEWERS=""
148
- echo "Auto-assigning deployment PR to $ASSIGNEE (only eligible reviewer)"
149
- else
150
- ASSIGNEE="${{ github.actor }}"
151
- LABELS="deployment,auto-generated"
152
- REVIEWERS="${{ steps.check_eligibility.outputs.unique_reviewers }}"
153
- echo "Assigning deployment PR to $ASSIGNEE with reviewers: $REVIEWERS"
154
- fi
155
-
156
- # Create PR with or without reviewers
157
- if [ -z "$REVIEWERS" ]; then
158
- gh pr create \
159
- --base main \
160
- --head "$BRANCH" \
161
- --title "🚀 Deploy: ${BRANCH#deploy/} → main" \
162
- --body "Auto-generated deployment PR for **${{ github.ref_name }}**
163
-
164
- $([ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ] && echo "🤖 Auto-assigned to $ASSIGNEE (only eligible reviewer)" || echo "👥 Assigned to $ASSIGNEE (other reviewers available: ${{ steps.check_eligibility.outputs.unique_reviewers }})")" \
165
- --label "$LABELS" \
166
- --assignee "$ASSIGNEE"
167
- else
168
- gh pr create \
169
- --base main \
170
- --head "$BRANCH" \
171
- --title "🚀 Deploy: ${BRANCH#deploy/} → main" \
172
- --body "Auto-generated deployment PR for **${{ github.ref_name }}**
173
-
174
- $([ "${{ steps.check_eligibility.outputs.is_only_reviewer }}" == "true" ] && echo "🤖 Auto-assigned to $ASSIGNEE (only eligible reviewer)" || echo "👥 Assigned to $ASSIGNEE with reviewers: $REVIEWERS")" \
175
- --label "$LABELS" \
176
- --assignee "$ASSIGNEE" \
177
- --reviewer "$REVIEWERS"
178
- fi
179
-
180
- - name: No diff – skip PR
181
- if: steps.diff.outputs.commits_ahead == '0'
182
- run: echo "develop is identical to main – no deployment PR needed."
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "semi": true,
3
- "trailingComma": "es5",
4
- "singleQuote": true,
5
- "printWidth": 80,
6
- "tabWidth": 4,
7
- "useTabs": true
8
- }
package/eslint.config.mjs DELETED
@@ -1,119 +0,0 @@
1
- import globals from "globals";
2
- import typescriptEslint from "@typescript-eslint/eslint-plugin";
3
- import tsParser from "@typescript-eslint/parser";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import js from "@eslint/js";
7
- import { FlatCompat } from "@eslint/eslintrc";
8
-
9
-
10
- const __filename = fileURLToPath(import.meta.url);
11
- const __dirname = path.dirname(__filename);
12
- const compat = new FlatCompat({
13
- baseDirectory: __dirname,
14
- recommendedConfig: js.configs.recommended,
15
- allConfig: js.configs.all
16
- });
17
-
18
- export default [
19
- {
20
- ignores: ["build/**", "dist/**", "node_modules/**", "scripts/**", "rules/**", "docs/**"], // Excludes all files and subdirectories in `dest`
21
- },
22
- ...compat.extends(
23
- "eslint:recommended",
24
- "plugin:vitest-globals/recommended",
25
- "plugin:@typescript-eslint/recommended",
26
- "plugin:import/recommended",
27
- "plugin:import/typescript"
28
- ),
29
- {
30
- plugins: {
31
- "@typescript-eslint": typescriptEslint,
32
- },
33
- languageOptions: {
34
- parser: tsParser,
35
- ecmaVersion: 2020,
36
- sourceType: "module",
37
- globals: {
38
- ...globals.node,
39
- vitest: "readonly",
40
- },
41
- parserOptions: {
42
- "ecmaVersion": 2020,
43
- "sourceType": "module",
44
- "project": "./tsconfig.json"
45
- },
46
- },
47
- files: ["**/*.ts"],
48
- rules: {
49
-
50
- "@typescript-eslint/no-explicit-any": "off",
51
- "@typescript-eslint/no-unused-vars": ["warn", {
52
- argsIgnorePattern: "^_",
53
- varsIgnorePattern: "^_",
54
- caughtErrors: "none",
55
- }],
56
- indent: ["error", "tab", {
57
- SwitchCase: 1,
58
- }],
59
-
60
- "import/no-unresolved": "error",
61
- "import/named": "error",
62
- "import/default": "error",
63
- "import/namespace": "error",
64
-
65
- "no-tabs": 0,
66
- quotes: ["error", "double"],
67
- "max-len": 0,
68
- semi: "error",
69
- "no-debugger": "warn",
70
- "object-curly-spacing": ["error", "always"],
71
-
72
- "comma-spacing": ["error", {
73
- before: false,
74
- after: true,
75
- }],
76
-
77
- "no-multiple-empty-lines": "error",
78
- "no-implicit-any": "off",
79
- "prefer-const": "off",
80
- "no-undef": "error",
81
-
82
- // No console.log
83
- "no-console": "warn",
84
-
85
- },
86
- "settings": {
87
- "import/resolver": {
88
- "typescript": {
89
- "alwaysTryTypes": true,
90
- "project": "./tsconfig.json"
91
- }
92
- }
93
- }
94
- },
95
- {
96
- files: ["**/*.cjs"],
97
- languageOptions: {
98
- ecmaVersion: 2020,
99
- sourceType: "script", // CommonJS files are treated as scripts
100
- globals: {
101
- require: "readonly",
102
- module: "readonly",
103
- exports: "readonly",
104
- process: "readonly",
105
- __dirname: "readonly",
106
- },
107
- },
108
- rules: {
109
- "@typescript-eslint/no-require-imports": "off",
110
- // "no-undef": "off"
111
- }
112
- },
113
- {
114
- files: ["eslint.config.mjs"],
115
- rules: {
116
- "import/no-unresolved": "off"
117
- }
118
- }
119
- ];
package/jest.config.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- roots: ['<rootDir>/src'],
5
- testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
6
- transform: {
7
- '^.+\\.ts$': 'ts-jest',
8
- },
9
- collectCoverageFrom: [
10
- 'src/**/*.ts',
11
- '!src/**/*.d.ts',
12
- '!src/**/__tests__/**',
13
- ],
14
- coverageDirectory: 'coverage',
15
- coverageReporters: ['text', 'lcov', 'html'],
16
- };
package/rollup.config.mjs DELETED
@@ -1,64 +0,0 @@
1
- import esbuild from 'rollup-plugin-esbuild';
2
- import dts from 'rollup-plugin-dts';
3
- import { nodeResolve } from '@rollup/plugin-node-resolve';
4
- import commonjs from '@rollup/plugin-commonjs';
5
- import terser from '@rollup/plugin-terser';
6
- import json from '@rollup/plugin-json';
7
-
8
- const useTerser = true;
9
-
10
- const external = []
11
-
12
- const plugins = [
13
- nodeResolve({
14
- preferBuiltins: true,
15
- exportConditions: ['node']
16
- }),
17
- commonjs({
18
- ignoreDynamicRequires: true
19
- }),
20
- esbuild({
21
- target: 'node16',
22
- platform: 'node'
23
- }),
24
- json()
25
- ];
26
-
27
- if (useTerser) {
28
- plugins.push(terser(
29
- {
30
- mangle: false, // Keep variable names
31
- module: true, // Tells terser you're using ES modules
32
- keep_classnames: true,
33
- keep_fnames: true,
34
- }
35
- ))
36
- }
37
-
38
- export default [
39
- {
40
- input: 'src/index.ts',
41
- output: [{
42
- dir: 'dist',
43
- format: 'esm',
44
- entryFileNames: 'index.js',
45
- exports: 'named',
46
- },
47
- {
48
- dir: 'dist',
49
- format: 'cjs',
50
- entryFileNames: 'index.cjs',
51
- exports: 'named',
52
- }],
53
- external,
54
- plugins
55
- },
56
- {
57
- input: 'src/index.ts',
58
- output: [{
59
- dir: 'dist',
60
- format: 'esm',
61
- entryFileNames: 'index.d.ts',
62
- }],
63
- plugins: [dts()]
64
- }]