Skip to content

Commit 77680eb

Browse files
committed
chore: move to ESM, pnpm
1 parent 1865487 commit 77680eb

38 files changed

+200
-170
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "npm"
4-
directory: "/"
3+
- package-ecosystem: 'npm'
4+
directory: '/'
55
schedule:
6-
interval: "weekly"
7-
assignees:
8-
- "edosrecki"
9-
- package-ecosystem: "github-actions"
10-
directory: "/"
6+
interval: 'weekly'
7+
ignore:
8+
- dependency-name: '@types/node'
9+
update-types: ['version-update:semver-major']
10+
11+
- package-ecosystem: 'github-actions'
12+
directory: '/'
1113
schedule:
12-
interval: "weekly"
13-
assignees:
14-
- "edosrecki"
14+
interval: 'weekly'

.github/workflows/continuous-deployment.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,29 @@ jobs:
1313
name: Build and deploy app
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Checkout code
16+
- name: 📂 Checkout code
1717
uses: actions/checkout@v6
1818

19-
- name: Setup Node.js
19+
- name: 📦 Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: 💚 Setup Node.js
2023
uses: actions/setup-node@v6
2124
with:
2225
node-version-file: package.json
26+
cache: 'pnpm'
27+
28+
- name: 📦 Install dependencies
29+
run: pnpm install
2330

24-
- name: Install packages
25-
run: npm install
31+
- name: 🔎 Typecheck code
32+
run: pnpm typecheck
2633

27-
- name: Lint
28-
run: npm run lint
34+
- name: 🔎 Lint code
35+
run: pnpm lint
2936

30-
- name: Build & Deploy
31-
run: npx semantic-release
37+
- name: 🚀 Build code and deploy app
38+
run: pnpm exec semantic-release
3239
env:
3340
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3441
HOMEBREW_TOOLS_TOKEN: ${{ secrets.HOMEBREW_TOOLS_TOKEN }}

.github/workflows/continuous-integration.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,30 @@ jobs:
1010
matrix:
1111
node-version: [24, 25]
1212
steps:
13-
- name: Checkout code
13+
- name: 📂 Checkout code
1414
uses: actions/checkout@v6
1515

16-
- name: Setup Node.js
16+
- name: 📦 Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: 💚 Setup Node.js
1720
uses: actions/setup-node@v6
1821
with:
1922
node-version: ${{ matrix.node-version }}
23+
cache: 'pnpm'
24+
25+
- name: 📦 Install dependencies
26+
run: pnpm install
2027

21-
- name: Install packages
22-
run: npm install
28+
- name: 🔎 Typecheck code
29+
run: pnpm typecheck
2330

24-
- name: Lint
25-
run: npm run lint
31+
- name: 🔎 Lint code
32+
run: pnpm lint
2633

27-
- name: Build
28-
run: npm run build
34+
- name: 🚀 Build code
35+
run: pnpm build
2936

30-
- name: Bundle
37+
- name: 📦 Bundle app
3138
if: ${{ matrix.node-version == 24 }}
32-
run: npm run bundle
39+
run: pnpm bundle

.husky/pre-commit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
npm run lint
1+
pnpm typecheck
2+
pnpm lint

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
package-lock=false
1+
lockfile=false

README.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,24 @@ Migration from v1 to v2 is done automatically when the app is run for the first
8282
== Build
8383
[source,bash]
8484
----
85-
npm run clean
86-
npm run build
85+
pnpm build
8786
----
8887

8988
== Package
9089
=== Pre-configured
91-
Package the app for Node.JS 18 on MacOS, Linux, and Windows.
90+
Package the app for Node.JS 24 on MacOS, Linux, and Windows.
9291

9392
[source,bash]
9493
----
95-
npm run bundle
94+
pnpm bundle
9695
----
9796

9897
=== Manual
9998
See https://www.npmjs.com/package/pkg#targets[pkg] for details.
10099

101100
[source,bash]
102101
----
103-
npx pkg <NODE_RANGE>-<PLATFORM>-<ARCH>
102+
pnpm exec pkg <NODE_RANGE>-<PLATFORM>-<ARCH>
104103
----
105104

