Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 3.29 KB

DEVELOPMENT.md

File metadata and controls

66 lines (50 loc) · 3.29 KB

Development and Contributing to the OpenFGA VS Code Extension

Read the OpenFGA Contribution Process and the OpenFGA Code of Conduct.

Getting Started

  • Run npm install in the root directory. This installs all necessary npm modules.
  • Run npm run compile in the root directory build both server and client code.

Distribution (Optional)

To generate an installable build of this extension, you can do the following:

  • Run npm install --global @vscode/vsce to get the latest version of vsce for packaging
  • Run vsce package to generate an installable VISX artifact for testing or distribution

Structure

.
├── client // Language Client
│   ├── src
│   │   ├── test // End to End tests for Language Client / Server
│   │   ├── extension.node.ts // Language Client node entry point
│   │   └── extension.browser.ts // Language CLient web entry point
│   └── testFixture // Directory containing test files used in e2e tests
├── package.json // The extension manifest.
└── server // Language Server
    └── src
        ├── server.node.ts // Language Server node entry point
        ├── server.browser.ts // Language Server web entry point
        └── server.common.ts // Language Server common code

Running the Client

  • Run npm install in the root directory. This installs all necessary npm modules.
  • Open the root directory in VS Code.
  • Press Ctrl+Shift+B (Windows) or Command+Shift+B (OSX) to start compiling the client and server in watch mode.
  • Switch to the Run and Debug View in the Sidebar (Ctrl+Shift+D on Windows, Command+Shift+D on OSX).
  • Select Launch Client from the drop down (if it is not already).
  • Press ▷ to run the launch config (F5).
  • Select Attach to Server from the drop down, and press ▷ to enable debugging on server code

Testing

  • Run npm run compile to compile the server and client for testing.
  • Run npm run test-node to execute the client node test suite.
  • Run npm run test-web to execute the client browser test suite.
  • Run npm run test-web-headless to execute the client browser test suite in headless mode.

Remote Testing the Web functionality

  • To manually test the extension in the browser for VS Code for the Web before publishing, follow these instructions to setup a VS Code for the Web instance with your local extension, and then proceed with the normal testing flow.

Install Extension from location example steps

  1. Use mkcert to generate a certificate for localhost
  2. Use serve to startup a minimal web server Using serve as a websever
  3. Open the command palette and choose:

    Developer: Install Extension from location

  4. Enter your serve url and select intstall Install extension from location
  5. Extension will install, and be ready to test Installed extension