Skip to content

Commit 7095ead

Browse files
committed
feat: Add workspace setup
1 parent ebb5ab1 commit 7095ead

File tree

20 files changed

+931
-3610
lines changed

20 files changed

+931
-3610
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
dist
3-
*.vsix
3+
*.vsix
4+
vitest.config.js*
5+
out
6+
**/*.vscode-test

.vscode-test.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { defineConfig } from '@vscode/test-cli';
2+
3+
export default defineConfig({
4+
files: 'out/test/**/*.test.js',
5+
workspaceFolder: './src/test/basic-monorepo/',
6+
});

.vscode/launch.json

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,19 @@
33
// Hover to view descriptions of existing attributes.
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
{
6-
"version": "0.2.0",
7-
"configurations": [
8-
{
9-
"name": "Run Extension",
10-
"type": "extensionHost",
11-
"request": "launch",
12-
"args": [
13-
"--extensionDevelopmentPath=${workspaceFolder}"
14-
],
15-
"outFiles": [
16-
"${workspaceFolder}/dist/**/*.js"
17-
],
18-
"preLaunchTask": "${defaultBuildTask}"
19-
},
20-
{
21-
"name": "Extension Tests",
22-
"type": "extensionHost",
23-
"request": "launch",
24-
"args": [
25-
"--extensionDevelopmentPath=${workspaceFolder}",
26-
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
27-
],
28-
"outFiles": [
29-
"${workspaceFolder}/out/**/*.js",
30-
"${workspaceFolder}/dist/**/*.js"
31-
],
32-
"preLaunchTask": "tasks: watch-tests"
33-
}
34-
]
35-
}
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
],
15+
"outFiles": [
16+
"${workspaceFolder}/out/**/*.js"
17+
],
18+
"preLaunchTask": "${defaultBuildTask}"
19+
}
20+
]
21+
}

.vscode/settings.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
3-
"files.exclude": {
4-
"out": false, // set this to true to hide the "out" folder with the compiled JS files
5-
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
6-
},
7-
"search.exclude": {
8-
"out": true, // set this to false to include "out" folder in search results
9-
"dist": true // set this to false to include "dist" folder in search results
10-
},
11-
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
12-
"typescript.tsc.autoDetect": "off"
13-
}
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "biomejs.biome",
5+
"files.exclude": {
6+
"out": false, // set this to true to hide the "out" folder with the compiled JS files
7+
"dist": false // set this to true to hide the "dist" folder with the compiled JS files
8+
},
9+
"search.exclude": {
10+
"out": true, // set this to false to include "out" folder in search results
11+
"dist": true // set this to false to include "dist" folder in search results
12+
},
13+
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
14+
"typescript.tsc.autoDetect": "off",
15+
"lnf.aliases": {
16+
"$/": "${workspaceRoot}/",
17+
"$src/": "${workspaceRoot}/src/"
18+
}
19+
}

.vscode/tasks.json

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,20 @@
11
// See https://go.microsoft.com/fwlink/?LinkId=733558
22
// for the documentation about the tasks.json format
33
{
4-
"version": "2.0.0",
5-
"tasks": [
6-
{
7-
"type": "npm",
8-
"script": "watch",
9-
"problemMatcher": [
10-
"$ts-webpack-watch",
11-
"$tslint-webpack-watch"
12-
],
13-
"isBackground": true,
14-
"presentation": {
15-
"reveal": "never",
16-
"group": "watchers"
17-
},
18-
"group": {
19-
"kind": "build",
20-
"isDefault": true
21-
}
22-
},
23-
{
24-
"type": "npm",
25-
"script": "watch-tests",
26-
"problemMatcher": "$tsc-watch",
27-
"isBackground": true,
28-
"presentation": {
29-
"reveal": "never",
30-
"group": "watchers"
31-
},
32-
"group": "build"
33-
},
34-
{
35-
"label": "tasks: watch-tests",
36-
"dependsOn": [
37-
"npm: watch",
38-
"npm: watch-tests"
39-
],
40-
"problemMatcher": []
41-
}
42-
]
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "watch",
9+
"problemMatcher": "$tsc-watch",
10+
"isBackground": true,
11+
"presentation": {
12+
"reveal": "never"
13+
},
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
}
19+
]
4320
}

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ like `ctrl+alt+n` on Windows
2929

3030
## Creating multiple files
3131

