Skip to content

Commit

Permalink
Merge branch 'master' into support-relaunch-debug-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-Holbrook authored Jan 24, 2024
2 parents 3c11754 + 7e28fdb commit 4a6be5d
Show file tree
Hide file tree
Showing 15 changed files with 287 additions and 149 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/create-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: create-package
on:
pull_request:
types: [labeled, unlabeled, synchronize]
jobs:
create-package:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'create-package')
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "14.19.0"
# Get a bot token so the bot's name shows up on all our actions
- name: Get Token From roku-ci-token Application
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- run: echo "TOKEN=${{ steps.generate-token.outputs.token }}" >> $GITHUB_ENV
- name: Compute variables
run: |
CURRENT_VERSION=$(grep -o '\"version\": *\"[^\"]*\"' package.json | awk -F'\"' '{print $4}')
SANITIZED_BRANCH_NAME=$(echo "$GITHUB_HEAD_REF" | sed 's/[^0-9a-zA-Z-]/-/g')
BUILD_VERSION="$CURRENT_VERSION-$SANITIZED_BRANCH_NAME.$(date +%Y%m%d%H%M%S)"
NPM_PACKAGE_NAME=$(grep -o '\"name\": *\"[^\"]*\"' package.json | awk -F'\"' '{print $4}')
ARTIFACT_NAME=$(echo "$NPM_PACKAGE_NAME-$BUILD_VERSION.tgz" | tr '/' '-')
ARTIFACT_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/v0.0.0-packages/${ARTIFACT_NAME}"
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
echo "ARTIFACT_URL=$ARTIFACT_URL" >> $GITHUB_ENV
- run: npm ci
- run: npm version "$BUILD_VERSION" --no-git-tag-version
- run: npm pack

# create the release if not exist
- run: gh release create v0.0.0-packages --latest=false --prerelease --notes "catchall release for temp packages" -R ${{ github.repository }}
continue-on-error: true

# upload this artifact to the "packages" github release
- run: gh release upload v0.0.0-packages *.tgz -R ${{ github.repository }}

- name: Fetch build artifact
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Hey there! I just built a new temporary npm package based on ${{ github.event.pull_request.head.sha }}. You can download it [here](${{ env.ARTIFACT_URL }}) or install it by running the following command: \n```bash\nnpm install ${{ env.ARTIFACT_URL }}\n```"
});
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



