@stratum-hq/create 0.2.3 → 0.3.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/CHANGELOG.md +42 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/index.js +1245 -37
- package/dist/matrix.js +131 -0
- package/package.json +27 -2
- package/src/generators/db-setup.ts +320 -0
- package/src/generators/docker-compose.ts +98 -0
- package/src/generators/init-sql.ts +57 -0
- package/src/generators/middleware.ts +267 -0
- package/src/generators/package-json.ts +174 -0
- package/src/generators/readme.ts +119 -0
- package/src/index.ts +61 -11
- package/src/matrix.ts +186 -0
- package/src/preset-project.ts +148 -0
- package/src/__tests__/create.test.ts +0 -217
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @stratum-hq/create
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b55ae70: Correct and complete package metadata for the npm registry listing.
|
|
8
|
+
|
|
9
|
+
Every published package now declares `license` (MIT), `author`, `homepage`, and
|
|
10
|
+
`bugs`. Runtime packages declare `engines` (Node >=20) to match the project's
|
|
11
|
+
support policy; this fixes `@stratum-hq/cli`, which previously declared Node >=18.
|
|
12
|
+
`@stratum-hq/mysql` and `@stratum-hq/mongodb` gain the `keywords` array they were
|
|
13
|
+
missing. No runtime code changes.
|
|
14
|
+
|
|
15
|
+
- c17b1a5: Point `@stratum-hq/create`'s `exports["./matrix"]` at built output instead of raw source (#219, from the #133 v1.0 surface review).
|
|
16
|
+
|
|
17
|
+
The `./matrix` subpath previously resolved (and shipped) `./src/matrix.ts` for both the `import` and `types` conditions, blessing a raw-source subpath unlike every other package. The build now emits `dist/matrix.js` and `./matrix` resolves there, matching the package's `.` entry. The stack-combination matrix API is unchanged.
|
|
18
|
+
|
|
19
|
+
- c17b1a5: Give the `@stratum-hq/db-adapters` barrel one consistent naming scheme for the tenant-context helpers (#219, from the #133 v1.0 surface review).
|
|
20
|
+
|
|
21
|
+
The barrel previously exposed the same "run in tenant context" concept under colliding names patched over with `as` aliases. The 1.0 names use an `<orm>` prefix so no export is an alias workaround:
|
|
22
|
+
- `withTenant` (Prisma) -> `prismaWithTenant`
|
|
23
|
+
- `withDrizzleTenant` -> `drizzleWithTenant`
|
|
24
|
+
- `withTenantScope` (Sequelize) -> `sequelizeWithTenantScope`
|
|
25
|
+
- `withDrizzleTenantScope` -> `drizzleWithTenantScope`
|
|
26
|
+
- `enableRLSMigration` (migration helper) -> `enableRLSForMigration` (distinct from the runtime `enableRLS`)
|
|
27
|
+
|
|
28
|
+
Behavior is identical; only the exported names change. The `@stratum-hq/cli` and `@stratum-hq/create` scaffolding templates emit the new `prismaWithTenant` name. Update your imports to the new names.
|
|
29
|
+
|
|
30
|
+
- 4adcbb5: Stop shipping test files in published tarballs. tsc-built packages now exclude **tests** directories and .test/.spec files from compilation, so dist and the tarball contain only real package output. The create package, which ships source for its ./matrix export, excludes tests via .npmignore instead. The vitest runner is unaffected and still runs tests from src.
|
|
31
|
+
|
|
32
|
+
## 0.3.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- Security hardening release plus ecosystem polish: NestJS ALS context-leak fix, SSRF-safe webhook validation, production JWT/HKDF enforcement, fail-closed ORM adapters, SHA-pinned CI (#84); `create --preset` architecture with ORM-aware generators and Stack Wizard (#85); scaffolded projects now target Next 15 / React 19 / NestJS 11; MIT LICENSE and READMEs shipped in every package; dependency security bumps across the workspace.
|
|
37
|
+
|
|
38
|
+
## 0.2.3
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Security hardening: fix NestJS tenant context leak, SSRF bypass in webhook delivery, RLS session scoping, fail-closed DB adapters, JWT secret hardening, tenant endpoint scoping, Knex INSERT injection, GitHub Actions pinning
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christian Crank
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @stratum-hq/create
|
|
2
|
+
|
|
3
|
+
Scaffold a complete [Stratum](https://github.com/stratum-hq/Stratum) multi-tenancy project with one command — package.json, Docker Compose, environment files, and framework-specific starter code.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @stratum-hq/create my-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This creates a `my-app/` directory containing:
|
|
12
|
+
|
|
13
|
+
- `package.json` with `@stratum-hq/lib`, `pg`, and your chosen framework
|
|
14
|
+
- `docker-compose.yml` with PostgreSQL 16 and the `ltree` + `uuid-ossp` extensions pre-loaded
|
|
15
|
+
- `.env.example` with `DATABASE_URL` and other defaults
|
|
16
|
+
- A starter server wired up with Stratum middleware
|
|
17
|
+
- `README.md` with getting-started instructions
|
|
18
|
+
|
|
19
|
+
## Options
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @stratum-hq/create my-app [options]
|
|
23
|
+
|
|
24
|
+
--template <name> express (default), fastify, or nextjs
|
|
25
|
+
--skip-install skip npm install after scaffolding
|
|
26
|
+
--force overwrite an existing directory
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Templates
|
|
30
|
+
|
|
31
|
+
- **express** (default) — Express server with Stratum middleware, tenant-aware routes, and TypeScript config.
|
|
32
|
+
- **fastify** — Fastify server with the Stratum plugin registered.
|
|
33
|
+
- **nextjs** — Next.js project with edge middleware for tenant resolution and server-side helpers.
|
|
34
|
+
|
|
35
|
+
## After Scaffolding
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd my-app
|
|
39
|
+
docker compose up -d # start PostgreSQL
|
|
40
|
+
npm run dev # run the app
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The generated project uses `autoMigrate: true`, so Stratum creates its tables automatically on first run — no separate migration step.
|
|
44
|
+
|
|
45
|
+
## Links
|
|
46
|
+
|
|
47
|
+
- Documentation: https://docs.stratum-hq.org/packages/create/
|
|
48
|
+
- GitHub: https://github.com/stratum-hq/Stratum
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT © Christian Crank
|