Skip to content

Commit 9edd184

Browse files
authored
refactor: migrate shared dir to an internal package (#95)
1 parent 09032ff commit 9edd184

28 files changed

Lines changed: 102 additions & 41 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DS_Store
22
node_modules
33
dist
4-
shared/meta.ts
4+
packages/shared/src/meta.ts
55

66
# local env files
77
.env.local

extensions/vscode/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
"scripts": {
199199
"dev": "tsdown --watch",
200200
"build": "tsdown",
201-
"update": "vscode-ext-gen --scope npmx --output ../../shared/meta.ts",
201+
"update": "vscode-ext-gen --scope npmx --output ../../packages/shared/src/meta.ts",
202202
"vscode:prepublish": "npm run build",
203203
"package": "npx @vscode/vsce package --no-dependencies",
204204
"prepare": "npm run update"
@@ -208,6 +208,7 @@
208208
"@volar/vscode": "catalog:lsp",
209209
"npmx-language-core": "workspace:*",
210210
"npmx-language-server": "workspace:*",
211+
"npmx-shared": "workspace:*",
211212
"ocache": "catalog:inline",
212213
"reactive-vscode": "catalog:inline",
213214
"semver": "catalog:inline",

extensions/vscode/src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { GetPackageManagerRequest } from '#shared/protocol'
21
import type { DocumentFilter } from '@volar/vscode'
3-
import { displayName, extensionId } from '#shared/meta'
4-
import { GET_PACKAGE_MANAGER_METHOD } from '#shared/protocol'
2+
import type { GetPackageManagerRequest } from 'npmx-shared/protocol'
53
import { SUPPORTED_DOCUMENT_PATTERN } from '#utils/constants'
64
import { middleware } from '@volar/vscode'
75
import { LanguageClient, TransportKind } from '@volar/vscode/node'
6+
import { displayName, extensionId } from 'npmx-shared/meta'
7+
import { GET_PACKAGE_MANAGER_METHOD } from 'npmx-shared/protocol'
88
import { commands, Hover, MarkdownString, Uri } from 'vscode'
99

1010
const SUPPORTED_LANGUAGES = [

extensions/vscode/src/commands/add-to-ignore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { ConfigurationTarget } from '#shared/constants'
2-
import { scopedConfigs } from '#shared/meta'
1+
import type { ConfigurationTarget } from 'npmx-shared/constants'
32
import { checkIgnored } from 'npmx-language-core/utils'
3+
import { scopedConfigs } from 'npmx-shared/meta'
44
import { workspace } from 'vscode'
55

66
export async function addToIgnore(scope: string, name: string, target: ConfigurationTarget) {

extensions/vscode/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useWorkspaceContext } from '#composables/workspace-context'
2-
import { ADD_TO_IGNORE_COMMAND } from '#shared/commands'
3-
import { commands, displayName, version } from '#shared/meta'
42
import { createLabsInfo } from '@volar/vscode'
3+
import { ADD_TO_IGNORE_COMMAND } from 'npmx-shared/commands'
4+
import { commands, displayName, version } from 'npmx-shared/meta'
55
import { defineExtension, useCommand, useCommands } from 'reactive-vscode'
66
import { Uri } from 'vscode'
77
import { launch } from './client'

extensions/vscode/src/state.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { NestedScopedConfigs } from '#shared/meta'
2-
import { displayName, scopedConfigs } from '#shared/meta'
1+
import type { NestedScopedConfigs } from 'npmx-shared/meta'
2+
import { displayName, scopedConfigs } from 'npmx-shared/meta'
33
import { defineConfig, defineLogger } from 'reactive-vscode'
44

55
export const config = defineConfig<NestedScopedConfigs>(scopedConfigs.scope)

extensions/vscode/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"compilerOptions": {
44
"tsBuildInfoFile": "./node_modules/.tsbuildinfo/app",
55
"paths": {
6-
"#shared/*": ["../../shared/*"],
76
"#state": ["./src/state.ts"],
87
"#api/*": ["./src/api/*"],
98
"#types/*": ["./src/types/*"],
@@ -14,7 +13,6 @@
1413
},
1514
"include": [
1615
"src/**/*",
17-
"tests/**/*",
18-
"../../shared"
16+
"tests/**/*"
1917
]
2018
}

packages/language-core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"./links": "./dist/links.js",
2020
"./types": "./dist/types.js",
2121
"./utils": "./dist/utils/index.js",
22-
"./workspace": "./dist/workspace.js",
23-
"./package.json": "./package.json"
22+
"./workspace": "./dist/workspace.js"
2423
},
2524
"files": [
2625
"dist/**/*"

packages/language-core/tsdown.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export default defineConfig({
1313
'src/workspace.ts',
1414
],
1515
platform: 'neutral',
16-
exports: true,
16+
exports: {
17+
packageJson: false,
18+
},
1719
dts: true,
1820
minify: 'dce-only',
1921
deps: {

packages/language-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
},
1212
"sideEffects": true,
1313
"exports": {
14-
".": "./dist/index.cjs",
15-
"./package.json": "./package.json"
14+
".": "./dist/index.cjs"
1615
},
1716
"main": "./dist/index.cjs",
1817
"bin": {
@@ -30,6 +29,7 @@
3029
"@volar/language-server": "catalog:lsp",
3130
"npmx-language-core": "workspace:*",
3231
"npmx-language-service": "workspace:*",
32+
"npmx-shared": "workspace:*",
3333
"ocache": "catalog:inline",
3434
"vscode-uri": "catalog:lsp"
3535
},

0 commit comments

Comments
 (0)