|
1 | 1 | ## Create a new SlickGrid‑Universal package |
2 | 2 |
|
3 | | -This skill documents the recommended steps and minimal references for adding a new package to the slickgrid‑universal monorepo. Use `SlickEmptyWarningComponent` (packages/empty-warning-component) as a simple reference implementation. |
| 3 | +New packages in the slickgrid‑universal monorepo are typically created when adding a new optional **External Resource** (i.e. a plugin or component that integrates with the grid but is not part of the core). This skill documents the recommended steps and minimal references for doing so. Use `SlickEmptyWarningComponent` ([packages/empty-warning-component](packages/empty-warning-component)) as a simple reference implementation. |
4 | 4 |
|
5 | 5 | Key points |
6 | 6 | - New packages that integrate with the grid should implement the `ExternalResource` interface from `@slickgrid-universal/common`. |
7 | 7 | - Every package should provide an `init(grid: SlickGrid)` method. When you need services from `@slickgrid-universal/common`, use the second argument `init(grid: SlickGrid, containerService: ContainerService)` to obtain them. |
8 | 8 | - Available Services (examples) are listed in the vanilla bundle; see [packages/vanilla-bundle/src/slick-vanilla-grid-bundle.ts](packages/vanilla-bundle/src/slick-vanilla-grid-bundle.ts#L399-L414). |
9 | | -- To publish on npm with OIDC (initial publish), use `azu/setup-npm-trusted-publish` for trusted publishing. |
10 | 9 |
|
11 | 10 | Quick checklist |
12 | 11 | - Create package folder under `packages/your-package-name/`. |
@@ -35,9 +34,7 @@ Minimal package structure |
35 | 34 | Example: ExternalResource implementation (TypeScript) |
36 | 35 |
|
37 | 36 | ```ts |
38 | | -import type { SlickGrid } from '@slickgrid-universal/common'; |
39 | | -import type { ContainerService } from '@slickgrid-universal/common'; |
40 | | -import type { ExternalResource } from '@slickgrid-universal/common'; |
| 37 | +import type { ContainerService, ExternalResource, SlickGrid } from '@slickgrid-universal/common'; |
41 | 38 |
|
42 | 39 | export class MyNewPackage implements ExternalResource { |
43 | 40 | readonly pluginName = 'MyNewPackage'; |
@@ -71,5 +68,3 @@ References |
71 | 68 | - Services list: [packages/vanilla-bundle/src/slick-vanilla-grid-bundle.ts](packages/vanilla-bundle/src/slick-vanilla-grid-bundle.ts#L399-L414). |
72 | 69 | - TypeScript project references: [tsconfig.packages.json](tsconfig.packages.json). |
73 | 70 | - OIDC publish action: https://github.com/azu/setup-npm-trusted-publish |
74 | | - |
75 | | -If you want, I can scaffold a minimal package skeleton (files + package.json + build/test scripts) for `packages/your-new-package` and a short example class modeled after `SlickEmptyWarningComponent`. |
0 commit comments