Skip to content

Commit 9c08db9

Browse files
committed
clean: add Codacy example and fix minor bugs on autogenerated code
1 parent 311ffd8 commit 9c08db9

File tree

8 files changed

+9583
-27
lines changed

8 files changed

+9583
-27
lines changed

.circleci/config.yml

Lines changed: 78 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,87 @@
1-
version: 2
1+
version: 2.1
2+
3+
orbs:
4+
codacy: codacy/[email protected]
5+
6+
references:
7+
release_filter: &release_filter
8+
filters:
9+
branches:
10+
only:
11+
- master
12+
13+
214
jobs:
3-
build:
15+
build_package:
416
docker:
5-
- image: cimg/node:lts-browsers
6-
resource_class: large
7-
working_directory: ~/repo
17+
- image: cimg/node:14.21
18+
working_directory: ~/workdir
819
steps:
9-
- checkout
10-
- restore_cache:
11-
keys:
12-
- v1-dependencies-{{ checksum "package-lock.json" }}
13-
- v1-dependencies-
20+
- attach_workspace:
21+
at: ~/workdir
1422
- run:
15-
name: Install dependencies
16-
command: npm install
17-
- save_cache:
18-
key: v1-dependencies-{{ checksum "package-lock.json" }}
19-
paths:
20-
- node_modules
23+
name: Check current version of node and npm
24+
command: |
25+
node -v
26+
npm -v
27+
- run:
28+
name: Install dependencies and generate
29+
command: |
30+
npm install
2131
- run:
2232
name: Build library
23-
command: npm run release
33+
command: |
34+
npm run release
2435
- run:
25-
name: Run unit tests
36+
name: Run tests
2637
command: npm run test
27-
# - run:
28-
# name: Run e2e tests
29-
# command: npm run test:e2e
38+
- persist_to_workspace:
39+
root: ~/workdir
40+
paths:
41+
- bin/
42+
- dist/
43+
- node_modules/
44+
45+
publish_packages:
46+
docker:
47+
- image: cimg/node:14.21
48+
working_directory: ~/workdir
49+
steps:
50+
- attach_workspace:
51+
at: ~/workdir
52+
- run:
53+
name: Setup npm credentials
54+
command: |
55+
npm config set @codacy:registry https://registry.npmjs.org/
56+
npm config set _authToken $NPM_TOKEN
57+
npm config set access public
58+
npm config set save-exact true
3059
- run:
31-
name: Submit to Codecov
32-
command: npm run codecov
60+
name: Publish packages
61+
command: |
62+
# Update version in packages to publish
63+
npm version --no-git-tag-version --no-commit-hooks "$(cat .version)"
64+
# Publish package versions to npmjs.org
65+
if [ "$CIRCLE_BRANCH" = "master" ]; then
66+
npm publish
67+
else
68+
npm publish --tag unstable
69+
fi
70+
71+
workflows:
72+
compile_deploy:
73+
jobs:
74+
- codacy/checkout_and_version
75+
- build_package:
76+
requires:
77+
- codacy/checkout_and_version
78+
- codacy/tag_version:
79+
name: tag_version
80+
context: CodacyAWS
81+
requires:
82+
- build_package
83+
- publish_packages:
84+
<<: *release_filter
85+
requires:
86+
- tag_version
87+
context: CodacyNPM

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ junit.xml
1010
*.iml
1111
dist
1212
coverage
13+
generated
1314
test/generated
1415
test/e2e/generated
1516
samples/generated

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Forked from [openapi-typescript-codegen](https://github.com/ferdikoomen/openapi-typescript-codegen)
2+
13
# OpenAPI Typescript Codegen
24

35
[![NPM][npm-image]][npm-url]

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"eslint:fix": "eslint . --fix",
5858
"prepare": "npm run clean && npm run release",
5959
"codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b",
60-
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen ."
60+
"docker": "docker build -t eeelenbaas/openapi-typescript-codegen .",
61+
"generate-codacy": "npm run build && rimraf ./generated && node ./bin/index.js --input ./samples/spec/codacy-api.yaml --output ./generated --useUnionTypes --indent 2 --client axios"
6162
},
6263
"dependencies": {
6364
"camelcase": "^6.3.0",

0 commit comments

Comments
 (0)