Skip to content
Merged

fixes #128

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
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
"semi": "warn"
},
"ignorePatterns": [
"out",
Expand Down
85 changes: 68 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,92 @@
name: CI

on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 18
- run: yarn install --frozen-lockfile
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npx vsce package --out vscode-splunk-soar.vsix
- uses: actions/upload-artifact@v3
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: corepack enable
- name: Verify Yarn lockfile registries
run: |
if grep 'resolved "https://' yarn.lock docs/yarn.lock | grep -v 'resolved "https://registry.yarnpkg.com/'; then
echo "All Yarn dependencies must resolve from registry.yarnpkg.com."
exit 1
fi
- name: Install dependencies
run: yarn install --frozen-lockfile --registry https://registry.yarnpkg.com
- name: Lint
run: yarn lint
- name: Audit dependencies
run: yarn audit --registry https://registry.yarnpkg.com
- name: Build VSIX
run: yarn vsce package --out vscode-splunk-soar.vsix
- name: Upload VSIX
uses: actions/upload-artifact@v7
with:
name: vscode-splunk-soar.vsix
path: "*.vsix"
name: vscode-splunk-soar-vsix
path: vscode-splunk-soar.vsix
if-no-files-found: error
retention-days: 7

publish:
runs-on: ubuntu-latest
needs: build
if: success() && startsWith( github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- uses: actions/download-artifact@v3
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock
- name: Enable Corepack
run: corepack enable
- name: Verify Yarn lockfile registries
run: |
if grep 'resolved "https://' yarn.lock docs/yarn.lock | grep -v 'resolved "https://registry.yarnpkg.com/'; then
echo "All Yarn dependencies must resolve from registry.yarnpkg.com."
exit 1
fi
- name: Install dependencies
run: yarn install --frozen-lockfile --registry https://registry.yarnpkg.com
- name: Download VSIX
uses: actions/download-artifact@v8
with:
name: vscode-splunk-soar.vsix
- uses: ncipollo/release-action@v1
name: vscode-splunk-soar-vsix
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
artifacts: "*.vsix"
artifacts: vscode-splunk-soar.vsix
token: ${{ secrets.GITHUB_TOKEN }}

- run: npx vsce publish --packagePath $(find . -type f -iname '*.vsix')
- name: Publish to Visual Studio Marketplace
run: yarn vsce publish --packagePath vscode-splunk-soar.vsix
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
40 changes: 25 additions & 15 deletions .github/workflows/docs_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,53 @@
name: Deploy to GitHub Pages

on:
workflow_dispatch:
push:
paths:
- "docs/**"
- ".github/workflows/docs_deploy.yml"
branches:
- main

permissions:
contents: write

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- name: Check out repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 18
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: docs/yarn.lock
- name: Enable Corepack
run: corepack enable
- name: Verify Yarn lockfile registries
run: |
if grep 'resolved "https://' yarn.lock docs/yarn.lock | grep -v 'resolved "https://registry.yarnpkg.com/'; then
echo "All Yarn dependencies must resolve from registry.yarnpkg.com."
exit 1
fi
- name: Install dependencies
working-directory: docs
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --registry https://registry.yarnpkg.com
- name: Build website
working-directory: docs
run: yarn build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./docs/build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com


1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.18.0
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
"recommendations": ["dbaeumer.vscode-eslint"]
}
14 changes: 0 additions & 14 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
}
]
}
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
// Turn off tsc task auto detection since we have the necessary Yarn scripts
"typescript.tsc.autoDetect": "off",
"git.mergeEditor": true
}
}
30 changes: 6 additions & 24 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "watch",
"label": "yarn: watch",
"type": "shell",
"command": "yarn",
"args": ["watch"],
"problemMatcher": [
"$ts-webpack-watch",
"$tslint-webpack-watch"
"$ts-webpack-watch"
],
"isBackground": true,
"presentation": {
Expand All @@ -19,25 +20,6 @@
"kind": "build",
"isDefault": true
}
},
{
"type": "npm",
"script": "watch-tests",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never",
"group": "watchers"
},
"group": "build"
},
{
"label": "tasks: watch-tests",
"dependsOn": [
"npm: watch",
"npm: watch-tests"
],
"problemMatcher": []
}
]
}
}
5 changes: 4 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ vsc-extension-quickstart.md
**/.eslintrc.json
**/*.map
**/*.ts
docs/**
docs/**
.github/**
.nvmrc
audits/**
2 changes: 1 addition & 1 deletion .yarnrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
--ignore-engines true
--registry "https://registry.yarnpkg.com"
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,92 @@ Execution logs can be displayed by:
* right-clicking on a run listed under the Playbook Runs View
* clicking on "Logs"

## Development

### Prerequisites

- VS Code 1.101 or newer
- Node.js 22.18.0 (the repository includes an `.nvmrc`)
- Yarn 1.22.22

This repository uses Yarn exclusively. Do not use npm to install or update dependencies; the root extension and the documentation site each have their own `yarn.lock`.

### Set up the repository

```bash
git clone https://github.com/splunk/vscode-extension-splunk-soar.git
cd vscode-extension-splunk-soar
nvm use
yarn install --frozen-lockfile
code .
```

If the requested Node.js version is not installed yet, run `nvm install` before `nvm use`.

### Inner development loop

1. Open **Run and Debug** in VS Code and start the **Run Extension** configuration, or press `F5`.
2. The default `yarn: watch` task starts webpack in watch mode and opens an Extension Development Host window with a temporary VS Code profile.
3. Exercise the change in the Extension Development Host. Open the Splunk SOAR view or invoke a contributed command to activate the extension.
4. After changing extension or webview source code, wait for webpack to finish rebuilding, then run **Developer: Reload Window** in the Extension Development Host to load the new bundles.
5. Set breakpoints in `src/` and inspect extension-host output in the Debug Console. Webview code is bundled from `app/src/` into `app/build/`.

The temporary profile does not inherit environments configured in your regular VS Code profile. If a change requires a SOAR connection, configure a non-production SOAR environment inside the Extension Development Host.

### Local checks

Run these before opening a pull request:

```bash
# Type-check the extension without emitting JavaScript
yarn check-types

# Lint extension and webview sources
yarn lint

# Create development bundles once, without watch mode
yarn compile

# Create optimized production bundles
yarn package

# Build the same VSIX artifact produced by CI
yarn vsce package --out vscode-splunk-soar.vsix
```

The current lint configuration reports an existing warning backlog but should complete with zero errors. Webpack also reports bundle-size recommendations for the webviews; these warnings do not fail the build.

There is currently no automated extension-host test suite. The required verification is type-checking, linting, production bundling, and exercising the affected workflow in the Extension Development Host.

### Updating dependencies

Run dependency commands from the directory whose manifest is being updated:

```bash
# Runtime dependency
yarn add <package>

# Development dependency
yarn add --dev <package>

# Remove a dependency
yarn remove <package>
```

Commit both the affected `package.json` and its `yarn.lock`. Verify the resulting graph with `yarn install --frozen-lockfile` and `yarn audit`.

### Documentation site

The Docusaurus site is an independent Yarn project under `docs/`:

```bash
cd docs
yarn install --frozen-lockfile
yarn start
```

The development server is available at [http://localhost:3000](http://localhost:3000). Run `yarn build` from `docs/` to verify a production documentation build.

## Documentation

The documentation is located on https://splunk.github.io/vscode-extension-splunk-soar/ and hosted via Github Pages.
Expand Down
4,859 changes: 3,399 additions & 1,460 deletions app/build/appwizard.js

Large diffs are not rendered by default.

Loading