Skip to content

Latest commit

 

History

History
130 lines (99 loc) · 4.03 KB

File metadata and controls

130 lines (99 loc) · 4.03 KB

Contributing

This is a guide for contributors.

Design

Please read the slides about css-modules-kit (in Japanese).

Repo Setup

vp install
vp test

npm-scripts

  • vp run build: Build for production
  • vp check: Run static-checking
  • vp test: Run tests
  • vp run vscode-test: Run VS Code Extension tests

How to debug

You can run code in debug mode from the "Run and Debug" panel in VS Code. To start debugging, select one of the following configurations.

  • codegen (...): Debug for codegen package
  • eslint-plugin (...): Debug for eslint-plugin package
  • stylelint (...): Debug for stylelint package
  • vscode (...): Debug for vscode and ts-plugin package
  • vscode-test: Debug for vp run vscode-test

Good to know:

  • You can set breakpoints in *.ts files.
  • In VS Code, you can view the tsserver log with F1 > TypeScript: Open TS Server log.
    • Runtime errors from ts-plugin are output there.
  • In VS Code, you can view the Extension Host log with F1 > Output: Show Output Channels... > Extension Host.
    • If the extension fails to load, the log will be output there.

Zed Extension

Debugging Zed Extension is a bit tricky.

  1. Run vp run build
  2. Start CMK_LOAD_LOCAL_TS_PLUGIN=0 zed examples/1-basic

Good to know:

  • If CMK_LOAD_LOCAL_TS_PLUGIN is set to 1, the ts-plugin built with vp run build will be loaded.
    • When it is not 1, the ts-plugin downloaded from npmjs.com is loaded.
  • In Zed, you can view the tsserver log with F1 > dev: Open language server logs > vtsls (1-basic).
  • When you start zed with the --foreground option, you can view the stdout of the Extension.
    • e.g. CMK_LOAD_LOCAL_TS_PLUGIN=0 zed --foreground examples/1-basic

NeoVim

  1. Run vp run build
  2. Edit your init.lua
     vim.lsp.config('vtsls', {
       filetypes = vim.list_extend(vtsls_default.filetypes, { 'css' }),
       settings = {
         vtsls = {
           tsserver = {
             globalPlugins = {
               {
                 name = '@css-modules-kit/ts-plugin',
    -            location = npm_root,
    +            location = '/path/to/css-modules-kit-repo-dir',
                 languages = { 'css' },
               },
             },
           },
         },
       },
     })
  3. Start TSS_LOG="-level verbose -file /tmp/tsserver.log" nvim .

Emacs

  1. Run vp run build
  2. Edit your init.el
       (add-to-list
         'eglot-server-programs
         `(((js-ts-mode :language-id "javascript")
            (typescript-ts-mode :language-id "typescript")
            (tsx-ts-mode :language-id "typescriptreact")
            (css-ts-mode :language-id "css"))
           . ("typescript-language-server" "--stdio"
               :initializationOptions
               ((plugins
                 . [((name      . "@css-modules-kit/ts-plugin")
    -                (location  . ,npm-root)
    +                (location  . "/path/to/css-modules-kit-repo-dir")
                     (languages . ["css"]))]))))))
  3. Start TSS_LOG="-level verbose -file /tmp/tsserver.log" emacs -nw .

Pull Request Guidelines

  1. Write your code
  2. Add tests if necessary
  3. Update documentation if necessary
  4. Pass vp check, vp test, and vp run vscode-test
  5. Run vp exec changeset add to create a changeset if the change affects users
    • The summary should be in the following format:
      • For bug fixes: fix: ...
      • For new features: feat: ...
      • For dependency updates: deps: ...
      • For everything else: chore: ...
  6. Create a pull request

Good to know:

  • There are no rules for commit messages. Write whatever you like!

How to release

css-modules-kit is released using changesets on CI. Please read the following workflow file.

Merging a pull request titled "Version Packages" will trigger a release.