Skip to content

Commit ea59f13

Browse files
Update tsconfig paths to use package exports (#3231)
1 parent 9220095 commit ea59f13

6 files changed

Lines changed: 24 additions & 42 deletions

File tree

.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "Run",
5+
"name": "Run extension",
66
"type": "extensionHost",
77
"request": "launch",
88
"env": {
@@ -21,7 +21,7 @@
2121
]
2222
},
2323
{
24-
"name": "Test",
24+
"name": "Extension tests",
2525
"type": "extensionHost",
2626
"request": "launch",
2727
"env": {
@@ -42,7 +42,7 @@
4242
]
4343
},
4444
{
45-
"name": "Test (subset)",
45+
"name": "Extension tests (subset)",
4646
"type": "extensionHost",
4747
"request": "launch",
4848
"env": {

cursorless-talon-dev/src/cursorless_launch_configuration.talon-list

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ app: vscode
33
win.title: /cursorless/
44
-
55

6-
extension: "VSCode: Run"
7-
test: "VSCode: Test"
8-
test subset: "VSCode: Test (subset)"
9-
test talon: "Talon: Test"
10-
test talon subset: "Talon: Test (subset)"
11-
test unit: "Unit tests: Test"
6+
extension: "Run extension"
7+
test: "Extension tests"
8+
test subset: "Extension tests (subset)"
129

1310
# Other launch config you may want to activate:
1411

15-
# update fixtures: "VSCode: Update test fixtures"
16-
# update fixtures subset: "VSCode: Update test fixtures (subset)"
17-
# update fixtures unit: "Unit tests: Update test fixtures"
18-
# docs: "Docusaurus: Run"
19-
# docs build: "Docusaurus: Build"
20-
# docs client: "cursorless.org: Run client-side"
12+
# update fixtures: "Update test fixtures"
13+
# update fixtures subset: "Update test fixtures (subset)"

packages/cursorless-org-docs/src/docs/contributing/CONTRIBUTING.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ locally, you need to run the extension in debug mode. To do so you need to do th
121121
1. Open the Cursorless repository in VSCode (with your regular default profile, _**not**_ with the `cursorlessDevelopment` profile)
122122
2. Say `"debug extension"` to run the extension. If you want to run the tests instead, say `"debug test"`.
123123

124-
If you don't have the `cursorless-talon-dev` files in your Talon user directory as described in step 6 above, then you instead need to run the `workbench.action.debug.selectandstart` command in VSCode and then select either "VSCode: Run" or "VSCode: Test".
124+
If you don't have the `cursorless-talon-dev` files in your Talon user directory as described in step 6 above, then you instead need to run the `workbench.action.debug.selectandstart` command in VSCode and then select either "Run extension" or "Extension tests".
125125

126126
### Running a subset of tests
127127

128128
The entire test suite takes a little while to run (1-2 mins), so you may want to run just a subset of the tests.
129129

130130
To specify the set of tests to run, say `"debug generate subset"`, or if you haven't installed the cursorless-talon-dev files, run the VSCode task "Generate test subset file". To do this, choose "Tasks: Run Task" from the command palette.
131131

132-
To run the specified subset of tests, say `"debug test subset"` (or use the "Run test subset" launch config).
132+
To run the specified subset of tests, say `"debug test subset"` (or use the "Extension tests (subset)" launch config).
133133

134134
If you need to edit the subset of tests to run in the future, you can say `"debug edit subset"`.
135135

packages/meta-updater/src/updatePackageJson.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { PackageJson } from "type-fest";
55
import type { Context } from "./Context";
66
import { getCursorlessVscodeFields } from "./getCursorlessVscodeFields";
77

8-
export const LIB_ENTRY_POINT = "src/index.ts";
8+
const LIB_ENTRY_POINT = "./src/index.ts";
99

1010
/**
1111
* Given a package.json, update it to match our conventions. This function is
@@ -51,7 +51,7 @@ export async function updatePackageJson(
5151
!Array.isArray(input.exports)
5252
? input.exports
5353
: {};
54-
exports["."] = `./${LIB_ENTRY_POINT}`;
54+
exports["."] = LIB_ENTRY_POINT;
5555
input.exports = exports;
5656
} else {
5757
delete input.types;

packages/meta-updater/src/updateTSConfigBase.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { FormatPluginFnOptions } from "@pnpm/meta-updater";
22
import * as fs from "fs/promises";
33
import type { PackageJson, TsConfigJson } from "type-fest";
44
import type { Context } from "./Context";
5-
import { LIB_ENTRY_POINT } from "./updatePackageJson";
65

76
export async function updateTSConfigBase(
87
{ workspaceDir, pnpmLockfile }: Context,
@@ -33,7 +32,7 @@ export async function updateTSConfigBase(
3332
) as PackageJson;
3433

3534
if (!packageJson.private) {
36-
paths[packageName] = [`./${packagePath}/${LIB_ENTRY_POINT}`];
35+
paths[packageName] = [`./${packagePath}`];
3736
}
3837
}
3938

tsconfig.base.json

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,19 @@
1212
"isolatedModules": true,
1313
"strict": true,
1414
"paths": {
15-
"@cursorless/cheatsheet": ["./packages/cheatsheet/src/index.ts"],
16-
"@cursorless/common": ["./packages/common/src/index.ts"],
17-
"@cursorless/cursorless-engine": [
18-
"./packages/cursorless-engine/src/index.ts"
19-
],
15+
"@cursorless/cheatsheet": ["./packages/cheatsheet"],
16+
"@cursorless/common": ["./packages/common"],
17+
"@cursorless/cursorless-engine": ["./packages/cursorless-engine"],
2018
"@cursorless/cursorless-everywhere-talon-core": [
21-
"./packages/cursorless-everywhere-talon-core/src/index.ts"
22-
],
23-
"@cursorless/cursorless-tutorial": [
24-
"./packages/cursorless-tutorial/src/index.ts"
25-
],
26-
"@cursorless/neovim-common": ["./packages/neovim-common/src/index.ts"],
27-
"@cursorless/neovim-registry": [
28-
"./packages/neovim-registry/src/index.ts"
29-
],
30-
"@cursorless/node-common": ["./packages/node-common/src/index.ts"],
31-
"@cursorless/sentence-parser": [
32-
"./packages/sentence-parser/src/index.ts"
33-
],
34-
"@cursorless/test-case-recorder": [
35-
"./packages/test-case-recorder/src/index.ts"
19+
"./packages/cursorless-everywhere-talon-core"
3620
],
37-
"@cursorless/vscode-common": ["./packages/vscode-common/src/index.ts"]
21+
"@cursorless/cursorless-tutorial": ["./packages/cursorless-tutorial"],
22+
"@cursorless/neovim-common": ["./packages/neovim-common"],
23+
"@cursorless/neovim-registry": ["./packages/neovim-registry"],
24+
"@cursorless/node-common": ["./packages/node-common"],
25+
"@cursorless/sentence-parser": ["./packages/sentence-parser"],
26+
"@cursorless/test-case-recorder": ["./packages/test-case-recorder"],
27+
"@cursorless/vscode-common": ["./packages/vscode-common"]
3828
}
3929
}
4030
}

0 commit comments

Comments
 (0)