Skip to content

The open alternative to Salesforce, designed for AI.

Ignore the CLI patch version in the scaffolded engines.twenty range (#28814)

Paul Rastoin57534d3f070f
diff --git a/packages/twenty-cli/src/app/render-app-template.ts b/packages/twenty-cli/src/app/render-app-template.ts
index 7feeeff2b23..422e91a7372 100644
--- a/packages/twenty-cli/src/app/render-app-template.ts
+++ b/packages/twenty-cli/src/app/render-app-template.ts
@@ -2,6 +2,8 @@ import { randomUUID } from 'node:crypto';
import { cp, readFile, rename, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
+import semver from 'semver';
+
import { APP_TEMPLATE_PACKAGE_VERSION } from '@/app/constants/app-template-package-version.constant';
import { APP_TEMPLATE_FIRST_PARTY_PACKAGES } from '@/app/constants/app-template-packages.constant';
import { getAppTemplateDirectory } from '@/app/get-app-template-directory';
@@ -71,7 +73,8 @@ export const renderAppTemplate = async ({
} = JSON.parse(await readFile(packageJsonPath, 'utf8'));
packageJson.name = appName;
- packageJson.engines.twenty = `>=${APP_TEMPLATE_PACKAGE_VERSION}`;
+ // Patch releases of the CLI can ship without a matching server release.
+ packageJson.engines.twenty = `>=${semver.major(APP_TEMPLATE_PACKAGE_VERSION)}.${semver.minor(APP_TEMPLATE_PACKAGE_VERSION)}.0`;
for (const packageName of APP_TEMPLATE_FIRST_PARTY_PACKAGES) {
packageJson.devDependencies[packageName] = APP_TEMPLATE_PACKAGE_VERSION;
diff --git a/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts b/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
index 9e8c63f4468..535b0d169a8 100644
--- a/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
+++ b/packages/twenty-cli/src/commands/app/__tests__/app-init.spec.ts
@@ -14,6 +14,7 @@ import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
+import semver from 'semver';
import { isDefined } from 'twenty-shared/utils';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -107,7 +108,7 @@ describe('app init', () => {
engines: {
node: '^24.5.0',
npm: 'please-use-yarn',
- twenty: `>=${APP_TEMPLATE_PACKAGE_VERSION}`,
+ twenty: `>=${semver.major(APP_TEMPLATE_PACKAGE_VERSION)}.${semver.minor(APP_TEMPLATE_PACKAGE_VERSION)}.0`,
yarn: '>=4.0.2',
},
devDependencies: {