Skip to content

Commit

Permalink
feat: update @diplodoc/translation & run schema build on postinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey authored and 3y3 committed Nov 15, 2024
1 parent 91425ab commit e73cf48
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"prepublishOnly": "npm run lint && npm run build",
"start": "node build/index.js",
"test": "vitest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"postinstall": "node scripts/generate-pc-schema.js"
},
"husky": {
"hooks": {
Expand All @@ -54,7 +55,7 @@
},
"dependencies": {
"@diplodoc/client": "^3.1.8",
"@diplodoc/translation": "^1.4.3",
"@diplodoc/translation": "^1.5.0",
"katex": "^0.16.9",
"shelljs": "0.8.5",
"threads": "1.7.0",
Expand Down
4 changes: 0 additions & 4 deletions scripts/build.cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ const esbuild = require('esbuild');
const tsPaths = require('./ts-paths');
const shell = require('shelljs');

const generatePageConstuctorSchema = require('./generate-pc-schema');

const SEARCH_API = require.resolve('@diplodoc/search-extension/worker');
const SEARCH_LANGS = require.resolve('@diplodoc/search-extension/worker/langs');
const CLIENT_PATH = dirname(require.resolve('@diplodoc/client/manifest'));
Expand Down Expand Up @@ -49,8 +47,6 @@ const builds = [
[['src/workers/linter/index.ts'], 'build/linter.js'],
];

generatePageConstuctorSchema();

Promise.all(builds.map(([entries, outfile]) => {
const currentConfig = {
...commonConfig,
Expand Down
10 changes: 3 additions & 7 deletions scripts/generate-pc-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ function replaceField(obj, oldFieldName, newFieldName, newFieldValue) {
return obj;
}

function generatePageConstuctorSchema() {
const schema = generateDefaultSchema();
const modifiedSchema = replaceField(schema, 'contentType', 'translate', 'md');
const schema = generateDefaultSchema();
const modifiedSchema = replaceField(schema, 'contentType', 'translate', 'md');

fs.writeFileSync('schemas/page-constructor-schema.json', JSON.stringify(modifiedSchema, null, 2));
}

module.exports = generatePageConstuctorSchema;
fs.writeFileSync('schemas/page-constructor-schema.json', JSON.stringify(modifiedSchema, null, 2));

0 comments on commit e73cf48

Please sign in to comment.