@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-twenty-app",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.3",
|
||||
"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.2');
|
||||
expect(packageJson.dependencies['twenty-sdk']).toBe('0.4.3');
|
||||
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.2',
|
||||
'twenty-sdk': '0.4.3',
|
||||
},
|
||||
devDependencies: {
|
||||
typescript: '^5.9.3',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "twenty-sdk",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.3",
|
||||
"main": "dist/index.cjs",
|
||||
"module": "dist/index.mjs",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -14,8 +14,9 @@
|
||||
"ui"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npx rimraf dist && npx vite build && tsx ./scripts/remove-nx-dependencies-from-dist-package-json.ts",
|
||||
"prepack": "yarn build"
|
||||
"build": "npx rimraf dist && npx vite build",
|
||||
"prepack": "tsx ./scripts/prepack.ts",
|
||||
"postpack": "tsx ./scripts/postpack.ts"
|
||||
},
|
||||
"keywords": [
|
||||
"twenty",
|
||||
@@ -95,7 +96,6 @@
|
||||
"storybook": "^10.1.11",
|
||||
"ts-morph": "^25.0.0",
|
||||
"tsx": "^4.7.0",
|
||||
"twenty-ui": "workspace:*",
|
||||
"vite-plugin-dts": "^4.5.4",
|
||||
"wait-on": "^7.2.0"
|
||||
},
|
||||
|
||||
@@ -3,10 +3,16 @@
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "packages/twenty-sdk/src",
|
||||
"projectType": "library",
|
||||
"tags": ["scope:sdk", "scope:shared"],
|
||||
"tags": [
|
||||
"scope:sdk",
|
||||
"scope:shared"
|
||||
],
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": ["generateBarrels", "^build"],
|
||||
"dependsOn": [
|
||||
"generateBarrels",
|
||||
"^build"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/dist",
|
||||
"{projectRoot}/front-component/package.json",
|
||||
@@ -19,7 +25,10 @@
|
||||
},
|
||||
"dev": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["generateBarrels", "^build"],
|
||||
"dependsOn": [
|
||||
"generateBarrels",
|
||||
"^build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-sdk",
|
||||
"command": "npx rimraf dist && npx vite build --watch"
|
||||
@@ -27,7 +36,9 @@
|
||||
},
|
||||
"start": {
|
||||
"executor": "nx:run-commands",
|
||||
"dependsOn": ["build"],
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "packages/twenty-sdk",
|
||||
"command": "node dist/cli.cjs"
|
||||
@@ -36,7 +47,10 @@
|
||||
"generateBarrels": {
|
||||
"executor": "nx:run-commands",
|
||||
"cache": true,
|
||||
"inputs": ["production", "{projectRoot}/scripts/generateBarrels.ts"],
|
||||
"inputs": [
|
||||
"production",
|
||||
"{projectRoot}/scripts/generateBarrels.ts"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/src/index.ts",
|
||||
"{projectRoot}/src/*/index.ts",
|
||||
@@ -49,12 +63,16 @@
|
||||
"typecheck": {},
|
||||
"lint": {
|
||||
"options": {
|
||||
"lintFilePatterns": ["{projectRoot}/src/**/*.{ts,json}"],
|
||||
"lintFilePatterns": [
|
||||
"{projectRoot}/src/**/*.{ts,json}"
|
||||
],
|
||||
"maxWarnings": 0
|
||||
},
|
||||
"configurations": {
|
||||
"ci": {
|
||||
"lintFilePatterns": ["{projectRoot}/src/**/*.{ts,json}"],
|
||||
"lintFilePatterns": [
|
||||
"{projectRoot}/src/**/*.{ts,json}"
|
||||
],
|
||||
"maxWarnings": 0
|
||||
},
|
||||
"fix": {}
|
||||
@@ -62,7 +80,9 @@
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nx/vitest:test",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/coverage/{projectRoot}"
|
||||
],
|
||||
"options": {
|
||||
"config": "{projectRoot}/vitest.config.ts"
|
||||
},
|
||||
@@ -126,7 +146,9 @@
|
||||
"storybook:prebuild": {
|
||||
"executor": "nx:run-commands",
|
||||
"cache": true,
|
||||
"dependsOn": ["generateRemoteDomElements"],
|
||||
"dependsOn": [
|
||||
"generateRemoteDomElements"
|
||||
],
|
||||
"inputs": [
|
||||
"{projectRoot}/src/front-component/__stories__/mocks/**/*",
|
||||
"{projectRoot}/src/front-component/__stories__/utils/**/*",
|
||||
@@ -134,19 +156,25 @@
|
||||
"{projectRoot}/src/front-component-constants/**/*",
|
||||
"{projectRoot}/src/sdk/**/*"
|
||||
],
|
||||
"outputs": ["{projectRoot}/src/front-component/__stories__/built/*"],
|
||||
"outputs": [
|
||||
"{projectRoot}/src/front-component/__stories__/built/*"
|
||||
],
|
||||
"options": {
|
||||
"command": "tsx {projectRoot}/src/front-component/__stories__/utils/buildMockComponents.ts"
|
||||
}
|
||||
},
|
||||
"storybook:build": {
|
||||
"dependsOn": ["storybook:prebuild"],
|
||||
"dependsOn": [
|
||||
"storybook:prebuild"
|
||||
],
|
||||
"configurations": {
|
||||
"test": {}
|
||||
}
|
||||
},
|
||||
"storybook:serve:dev": {
|
||||
"dependsOn": ["storybook:prebuild"],
|
||||
"dependsOn": [
|
||||
"storybook:prebuild"
|
||||
],
|
||||
"options": {
|
||||
"port": 6008
|
||||
}
|
||||
@@ -161,13 +189,17 @@
|
||||
}
|
||||
},
|
||||
"storybook:test": {
|
||||
"dependsOn": ["storybook:prebuild"],
|
||||
"dependsOn": [
|
||||
"storybook:prebuild"
|
||||
],
|
||||
"options": {
|
||||
"command": "vitest run --coverage --config vitest.storybook.config.ts --shard={args.shard}"
|
||||
}
|
||||
},
|
||||
"storybook:test:no-coverage": {
|
||||
"dependsOn": ["storybook:prebuild"],
|
||||
"dependsOn": [
|
||||
"storybook:prebuild"
|
||||
],
|
||||
"options": {
|
||||
"command": "vitest run --config vitest.storybook.config.ts --shard={args.shard}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import fs from 'fs-extra';
|
||||
import { BACKUP_PATH, PKG_PATH } from './prepack';
|
||||
|
||||
const main = async () => {
|
||||
if (await fs.pathExists(BACKUP_PATH)) {
|
||||
const original = await fs.readJson(BACKUP_PATH);
|
||||
await fs.rm(PKG_PATH);
|
||||
await fs.writeJson(PKG_PATH, original, { spaces: 2 });
|
||||
await fs.remove(BACKUP_PATH);
|
||||
}
|
||||
};
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import { PACKAGES_TO_VENDOR } from '../vite.config';
|
||||
|
||||
export const PKG_PATH = path.resolve(process.cwd(), 'package.json');
|
||||
export const BACKUP_PATH = path.resolve(
|
||||
process.cwd(),
|
||||
'package.__backup__.json',
|
||||
);
|
||||
|
||||
const stripWorkspace = (deps = {}) =>
|
||||
Object.fromEntries(
|
||||
Object.entries(deps).filter(
|
||||
([key, _]) => !PACKAGES_TO_VENDOR.includes(key),
|
||||
),
|
||||
);
|
||||
|
||||
const main = async () => {
|
||||
const pkg = await fs.readJson(PKG_PATH);
|
||||
|
||||
await fs.writeJson(BACKUP_PATH, pkg, { spaces: 2 });
|
||||
|
||||
const { devDependencies: _, ...builtPkg } = pkg;
|
||||
|
||||
builtPkg.dependencies = stripWorkspace(builtPkg.dependencies);
|
||||
|
||||
await fs.writeJson(PKG_PATH, builtPkg, { spaces: 2 });
|
||||
};
|
||||
|
||||
main().catch((e) => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,56 +0,0 @@
|
||||
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();
|
||||
@@ -127,7 +127,7 @@ export default defineConfig(() => {
|
||||
},
|
||||
external: [
|
||||
...Object.keys((packageJson as any).dependencies || {}).filter(
|
||||
(dep) => dep !== 'twenty-ui',
|
||||
(dep) => !PACKAGES_TO_VENDOR.includes(dep),
|
||||
),
|
||||
'path',
|
||||
'fs',
|
||||
|
||||
Reference in New Issue
Block a user