|
| 1 | +# cs_script |
| 2 | + |
| 3 | +TypeScript libraries and type definitions for scripting in **Counter-Strike 2**. |
| 4 | + |
| 5 | +This repository is a [pnpm](https://pnpm.io/) workspace. Each package is published independently to npm under the `@s2ze` scope but shares a single fixed version across the workspace. |
| 6 | + |
| 7 | +## Packages |
| 8 | + |
| 9 | +| Package | Description | |
| 10 | +| --- | --- | |
| 11 | +| [`@s2ze/types`](packages/types) | Valve-provided type definitions for CS2 scripting | |
| 12 | +| [`@s2ze/math`](packages/math) | Math utilities (vectors, matrices, etc.) for scripts. | |
| 13 | +| [`@s2ze/scheduler`](packages/scheduler) | Scheduling helpers, setTimeout, setInterval. | |
| 14 | +| [`@s2ze/debug`](packages/debug) | Debugging helpers. | |
| 15 | +| [`@s2ze/tsconfig`](packages/tsconfig) | Shared TypeScript configuration consumed by the other packages. | |
| 16 | + |
| 17 | +## Requirements |
| 18 | + |
| 19 | +- **Node.js** (LTS recommended) |
| 20 | +- **pnpm** `11.2.2` (the version is pinned via the `packageManager` field — run `corepack enable` to have the correct version selected automatically) |
| 21 | + |
| 22 | +## Getting started |
| 23 | + |
| 24 | +```bash |
| 25 | +pnpm install # install all dependencies and link workspace packages |
| 26 | +pnpm build # compile every package (runs `build` in each package) |
| 27 | +pnpm test # run the test suites |
| 28 | +``` |
| 29 | + |
| 30 | +Common root scripts (see `package.json`): |
| 31 | + |
| 32 | +| Script | What it does | |
| 33 | +| --- | --- | |
| 34 | +| `pnpm build` | `pnpm -r run build` — builds every package. | |
| 35 | +| `pnpm test` | `pnpm -r run test` — tests every package. | |
| 36 | +| `pnpm lint` | Run ESLint across the workspace. | |
| 37 | +| `pnpm format` | `eslint . --fix` — autofix lint/formatting. | |
| 38 | + |
| 39 | +## Development workflow |
| 40 | + |
| 41 | +Each package compiles its TypeScript **source** in `src/` down to JavaScript in a `build/` directory: |
| 42 | + |
| 43 | +When one package imports another (e.g. `@s2ze/debug` importing `@s2ze/math`), pnpm symlinks the dependency into `node_modules`, but Node/TypeScript resolve the import through that package's `main`/`exports` fields — which point at **`build/`, not `src/`**, editing `packages/math/src/...` does *not* change what `@s2ze/debug` sees until `@s2ze/math` is rebuilt and its `build/` output is regenerated. The consumer reads the compiled artifact, so stale `build/` output means stale behavior. |
| 44 | + |
| 45 | +After changing a library package, you need to rebuild it for the changes to be reflected with `pnpm build` in the root. |
| 46 | + |
| 47 | +## License |
| 48 | + |
| 49 | +[MIT](LICENSE) © Source2ZE |
0 commit comments