It's recommended to use npm workspaces to allow testing changes to multiple packages. On Codespaces, this is already set up.
npm workspaces are really meant for mono-repos, but we can use that feature here to link our various packages together so you can make changes to a package and immediately consume those changes in a dependent package.
The workspace files will be in the parent directory of the repository, so it's recommended to create a folder for all of the workspace repositories. We chose vscode for these instructions.
mkdir ~/vscode
cd ~/vscodeThen, clone this repository and run script/bootstrap to pull in the other repositories.
gh repo clone github/vscode-github-actions
cd vscode-github-actions
script/bootstrapFinally, install packages in the workspace and build
cd ~/vscode
npm i
npm run build -wsNote: We have included a package-lock.json in script/workspace. If npm run build -ws fails because packages are not installed correctly with npm i, re-run script/bootstrap and run npm ci to
get working packages.
- Open the workspace in VS Code
File -> Open Workspace from File...:/workspaces/vscode-github-actions.code-workspace- If you're doing local development, replace
/workspaceswith the folder you created above (~/vscodein the example)
- If you're doing local development, replace
- Make change to any of the packages
- Build them all with
npm run build -wsin/workspaces/(or~/vscode/for local dev) - Uninstall or disable the Actions extension in your development instance of VS Code
- Start and debug extension with the
Watch & Launch Extensionconfiguration from the "Run and Debug" side panel menu - Open a workspace in the remote extension host that contains workflow files in the
.github/workflowsdirectory
Once you're happy with your changes, publish the changes to the respective packages. You might have to adjust package versions, so if you made a change to actions-workflow-parser and increase the version there, you will have to consume the updated package in actions-languageservice.
npm workspaces hoists all dependencies into a shared node_modules folder at the root directory (/workspaces/node_modules or ~/vscode/node_modules for local dev) and also creates a single package-lock.json file there for the whole workspace. We don't want that when pushing changes back to the individual repos.
There is a script in /workspaces (or ~/vscode for local dev): update-package-locks.sh that does an npm install in every package directory without using workspaces. That way, the local package-lock.json file is generated correctly and can be pushed to the repository.
Launching and debugging the extension should just work. If you need to debug the language server, start the extension first, then execute the Attach to language-server target to also attach to the language server.
Upgrade to a newer version of npm. You can use npm install npm@latest -g, brew upgrade node or other methods.