Skip to content

Commit

Permalink
chore: attempt to migrate generate-clients script
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed Apr 13, 2022
1 parent 3999c27 commit 79e56bf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"clear-build-cache": "rimraf ./packages/*/dist-* ./clients/*/dist-* ./lib/*/dist-* ./private/*/dist-*",
"clear-build-info": "rimraf ./packages/**/*.tsbuildinfo ./clients/**/*.tsbuildinfo ./lib/**/*.tsbuildinfo ./private/**/*.tsbuildinfo",
"copy-models": "node ./scripts/copy-models",
"generate-clients": "node ./scripts/generate-clients",
"generate-clients": "yarn node ./scripts/generate-clients",
"generate:clients:generic": "node ./scripts/generate-clients/generic",
"generate:defaults-mode-provider": "./scripts/generate-defaults-mode-provider/index.js",
"lerna:version": "lerna version --exact --conventional-commits --no-push --no-git-tag-version --no-commit-hooks --loglevel silent --yes",
Expand Down
5 changes: 1 addition & 4 deletions scripts/copy-models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,5 @@ const { models } = yargs
}

// Prettify copied models
await spawnProcess(join(__dirname, "..", "..", "node_modules", ".bin", "prettier"), [
"--write",
`${OUTPUT_DIR}/*.json`,
]);
await spawnProcess("yarn", ["exec", "prettier", "--write", `${OUTPUT_DIR}/*.json`]);
})();
7 changes: 1 addition & 6 deletions scripts/generate-clients/code-eslint-fix.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
// @ts-check
const { spawnProcess } = require("../utils/spawn-process");
const path = require("path");

const eslintFixCode = async () => {
try {
await spawnProcess(path.join(__dirname, "..", "..", "node_modules", ".bin", "esprint"), [
"check",
"--fix",
"--quiet",
]);
await spawnProcess("yarn", ["exec", "esprint", "check", "--fix", "--quiet"]);
} catch (error) {
// esprint throws error as the clients source code does not follow 'prefer-const' rule.
// And esprint does not have a way to override rules written in .eslintrc
Expand Down
11 changes: 2 additions & 9 deletions scripts/generate-clients/code-prettify.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
// @ts-check
const { spawnProcess } = require("../utils/spawn-process");
const path = require("path");

const prettifyCode = async (dir) => {
await spawnProcess(path.join(__dirname, "..", "..", "node_modules", ".bin", "pprettier"), [
"--write",
`${dir}/*/typescript-codegen/**/*.{ts,js,md,json}`,
]);
await spawnProcess(path.join(__dirname, "..", "..", "node_modules", ".bin", "pprettier"), [
"--write",
`${dir}/*/typescript-ssdk-codegen/**/*.{ts,js,md,json}`,
]);
await spawnProcess("yarn", ["exec", "prettier", "--write", `${dir}/*/typescript-codegen/**/*.{ts,js,md,json}`]);
await spawnProcess("yarn", ["exec", "prettier", "--write", `${dir}/*/typescript-ssdk-codegen/**/*.{ts,js,md,json}`]);
};

module.exports = {
Expand Down

0 comments on commit 79e56bf

Please sign in to comment.