Fix build without nx build (#17700)

as title
This commit is contained in:
martmull
2026-02-04 12:14:28 +01:00
committed by GitHub
parent bcfacdead9
commit 6407474461
7 changed files with 64 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "create-twenty-app",
"version": "0.4.1",
"version": "0.4.2",
"description": "Command-line interface to create Twenty application",
"main": "dist/cli.cjs",
"bin": "dist/cli.cjs",
@@ -70,7 +70,7 @@ describe('copyBaseApplicationProject', () => {
const packageJson = await fs.readJson(packageJsonPath);
expect(packageJson.name).toBe('my-test-app');
expect(packageJson.version).toBe('0.1.0');
expect(packageJson.dependencies['twenty-sdk']).toBe('0.4.1');
expect(packageJson.dependencies['twenty-sdk']).toBe('0.4.2');
expect(packageJson.scripts['app:dev']).toBe('twenty app:dev');
});
@@ -282,7 +282,7 @@ const createPackageJson = async ({
'lint:fix': 'eslint --fix',
},
dependencies: {
'twenty-sdk': '0.4.1',
'twenty-sdk': '0.4.2',
},
devDependencies: {
typescript: '^5.9.3',
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "twenty-sdk",
"version": "0.4.1",
"version": "0.4.2",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
@@ -14,7 +14,8 @@
"ui"
],
"scripts": {
"build": "npx rimraf dist && npx vite build"
"build": "npx rimraf dist && npx vite build && tsx ./scripts/remove-nx-dependencies-from-dist-package-json.ts",
"prepack": "yarn build"
},
"keywords": [
"twenty",
@@ -0,0 +1,56 @@
import fs from 'fs-extra';
import path from 'path';
import url from 'url';
import { PACKAGES_TO_VENDOR } from '../vite.config';
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
const pkgPath = path.resolve(__dirname, '../package.json');
const distDir = path.resolve(__dirname, '../dist');
const main = async () => {
const pkg = await fs.readJson(pkgPath);
const stripWorkspaceRanges = (deps = {}) =>
Object.fromEntries(
Object.entries(deps).filter(
([key, _]) => !PACKAGES_TO_VENDOR.includes(key),
),
);
const outPkg = {
name: pkg.name,
version: pkg.version,
license: pkg.license,
description: pkg.description,
keywords: pkg.keywords,
repository: pkg.repository,
homepage: pkg.homepage,
bugs: pkg.bugs,
author: pkg.author,
main: pkg.main,
module: pkg.module,
types: pkg.types,
bin: pkg.bin,
exports: pkg.exports,
typesVersions: pkg.typesVersions,
engines: pkg.engines,
dependencies: stripWorkspaceRanges(pkg.dependencies),
};
await fs.ensureDir(distDir);
await fs.writeJson(path.join(distDir, 'package.json'), outPkg, {
spaces: 2,
});
// Optional but common: include README/LICENSE in the published tarball
for (const file of ['README.md', 'LICENSE']) {
const src = path.resolve(__dirname, '..', file);
if (await fs.pathExists(src)) {
await fs.copy(src, path.join(distDir, file));
}
}
};
main();
+1 -1
View File
@@ -23,7 +23,7 @@
"**/__mocks__/**/*",
"**/__tests__/**/*",
"vite.config.ts",
"scripts/generateBarrels.ts",
"scripts/**/*.ts",
"jest.config.mjs"
],
"exclude": [
+1 -1
View File
@@ -11,7 +11,7 @@ const moduleEntries = Object.keys((packageJson as any).exports || {})
const entries = ['src/index.ts', 'src/cli/cli.ts', ...moduleEntries];
const PACKAGES_TO_VENDOR = ['twenty-ui', 'twenty-shared'];
export const PACKAGES_TO_VENDOR = ['twenty-ui', 'twenty-shared'];
const entryFileNames = (chunk: any, extension: 'cjs' | 'mjs') => {
if (!chunk.isEntry) {