Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bring rich text validator [TOL-2426] #694

Merged
merged 6 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/contentful/rich-text.git"
},
"engines": {
"node": ">=18"
"node": ">=20"
},
"scripts": {
"benchmark": "ts-node -O '{\"module\": \"commonjs\"}' bin/benchmark",
Expand Down Expand Up @@ -71,7 +71,6 @@
"prettier": "^3.2.5",
"rimraf": "6.0.1",
"rollup": "^4.18.0",
"rollup-plugin-copy": "3.5.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-typescript2": "^0.36.0",
"ts-jest": "^29.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/contentful-slatejs-adapter/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const options = {
input: `src/index.ts`,
output: { file: pkg.main, format: 'cjs', sourcemap: true },
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: ['@contentful/rich-text-types'],
external: Object.keys(pkg.dependencies),
watch: {
include: ['src/**'],
},
Expand Down
6 changes: 4 additions & 2 deletions packages/rich-text-from-markdown/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import config from '../../rollup.config';
import { main as outputFile } from './package.json';
import { main as outputFile, dependencies } from './package.json';

export default config(outputFile);
export default config(outputFile, {
external: Object.keys(dependencies),
});
2 changes: 0 additions & 2 deletions packages/rich-text-html-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
},
"devDependencies": {
"@types/escape-html": "^1.0.4",
"@types/lodash.clonedeep": "^4.5.6",
"lodash.clonedeep": "^4.5.0",
"ts-jest": "^29.1.2"
}
}
6 changes: 4 additions & 2 deletions packages/rich-text-html-renderer/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import config from '../../rollup.config';
import { main as outputFile } from './package.json';
import { main as outputFile, dependencies } from './package.json';

export default config(outputFile);
export default config(outputFile, {
external: Object.keys(dependencies),
});
6 changes: 4 additions & 2 deletions packages/rich-text-links/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import config from '../../rollup.config';
import { main as outputFile } from './package.json';
import { main as outputFile, dependencies } from './package.json';

export default config(outputFile);
export default config(outputFile, {
external: Object.keys(dependencies),
});
6 changes: 4 additions & 2 deletions packages/rich-text-plain-text-renderer/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import config from '../../rollup.config';
import { main as outputFile } from './package.json';
import { main as outputFile, dependencies } from './package.json';

export default config(outputFile);
export default config(outputFile, {
external: Object.keys(dependencies),
});
4 changes: 2 additions & 2 deletions packages/rich-text-react-renderer/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import config from '../../rollup.config';
import { main as outputFile } from './package.json';
import { main as outputFile, dependencies } from './package.json';

const overrides = {
input: 'src/index.tsx',
external: ['react'],
external: [...Object.keys(dependencies), 'react'],
};

export default config(outputFile, overrides);
11 changes: 5 additions & 6 deletions packages/rich-text-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
},
"scripts": {
"prebuild": "rimraf dist",
"build": "yarn generate-json-schema && tsc --module commonjs && rollup -c --bundleConfigAsCjs rollup.config.js",
"build": "tsc --module commonjs && rollup -c --bundleConfigAsCjs rollup.config.js",
"start": "tsc && rollup -c --bundleConfigAsCjs rollup.config.js -w",
"generate-json-schema": "ts-node -O '{\"module\": \"commonjs\"}' ./tools/jsonSchemaGen",
"test": "jest"
},
"dependencies": {
"is-plain-obj": "^3.0.0"
},
"devDependencies": {
"@cspotcode/source-map-consumer": "^0.8.0",
"@faker-js/faker": "^9.0.0",
"@types/jest": "^29.5.12",
"@types/node": "^22.0.0",
"ts-jest": "^29.1.2",
"typescript-json-schema": "0.65.1"
"ts-jest": "^29.1.2"
}
}
34 changes: 4 additions & 30 deletions packages/rich-text-types/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
import copy from 'rollup-plugin-copy';

import config from '../../rollup.config';
import { main as outputFile } from './package.json';

const customConfig = () => {
const baseConfig = config(outputFile);

return {
...baseConfig,
output: {
// Maintain the same file names & folders structure as "src"
// This is necessary to resolve generated JSON schema files
//
// https://rollupjs.org/guide/en/#outputpreservemodules
preserveModules: true,
},
z0al marked this conversation as resolved.
Show resolved Hide resolved
plugins: [
...baseConfig.plugins,
copy({
targets: [
{
src: 'src/schemas/generated',
dest: 'dist/schemas',
},
],
}),
],
};
};
import { main as outputFile, dependencies } from './package.json';

export default customConfig();
export default config(outputFile, {
external: Object.keys(dependencies),
});
Loading
Loading