Skip to content

fix: test failed #85

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

Merged
merged 1 commit into from
Oct 5, 2022
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,12 @@ If your changes are in line with the design concept, please submit a pull reques
```bash
git clone https://github.com/Himenon/openapi-typescript-code-generator.git
cd openapi-typescript-code-generator
yarn
pnpm i
#### your change
pnpm build && pnpm test
pnpm build
pnpm run test:code:gen
pnpm run update:snapshot # if you changed
pnpm run test
```

## Useful development tools
Expand Down
9 changes: 6 additions & 3 deletions docs/ja/README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,12 @@ API 仕様書から TypeScript のコードへ変換するとき、参照関係
```bash
git clone https://github.com/Himenon/openapi-typescript-code-generator.git
cd openapi-typescript-code-generator
yarn
# your change
yarn build && yarn test
pnpm i
#### your change
pnpm build
pnpm run test:code:gen
pnpm run update:snapshot # if you changed
pnpm run test
```

### 便利な開発ツール
Expand Down
13 changes: 8 additions & 5 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ import { shell } from "./tools/shell";
const generateVersionTsFile = () => {
const codes: string[] = [`export const Name = "${pkg.name}";`, `export const Version = "${pkg.version}";`];
const tscCode = codes.join(EOL);
if (process.env.CI) {
Copy link
Owner Author

@Himenon Himenon Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove CI Flag. Developer can always reproduce test.

console.log("Update src/meta.ts file.");
fs.writeFileSync("src/meta.ts", tscCode, "utf-8");
}
console.log("Update src/meta.ts file.");
const snapshot = fs.readFileSync("src/meta.ts", "utf-8");
fs.writeFileSync("src/meta.ts", tscCode, "utf-8");
return () => {
fs.writeFileSync("src/meta.ts", snapshot, "utf-8");
};
};

const main = async () => {
generateVersionTsFile();
const recovery = generateVersionTsFile();

await Promise.all([
shell("pnpm tsc -p tsconfig.esm.json -d --emitDeclarationOnly --outDir ./lib/\\$types"),
Expand All @@ -39,6 +41,7 @@ const main = async () => {
});

await copyPackageSet(exportsFiled);
recovery();
};

main().catch(error => {
Expand Down