Skip to content

Commit 66baca6

Browse files
Total Overhaul (but with all the same fixtures!) (Kong#248)
see Kong#248 and the commits therein for more context. Essentially: - the original client fixtures were unchanged, which hopefully means the - all source code is now in strict mode TypeScript - tests are now all in jest - the file structure was reorganized so that everything for a particular client is in one place - the CLI is updated and now using yargs - all dependencies were updated and some (i.e. `format.utils`) were able to be removed entirely - more work left to do (including CI with GitHub Actions, for example), but this is a start
1 parent 7fd160c commit 66baca6

File tree

1,241 files changed

+19796
-14722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,241 files changed

+19796
-14722
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,15 @@ charset = utf-8
99
trim_trailing_whitespace = true
1010
insert_final_newline = true
1111

12+
[targets/**/fixtures/*]
13+
insert_final_newline = false
14+
15+
[**/http1.1/fixtures/*]
16+
end_of_line = crlf
17+
insert_final_newline = false
18+
19+
[**/http1.1/fixtures/jsonObj-multiline]
20+
end_of_line = unset
21+
1222
[*.md]
1323
trim_trailing_whitespace = false

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/targets/**/fixtures
2+
dist
3+
bin

.eslintrc.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/** @type { import('eslint').Linter.Config } */
2+
module.exports = {
3+
parser: '@typescript-eslint/parser',
4+
env: {
5+
node: true,
6+
},
7+
parserOptions: {
8+
project: 'tsconfig.json',
9+
},
10+
extends: [
11+
'eslint:recommended',
12+
'plugin:@typescript-eslint/recommended',
13+
'plugin:jest/all',
14+
'plugin:jest-formatting/strict',
15+
'plugin:eslint-comments/recommended',
16+
'prettier',
17+
],
18+
plugins: ['eslint-comments', 'simple-import-sort', 'jest', 'jest-formatting'],
19+
rules: {
20+
'prefer-template': 'error',
21+
'no-else-return': 'error',
22+
'@typescript-eslint/no-explicit-any': 'off',
23+
'eslint-comments/require-description': 'error',
24+
'eslint-comments/disable-enable-pair': 'off',
25+
'simple-import-sort/imports': 'error',
26+
'simple-import-sort/exports': 'error',
27+
'jest/prefer-expect-assertions': 'off',
28+
'jest/require-hook': 'off',
29+
},
30+
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
targets/http/http1.1/fixtures text

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.log
22
node_modules
33
coverage*
4+
dist

.npmignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
.editorconfig
2-
test
1+
# Ignore everything by default
2+
# NOTE: NPM publish will never ignore package.json, package-lock.json, README, LICENSE, CHANGELOG
3+
# https://npm.github.io/publishing-pkgs-docs/publishing/the-npmignore-file.html
4+
*
5+
6+
# Don't ignore dist folder
7+
!dist/**

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build
2+
node_modules
3+
src/targets/**/fixtures
4+
dist
5+
bin

.prettierrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/** @type { import('prettier').Config } */
2+
module.exports = {
3+
arrowParens: 'avoid',
4+
bracketSameLine: false,
5+
bracketSpacing: true,
6+
jsxSingleQuote: false,
7+
printWidth: 100,
8+
proseWrap: 'never',
9+
quoteProps: 'as-needed',
10+
semi: true,
11+
singleAttributePerLine: true,
12+
singleQuote: true,
13+
tabWidth: 2,
14+
trailingComma: 'all',
15+
useTabs: false,
16+
};

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["EditorConfig.EditorConfig"]
3+
}

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"files.insertFinalNewline": false, // controlled by the .editorconfig at root since we can't map vscode settings directly to files (see: https://github.com/microsoft/vscode/issues/35350)
3+
"editor.defaultFormatter": "esbenp.prettier-vscode"
4+
}

CONTRIBUTING.md

Lines changed: 44 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,101 @@
11
# Contributing to this project
22

3-
Please take a moment to review this document in order to make the contribution
4-
process easy and effective for everyone involved.
3+
Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
54

6-
Following these guidelines helps to communicate that you respect the time of
7-
the developers managing and developing this open source project. In return,
8-
they should reciprocate that respect in addressing your issue or assessing
9-
patches and features.
5+
Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
106

117
## Using the issue tracker
128

