@tailor-platform/create-sdk 0.11.3 → 0.12.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 +8 -0
- package/dist/index.js +2 -1
- package/package.json +2 -2
- package/templates/hello-world/package.json +2 -2
- package/templates/inventory-management/package.json +2 -2
- package/templates/multi-application/.gitignore +3 -0
- package/templates/multi-application/.prettierignore +1 -0
- package/templates/multi-application/.prettierrc +1 -0
- package/templates/multi-application/README.md +45 -0
- package/templates/multi-application/apps/admin/db/adminNote.ts +18 -0
- package/templates/multi-application/apps/admin/tailor.config.ts +10 -0
- package/templates/multi-application/apps/user/db/user.ts +17 -0
- package/templates/multi-application/apps/user/tailor.config.ts +8 -0
- package/templates/multi-application/eslint.config.js +27 -0
- package/templates/multi-application/package.json +24 -0
- package/templates/multi-application/tsconfig.json +15 -0
- package/templates/testing/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @tailor-platform/create-sdk
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#79](https://github.com/tailor-platform/sdk/pull/79) [`f68247d`](https://github.com/tailor-platform/sdk/commit/f68247deded52ee8687fdf750e5321f7a8c8da4e) Thanks [@remiposo](https://github.com/remiposo)! - Added the multi-application template
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
3
11
|
## 0.11.3
|
|
4
12
|
|
|
5
13
|
## 0.11.2
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,8 @@ const availableTemplates = async () => {
|
|
|
17
17
|
const templateHints = {
|
|
18
18
|
"hello-world": "Initial project to get started with Tailor Platform SDK",
|
|
19
19
|
"inventory-management": "Simple inventory management system",
|
|
20
|
-
testing: "Testing guide for Tailor Platform SDK"
|
|
20
|
+
testing: "Testing guide for Tailor Platform SDK",
|
|
21
|
+
"multi-application": "Multi-application setup with shared databases"
|
|
21
22
|
};
|
|
22
23
|
const validateName = (name) => {
|
|
23
24
|
if (name.length < 3 || name.length > 30) return "Project name must be between 3 and 30 characters long.";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-platform/create-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "A CLI tool to quickly create a new Tailor Platform SDK project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"eslint": "9.39.1",
|
|
32
32
|
"tsdown": "0.15.6",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
|
-
"typescript-eslint": "8.
|
|
34
|
+
"typescript-eslint": "8.48.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsdown",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@eslint/js": "9.39.1",
|
|
15
|
-
"@tailor-platform/sdk": "0.
|
|
15
|
+
"@tailor-platform/sdk": "0.12.1",
|
|
16
16
|
"@types/node": "22.19.1",
|
|
17
17
|
"eslint": "9.39.1",
|
|
18
18
|
"prettier": "3.6.2",
|
|
19
19
|
"typescript": "5.9.3",
|
|
20
|
-
"typescript-eslint": "8.
|
|
20
|
+
"typescript-eslint": "8.48.0"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@eslint/js": "9.39.1",
|
|
20
20
|
"@tailor-platform/function-types": "0.7.2",
|
|
21
|
-
"@tailor-platform/sdk": "0.
|
|
21
|
+
"@tailor-platform/sdk": "0.12.1",
|
|
22
22
|
"@types/node": "22.19.1",
|
|
23
23
|
"eslint": "9.39.1",
|
|
24
24
|
"prettier": "3.6.2",
|
|
25
25
|
"typescript": "5.9.3",
|
|
26
|
-
"typescript-eslint": "8.
|
|
26
|
+
"typescript-eslint": "8.48.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm-lock.yaml
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Multi-Application Guide
|
|
2
|
+
|
|
3
|
+
A sample project demonstrating multiple applications with shared databases using [Tailor Platform SDK](https://www.npmjs.com/package/@tailor-platform/sdk).
|
|
4
|
+
|
|
5
|
+
This project was bootstrapped with [Create Tailor Platform SDK](https://www.npmjs.com/package/@tailor-platform/create-sdk).
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
This project contains two applications: `user` and `admin`.
|
|
10
|
+
|
|
11
|
+
- `user` application owns `shared-db` and deploys its resources
|
|
12
|
+
- `admin` application references `shared-db` as `external`, which exposes it in GraphQL without deploying duplicate resources
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
1. Create a new workspace:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx tailor-sdk login
|
|
20
|
+
npx tailor-sdk workspace create --name <workspace-name> --region <workspace-region>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. Deploy the project:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
TAILOR_PLATFORM_WORKSPACE_ID=<workspace-id> npm run deploy
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This deploys both applications in order: `user` first, then `admin`.
|
|
30
|
+
|
|
31
|
+
3. Open [Tailor Platform Console](https://console.tailor.tech/) and verify:
|
|
32
|
+
|
|
33
|
+
- Two applications (`user` and `admin`) exist in your workspace
|
|
34
|
+
- In `admin` application's GraphQL Playground, `User` type from `shared-db` is available
|
|
35
|
+
|
|
36
|
+
## Scripts
|
|
37
|
+
|
|
38
|
+
- `deploy`: Deploy all applications to Tailor Platform
|
|
39
|
+
- `deploy:user`: Deploy user application only
|
|
40
|
+
- `deploy:admin`: Deploy admin application only
|
|
41
|
+
- `format`: Format the code using Prettier
|
|
42
|
+
- `format:check`: Check code formatting using Prettier
|
|
43
|
+
- `lint`: Lint the code using ESLint
|
|
44
|
+
- `lint:fix`: Fix linting issues using ESLint
|
|
45
|
+
- `typecheck`: Run TypeScript type checks
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { db } from "@tailor-platform/sdk";
|
|
2
|
+
|
|
3
|
+
export const adminNote = db
|
|
4
|
+
.type("AdminNote", {
|
|
5
|
+
title: db.string(),
|
|
6
|
+
content: db.string(),
|
|
7
|
+
authorId: db.uuid().hooks({ create: ({ user }) => user.id }),
|
|
8
|
+
...db.fields.timestamps(),
|
|
9
|
+
})
|
|
10
|
+
// NOTE: This permits all operations for simplicity.
|
|
11
|
+
// In production, configure proper permissions based on your requirements.
|
|
12
|
+
.permission({
|
|
13
|
+
create: [{ conditions: [], permit: true }],
|
|
14
|
+
read: [{ conditions: [], permit: true }],
|
|
15
|
+
update: [{ conditions: [], permit: true }],
|
|
16
|
+
delete: [{ conditions: [], permit: true }],
|
|
17
|
+
})
|
|
18
|
+
.gqlPermission([{ conditions: [], actions: "all", permit: true }]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from "@tailor-platform/sdk";
|
|
2
|
+
import { sharedDb } from "../user/tailor.config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
name: "admin",
|
|
6
|
+
db: {
|
|
7
|
+
[sharedDb]: { external: true },
|
|
8
|
+
"admin-db": { files: [`./apps/admin/db/**/*.ts`] },
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { db } from "@tailor-platform/sdk";
|
|
2
|
+
|
|
3
|
+
export const user = db
|
|
4
|
+
.type("User", {
|
|
5
|
+
name: db.string().unique(),
|
|
6
|
+
role: db.enum("USER", "ADMIN"),
|
|
7
|
+
...db.fields.timestamps(),
|
|
8
|
+
})
|
|
9
|
+
// NOTE: This permits all operations for simplicity.
|
|
10
|
+
// In production, configure proper permissions based on your requirements.
|
|
11
|
+
.permission({
|
|
12
|
+
create: [{ conditions: [], permit: true }],
|
|
13
|
+
read: [{ conditions: [], permit: true }],
|
|
14
|
+
update: [{ conditions: [], permit: true }],
|
|
15
|
+
delete: [{ conditions: [], permit: true }],
|
|
16
|
+
})
|
|
17
|
+
.gqlPermission([{ conditions: [], actions: "all", permit: true }]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig([
|
|
6
|
+
// Ignore sdk's output directory.
|
|
7
|
+
globalIgnores([".tailor-sdk/"]),
|
|
8
|
+
// Use recommended rules.
|
|
9
|
+
// https://typescript-eslint.io/users/configs#projects-with-type-checking
|
|
10
|
+
eslint.configs.recommended,
|
|
11
|
+
tseslint.configs.recommendedTypeChecked,
|
|
12
|
+
tseslint.configs.stylisticTypeChecked,
|
|
13
|
+
{
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parserOptions: {
|
|
16
|
+
projectService: true,
|
|
17
|
+
tsconfigRootDir: import.meta.dirname,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
// Disable type-checked linting for root config files.
|
|
22
|
+
// https://typescript-eslint.io/troubleshooting/typed-linting/#how-do-i-disable-type-checked-linting-for-a-file
|
|
23
|
+
{
|
|
24
|
+
files: ["eslint.config.js"],
|
|
25
|
+
extends: [tseslint.configs.disableTypeChecked],
|
|
26
|
+
},
|
|
27
|
+
]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "multi-application",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"deploy": "pnpm run deploy:user && pnpm run deploy:admin",
|
|
7
|
+
"deploy:user": "tailor-sdk apply -c apps/user/tailor.config.ts",
|
|
8
|
+
"deploy:admin": "tailor-sdk apply -c apps/admin/tailor.config.ts",
|
|
9
|
+
"format": "prettier --write .",
|
|
10
|
+
"format:check": "prettier --check .",
|
|
11
|
+
"lint": "eslint --cache .",
|
|
12
|
+
"lint:fix": "eslint --cache --fix .",
|
|
13
|
+
"typecheck": "tsc --noEmit"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/js": "9.39.1",
|
|
17
|
+
"@tailor-platform/sdk": "0.12.1",
|
|
18
|
+
"@types/node": "22.19.1",
|
|
19
|
+
"eslint": "9.39.1",
|
|
20
|
+
"prettier": "3.6.2",
|
|
21
|
+
"typescript": "5.9.3",
|
|
22
|
+
"typescript-eslint": "8.48.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"resolveJsonModule": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["**/*.ts"]
|
|
15
|
+
}
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@eslint/js": "9.39.1",
|
|
23
23
|
"@tailor-platform/function-types": "0.7.2",
|
|
24
|
-
"@tailor-platform/sdk": "0.
|
|
24
|
+
"@tailor-platform/sdk": "0.12.1",
|
|
25
25
|
"@types/node": "22.19.1",
|
|
26
26
|
"eslint": "9.39.1",
|
|
27
27
|
"graphql-request": "7.3.4",
|
|
28
28
|
"prettier": "3.6.2",
|
|
29
29
|
"typescript": "5.9.3",
|
|
30
|
-
"typescript-eslint": "8.
|
|
31
|
-
"vitest": "4.0.
|
|
30
|
+
"typescript-eslint": "8.48.0",
|
|
31
|
+
"vitest": "4.0.14"
|
|
32
32
|
}
|
|
33
33
|
}
|