Skip to content

Commit b5e9ecf

Browse files
committed
update documentation
1 parent 802aede commit b5e9ecf

2 files changed

Lines changed: 66 additions & 25 deletions

File tree

CONTRIBUTING.md

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,67 @@
22

33
This is a guide for contributors.
44

5-
## How to dev
5+
## Design
6+
7+
Please read the slides about css-modules-kit (in Japanese).
8+
9+
- https://speakerdeck.com/mizdra/css-modules-kit
10+
11+
## Repo Setup
12+
13+
```console
14+
npm install
15+
npm run test
16+
```
17+
18+
## npm-scripts
619

720
- `npm run build`: Build for production
8-
- `npm run dev`: Run for development
921
- `npm run lint`: Run static-checking
1022
- `npm run test`: Run tests
1123

24+
## How to debug
25+
26+
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.
27+
28+
- `codegen (...)`: Debug for `codegen` package
29+
- `eslint-plugin (...)`: Debug for `eslint-plugin` package
30+
- `stylelint (...)`: Debug for `stylelint` package
31+
- `vscode (...)`: Debug for `vscode` and `ts-plugin` package
32+
- `vscode-test`: Debug for `npm run test:vscode`
33+
34+
Good to know:
35+
36+
- You can set breakpoints in `*.ts` files.
37+
- In VS Code, you can view the tsserver log with `F1 > TypeScript: Open TS Server log`.
38+
- Runtime errors from `ts-plugin` are output there.
39+
- In VS Code, you can view the Extension Host log with `F1 > Output: Show Output Channels... > Extension Host`.
40+
- If the extension fails to load, the log will be output there.
41+
42+
## Pull Request Guidelines
43+
44+
1. Write your code
45+
1. Add tests if necessary
46+
1. Update documentation if necessary
47+
1. Pass `npm run lint` and `npm run test`
48+
1. Run `npx @changesets/cli add` to create a changeset if the change affects users
49+
- The summary should be in the following format:
50+
- For bug fixes: `fix: ...`
51+
- For new features: `feat: ...`
52+
- For dependency updates: `deps: ...`
53+
- For everything else: `chore: ...`
54+
1. Create a pull request
55+
56+
Good to know:
57+
58+
- There are no rules for commit messages. Write whatever you like!
59+
1260
## How to release
1361

14-
- Wait for passing CI...
15-
- ```bash
16-
git switch main && git pull
17-
```
18-
- ```bash
19-
npm run build -- --clean && npm run build
20-
```
21-
- ```bash
22-
npx @changesets/cli version
23-
```
24-
- ```bash
25-
npx @changesets/cli publish
26-
```
27-
- ```bash
28-
git push --follow-tags
29-
```
62+
css-modules-kit is released using [changesets](https://github.com/changesets/changesets) on CI. Please read the following workflow file.
63+
64+
- https://github.com/mizdra/css-modules-kit/blob/main/.github/workflows/release.yml
65+
66+
Merging a pull request titled "Version Packages" will trigger a release.
67+
68+
- https://github.com/mizdra/css-modules-kit/pulls?q=is%3Apr+Version+Packages+in%3Atitle

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ A toolkit for making CSS Modules useful.
66

77
By default, CSS Modules have limited language features in editors. For example:
88

9-
- Clicking on `styles.button` does not jump to its definition in `Button.module.css`.
10-
- When renaming `styles.button`, the corresponding `.button {...}` in `Button.module.css` is not renamed.
11-
- Performing "Find All References" on `styles.button` does not find its definition in `Button.module.css`.
9+
- Clicking on `styles.button` does not go to its definition in `Button.module.css`.
10+
- Renaming `styles.button` does not rename the corresponding `.button {...}` in `Button.module.css`.
11+
- Find all references of `styles.button` does not include its definition in `Button.module.css`.
1212

13-
It has been difficult to solve these issues because the TypeScript Language Server (tsserver) does not handle CSS files. Since tsserver does not hold information about CSS files, it cannot calculate jump destinations or determine which code should be renamed.
13+
It has been difficult to solve these issues because the TypeScript Language Server (tsserver) does not handle CSS files. Since tsserver does not load CSS files, it cannot determine which definitions to go to or which code to rename.
1414

15-
css-modules-kit addresses this by using a TypeScript Language Service Plugin. With this plugin, css-modules-kit extends tsserver to handle `*.module.css` files. As a result, many language features like code navigation and rename refactoring become available.
15+
css-modules-kit solves this problem by using the [TypeScript Language Service Plugin](https://github.com/microsoft/TypeScript/wiki/Writing-a-Language-Service-Plugin). With this plugin, css-modules-kit extends tsserver to handle `*.module.css` files. As a result, rich language features like code navigation and rename refactoring become available.
1616

17-
Additionally, css-modules-kit provides various development tools for CSS Modules, such as a stylelint plugin and a utility for generating `*.d.ts` files.
17+
Another method that provides rich language features is to use the VS Code Extension API (see: https://github.com/Viijay-Kr/react-ts-css). However, it only supports VS Code. On the other hand, css-modules-kit is based on the TypeScript Language Service Plugin, so it supports other editors as well.
18+
19+
Additionally, css-modules-kit provides various development tools for CSS Modules. For example, stylelint plugins and the tool that generates `*.d.ts` files.
1820

1921
## Supported Language Features
2022

@@ -56,7 +58,7 @@ https://github.com/user-attachments/assets/4af168fa-357d-44e1-b010-3053802bf1a2
5658
</details>
5759

5860
<details>
59-
<summary>Create CSS Module file for current file.</summary>
61+
<summary>Create CSS Module file for current file</summary>
6062

6163
If there is no CSS Module file corresponding to `xxx.tsx`, create one.
6264

0 commit comments

Comments
 (0)