Skip to content

The open alternative to Salesforce, designed for AI.

fix(cli): create a fallback yarn.lock during app init (#27651)

Weiko9b425fea9fce
diff --git a/packages/twenty-cli/src/app/render-app-template.ts b/packages/twenty-cli/src/app/render-app-template.ts
index 395e1c7014e..fac71b14032 100644
--- a/packages/twenty-cli/src/app/render-app-template.ts
+++ b/packages/twenty-cli/src/app/render-app-template.ts
@@ -20,6 +20,7 @@ export const renderAppTemplate = async ({
appDescription: string;
}) => {
await cp(getAppTemplateDirectory(), appDirectory, { recursive: true });
+ await writeFile(join(appDirectory, 'yarn.lock'), '', { flag: 'a' });
// npm excludes these dotfiles when packing the template.
for (const [source, destination] of [
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 57ea0c45f8c..c6ce2f81e56 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
@@ -97,8 +97,10 @@ describe('app init', () => {
'package.json',
'public',
'src',
+ 'yarn.lock',
]),
);
+ expect(await readFile(join(appDirectory, 'yarn.lock'), 'utf8')).toBe('');
expect(await readdir(appDirectory)).not.toContain('node_modules');
expect(await readPackageJson(appDirectory)).toMatchObject({
name: 'my-app',