32-
Creating multiple files in one prompt requires you to use a comma in the input field. The comma can be top level, or can be nested within a set of curly brackets(`{}`)
32+
Creating multiple files in one prompt requires you to use a comma in the input field. The comma can be top level, or can be nested within a set of curly brackets(`{}`); e.g.
33+
34+
```
35+
$components/expandable/{expandable.svelte,expandable.stories.svelte}
36+
```
37+
38+
Will create two files in the folder where `$components/` is aliases:
39+
40+
1. `$components/expandable/expandable.svelte`
41+
2. `$components/expandable/expandable.stories.svelte`
3342

3443
These follow the same rules as the rest of the extension: if it matches an alias, it will be created from the given directory the alias is associated with.
3544
Otherwise it will be based on the current file.
@@ -45,9 +54,11 @@ Otherwise it will be based on the current file.
4554
`lib/{something/index.ts,something-else.ts,something-else-else.ts}` -> `src/lib/something/index.ts` + `src/lib/something-else.ts` + `src/lib/something-else-else.ts`
4655
```
4756

57+
**NOTE**: by default the aliases begin with `$`, this is to mimic bundlers to some degree, but there is no hard rule that your aliases must begin with the the `$` symbol.
58+
4859
## Aliases
4960

50-
Aliases should be unique among themselves and ***not*** nested. Both the shortcut and the expanded value should end with slashes
61+
Aliases should be unique among themselves and ***not*** nested. Both the shortcut and the expanded value should end with slashes.
5162

5263
### ✅ Examples of good aliases
5364

@@ -66,4 +77,15 @@ Aliases should be unique among themselves and ***not*** nested. Both the shortcu
6677
// This item will never be matched because the extensions exists on first match
6778
"$src/lib": "${workspaceRoot}/src/lib"
6879
}
80+
```
81+
82+
## Workspaces
83+
84+
If you are working a repository that utilizes workspaces, where there are multiple
85+
packages and apps, it can be useful to have it so that your aliases become aware of that.
86+
87+
```json
88+
"lnf.aliases": {
89+
"$src/*/": "${workspaceRoot}/packages/$1/src/??"
90+
}
6991
```

package.json

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
"license": "MIT",
1111
"version": "1.3.0",
1212
"engines": {
13-
"vscode": "^1.63.0"
13+
"vscode": "^1.100.0"
1414
},
1515
"categories": [
1616
"Other"
1717
],
18-
"activationEvents": [
19-
"onCommand:lazy-new-file.lazyNewFile"
20-
],
21-
"main": "./dist/extension.js",
18+
"main": "./out/extension.js",
2219
"contributes": {
2320
"commands": [
2421
{
@@ -78,14 +75,13 @@
7875
}
7976
},
8077
"scripts": {
81-
"vscode:prepublish": "npm run package",
82-
"compile": "webpack",
83-
"watch": "webpack --watch",
78+
"vscode:prepublish": "pnpm run package",
79+
"compile": "tsc -p ./",
80+
"watch": "tsc -watch -p ./",
8481
"package": "webpack --mode production --devtool hidden-source-map",
85-
"compile-tests": "tsc -p . --outDir dist",
8682
"watch-tests": "tsc -p . -w --outDir dist",
87-
"pretest": "npm run compile-tests && npm run compile",
88-
"test": "node ./dist/test/runTest.js",
83+
"pretest": "pnpm run compile",
84+
"test": "vscode-test",
8985
"biome:lint": "biome lint --write ./src",
9086
"biome:format": "biome format --write ./src",
9187
"biome:check": "biome check --write ./src",
@@ -94,21 +90,14 @@
9490
"devDependencies": {
9591
"@biomejs/biome": "^1.8.1",
9692
"@types/glob": "^7.2.0",
97-
"@types/mocha": "^9.1.1",
93+
"@types/mocha": "^10.0.10",
9894
"@types/node": "~14.18.63",
99-
"@types/vscode": "^1.90.0",
95+
"@types/vscode": "^1.105.0",
10096
"@typescript-eslint/eslint-plugin": "^5.62.0",
10197
"@typescript-eslint/parser": "^5.62.0",
102-
"@vscode/test-electron": "^2.4.0",
103-
"@wdio/cli": "^8.38.2",
104-
"glob": "^7.2.3",
105-
"mocha": "^9.2.2",
106-
"prettier": "^3.3.2",
98+
"@vscode/test-cli": "^0.0.12",
99+
"@vscode/test-electron": "^2.5.2",
107100
"standard-version": "^9.5.0",
108-
"ts-loader": "^9.5.1",
109-
"ts-node": "^10.9.2",
110-
"typescript": "^4.9.5",
111-
"webpack": "^5.92.0",
112-
"webpack-cli": "^4.10.0"
101+
"typescript": "^5.9.3"
113102
}
114-
}
103+
}

0 commit comments

Comments
 (0)