Skip to content

Migrate to pnpm monorepo #1313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ insert_final_newline = false
# with a line that has trailing white space. Many of our recorded
# tests use strings with trailing white space to represent the final
# document contents. For example
# packages/cursorless-vscode-e2e/suite/fixtures/recorded/languages/ruby/changeCondition.yml
# packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/ruby/changeCondition.yml
trim_trailing_whitespace = false

[Makefile]
Expand Down
34 changes: 29 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "unused-imports"],
"plugins": ["@typescript-eslint", "unused-imports", "import"],
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-restricted-imports": "off",
"@typescript-eslint/no-restricted-imports": "error",
"import/no-relative-packages": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
Expand Down Expand Up @@ -51,5 +49,31 @@
"no-throw-literal": "warn",
"semi": "off"
},
"ignorePatterns": ["**/vendor/**/*.ts", "**/vendor/**/*.js"]
"overrides": [
{
"files": ["*.tsx"],
"rules": {
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": ["function"],
"format": ["PascalCase", "camelCase"]
}
]
}
}
],
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {
"alwaysTryTypes": true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`

"project": ["tsconfig.json", "packages/*/tsconfig.json"]
}
}
},
"ignorePatterns": ["**/vendor/**/*.ts", "**/vendor/**/*.js", "**/out/**"]
}
22 changes: 11 additions & 11 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn run compile
- run: yarn run prepare-for-extension-publish
- name: Initialize cursorless-nx subdir
run: npm ci
working-directory: cursorless-nx
- name: Build cheatsheet html
run: npx nx build cheatsheet-local
working-directory: cursorless-nx
cache: pnpm
- run: pnpm install
- run: pnpm compile
- run: pnpm build
env:
CURSORLESS_DEPLOY: true
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
id: publishToOpenVSX
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
packagePath: packages/cursorless-vscode/dist
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
- run: bash -x scripts/docs-build.sh
cache: pnpm
- run: bash -x scripts/build-and-assemble-website.sh
29 changes: 25 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,38 @@ jobs:
VSCODE_LOGS_DIR: ${{ github.workspace }}/artifacts/logs
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache: pnpm
- run: mkdir -p "${{ env.VSCODE_CRASH_DIR }}" "${{ env.VSCODE_LOGS_DIR }}"
shell: bash
- run: yarn install --frozen-lockfile
- run: xvfb-run -a yarn test
- run: pnpm --color install
- run: pnpm --color compile
- run: pnpm --color --filter '!cursorless-org' --filter '!cursorless-org-*' build
- run: xvfb-run -a pnpm --color test
if: runner.os == 'Linux'
- run: yarn test
- run: pnpm --color test
if: runner.os != 'Linux'
- name: Create vscode dist that can be installed locally
run: pnpm -F @cursorless/cursorless-vscode populate-dist --local-install
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
- name: Test create vsix
id: createVsix
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: none
packagePath: packages/cursorless-vscode/dist
dryRun: true
- name: Upload vsix
uses: actions/upload-artifact@v3
if: runner.os == 'Linux' && matrix.vscode_version == 'stable'
with:
name: vsix
path: ${{ steps.createVsix.outputs.vsixPath }}
- name: Archive logs
uses: actions/upload-artifact@v3
with:
Expand Down
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,37 @@ node_modules

# TypeDoc output
docs/contributing/api/

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
.pnp
.pnp.js

# testing
coverage

# next.js
.next/

# production
build

# misc
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
3 changes: 3 additions & 0 deletions .meta-updater/main.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { updater } from "../packages/meta-updater/out/index.js";

export default updater;
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-workspace-protocol=rolling
save-prefix=""
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
exclude_types: [svg]
exclude: patches/.*\.patch
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
# Trailing whitespace breaks yaml files if you use a multiline string
# with a line that has trailing white space. Many of our recorded
# tests use strings with trailing white space to represent the final
# document contents. For example
# packages/cursorless-vscode-e2e/suite/fixtures/recorded/languages/ruby/changeCondition.yml
exclude: ^packages/cursorless-vscode-e2e/suite/fixtures/recorded/.*/[^/]*\.yml$
# packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/languages/ruby/changeCondition.yml
exclude: ^packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/.*/[^/]*\.yml$
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
Expand Down
5 changes: 2 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
**/vendor

# We use our own format for our recorded yaml tests to keep them compact
/packages/cursorless-vscode-e2e/suite/fixtures/recorded/**/*.yml
/packages/cursorless-vscode-e2e/src/suite/fixtures/recorded/**/*.yml

# This was swizzled from a Docusaurus core class
docs-site/src/theme/SearchBar/index.js
pnpm-lock.yaml
10 changes: 10 additions & 0 deletions .syncpackrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"dependencyTypes": [
"dev",
"overrides",
"peer",
"pnpmOverrides",
"prod",
"resolutions"
]
}
53 changes: 24 additions & 29 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionDevelopmentPath=${workspaceFolder}/packages/cursorless-vscode/dist",
"--profile=cursorlessDevelopment"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -29,10 +29,10 @@
},
"args": [
"--profile=cursorlessDevelopment",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test-harness/runners/all"
"--extensionDevelopmentPath=${workspaceFolder}/packages/cursorless-vscode/dist",
"--extensionTestsPath=${workspaceFolder}/packages/test-harness/out/runners/all"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -43,11 +43,11 @@
"type": "node",
"request": "launch",
"name": "Unit tests only",
"program": "${workspaceFolder}/out/test-harness/scripts/runUnitTestsOnly",
"program": "${workspaceFolder}/packages/test-harness/out/scripts/runUnitTestsOnly",
"env": {
"CURSORLESS_TEST": "true"
},
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -64,10 +64,10 @@
},
"args": [
"--profile=cursorlessDevelopment",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test-harness/runners/all"
"--extensionDevelopmentPath=${workspaceFolder}/packages/cursorless-vscode/dist",
"--extensionTestsPath=${workspaceFolder}/packages/test-harness/out/runners/all"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -84,10 +84,10 @@
},
"args": [
"--profile=cursorlessDevelopment",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test-harness/runners/all"
"--extensionDevelopmentPath=${workspaceFolder}/packages/cursorless-vscode/dist",
"--extensionTestsPath=${workspaceFolder}/packages/test-harness/out/runners/all"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -105,10 +105,10 @@
},
"args": [
"--profile=cursorlessDevelopment",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test-harness/runners/all"
"--extensionDevelopmentPath=${workspaceFolder}/packages/cursorless-vscode/dist",
"--extensionTestsPath=${workspaceFolder}/packages/test-harness/out/runners/all"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"outFiles": ["${workspaceFolder}/**/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
Expand All @@ -119,9 +119,9 @@
"name": "Docusaurus Start (Debug)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/docs-site",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "start"],
"cwd": "${workspaceFolder}/packages/cursorless-org-docs",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["start"],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
Expand All @@ -131,9 +131,9 @@
"name": "Docusaurus Build (Debug)",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/docs-site",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "build"],
"cwd": "${workspaceFolder}/packages/cursorless-org-docs",
"runtimeExecutable": "pnpm",
"runtimeArgs": ["build"],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
Expand All @@ -143,13 +143,8 @@
"name": "cursorless.org client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}/cursorless-nx",
"sourceMapPathOverrides": {
"webpack://_N_E/*": "${webRoot}/apps/cursorless-org/*",
"webpack://_N_E/libs/*": "${webRoot}/libs/*",
"webpack://_N_E/node_modules/*": "${webRoot}/node_modules/*"
}
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/packages/cursorless-org"
}
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@
"pojo",
"subword"
],
"files.eol": "\n"
"files.eol": "\n",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
Loading