## [0.21.1](https://github.com/rokucommunity/roku-debug/compare/v0.21.0...v0.21.1) - 2024-01-16
### Changed
- upgrade to [[email protected]](https://github.com/rokucommunity/brighterscript/blob/master/CHANGELOG.md#06517---2024-01-16). Notable changes since 0.65.16:
- adds support for libpkg prefix ([brighterscript#1017](https://github.com/rokucommunity/brighterscript/pull/1017))
- Assign .program to the builder BEFORE calling afterProgram ([brighterscript#1011](https://github.com/rokucommunity/brighterscript/pull/1011))



## [0.21.0](https://github.com/rokucommunity/roku-debug/compare/v0.20.15...v0.21.0) - 2024-01-10
### Added
- Add cli flag to run dap as standalone process ([#173](https://github.com/rokucommunity/roku-debug/pull/173))
- Expose `controlPort` launch option for overriding the debug protocol port ([#182](https://github.com/rokucommunity/roku-debug/pull/182))



## [0.20.15](https://github.com/rokucommunity/roku-debug/compare/v0.20.14...v0.20.15) - 2024-01-08
### Changed
- Display a modal message when the we fail to upload a package to the device ([#178](https://github.com/rokucommunity/roku-debug/pull/178))
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ A [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol/)
[![license](https://img.shields.io/github/license/rokucommunity/roku-debug.svg)](LICENSE)
[![Slack](https://img.shields.io/badge/Slack-RokuCommunity-4A154B?logo=slack)](https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA)

## Usage
This project can be integrated with any IDE that supports the debug-adapter-protocol.

**Known integrations:**
- [BrightScript Language extension for VSCode](https://github.com/rokucommunity/vscode-brightscript-language)
- [nvim-dap extension for Neovim](https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#brightscript)

## DAP instructions
To run the language server standalone, you simply need to:
- install nodejs and make sure npx is on your path
- install this project (`npm install roku-debug`)
- run the project in dap mode (`npx roku-debug --dap`)


## Contributors
[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/0)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/0)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/1)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/1)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/2)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/2)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/3)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/3)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/4)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/4)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/5)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/5)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/6)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/6)[![](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/images/7)](https://sourcerer.io/fame/TwitchBronBron/rokucommunity/roku-debug/links/7)

Expand Down
37 changes: 15 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roku-debug",
"version": "0.20.15",
"version": "0.21.1",
"description": "Debug adapter for Roku application development using Node.js",
"main": "dist/index.js",
"scripts": {
Expand All @@ -18,6 +18,9 @@
"type": "git",
"url": "https://github.com/rokucommunity/roku-debug"
},
"bin": {
"roku-debug": "dist/cli.js"
},
"author": "RokuCommunity",
"license": "MIT",
"mocha": {
Expand Down Expand Up @@ -84,7 +87,6 @@
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"p-defer": "^4.0.0",
"portfinder": "^1.0.32",
"rimraf": "^3.0.2",
"rmfr": "^2.0.0",
"rxjs": "^7.4.0",
Expand All @@ -96,7 +98,7 @@
"dependencies": {
"@rokucommunity/logger": "^0.3.3",
"@types/request": "^2.48.8",
"brighterscript": "^0.65.16",
"brighterscript": "^0.65.17",
"dateformat": "^4.6.3",
"debounce": "^1.2.1",
"eol": "^0.9.1",
Expand All @@ -105,6 +107,7 @@
"find-in-files": "^0.5.0",
"fs-extra": "^10.0.0",
"natural-orderby": "^2.0.3",
"portfinder": "^1.0.32",
"postman-request": "^2.88.1-postman.32",
"replace-in-file": "^6.3.2",
"replace-last": "^1.2.6",
Expand Down
36 changes: 28 additions & 8 deletions src/LaunchConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export interface LaunchConfiguration extends DebugProtocol.LaunchRequestArgument
bsConst?: Record<string, boolean>;

/**
* Port to access component libraries.
* Port used to use when spinning up a web server to host component libraries. This runs on the developer machine and does not correspond to a port on the Roku device.
* Defaults to 8080
* @default 8080
*/
componentLibrariesPort: number;

Expand Down Expand Up @@ -223,27 +225,51 @@ export interface LaunchConfiguration extends DebugProtocol.LaunchRequestArgument
* The port that should be used when installing the package. Defaults to 80.
* This is mainly useful for things like emulators that use alternate ports,
* or when publishing through some type of port forwarding configuration.
* @default 80
*/
packagePort?: number;

/**
* The port used to send remote control commands (like home press, back, etc.). Defaults to 8060.
* This is mainly useful for things like emulators that use alternate ports,
* or when sending commands through some type of port forwarding.
* @default 8060
*/
remotePort?: number;

/**
* The brightscript console port. In telnet mode this is the port used for the telnet connection. In debug protocol mode, this is used to obtain compile errors from the device.
* The port that should be used to send SceneGraph debug commands. Defaults to 8080.
* @default 8080
*/
sceneGraphDebugCommandsPort: number;

/**
* Port used to connect to and control a debug protocol session.
* This is mainly useful for things like emulators that use alternate ports,
* or when connecting to the debug protocol through some type of port forwarding. Defaults to 8081.
* @default 8081
*/
controlPort: number;

/**
* The brightscript console port. In telnet mode this is the port used for the primary telnet connection. In debug protocol mode, this is used to obtain compile errors from the device. Defaults to 8085.
* @default 8085
*/
brightScriptConsolePort?: number;

/**
* The path used for the staging folder of roku-deploy
* This should generally be set to "${cwd}/.roku-deploy-staging", but that's ultimately up to the debug client.
* @deprecated use `stagingDir` instead
*/
stagingFolderPath?: string;

/**
* Path used for the staging folder where files are written right before being packaged. This folder will contain any roku-debug related sourcemaps,
* as well as having breakpoints injected into source code
*/
stagingDir?: string;

/**
* What level of debug server's internal logging should be performed in the debug session
*/
Expand All @@ -266,12 +292,6 @@ export interface LaunchConfiguration extends DebugProtocol.LaunchRequestArgument
* @default false
*/
deleteDevChannelBeforeInstall: boolean;

/**
* sceneGraphDebugCommandsPort
* The port that should be used to send SceneGraph debug commands. Defaults to 8080.
*/
sceneGraphDebugCommandsPort: number;
}

export interface ComponentLibraryConfiguration {
Expand Down
17 changes: 17 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env node
import * as yargs from 'yargs';
import { BrightScriptDebugSession } from './debugSession/BrightScriptDebugSession';

let options = yargs
.usage('$0', 'BrighterScript, a superset of Roku\'s BrightScript language')
.help('help', 'View help information about this tool.')
.option('dap', { type: 'boolean', defaultDescription: 'false', description: 'Run roku-debug as a standalone debug-adapter-protocol process, communicating over STDIO' })
.parseSync();

(function main() {
if (options.dap) {
BrightScriptDebugSession.run(BrightScriptDebugSession);
} else {
throw new Error('Not supported');
}
}());
Loading

0 comments on commit 4a6be5d

Please sign in to comment.