The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(cli): install the pinned CLI in generated app CI (#27518)
Weiko47424067d1a2
diff --git a/packages/twenty-cli/app-template/github/workflows/ci.yml b/packages/twenty-cli/app-template/github/workflows/ci.ymlindex 95e85ef31a2..9ce7e6abd43 100644--- a/packages/twenty-cli/app-template/github/workflows/ci.yml+++ b/packages/twenty-cli/app-template/github/workflows/ci.yml@@ -38,6 +38,9 @@ jobs:node-version-file: '.nvmrc'cache: yarn+ - name: Install Twenty CLI+ run: npm install -g twenty@CLI-VERSION-TO-BE-GENERATED+- name: Install dependenciesrun: yarn install --immutablediff --git a/packages/twenty-cli/src/app/render-app-template.ts b/packages/twenty-cli/src/app/render-app-template.tsindex 952fb1b18fc..395e1c7014e 100644--- a/packages/twenty-cli/src/app/render-app-template.ts+++ b/packages/twenty-cli/src/app/render-app-template.ts@@ -6,6 +6,7 @@ import { APP_TEMPLATE_PACKAGE_VERSION } from '@/app/constants/app-template-packaimport { APP_TEMPLATE_FIRST_PARTY_PACKAGES } from '@/app/constants/app-template-packages.constant';import { getAppTemplateDirectory } from '@/app/get-app-template-directory';import { printTypescriptValue } from '@/app/pull/print-typescript-value';+import { CLI_VERSION } from '@/constants/cli-version.constant';export const renderAppTemplate = async ({appDirectory,@@ -31,6 +32,14 @@ export const renderAppTemplate = async ({await cp(join(appDirectory, 'AGENTS.md'), join(appDirectory, 'CLAUDE.md'));+ const workflowPath = join(appDirectory, '.github', 'workflows', 'ci.yml');+ const workflow = (await readFile(workflowPath, 'utf8')).replace(+ 'CLI-VERSION-TO-BE-GENERATED',+ CLI_VERSION,+ );++ await writeFile(workflowPath, workflow);+const identifiersPath = join(appDirectory,'src/constants/universal-identifiers.ts',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.tsindex aaf4fa4dc7f..57ea0c45f8c 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@@ -23,6 +23,7 @@ import {runCliForTest,} from '@/__tests__/utils/run-cli-for-test';import { getAppTemplateDirectory } from '@/app/get-app-template-directory';+import { CLI_VERSION } from '@/constants/cli-version.constant';vi.mock('@/app/get-app-template-directory', () => ({getAppTemplateDirectory: vi.fn(),@@ -165,6 +166,25 @@ describe('app init', () => {]);});+ it('installs the generating CLI version in CI before running integration tests', async () => {+ const result = await run(['my-app']);+ const workflow = await readFile(+ join(workDirectory, 'my-app', '.github', 'workflows', 'ci.yml'),+ 'utf8',+ );+ const installCommand = `run: npm install -g twenty@${CLI_VERSION}`;++ expect(result.exitCode, result.stderr).toBe(0);+ expect(workflow).toContain(installCommand);+ expect(workflow).not.toContain('TO-BE-GENERATED');+ expect(workflow.indexOf(installCommand)).toBeGreaterThan(+ workflow.indexOf('uses: actions/setup-node@'),+ );+ expect(workflow.indexOf(installCommand)).toBeLessThan(+ workflow.indexOf('run: yarn test\n'),+ );+ });+it('returns the app, its pins and the next steps as JSON, without a login step when a workspace is set', async () => {vi.stubEnv('TWENTY_API_URL', 'https://crm.example.com');vi.stubEnv('TWENTY_API_KEY', 'test-key');