Skip to content

Commit

Permalink
moved logic to js script
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Apr 20, 2024
1 parent 8cc70a2 commit d99f1f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/altair-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
"main": "./build/index.js",
"repository": "altair-graphql/altair.git",
"scripts": {
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && yarn generate-settings-schema",
"generate-settings-schema": "./scripts/generate-settings-schema.sh",
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node ./scripts/copy_settings_d_ts.js",
"prepare": "npm run build",
"test": "jest"
},
Expand Down
15 changes: 15 additions & 0 deletions packages/altair-core/scripts/copy_settings_d_ts.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');

const srcDir = path.resolve(__dirname, '../src');
const distSrc = path.resolve(__dirname, '../build');

execSync(
'yarn typescript-json-schema --ignoreErrors src/types/state/settings.interfaces.ts SettingsState --out build/settings.schema.json'
);
execSync(
'yarn ajv compile -s build/settings.schema.json -o build/validate-settings.js'
);

execSync(
'yarn typescript-json-schema --ignoreErrors src/types/state/settings.interfaces.ts PartialSettingsState --out build/partial_settings.schema.json'
);
execSync(
'yarn ajv compile -s build/partial_settings.schema.json -o build/validate-partial-settings.js'
);

fs.copyFileSync(
path.resolve(srcDir, 'validate-settings.d.ts'),
path.resolve(distSrc, 'validate-settings.d.ts')
Expand Down

0 comments on commit d99f1f6

Please sign in to comment.