Skip to content

Commit

Permalink
tweak PR build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed May 5, 2022
1 parent 53f0de7 commit 588b820
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/PR_build_extension.yml
Expand Up @@ -11,7 +11,6 @@ on:
- '.github/CODEOWNERS'

env:
PRISMA_USE_LOCAL_LS: true
GH_TOKEN: ${{ secrets.GH_TOKEN }}
ENVIRONMENT: ${{ secrets.ENVIRONMENT }}
PRISMA_TELEMETRY_INFORMATION: 'language-tools PR_build_extension.yml'
Expand Down Expand Up @@ -47,6 +46,12 @@ jobs:
node scripts/update_package_json_file_PR_build.js
env:
PR_NUMBER: ${{ github.event.number }}
# So we can use the local language server and don't have to publish it to npm first
# Note that linked node_modules are not supported https://github.com/microsoft/vscode-vsce/issues/203
- name: Copy language-server dist directory inside vscode package
run: |
cp -R packages/language-server packages/vscode
rm -R packages/vscode/language-server/src packages/vscode/language-server/test
- name: Build vsix
run: cd packages/vscode && npm run package -- --out=prisma.vsix

Expand Down
3 changes: 2 additions & 1 deletion packages/vscode/.gitignore
Expand Up @@ -2,4 +2,5 @@
/node_modules
.envrc
*.vsix
*.exe
*.exe
language-server
3 changes: 2 additions & 1 deletion packages/vscode/.vscodeignore
Expand Up @@ -5,4 +5,5 @@
src
.eslintignore
.eslintrc.js
.prettierignore
.prettierignore
*.vsix
11 changes: 8 additions & 3 deletions packages/vscode/src/plugins/prisma-language-server/index.ts
Expand Up @@ -100,15 +100,20 @@ const plugin: PrismaVSCodePlugin = {
console.debug('File Watcher was skipped, rootPath is falsy')
}

if (isDebugMode() || isE2ETestOnPullRequest()) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (packageJson.name === 'prisma-insider-pr-build') {
console.log('Using local Language Server for prisma-insider-pr-build')
serverModule = context.asAbsolutePath(path.join('./language-server/dist/src/bin'))
} else if (isDebugMode() || isE2ETestOnPullRequest()) {
// use Language Server from folder for debugging
console.log('Using local Language Server')
console.log('Using local Language Server from filesystem')
serverModule = context.asAbsolutePath(path.join('../../packages/language-server/dist/src/bin'))
} else {
console.log('Using published Language Server')
console.log('Using published Language Server (npm)')
// use published npm package for production
serverModule = require.resolve('@prisma/language-server/dist/src/bin')
}
console.log(`serverModule: ${serverModule}`)

// The debug options for the server
// --inspect=6009: runs the server in Node's Inspector mode so VSCode can attach to the server for debugging
Expand Down
2 changes: 1 addition & 1 deletion scripts/update_package_json_file_PR_build.js
Expand Up @@ -8,7 +8,7 @@ if (require.main === module) {

// Change name so VS Code doesn't try to auto-update it to the current Insider version
content['name'] = 'prisma-insider-pr-build'
content['displayName'] = `Prisma - Insider - PR ${process.env.PR_NUMBER} Build`
content['displayName'] = `Prisma - Insider - PR ${process.env.PR_NUMBER} Build - ${new Date().toISOString()}`

writeJsonToPackageJson({ content: content, path: vscodePackageJsonPath })
}

0 comments on commit 588b820

Please sign in to comment.