Skip to content

Commit 6ce556d

Browse files
Update CI/CD workflows, enhance README, and refactor code
- Modified CI workflow to include packaging step. - Adjusted Dependabot configuration for open pull requests and schedule. - Updated Release workflow for improved Node.js setup and packaging. - Added development prerequisites and build instructions to README. - Refactored import statements in gcloud.ts and proxy.ts for consistency. - Removed unnecessary comments in updater.ts. - Added compiled executable to the bin directory.
1 parent 336d09a commit 6ce556d

File tree

8 files changed

+42
-22
lines changed

8 files changed

+42
-22
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,24 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v4
19+
1920
- name: Use Node.js ${{ matrix.node-version }}
2021
uses: actions/setup-node@v4
2122
with:
2223
node-version: ${{ matrix.node-version }}
23-
cache: "npm"
24-
cache-dependency-path: cloudsqlctl/package-lock.json
24+
cache: 'npm'
2525

2626
- name: Install dependencies
2727
run: npm ci
28-
working-directory: ./cloudsqlctl
2928

3029
- name: Lint
3130
run: npm run lint
32-
working-directory: ./cloudsqlctl
3331

3432
- name: Build
3533
run: npm run build
36-
working-directory: ./cloudsqlctl
3734

3835
- name: Test
3936
run: npm test
40-
working-directory: ./cloudsqlctl
37+
38+
- name: Package
39+
run: npm run package

.github/workflows/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ updates:
44
directory: '/'
55
schedule:
66
interval: 'weekly'
7-
open-pull-requests-limit: 10
7+
open-pull-requests-limit: 5
88
- package-ecosystem: 'github-actions'
99
directory: '/'
1010
schedule:
11-
interval: 'weekly'
11+
interval: 'monthly'

.github/workflows/release.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- 'v*'
77

88
jobs:
99
release:
@@ -14,27 +14,24 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616

17-
- name: Setup Node.js
17+
- name: Use Node.js 22.x
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version: "22"
21-
cache: "npm"
22-
cache-dependency-path: cloudsqlctl/package-lock.json
20+
node-version: 22.x
21+
cache: 'npm'
2322

2423
- name: Install dependencies
2524
run: npm ci
26-
working-directory: ./cloudsqlctl
2725

2826
- name: Build
2927
run: npm run build
30-
working-directory: ./cloudsqlctl
3128

32-
- name: Package EXE
29+
- name: Package
3330
run: npm run package
34-
working-directory: ./cloudsqlctl
3531

36-
- name: Create Release
32+
- name: Release
3733
uses: softprops/action-gh-release@v2
34+
if: startsWith(github.ref, 'refs/tags/')
3835
with:
39-
files: ./cloudsqlctl/dist/cloudsqlctl.exe
36+
files: bin/cloudsqlctl.exe
4037
generate_release_notes: true

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,30 @@ If you encounter issues:
7373

7474
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
7575

76+
## Development
77+
78+
### Prerequisites
79+
80+
- Node.js 22 (LTS)
81+
- PowerShell 5.1 or later
82+
83+
### Build
84+
85+
To build the project and generate the single executable:
86+
87+
```powershell
88+
# Install dependencies
89+
npm install
90+
91+
# Build the source code (TypeScript -> CJS)
92+
npm run build
93+
94+
# Package into a single executable (SEA)
95+
npm run package
96+
```
97+
98+
The executable will be generated at `bin/cloudsqlctl.exe`.
99+
76100
## License
77101

78102
MIT

bin/cloudsqlctl.exe

83.4 MB
Binary file not shown.

src/core/gcloud.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import execa from 'execa';
1+
import { execa } from 'execa';
22
import { logger } from './logger.js';
33

44
export interface GcloudInstance {

src/core/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs-extra';
33
import path from 'path';
44
import { PATHS } from './config.js';
55
import { logger } from './logger.js';
6-
import execa from 'execa';
6+
import { execa } from 'execa';
77

88
export async function isRunning(): Promise<boolean> {
99
if (!await fs.pathExists(PATHS.PID_FILE)) {

src/core/updater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export async function downloadProxy(version: string) {
3939
try {
4040
const releaseUrl = `https://api.github.com/repos/${GITHUB_REPO}/releases/tags/${version}`;
4141
const response = await axios.get(releaseUrl);
42-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4342
const assets = response.data.assets;
43+
logger.info(`Found ${assets.length} assets: ${assets.map((a: any) => a.name).join(', ')}`);
4444
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4545
const asset = assets.find((a: any) => a.name === ASSET_NAME);
4646
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)