@weebet/spike 0.1.0 → 0.1.1
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 +214 -0
- package/dist/cli.js +0 -0
- package/package.json +6 -2
- package/templates/Makefile +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# `@weebet/spike`
|
|
2
|
+
|
|
3
|
+
Internal development scaffolding CLI.
|
|
4
|
+
Standardizes infrastructure bootstrapping across services at Weebet.io
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
`@weebet/spike`is a lightweight, extensible CLI that standardizes development environments across repositories
|
|
9
|
+
|
|
10
|
+
It allows teams to:
|
|
11
|
+
|
|
12
|
+
- Initialize a repo with approved baseline tooling
|
|
13
|
+
- Add infrastructure components (Postgres, Elasticsearch, etc.)
|
|
14
|
+
- Enforce consistent Docker, Makefile, and environment setups
|
|
15
|
+
- Scaffold services across multiple languages (Node, Python, Go, Rust)
|
|
16
|
+
- Integrate with private registries (GitHub Packages / Artifactory)
|
|
17
|
+
|
|
18
|
+
This eliminates configuration drift and reduces onboarding friction.
|
|
19
|
+
|
|
20
|
+
**Why `@weebet/spike` Exists**
|
|
21
|
+
As weebet scales we need:
|
|
22
|
+
|
|
23
|
+
- Centralized tooling
|
|
24
|
+
- Reproducible dev environments
|
|
25
|
+
- Cross-service consistency
|
|
26
|
+
- Registry independence
|
|
27
|
+
- Multi-language compatibility
|
|
28
|
+
|
|
29
|
+
`@weebet/spike` ensures every service follows the same standards.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Public (npm)
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
npm install @weebet/spike
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Install globally
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
npm install -g @weebet/spike
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
**Internalize dev environment**
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
npx weebet-spike init
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Creates**
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
docker-compose.yml
|
|
57
|
+
.env.dev
|
|
58
|
+
Makefile
|
|
59
|
+
/scripts/seed.ts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Files Installed
|
|
63
|
+
|
|
64
|
+
| File | Purpose |
|
|
65
|
+
| ------------------- | -------------------------------------------- |
|
|
66
|
+
| docker-composed.yml | Standard Postgres + Elasticsearch containers |
|
|
67
|
+
| .env.dev | Development environment variables |
|
|
68
|
+
| Makefile | Development commands abstraction |
|
|
69
|
+
| scripts/seeds.ts | Seed entry point |
|
|
70
|
+
|
|
71
|
+
## Architecture Overview
|
|
72
|
+
|
|
73
|
+
`@weebet/spike` follows a template-driven architecture.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
┌────────────────────┐
|
|
77
|
+
│ User runs CLI │
|
|
78
|
+
│ spike init │
|
|
79
|
+
└─────────┬──────────┘
|
|
80
|
+
│
|
|
81
|
+
▼
|
|
82
|
+
┌─────────────────────┐
|
|
83
|
+
│ Commander Router │
|
|
84
|
+
│ (Command parsing) │
|
|
85
|
+
└─────────┬───────────┘
|
|
86
|
+
│
|
|
87
|
+
▼
|
|
88
|
+
┌──────────────────────┐
|
|
89
|
+
│ initCommand() │
|
|
90
|
+
│ Build file plan │
|
|
91
|
+
└─────────┬────────────┘
|
|
92
|
+
│
|
|
93
|
+
▼
|
|
94
|
+
┌────────────────────────────┐
|
|
95
|
+
│ Template Resolver │
|
|
96
|
+
│ (dist → package root) │
|
|
97
|
+
└─────────┬──────────────────┘
|
|
98
|
+
│
|
|
99
|
+
▼
|
|
100
|
+
┌────────────────────────────┐
|
|
101
|
+
│ Safe Copy Engine │
|
|
102
|
+
│ - check exists │
|
|
103
|
+
│ - dry-run mode │
|
|
104
|
+
│ - force overwrite │
|
|
105
|
+
└─────────┬──────────────────┘
|
|
106
|
+
│
|
|
107
|
+
▼
|
|
108
|
+
┌────────────────────────────┐
|
|
109
|
+
│ Project Directory │
|
|
110
|
+
│ docker-compose.yml │
|
|
111
|
+
│ Makefile │
|
|
112
|
+
│ .env.dev │
|
|
113
|
+
└────────────────────────────┘
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Infrastructure Standards
|
|
117
|
+
|
|
118
|
+
Every generated service includes
|
|
119
|
+
|
|
120
|
+
### Postgres
|
|
121
|
+
|
|
122
|
+
- Version pinned (e.g, `postgres:16-alpine`)
|
|
123
|
+
- Configurable port mapping
|
|
124
|
+
- Healthcheck via `pg_isready``
|
|
125
|
+
- Named volume
|
|
126
|
+
|
|
127
|
+
### Elasticsearch
|
|
128
|
+
|
|
129
|
+
- Single-node dev cluster
|
|
130
|
+
- Memory limited config
|
|
131
|
+
- Health endpoint validation
|
|
132
|
+
|
|
133
|
+
## Makefile Commands
|
|
134
|
+
|
|
135
|
+
| Command | Description |
|
|
136
|
+
| ------------------------ | -------------------------------- |
|
|
137
|
+
| `make help ` | Display available commands |
|
|
138
|
+
| `make system-deps` | Install Docker/Colima (OS-aware) |
|
|
139
|
+
| `make up store=all` | Start Postgres + Elsaticsearch |
|
|
140
|
+
| `make up store=postgres` | Start Postgres only |
|
|
141
|
+
| `make up store=es` | Start Elastic only |
|
|
142
|
+
| `make health` | Block until services healthy |
|
|
143
|
+
| `make seed` | Run database seed |
|
|
144
|
+
| `make logs` | Tail logs |
|
|
145
|
+
| `make reset` | Destroy volumes and restart |
|
|
146
|
+
| `make down` | Stop containers |
|
|
147
|
+
|
|
148
|
+
## How it Works
|
|
149
|
+
|
|
150
|
+
- CLI copies version-controlled templates into your repo.
|
|
151
|
+
- Docker Compose defines infrastructure.
|
|
152
|
+
- Makefile wraps Docker commands for a consistent interface.
|
|
153
|
+
- Health checks block until services are ready.
|
|
154
|
+
- Seed script initializes data safely.
|
|
155
|
+
|
|
156
|
+
## Security & Compliance
|
|
157
|
+
|
|
158
|
+
- `.env.dev`contains no secrets
|
|
159
|
+
- Intended for local development only
|
|
160
|
+
- Private package restricted to org members
|
|
161
|
+
- No production credentials included
|
|
162
|
+
|
|
163
|
+
## Versioning Policy
|
|
164
|
+
|
|
165
|
+
Follows Semantic Versioning:
|
|
166
|
+
|
|
167
|
+
- **Patch** -> Bug fixes
|
|
168
|
+
- **Minor** -> New features
|
|
169
|
+
- **Major** -> Breaking changes
|
|
170
|
+
|
|
171
|
+
## Future Roadmap
|
|
172
|
+
|
|
173
|
+
`@weebet/spike`is not limited to Node services.
|
|
174
|
+
|
|
175
|
+
Planned and supported scafolds:
|
|
176
|
+
| Language | Support |
|
|
177
|
+
| -------- | ------- |
|
|
178
|
+
| Node | Full support |
|
|
179
|
+
| Python | uvx / uv setup |
|
|
180
|
+
| Go | Module bootsrap |
|
|
181
|
+
| Rust | Cargo-based scafollding |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
Registry abstraction (GitHub Packages)
|
|
186
|
+
`@weebet/spike`is registry-agnostic.
|
|
187
|
+
|
|
188
|
+
Supported backedns:
|
|
189
|
+
|
|
190
|
+
- GitHub Packages
|
|
191
|
+
- Artifactory
|
|
192
|
+
- Local Adapter
|
|
193
|
+
|
|
194
|
+
Future design includes a registry abstraction layer:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
Spike CLI
|
|
198
|
+
│
|
|
199
|
+
Registry Adapter Interface
|
|
200
|
+
├── GitHub Adapter
|
|
201
|
+
├── Artifactory Adapter
|
|
202
|
+
└── Local Adapter
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This enables:
|
|
206
|
+
|
|
207
|
+
- Centralized publishing
|
|
208
|
+
- Cross-language package distribution
|
|
209
|
+
- Token-based CI publishing
|
|
210
|
+
- Scoped package governance
|
|
211
|
+
|
|
212
|
+
## Maintained By
|
|
213
|
+
|
|
214
|
+
Weebet.io
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weebet/spike",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"bin": {
|
|
7
7
|
"weebet-spike": "./dist/cli.js"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
10
13
|
"scripts": {
|
|
11
14
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
15
|
"build": "tsc -p tsconfig.json",
|
|
@@ -17,6 +20,7 @@
|
|
|
17
20
|
"author": "",
|
|
18
21
|
"license": "ISC",
|
|
19
22
|
"dependencies": {
|
|
23
|
+
"@weebet/spike": "^0.1.0",
|
|
20
24
|
"commander": "^14.0.3"
|
|
21
25
|
},
|
|
22
26
|
"devDependencies": {
|
package/templates/Makefile
CHANGED
|
@@ -24,6 +24,7 @@ DOCKER_COMPOSE := $(shell \
|
|
|
24
24
|
|
|
25
25
|
help: ## Show available commands
|
|
26
26
|
@echo "Available commands:"
|
|
27
|
+
@echo " make help - Show available commands"
|
|
27
28
|
@echo " make up [store=postgres|es|all] - Start local dev environment"
|
|
28
29
|
@echo " make down - Stop local dev environment"
|
|
29
30
|
@echo " make reset - Tear down and restart with clean volumes"
|