@fakeware/plugin-pickware 0.0.1 → 1.0.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 +0 -136
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,139 +2,3 @@
|
|
|
2
2
|
|
|
3
3
|
A [fakeware](https://github.com/fakeware-sh/fakeware) plugin for **Pickware ERP** —
|
|
4
4
|
seed warehouses, bin locations, and stock into a Shopware 6 shop running Pickware.
|
|
5
|
-
|
|
6
|
-
It teaches fakeware about Pickware's DAL entities so you can author them with
|
|
7
|
-
`define(...)` in your data files, and contributes a fetcher that loads the shop's
|
|
8
|
-
existing warehouses into the run context.
|
|
9
|
-
|
|
10
|
-
> **Status: minimal v1.** Covers `pickware_erp_warehouse`, `pickware_erp_bin_location`,
|
|
11
|
-
> and `pickware_erp_stock_movement`. Suppliers, purchasing, stocktakes, and the
|
|
12
|
-
> WMS/POS/Shipping entities are intentionally out of scope for now.
|
|
13
|
-
|
|
14
|
-
## Install
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
bun add -D @fakeware/plugin-pickware
|
|
18
|
-
# @fakeware/core is a peer dependency — your fakeware project already has it.
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
Register the plugin in `fakeware.config.ts`:
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
import { defineConfig } from '@fakeware/core/config'
|
|
27
|
-
import { pickware } from '@fakeware/plugin-pickware'
|
|
28
|
-
|
|
29
|
-
export default defineConfig({
|
|
30
|
-
shopware: {
|
|
31
|
-
url: process.env.SHOPWARE_URL!,
|
|
32
|
-
clientId: process.env.SHOPWARE_CLIENT_ID!,
|
|
33
|
-
clientSecret: process.env.SHOPWARE_CLIENT_SECRET!,
|
|
34
|
-
},
|
|
35
|
-
plugins: [pickware()],
|
|
36
|
-
})
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Author Pickware data in `data/*.ts`. Importing the package augments fakeware's
|
|
40
|
-
`EntityRegistry`, so the `pickware_erp_*` entity names are fully type-checked:
|
|
41
|
-
|
|
42
|
-
`data/pickware.ts`:
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { define, ref } from '@fakeware/core'
|
|
46
|
-
import { stockMovementIn } from '@fakeware/plugin-pickware'
|
|
47
|
-
|
|
48
|
-
define('pickware_erp_warehouse', { $key: 'main', name: 'Main', code: 'WH-01' })
|
|
49
|
-
|
|
50
|
-
define('pickware_erp_bin_location', {
|
|
51
|
-
$key: 'a1',
|
|
52
|
-
code: 'A1',
|
|
53
|
-
warehouseId: ref('pickware_erp_warehouse/main'),
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
define(
|
|
57
|
-
'pickware_erp_stock_movement',
|
|
58
|
-
stockMovementIn({
|
|
59
|
-
productId: ref('product/my-product'),
|
|
60
|
-
warehouseId: ref('pickware_erp_warehouse/main'),
|
|
61
|
-
quantity: 100,
|
|
62
|
-
}),
|
|
63
|
-
)
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Bin locations referencing a warehouse via `ref()` are written after it
|
|
67
|
-
automatically. Seed stock through `pickware_erp_stock_movement` (an append-only
|
|
68
|
-
ledger) — never write `product.stock` directly while Pickware is active.
|
|
69
|
-
|
|
70
|
-
Run it with the fakeware CLI:
|
|
71
|
-
|
|
72
|
-
```sh
|
|
73
|
-
fakeware up --dry-run
|
|
74
|
-
fakeware up
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Referencing existing warehouses
|
|
78
|
-
|
|
79
|
-
`pickware()` adds a fetcher that loads the shop's current warehouses into the run
|
|
80
|
-
context. Read them in a plugin `setup` hook or any code with access to the context:
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
import { pickwareWarehouses } from '@fakeware/plugin-pickware'
|
|
84
|
-
|
|
85
|
-
const existing = pickwareWarehouses(shopContext.extensions)
|
|
86
|
-
const main = existing.find((w) => w.code === 'WH-01')
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## ⚠️ Verify field names against your install
|
|
90
|
-
|
|
91
|
-
Pickware publishes **no Shopware 6 API documentation**, so the entity *field
|
|
92
|
-
names* in this plugin (especially `destinationWarehouseId` on the stock movement)
|
|
93
|
-
are best-effort. **Before a live `up`, confirm them against your shop:**
|
|
94
|
-
|
|
95
|
-
```sh
|
|
96
|
-
curl -H "Authorization: Bearer <token>" \
|
|
97
|
-
https://your-shop.example/api/_info/entity-schema.json \
|
|
98
|
-
| jq 'keys | map(select(startswith("pickware_erp")))'
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Inspect the `pickware_erp_warehouse`, `pickware_erp_bin_location`, and
|
|
102
|
-
`pickware_erp_stock_movement` field definitions there (or watch the Pickware
|
|
103
|
-
admin module's network requests) and adjust the record shapes in
|
|
104
|
-
`src/entities.ts` / the `stockMovementIn` helper to match.
|
|
105
|
-
|
|
106
|
-
Key facts the plugin is built around:
|
|
107
|
-
|
|
108
|
-
- Stock is owned by Pickware's **append-only ledger** (`pickware_erp_stock_movement`).
|
|
109
|
-
You change stock by **adding movements**; Pickware recomputes
|
|
110
|
-
`pickware_erp_stock` and mirrors the total back into `product.stock`.
|
|
111
|
-
- Writing `product.stock` directly via the standard API while Pickware is active
|
|
112
|
-
**nulls** the Pickware warehouses — don't do it.
|
|
113
|
-
|
|
114
|
-
## Publishing
|
|
115
|
-
|
|
116
|
-
This repo publishes `@fakeware/plugin-pickware` to npm via
|
|
117
|
-
[release-please](https://github.com/googleapis/release-please) — the same flow as
|
|
118
|
-
the fakeware monorepo. Conventional commits on `main` open a release PR; merging
|
|
119
|
-
it tags a version and publishes.
|
|
120
|
-
|
|
121
|
-
**One-time repo setup** (in GitHub → Settings):
|
|
122
|
-
|
|
123
|
-
- Add an npm publish credential for the `@fakeware` scope. The release workflow
|
|
124
|
-
uses npm provenance (`id-token: write`) — configure a trusted publisher on npm,
|
|
125
|
-
or add an `NPM_TOKEN` secret and wire it into `.github/workflows/release.yml`.
|
|
126
|
-
- The default `GITHUB_TOKEN` is sufficient for release-please's PR/tagging.
|
|
127
|
-
|
|
128
|
-
## Development
|
|
129
|
-
|
|
130
|
-
```sh
|
|
131
|
-
bun install
|
|
132
|
-
bun run build
|
|
133
|
-
bun run typecheck
|
|
134
|
-
bun test
|
|
135
|
-
bun run check
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## License
|
|
139
|
-
|
|
140
|
-
MIT
|
package/package.json
CHANGED