@tailor-platform/erp-kit 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -28
- package/dist/cli.js +894 -0
- package/package.json +65 -8
- package/rules/app-compose/backend/auth.md +78 -0
- package/rules/app-compose/frontend/auth.md +55 -0
- package/rules/app-compose/frontend/component.md +55 -0
- package/rules/app-compose/frontend/page.md +86 -0
- package/rules/app-compose/frontend/screen-detailview.md +112 -0
- package/rules/app-compose/frontend/screen-form.md +145 -0
- package/rules/app-compose/frontend/screen-listview.md +159 -0
- package/rules/app-compose/structure.md +32 -0
- package/rules/module-development/commands.md +54 -0
- package/rules/module-development/cross-module-type-injection.md +28 -0
- package/rules/module-development/dependency-modules.md +24 -0
- package/rules/module-development/errors.md +12 -0
- package/rules/module-development/executors.md +67 -0
- package/rules/module-development/exports.md +13 -0
- package/rules/module-development/models.md +34 -0
- package/rules/module-development/structure.md +27 -0
- package/rules/module-development/sync-vs-async-operations.md +83 -0
- package/rules/module-development/testing.md +43 -0
- package/rules/sdk-best-practices/db-relations.md +74 -0
- package/rules/sdk-best-practices/sdk-docs.md +14 -0
- package/schemas/app-compose/actors.yml +34 -0
- package/schemas/app-compose/business-flow.yml +50 -0
- package/schemas/app-compose/requirements.yml +33 -0
- package/schemas/app-compose/resolver.yml +47 -0
- package/schemas/app-compose/screen.yml +81 -0
- package/schemas/app-compose/story.yml +67 -0
- package/schemas/module/command.yml +52 -0
- package/schemas/module/feature.yml +58 -0
- package/schemas/module/model.yml +70 -0
- package/schemas/module/module.yml +50 -0
- package/skills/1-module-docs/SKILL.md +107 -0
- package/skills/2-module-feature-breakdown/SKILL.md +66 -0
- package/skills/3-module-doc-review/SKILL.md +230 -0
- package/skills/4-module-tdd-implementation/SKILL.md +56 -0
- package/skills/5-module-implementation-review/SKILL.md +400 -0
- package/skills/app-compose-1-requirement-analysis/SKILL.md +85 -0
- package/skills/app-compose-2-requirements-breakdown/SKILL.md +88 -0
- package/skills/app-compose-3-doc-review/SKILL.md +112 -0
- package/skills/app-compose-4-design-mock/SKILL.md +248 -0
- package/skills/app-compose-5-design-mock-review/SKILL.md +283 -0
- package/skills/app-compose-6-implementation-spec/SKILL.md +122 -0
- package/skills/mock-scenario/SKILL.md +118 -0
- package/src/app.ts +1 -0
- package/src/cli.ts +120 -0
- package/src/commands/check.test.ts +30 -0
- package/src/commands/check.ts +66 -0
- package/src/commands/init.test.ts +77 -0
- package/src/commands/init.ts +87 -0
- package/src/commands/mock/index.ts +53 -0
- package/src/commands/mock/start.ts +179 -0
- package/src/commands/mock/validate.test.ts +185 -0
- package/src/commands/mock/validate.ts +198 -0
- package/src/commands/scaffold.test.ts +76 -0
- package/src/commands/scaffold.ts +119 -0
- package/src/commands/sync-check.test.ts +125 -0
- package/src/commands/sync-check.ts +182 -0
- package/src/integration.test.ts +63 -0
- package/src/mdschema.ts +48 -0
- package/src/mockServer.ts +55 -0
- package/src/module.ts +86 -0
- package/src/modules/accounting/.gitkeep +0 -0
- package/src/modules/coa-management/.gitkeep +0 -0
- package/src/modules/inventory/.gitkeep +0 -0
- package/src/modules/manufacturing/.gitkeep +0 -0
- package/src/modules/primitives/README.md +39 -0
- package/src/modules/primitives/command/activateCategory.test.ts +75 -0
- package/src/modules/primitives/command/activateCategory.ts +50 -0
- package/src/modules/primitives/command/activateCurrency.test.ts +70 -0
- package/src/modules/primitives/command/activateCurrency.ts +50 -0
- package/src/modules/primitives/command/activateUnit.test.ts +53 -0
- package/src/modules/primitives/command/activateUnit.ts +50 -0
- package/src/modules/primitives/command/convertAmount.test.ts +275 -0
- package/src/modules/primitives/command/convertAmount.ts +126 -0
- package/src/modules/primitives/command/convertQuantity.test.ts +219 -0
- package/src/modules/primitives/command/convertQuantity.ts +73 -0
- package/src/modules/primitives/command/createCategory.test.ts +126 -0
- package/src/modules/primitives/command/createCategory.ts +89 -0
- package/src/modules/primitives/command/createCurrency.test.ts +191 -0
- package/src/modules/primitives/command/createCurrency.ts +77 -0
- package/src/modules/primitives/command/createExchangeRate.test.ts +216 -0
- package/src/modules/primitives/command/createExchangeRate.ts +91 -0
- package/src/modules/primitives/command/createUnit.test.ts +214 -0
- package/src/modules/primitives/command/createUnit.ts +88 -0
- package/src/modules/primitives/command/deactivateCategory.test.ts +97 -0
- package/src/modules/primitives/command/deactivateCategory.ts +62 -0
- package/src/modules/primitives/command/deactivateCurrency.test.ts +85 -0
- package/src/modules/primitives/command/deactivateCurrency.ts +55 -0
- package/src/modules/primitives/command/deactivateUnit.test.ts +78 -0
- package/src/modules/primitives/command/deactivateUnit.ts +62 -0
- package/src/modules/primitives/command/setBaseCurrency.test.ts +98 -0
- package/src/modules/primitives/command/setBaseCurrency.ts +74 -0
- package/src/modules/primitives/command/setReferenceUnit.test.ts +108 -0
- package/src/modules/primitives/command/setReferenceUnit.ts +84 -0
- package/src/modules/primitives/db/currency.ts +30 -0
- package/src/modules/primitives/db/exchangeRate.ts +28 -0
- package/src/modules/primitives/db/unit.ts +32 -0
- package/src/modules/primitives/db/uomCategory.ts +32 -0
- package/src/modules/primitives/docs/commands/ActivateCategory.md +34 -0
- package/src/modules/primitives/docs/commands/ActivateCurrency.md +33 -0
- package/src/modules/primitives/docs/commands/ActivateUnit.md +34 -0
- package/src/modules/primitives/docs/commands/ConvertAmount.md +50 -0
- package/src/modules/primitives/docs/commands/ConvertQuantity.md +43 -0
- package/src/modules/primitives/docs/commands/CreateCategory.md +44 -0
- package/src/modules/primitives/docs/commands/CreateCurrency.md +47 -0
- package/src/modules/primitives/docs/commands/CreateExchangeRate.md +48 -0
- package/src/modules/primitives/docs/commands/CreateUnit.md +48 -0
- package/src/modules/primitives/docs/commands/DeactivateCategory.md +38 -0
- package/src/modules/primitives/docs/commands/DeactivateCurrency.md +38 -0
- package/src/modules/primitives/docs/commands/DeactivateUnit.md +38 -0
- package/src/modules/primitives/docs/commands/SetBaseCurrency.md +39 -0
- package/src/modules/primitives/docs/commands/SetReferenceUnit.md +43 -0
- package/src/modules/primitives/docs/features/currency-definitions.md +55 -0
- package/src/modules/primitives/docs/features/exchange-rates.md +61 -0
- package/src/modules/primitives/docs/features/unit-conversion.md +66 -0
- package/src/modules/primitives/docs/features/uom-categories.md +52 -0
- package/src/modules/primitives/docs/models/Currency.md +45 -0
- package/src/modules/primitives/docs/models/ExchangeRate.md +33 -0
- package/src/modules/primitives/docs/models/Unit.md +46 -0
- package/src/modules/primitives/docs/models/UoMCategory.md +44 -0
- package/src/modules/primitives/generated/kysely-tailordb.ts +95 -0
- package/src/modules/primitives/index.ts +40 -0
- package/src/modules/primitives/lib/errors.ts +138 -0
- package/src/modules/primitives/lib/types.ts +20 -0
- package/src/modules/primitives/module.ts +66 -0
- package/src/modules/primitives/permissions.ts +18 -0
- package/src/modules/primitives/tailor.config.ts +11 -0
- package/src/modules/primitives/testing/fixtures.ts +161 -0
- package/src/modules/product-management/.gitkeep +0 -0
- package/src/modules/purchase/.gitkeep +0 -0
- package/src/modules/sales/.gitkeep +0 -0
- package/src/modules/shared/createContext.test.ts +39 -0
- package/src/modules/shared/createContext.ts +15 -0
- package/src/modules/shared/defineCommand.test.ts +42 -0
- package/src/modules/shared/defineCommand.ts +19 -0
- package/src/modules/shared/definePermissions.test.ts +146 -0
- package/src/modules/shared/definePermissions.ts +94 -0
- package/src/modules/shared/entityTypes.ts +15 -0
- package/src/modules/shared/errors.ts +22 -0
- package/src/modules/shared/index.ts +1 -0
- package/src/modules/shared/internal.ts +13 -0
- package/src/modules/shared/requirePermission.test.ts +47 -0
- package/src/modules/shared/requirePermission.ts +8 -0
- package/src/modules/shared/types.ts +4 -0
- package/src/modules/supplier-management/.gitkeep +0 -0
- package/src/modules/supplier-portal/.gitkeep +0 -0
- package/src/modules/testing/index.ts +120 -0
- package/src/modules/user-management/README.md +38 -0
- package/src/modules/user-management/command/activateUser.test.ts +112 -0
- package/src/modules/user-management/command/activateUser.ts +67 -0
- package/src/modules/user-management/command/assignPermissionToRole.test.ts +119 -0
- package/src/modules/user-management/command/assignPermissionToRole.ts +87 -0
- package/src/modules/user-management/command/assignRoleToUser.test.ts +162 -0
- package/src/modules/user-management/command/assignRoleToUser.ts +93 -0
- package/src/modules/user-management/command/createPermission.test.ts +143 -0
- package/src/modules/user-management/command/createPermission.ts +66 -0
- package/src/modules/user-management/command/createRole.test.ts +115 -0
- package/src/modules/user-management/command/createRole.ts +52 -0
- package/src/modules/user-management/command/createUser.test.ts +198 -0
- package/src/modules/user-management/command/createUser.ts +85 -0
- package/src/modules/user-management/command/deactivateUser.test.ts +112 -0
- package/src/modules/user-management/command/deactivateUser.ts +67 -0
- package/src/modules/user-management/command/logAuditEvent.test.ts +179 -0
- package/src/modules/user-management/command/logAuditEvent.ts +59 -0
- package/src/modules/user-management/command/reactivateUser.test.ts +115 -0
- package/src/modules/user-management/command/reactivateUser.ts +67 -0
- package/src/modules/user-management/command/revokePermissionFromRole.test.ts +112 -0
- package/src/modules/user-management/command/revokePermissionFromRole.ts +81 -0
- package/src/modules/user-management/command/revokeRoleFromUser.test.ts +112 -0
- package/src/modules/user-management/command/revokeRoleFromUser.ts +81 -0
- package/src/modules/user-management/db/auditEvent.ts +47 -0
- package/src/modules/user-management/db/permission.ts +31 -0
- package/src/modules/user-management/db/role.ts +28 -0
- package/src/modules/user-management/db/rolePermission.ts +44 -0
- package/src/modules/user-management/db/user.ts +38 -0
- package/src/modules/user-management/db/userRole.ts +44 -0
- package/src/modules/user-management/docs/commands/ActivateUser.md +36 -0
- package/src/modules/user-management/docs/commands/AssignPermissionToRole.md +39 -0
- package/src/modules/user-management/docs/commands/AssignRoleToUser.md +43 -0
- package/src/modules/user-management/docs/commands/CreatePermission.md +35 -0
- package/src/modules/user-management/docs/commands/CreateRole.md +35 -0
- package/src/modules/user-management/docs/commands/CreateUser.md +41 -0
- package/src/modules/user-management/docs/commands/DeactivateUser.md +38 -0
- package/src/modules/user-management/docs/commands/LogAuditEvent.md +37 -0
- package/src/modules/user-management/docs/commands/ReactivateUser.md +37 -0
- package/src/modules/user-management/docs/commands/RevokePermissionFromRole.md +40 -0
- package/src/modules/user-management/docs/commands/RevokeRoleFromUser.md +40 -0
- package/src/modules/user-management/docs/features/audit-trail.md +80 -0
- package/src/modules/user-management/docs/features/role-based-access-control.md +76 -0
- package/src/modules/user-management/docs/features/user-account-management.md +64 -0
- package/src/modules/user-management/docs/models/AuditEvent.md +34 -0
- package/src/modules/user-management/docs/models/Permission.md +31 -0
- package/src/modules/user-management/docs/models/Role.md +31 -0
- package/src/modules/user-management/docs/models/RolePermission.md +33 -0
- package/src/modules/user-management/docs/models/User.md +47 -0
- package/src/modules/user-management/docs/models/UserRole.md +34 -0
- package/src/modules/user-management/docs/plans/2026-01-30-flattened-permissions-design.md +52 -0
- package/src/modules/user-management/executor/recomputeOnRolePermissionChange.ts +61 -0
- package/src/modules/user-management/generated/enums.ts +24 -0
- package/src/modules/user-management/generated/kysely-tailordb.ts +112 -0
- package/src/modules/user-management/index.ts +32 -0
- package/src/modules/user-management/lib/errors.ts +81 -0
- package/src/modules/user-management/lib/recomputeUserPermissions.ts +53 -0
- package/src/modules/user-management/lib/types.ts +31 -0
- package/src/modules/user-management/module.ts +77 -0
- package/src/modules/user-management/permissions.ts +15 -0
- package/src/modules/user-management/tailor.config.ts +11 -0
- package/src/modules/user-management/testing/fixtures.ts +98 -0
- package/src/schemas.ts +25 -0
- package/src/testing.ts +10 -0
- package/src/util.ts +3 -0
package/README.md
CHANGED
|
@@ -1,45 +1,213 @@
|
|
|
1
1
|
# @tailor-platform/erp-kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI tool for validating, scaffolding, syncing module documentation, and managing mock API servers.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tailor-platform/erp-kit
|
|
9
|
+
```
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## Quick Start
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
13
|
+
```bash
|
|
14
|
+
# Set up your repo (agent skills, rules)
|
|
15
|
+
erp-kit init
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
# Validate docs against schemas
|
|
18
|
+
erp-kit check --modules-root modules
|
|
19
|
+
erp-kit check --app-root examples
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
# Check source ↔ doc correspondence
|
|
22
|
+
erp-kit sync-check --modules-root modules
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
# Generate a new doc from template
|
|
25
|
+
erp-kit scaffold --modules-root modules <type> <parent> [name]
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
# Start mock API servers
|
|
28
|
+
erp-kit mock start
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
30
|
+
# Validate mock configs
|
|
31
|
+
erp-kit mock validate
|
|
32
|
+
```
|
|
28
33
|
|
|
29
|
-
##
|
|
34
|
+
## Commands
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
+
### `check`
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Validates markdown documentation against YAML schemas.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
40
|
+
```bash
|
|
41
|
+
erp-kit check --modules-root modules
|
|
42
|
+
erp-kit check --app-root examples
|
|
43
|
+
erp-kit check --modules-root modules --app-root examples
|
|
44
|
+
```
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
### `sync-check`
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
Ensures every source file has a corresponding doc and vice versa. Detects missing and orphaned documentation.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
erp-kit sync-check --modules-root modules
|
|
52
|
+
erp-kit sync-check --app-root examples
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `scaffold`
|
|
56
|
+
|
|
57
|
+
Generates documentation files from schema templates.
|
|
58
|
+
|
|
59
|
+
**Module types:**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
erp-kit scaffold --modules-root modules module inventory
|
|
63
|
+
erp-kit scaffold --modules-root modules feature inventory stock-tracking
|
|
64
|
+
erp-kit scaffold --modules-root modules command inventory CreateOrder
|
|
65
|
+
erp-kit scaffold --modules-root modules model inventory StockItem
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**App-compose types:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
erp-kit scaffold --app-root examples requirements my-app
|
|
72
|
+
erp-kit scaffold --app-root examples actors my-app admin
|
|
73
|
+
erp-kit scaffold --app-root examples business-flow my-app onboarding
|
|
74
|
+
erp-kit scaffold --app-root examples story my-app onboarding/admin--create-user
|
|
75
|
+
erp-kit scaffold --app-root examples screen my-app supplier-list
|
|
76
|
+
erp-kit scaffold --app-root examples resolver my-app create-supplier
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `mock start`
|
|
80
|
+
|
|
81
|
+
Starts Mockoon-based mock API servers behind a reverse proxy. Each mock scenario (`mocks/{provider}/{scenario}/mock.json`) runs on an auto-assigned port and is accessible through the proxy at `http://localhost:{port}/{provider}/{scenario}/...`.
|
|
82
|
+
|
|
83
|
+
**Arguments:**
|
|
84
|
+
|
|
85
|
+
- `[filter...]` — (optional) Filter by provider or provider/scenario. If omitted, all mocks are started.
|
|
86
|
+
- `--mocks-root <path>` — Path to mocks directory (default: `./mocks`)
|
|
87
|
+
- `-p, --port <number>` — Reverse proxy port (default: `3000`)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Start all mocks
|
|
91
|
+
erp-kit mock start
|
|
92
|
+
|
|
93
|
+
# Custom proxy port
|
|
94
|
+
erp-kit mock start --port 4000
|
|
95
|
+
|
|
96
|
+
# Filter by provider or provider/scenario
|
|
97
|
+
erp-kit mock start qbo
|
|
98
|
+
erp-kit mock start shopify/admin-api sendgrid/send-email
|
|
99
|
+
|
|
100
|
+
# Custom mocks directory
|
|
101
|
+
erp-kit mock start --mocks-root ./my-mocks
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### `mock validate`
|
|
105
|
+
|
|
106
|
+
Validates mock scenario configs against the Mockoon schema and checks for common issues (missing `Content-Type` headers, empty response labels, broken databucket references).
|
|
107
|
+
|
|
108
|
+
**Arguments:**
|
|
109
|
+
|
|
110
|
+
- `[paths...]` — (optional) Specific scenario paths to validate. If omitted, all scenarios are validated.
|
|
111
|
+
- `--mocks-root <path>` — Path to mocks directory (default: `./mocks`)
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Validate all scenarios
|
|
115
|
+
erp-kit mock validate
|
|
116
|
+
|
|
117
|
+
# Validate specific scenarios
|
|
118
|
+
erp-kit mock validate mocks/shopify/admin-api mocks/sendgrid/send-email
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `init`
|
|
122
|
+
|
|
123
|
+
One-time setup for consumer repos. Idempotent — skips files that already exist.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
erp-kit init
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This will:
|
|
130
|
+
|
|
131
|
+
1. Copy 12 agent skills to `.agents/skills/`
|
|
132
|
+
2. Copy development rules to `.agents/rules/`
|
|
133
|
+
|
|
134
|
+
## Options
|
|
135
|
+
|
|
136
|
+
| Flag | Description |
|
|
137
|
+
| ----------------------- | --------------------------------------------------------- |
|
|
138
|
+
| `--modules-root <path>` | Path to modules directory (required for module commands) |
|
|
139
|
+
| `--app-root <path>` | Path to app-compose directory (required for app commands) |
|
|
140
|
+
| `--mocks-root <path>` | Path to mocks directory (default: `./mocks`) |
|
|
141
|
+
| `-p, --port <number>` | Reverse proxy port for `mock start` (default: `3000`) |
|
|
142
|
+
|
|
143
|
+
At least one of `--modules-root` or `--app-root` is required for `check`, `sync-check`, and `scaffold`.
|
|
144
|
+
|
|
145
|
+
## What's Bundled
|
|
146
|
+
|
|
147
|
+
| Directory | Contents |
|
|
148
|
+
| ------------- | ---------------------------------------------------------------- |
|
|
149
|
+
| `schemas/` | YAML schema definitions for all doc types |
|
|
150
|
+
| `sync-check/` | Source-to-doc mapping configs |
|
|
151
|
+
| `skills/` | 12 agent skills for documentation, implementation, and mocking |
|
|
152
|
+
| `rules/` | Development rules and best practices for modules and app-compose |
|
|
153
|
+
|
|
154
|
+
### Schemas
|
|
155
|
+
|
|
156
|
+
**Module:** `module`, `feature`, `command`, `model`
|
|
157
|
+
|
|
158
|
+
**App-compose:** `requirements`, `actors`, `business-flow`, `story`, `screen`, `resolver`
|
|
159
|
+
|
|
160
|
+
### Agent Skills
|
|
161
|
+
|
|
162
|
+
Module workflow:
|
|
163
|
+
|
|
164
|
+
1. `1-module-docs` — Create module documentation
|
|
165
|
+
2. `2-module-feature-breakdown` — Break features into models and commands
|
|
166
|
+
3. `3-module-doc-review` — Review feature-to-doc parity
|
|
167
|
+
4. `4-module-tdd-implementation` — TDD implementation from docs
|
|
168
|
+
5. `5-module-implementation-review` — Review implementation-to-doc parity
|
|
169
|
+
|
|
170
|
+
App-compose workflow:
|
|
171
|
+
|
|
172
|
+
1. `app-compose-1-requirement-analysis` — Tier 1-2: requirements, actors, business flows
|
|
173
|
+
2. `app-compose-2-requirements-breakdown` — Tier 3: stories and screens
|
|
174
|
+
3. `app-compose-3-doc-review` — Review doc parity
|
|
175
|
+
4. `app-compose-4-design-mock` — Create UI mockups from screen specs
|
|
176
|
+
5. `app-compose-5-design-mock-review` — Review mockups against specs
|
|
177
|
+
6. `app-compose-6-implementation-spec` — Tier 4: resolver specs
|
|
178
|
+
|
|
179
|
+
Mock workflow:
|
|
180
|
+
|
|
181
|
+
1. `mock-scenario` — Scaffold a new Mockoon mock scenario with CRUD routes and error scenarios
|
|
182
|
+
|
|
183
|
+
### Development Rules
|
|
184
|
+
|
|
185
|
+
- `module-development/` — Structure, commands, models, executors, testing, exports, errors
|
|
186
|
+
- `app-compose/` — App structure, frontend screens, components, auth patterns
|
|
187
|
+
- `sdk-best-practices/` — Database relations, SDK documentation references
|
|
188
|
+
|
|
189
|
+
## Programmatic Mock Server
|
|
190
|
+
|
|
191
|
+
The `createMockServer` helper starts a Mockoon server from a `mock.json` file, useful for integration tests:
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
import { createMockServer } from "@tailor-platform/erp-kit/testing";
|
|
195
|
+
|
|
196
|
+
const server = await createMockServer("./mocks/shopify/admin-api/mock.json");
|
|
197
|
+
// server.url → "http://127.0.0.1:{port}"
|
|
198
|
+
// server.port → assigned port number
|
|
199
|
+
|
|
200
|
+
// Use server.url as base URL in your tests
|
|
201
|
+
const res = await fetch(`${server.url}/admin/api/2024-01/products`);
|
|
202
|
+
|
|
203
|
+
// Clean up
|
|
204
|
+
await server.stop();
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pnpm install
|
|
211
|
+
pnpm --filter @tailor-platform/erp-kit build
|
|
212
|
+
pnpm --filter @tailor-platform/erp-kit test
|
|
213
|
+
```
|