Skip to content

Commit

Permalink
feat(cli): inject default config for tenant
Browse files Browse the repository at this point in the history
  • Loading branch information
Plopix committed Jan 24, 2025
1 parent 30b6b72 commit fbe3bb6
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
4 changes: 4 additions & 0 deletions components/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [5.2.1]

- capability to replace Root Tenant Id and Vat Type in the install process from the extra mutation.

## [5.2.0]

### Added
Expand Down
26 changes: 15 additions & 11 deletions components/cli/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,26 @@
color: #fff;
padding: 100px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(255, 191, 74, 0.6),
0 0 20px rgba(255, 191, 74, 0.4),
0 0 30px rgba(255, 191, 74, 0.3);
box-shadow:
0 0 10px rgba(255, 191, 74, 0.6),
0 0 20px rgba(255, 191, 74, 0.4),
0 0 30px rgba(255, 191, 74, 0.3);
animation: glow 1.5s infinite;
}

@keyframes glow {
0%, 100% {
box-shadow: 0 0 10px rgba(255, 191, 74, 0.6),
0 0 20px rgba(255, 191, 74, 0.4),
0 0 30px rgba(255, 191, 74, 0.3);
0%,
100% {
box-shadow:
0 0 10px rgba(255, 191, 74, 0.6),
0 0 20px rgba(255, 191, 74, 0.4),
0 0 30px rgba(255, 191, 74, 0.3);
}
50% {
box-shadow: 0 0 20px rgba(255, 191, 74, 0.8),
0 0 30px rgba(255, 191, 74, 0.6),
0 0 40px rgba(255, 191, 74, 0.5);
box-shadow:
0 0 20px rgba(255, 191, 74, 0.8),
0 0 30px rgba(255, 191, 74, 0.6),
0 0 40px rgba(255, 191, 74, 0.5);
}
}

Expand Down
2 changes: 1 addition & 1 deletion components/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crystallize/cli",
"version": "5.2.0",
"version": "5.2.1",
"description": "Crystallize CLI",
"module": "src/index.ts",
"repository": "https://github.com/CrystallizeAPI/crystallize-cli",
Expand Down
22 changes: 21 additions & 1 deletion components/cli/src/domain/use-cases/create-clean-tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,29 @@ const handler = async (
}

try {
const results = await cClient.pimApi(`#graphql
query {
tenant {
get(id:"${id}") {
rootItemId
vatTypes {
id
}
}
}
}`);

const { rootItemId, vatTypes } = results.tenant.get;
const defaultVat = vatTypes[0].id;

const extraMutationsFile = `${crytallizeHiddenFolder}/extra-mutations.json`;
const extraMutationsContent = await flySystem.loadFile(extraMutationsFile);
const extraMutations = JSON.parse(extraMutationsContent.replaceAll('##TENANT_ID##', id)) as {
const extraMutations = JSON.parse(
extraMutationsContent
.replaceAll('##TENANT_ID##', id)
.replaceAll('##TENANT_DEFAULT_VATTYPE_ID##', defaultVat)
.replaceAll('##TENANT_ROOT_ID##', rootItemId),
) as {
mutation: string;
sets: Record<string, VariableType>[];
}[];
Expand Down

0 comments on commit fbe3bb6

Please sign in to comment.