106105
== Deploy

mise.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[tools]
2-
node = "24"
2+
node = "24.12.0"
3+
pnpm = "10.28.0"

package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "google-cloud-sql",
33
"version": "2.0.0",
44
"description": "Connect to private Google Cloud SQL/AlloyDB instance through Cloud SQL/AlloyDB Auth Proxy running in GKE cluster.",
5+
"type": "module",
56
"license": "UNLICENSED",
67
"author": "Dinko Osrecki <[email protected]>",
78
"homepage": "https://github.com/edosrecki/google-cloud-sql-cli",
@@ -13,60 +14,64 @@
1314
"url": "https://github.com/edosrecki/google-cloud-sql-cli/issues"
1415
},
1516
"bin": {
16-
"google-cloud-sql": "dist/index.js"
17+
"google-cloud-sql": "dist/index.cjs"
1718
},
19+
"packageManager": "[email protected]",
1820
"engines": {
19-
"node": "24"
21+
"node": "24.12.0",
22+
"pnpm": "10.28.0"
2023
},
2124
"scripts": {
2225
"clean": "rimraf dist bin",
23-
"prebuild": "npm run clean",
24-
"build": "tsc",
25-
"bundle": "npm run build && pkg . --targets node24-linux,node24-macos,node24-win --out-dir bin",
26-
"exec:dev": "ts-node src/index.ts",
27-
"exec:dist": "node dist/index.js",
26+
"prebuild": "pnpm clean",
27+
"build": "tsdown",
28+
"bundle": "pkg dist/index.cjs --targets node24-linux,node24-macos,node24-win --out-dir bin",
29+
"exec:dev": "tsx src/index.ts",
30+
"exec:dist": "node dist/index.cjs",
2831
"lint": "eslint .",
2932
"lint:fix": "eslint . --fix",
30-
"test": "npm run lint",
33+
"test": "pnpm lint",
34+
"typecheck": "tsc --noEmit",
3135
"prepare": "husky",
3236
"prettify-package-json": "prettier-package-json --write"
3337
},
3438
"dependencies": {
35-
"boxen": "5.1.2",
36-
"chalk": "4.1.2",
39+
"boxen": "8.0.1",
40+
"chalk": "5.6.2",
3741
"commander": "14.0.2",
38-
"conf": "10.2.0",
39-
"exit-hook": "2.2.1",
42+
"conf": "15.0.2",
43+
"exit-hook": "5.0.1",
4044
"fuse.js": "7.1.0",
4145
"inquirer": "8.2.5",
4246
"inquirer-autocomplete-prompt": "2.0.0",
43-
"lodash": "4.17.21",
47+
"lodash-es": "4.17.22",
4448
"memoizee": "0.4.17",
4549
"shelljs": "0.10.0",
46-
"update-notifier": "5.1.0"
50+
"update-notifier": "7.3.1"
4751
},
4852
"devDependencies": {
4953
"@eslint/js": "9.39.2",
5054
"@semantic-release/changelog": "6.0.3",
5155
"@semantic-release/exec": "7.1.0",
5256
"@semantic-release/git": "10.0.1",
53-
"@stylistic/eslint-plugin": "5.6.1",
57+
"@stylistic/eslint-plugin": "5.7.0",
5458
"@tsconfig/node24": "24.0.3",
5559
"@types/inquirer": "8.2.6",
5660
"@types/inquirer-autocomplete-prompt": "2.0.0",
57-
"@types/lodash": "4.17.21",
61+
"@types/lodash-es": "4.17.12",
5862
"@types/memoizee": "0.4.12",
5963
"@types/node": "24.10.6",
60-
"@types/shelljs": "0.8.17",
61-
"@types/update-notifier": "5.1.0",
64+
"@types/shelljs": "0.10.0",
65+
"@types/update-notifier": "6.0.8",
6266
"@yao-pkg/pkg": "6.11.0",
6367
"eslint": "9.39.2",
6468
"husky": "9.1.7",
6569
"prettier-package-json": "2.8.0",
6670
"rimraf": "6.1.2",
6771
"semantic-release": "25.0.2",
68-
"ts-node": "10.9.2",
72+
"tsdown": "0.19.0",
73+
"tsx": "4.21.0",
6974
"typescript": "5.9.3",
70-
"typescript-eslint": "8.50.0"
75+
"typescript-eslint": "8.52.0"
7176
}
7277
}
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { bold, green, red } from 'chalk'
1+
import chalk from 'chalk'
22
import inquirer from 'inquirer'
33
import autocomplete from 'inquirer-autocomplete-prompt'
4-
import { saveConfiguration } from '../../lib/configurations'
5-
import { ConfigurationCreateAnswers } from '../../lib/types'
6-
import { googleAlloyDbInstancePrompt } from './prompts/google-alloydb-instance'
7-
import { configurationNamePrompt } from './prompts/configuration-name'
8-
import { confirmationPrompt } from './prompts/confirmation'
9-
import { databaseTypePrompt } from './prompts/database-type'
10-
import { googleCloudProjectPrompt } from './prompts/google-cloud-project'
11-
import { googleCloudSqlInstancePrompt } from './prompts/google-cloud-sql-instance'
12-
import { kubernetesContextPrompt } from './prompts/kubernetes-context'
13-
import { kubernetesNamespacePrompt } from './prompts/kubernetes-namespace'
14-
import { kubernetesServiceAccountPrompt } from './prompts/kubernetes-service-account'
15-
import { localPortPrompt } from './prompts/local-port'
4+
import { saveConfiguration } from '../../lib/configurations/index.js'
5+
import { ConfigurationCreateAnswers } from '../../lib/types.js'
6+
import { googleAlloyDbInstancePrompt } from './prompts/google-alloydb-instance.js'
7+
import { configurationNamePrompt } from './prompts/configuration-name.js'
8+
import { confirmationPrompt } from './prompts/confirmation.js'
9+
import { databaseTypePrompt } from './prompts/database-type.js'
10+
import { googleCloudProjectPrompt } from './prompts/google-cloud-project.js'
11+
import { googleCloudSqlInstancePrompt } from './prompts/google-cloud-sql-instance.js'
12+
import { kubernetesContextPrompt } from './prompts/kubernetes-context.js'
13+
import { kubernetesNamespacePrompt } from './prompts/kubernetes-namespace.js'
14+
import { kubernetesServiceAccountPrompt } from './prompts/kubernetes-service-account.js'
15+
import { localPortPrompt } from './prompts/local-port.js'
1616

