Skip to content

Commit 0b86341

Browse files
committed
refactor(vscode): move result into shared bus
1 parent a35fb91 commit 0b86341

14 files changed

Lines changed: 55 additions & 10 deletions

File tree

package-lock.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode/bus/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules

vscode/bus/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "sqlmesh-extension-bus",
3+
"private": true,
4+
"version": "0.0.1",
5+
"scripts": {
6+
"build": "tsc",
7+
"dev": "tsc -w",
8+
"lint": "tsc --noEmit"
9+
},
10+
"files": [
11+
"/dist"
12+
],
13+
"main": "dist/index.js",
14+
"types": "dist/index.d.ts",
15+
"devDependencies": {
16+
"typescript": "^5.5.4"
17+
}
18+
}

vscode/extension/src/utilities/functional/result.ts renamed to vscode/bus/src/result.ts

File renamed without changes.

vscode/bus/tsconfig.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ESNext",
4+
"module": "ESNext",
5+
"declaration": true,
6+
"outDir": "./dist",
7+
"strict": true,
8+
"strictNullChecks": true,
9+
"noImplicitAny": true,
10+
"noUnusedLocals": true,
11+
"noUnusedParameters": true,
12+
"noEmit": true,
13+
"moduleResolution": "node",
14+
"baseUrl": "./"
15+
},
16+
"include": ["src/**/*"]
17+
}

vscode/extension/esbuild.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const production = process.argv.includes('--production')
44
const watch = process.argv.includes('--watch')
55

66
async function main() {
7+
const IS_PRODUCTION = production
8+
79
const ctx = await esbuild.context({
810
entryPoints: ['src/extension.ts'],
911
bundle: true,
@@ -15,6 +17,9 @@ async function main() {
1517
outfile: 'dist/extension.js',
1618
external: ['vscode'],
1719
logLevel: 'warning',
20+
define: {
21+
'process.env.NODE_ENV': IS_PRODUCTION ? '"production"' : '"development"',
22+
},
1823
plugins: [
1924
/* add to the end of plugins array */
2025
esbuildProblemMatcherPlugin,

vscode/extension/src/auth/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
window,
1010
} from 'vscode'
1111
import { get_tcloud_bin } from '../utilities/sqlmesh/sqlmesh'
12-
import { err, isErr, ok, Result } from '../utilities/functional/result'
12+
import { err, isErr, ok, Result } from '@bus/result'
1313
import { execAsync } from '../utilities/exec'
1414
import { getProjectRoot } from '../utilities/common/utilities'
1515
import z from 'zod'

vscode/extension/src/commands/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { traceLog } from '../utilities/common/log'
22
import { execSync } from 'child_process'
33
import { sqlmesh_exec } from '../utilities/sqlmesh/sqlmesh'
4-
import { err, isErr, ok, Result } from '../utilities/functional/result'
4+
import { err, isErr, ok, Result } from '@bus/result'
55
import * as vscode from 'vscode'
66
import {
77
ErrorType,

vscode/extension/src/completion/completion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from 'vscode'
22
import { LSPClient } from '../lsp/lsp'
3-
import { isErr } from '../utilities/functional/result'
3+
import { isErr } from '@bus/result'
44

55
export const selector: vscode.DocumentSelector = {
66
pattern: '**/*.sql',

vscode/extension/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { AuthenticationProviderTobikoCloud } from './auth/auth'
1212
import { signOut } from './commands/signout'
1313
import { signIn } from './commands/signin'
1414
import { signInSpecifyFlow } from './commands/signinSpecifyFlow'
15-
import { isErr } from './utilities/functional/result'
15+
import { isErr } from '@bus/result'
1616
import {
1717
handleNotSginedInError,
1818
handleSqlmeshLspNotFoundError,

0 commit comments

Comments
 (0)