Skip to content
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

Fix #552 #586

Merged
merged 3 commits into from
Apr 17, 2023
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
9 changes: 6 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ Before submitting a Pull Request, please test your code.
If you created a new created a new feature, then create the unit test function, too.

```bash
# COMPILE TEST AUTOMATION PROGRAM
npm run build:test
# COMPILE
npm run build

# RUN THE TEST AUTOMATION PROGRAM
# PREPARE
npm run test:generate

# DO TEST
npm run test
```

Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ I always welcome your suggestion. When you publishing a suggestion, then please

## Contributing Code
### Test your code
Before sending a pull request, please test your new code. You type the command `npm run build &&& npm run test`, then compiling your code and test-automation will be all processed.
Before sending a pull request, please test your new code. Please run the following commands:

```bash
# COMPILE
npm run build

# PREPARE
npm run test:generate

# DO TEST
npm run test
```
Expand Down Expand Up @@ -92,7 +95,7 @@ When you send a pull request, please include a description, of what your change
- Add tests for #28

### 2. Include adequate tests
As I've mentioned in the `Contributing Code` section, your PR should pass the test-automation module. Your PR includes *new features* that have not being handled in the ordinary test-automation module, then also update *add the testing unit* please.
As I've mentioned in the `Contributing Code` section, your PR should pass the test-automation module. If your PR includes *new features* that have not being handled in the ordinary test-automation module, then also update *add the testing unit* please.

If there're some specific reasons that could not pass the test-automation (not error but *intended*), then please update the ordinary test-automation module or write the reasons on your PR content and *const me update the test-automation module*.

Expand Down
15 changes: 12 additions & 3 deletions src/factories/TypiaFileFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,24 @@ export namespace TypiaFileFactory {
}

// CREATE PROGRAM
const { config } = ts.readConfigFile(props.project, ts.sys.readFile);
const { options: compilerOptions } = ts.parseJsonConfigFileContent(
ts.readConfigFile(props.project, ts.sys.readFile).config,
{
fileExists: ts.sys.fileExists,
readFile: ts.sys.readFile,
readDirectory: ts.sys.readDirectory,
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
},
path.dirname(props.project)
)

const program: ts.Program = ts.createProgram(
await (async () => {
const container: string[] = [];
await gather(props)(container)(props.input)(props.output);
return container;
})(),
config.compilerOptions,
compilerOptions,
);

// DO TRANSFORM
Expand All @@ -59,7 +68,7 @@ export namespace TypiaFileFactory {
ImportTransformer.transform(props.input)(props.output),
transform(
program,
(config.compilerOptions.plugins ?? []).find(
(compilerOptions.plugins as any[] ?? []).find(
(p: any) =>
p.transform === "typia/lib/transform" ||
p.transform === "../src/transform.ts",
Expand Down