1717
export const createConfiguration = async () => {
1818
inquirer.registerPrompt('autocomplete', autocomplete)
@@ -33,9 +33,9 @@ export const createConfiguration = async () => {
3333
if (answers.confirmation) {
3434
saveConfiguration(answers)
3535

36-
console.log(green(`Saved configuration '${bold(answers.configurationName)}'.`))
36+
console.log(chalk.green(`Saved configuration '${chalk.bold(answers.configurationName)}'.`))
3737
}
3838
else {
39-
console.log(red('You are excused.'))
39+
console.log(chalk.red('You are excused.'))
4040
}
4141
}

src/commands/configurations/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Command } from 'commander'
2-
import { logError } from '../../lib/util/error'
3-
import { createConfiguration } from './create'
4-
import { showConfigurationPath } from './path'
5-
import { removeConfiguration } from './remove'
6-
import { runConfiguration, runConfigurationByName } from './run'
7-
import { showConfiguration } from './show'
2+
import { logError } from '../../lib/util/error.js'
3+
import { createConfiguration } from './create.js'
4+
import { showConfigurationPath } from './path.js'
5+
import { removeConfiguration } from './remove.js'
6+
import { runConfiguration, runConfigurationByName } from './run.js'
7+
import { showConfiguration } from './show.js'
88

99
export async function addConfigurationsCommands(program: Command) {
1010
const configurations = new Command('configurations')

0 commit comments

Comments
 (0)