13-
The [issue tracker](/issues) is the preferred channel for [bug reports](#bug-reports),
14-
[features requests](#feature-requests) and [submitting pull requests](#pull-requests),
15-
but please respect the following restrictions:
9+
The [issue tracker](/issues) is the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests) and [submitting pull requests](#pull-requests), but please respect the following restrictions:
1610

17-
* Please **do not** use the issue tracker for personal support requests (use
18-
[Stack Overflow](http://stackoverflow.com) or IRC).
11+
- Please **do not** use the issue tracker for personal support requests (use [Stack Overflow](http://stackoverflow.com) or IRC).
1912

20-
* Please **do not** derail or troll issues. Keep the discussion on topic and
21-
respect the opinions of others.
13+
- Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others.
2214

2315
## Bug reports
2416

25-
A bug is a _demonstrable problem_ that is caused by the code in the repository.
26-
Good bug reports are extremely helpful - thank you!
17+
A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
2718

2819
Guidelines for bug reports:
2920

30-
1. **Use the GitHub issue search** — check if the issue has already been
31-
reported.
21+
1. **Use the GitHub issue search** — check if the issue has already been reported.
3222

33-
2. **Check if the issue has been fixed** — try to reproduce it using the
34-
latest `master` or development branch in the repository.
23+
2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository.
3524

36-
3. **Isolate the problem** — create a [reduced test
37-
case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.
25+
3. **Isolate the problem** — create a [reduced test case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.
3826

39-
A good bug report shouldn't leave others needing to chase you up for more
40-
information. Please try to be as detailed as possible in your report. What is
41-
your environment? What steps will reproduce the issue? What browser(s) and OS
42-
experience the problem? What would you expect to be the outcome? All these
43-
details will help people to fix any potential bugs.
27+
A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
4428

4529
Example:
4630

4731
> Short and descriptive example bug report title
4832
>
49-
> A summary of the issue and the browser/OS environment in which it occurs. If
50-
> suitable, include the steps required to reproduce the bug.
33+
> A summary of the issue and the browser/OS environment in which it occurs. If suitable, include the steps required to reproduce the bug.
5134
>
5235
> 1. This is the first step
5336
> 2. This is the second step
5437
> 3. Further steps, etc.
5538
>
5639
> `<url>` - a link to the reduced test case
5740
>
58-
> Any other information you want to share that is relevant to the issue being
59-
> reported. This might include the lines of code that you have identified as
60-
> causing the bug, and potential solutions (and your opinions on their
61-
> merits).
41+
> Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits).
6242
6343
## Feature requests
6444

65-
Feature requests are welcome. But take a moment to find out whether your idea
66-
fits with the scope and aims of the project. It's up to *you* to make a strong
67-
case to convince the project's developers of the merits of this feature. Please
68-
provide as much detail and context as possible.
45+
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to _you_ to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
6946

7047
## Pull requests
7148

72-
Good pull requests (patches, improvements, new features) are a fantastic
73-
help. They should remain focused in scope and avoid containing unrelated
74-
commits.
49+
Good pull requests (patches, improvements, new features) are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
7550

76-
**Please ask first** before embarking on any significant pull request (e.g.
77-
implementing features, refactoring code, porting to a different language),
78-
otherwise you risk spending a lot of time working on something that the
79-
project's developers might not want to merge into the project.
51+
**Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
8052

81-
Please adhere to the coding conventions used throughout a project (indentation,
82-
accurate comments, etc.) and any other requirements (such as test coverage).
53+
Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage).
8354

84-
Follow this process if you'd like your work considered for inclusion in the
85-
project:
55+
Follow this process if you'd like your work considered for inclusion in the project:
8656

87-
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
88-
and configure the remotes:
57+
1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, and configure the remotes:
8958

90-
```bash
91-
# Clone your fork of the repo into the current directory
92-
git clone https://github.com/<your-username>/<repo-name>
93-
# Navigate to the newly cloned directory
94-
cd <repo-name>
95-
# Assign the original repo to a remote called "upstream"
96-
git remote add upstream https://github.com/Mashape/httpsnippet.git
97-
```
59+
```bash
60+
# Clone your fork of the repo into the current directory
61+
git clone https://github.com/<your-username>/<repo-name>
62+
# Navigate to the newly cloned directory
63+
cd <repo-name>
64+
# Assign the original repo to a remote called "upstream"
65+
git remote add upstream https://github.com/Kong/httpsnippet.git
66+
```
9867

9968
2. If you cloned a while ago, get the latest changes from upstream:
10069

101-
```bash
102-
git checkout <dev-branch>
103-
git pull upstream <dev-branch>
104-
```
70+
```bash
71+
git checkout <dev-branch>
72+
git pull upstream <dev-branch>
73+
```
10574

106-
3. Create a new topic branch (off the main project development branch) to
107-
contain your feature, change, or fix:
75+
3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:
10876

109-
```bash
110-
git checkout -b <topic-branch-name>
111-
```
77+
```bash
78+
git checkout -b <topic-branch-name>
79+
```
11280

113-
4. Commit your changes in logical chunks. Please adhere to these [git commit
114-
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
115-
or your code is unlikely be merged into the main project. Use Git's
116-
[interactive rebase](https://help.github.com/articles/interactive-rebase)
117-
feature to tidy up your commits before making them public.
81+
4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/interactive-rebase) feature to tidy up your commits before making them public.
11882

11983
5. Locally merge (or rebase) the upstream development branch into your topic branch:
12084

121-
```bash
122-
git pull [--rebase] upstream <dev-branch>
123-
```
85+
```bash
86+
git pull [--rebase] upstream <dev-branch>
87+
```
12488

12589
6. Push your topic branch up to your fork:
12690

127-
```bash
128-
git push origin <topic-branch-name>
129-
```
91+
```bash
92+
git push origin <topic-branch-name>
93+
```
13094

131-
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
132-
with a clear title and description.
95+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) with a clear title and description.
13396

134-
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
135-
license your work under the same license as that used by the project.
97+
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to license your work under the same license as that used by the project.
13698

13799
## Creating New Conversion Targets
138100

139-
For a info on creating new conversion targets, please review this [guideline](https://github.com/Mashape/httpsnippet/wiki/Creating-Targets)
101+
For a info on creating new conversion targets, please review this [guideline](https://github.com/Kong/httpsnippet/wiki/Creating-Targets)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Mashape (https://www.mashape.com)
3+
Copyright (c) 2022 Kong (https://www.konghq.com)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)