Skip to content

Commit

Permalink
chore: move spawn-process to utils directory
Browse files Browse the repository at this point in the history
Reason: it's shared between copy-modles and generate-clients scripts
  • Loading branch information
trivikr committed Nov 12, 2020
1 parent b288f4c commit 0528f99
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion scripts/copy-models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const yargs = require("yargs");

const { promises: fsPromises } = require("fs");
const { join } = require("path");
const { spawnProcess } = require("../generate-clients/spawn-process");
const { spawnProcess } = require("../utils/spawn-process");

const { models } = yargs
.alias("m", "models")
Expand All @@ -14,6 +14,7 @@ const { models } = yargs

(async () => {
const OUTPUT_DIR = join(__dirname, "..", "..", "codegen", "sdk-codegen", "aws-models");

const files = await fsPromises.readdir(models.toString(), {
withFileTypes: true,
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-clients/code-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const path = require("path");
const { emptyDirSync } = require("fs-extra");
const { copyFileSync, readdirSync, lstatSync } = require("fs");
const { spawnProcess } = require("./spawn-process");
const { spawnProcess } = require("../utils/spawn-process");
const { CODE_GEN_ROOT, CODE_GEN_SDK_ROOT, TEMP_CODE_GEN_INPUT_DIR } = require("./code-gen-dir");
const Glob = require("glob");

Expand Down
7 changes: 5 additions & 2 deletions scripts/generate-clients/code-prettify.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// @ts-check
const { spawnProcess } = require("./spawn-process");
const { spawnProcess } = require("../utils/spawn-process");
const path = require("path");

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

module.exports = {
Expand Down
File renamed without changes.

0 comments on commit 0528f99

Please sign in to comment.