Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit a2cd34c

Browse files
author
Elmer Bulthuis
committed
upgrade to oas3
1 parent 9698735 commit a2cd34c

File tree

9 files changed

+3303
-72
lines changed

9 files changed

+3303
-72
lines changed

.circleci/config.yml

Lines changed: 21 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,34 @@
11
version: 2.1
22

33
jobs:
4+
install:
5+
docker: [image: circleci/node:14]
6+
steps:
7+
- checkout
8+
- run: npm install
9+
- persist_to_workspace:
10+
root: .
11+
paths: [node_modules]
12+
413
build:
5-
docker: [image: circleci/node:16]
14+
docker: [image: circleci/node:14]
615
steps:
716
- checkout
8-
- run: make TAG=$CIRCLE_TAG
17+
- attach_workspace: { at: . }
18+
- run: make TAG=$CIRCLE_TAG PACKAGE_NAME=@gameye/$CIRCLE_PROJECT_REPONAME
919
- persist_to_workspace:
1020
root: .
1121
paths: [out]
1222

1323
test:
14-
docker: [image: circleci/node:16]
24+
docker: [image: circleci/node:14]
1525
steps:
1626
- checkout
17-
- run: ./test
18-
19-
publish-static:
20-
docker: [image: circleci/python:3.6]
21-
environment:
22-
BUCKET: api-spec.gameye.com
23-
steps:
24-
- run: sudo pip install awscli
2527
- attach_workspace: { at: . }
26-
- run: >
27-
aws s3 cp
28-
out/static/index.html
29-
s3://$BUCKET/$CIRCLE_TAG/index.html
30-
--content-type 'text/html'
31-
--cache-control 'max-age=604800'
32-
- run: >
33-
aws s3 cp
34-
out/static/openapi.yaml
35-
s3://$BUCKET/$CIRCLE_TAG/openapi.yaml
36-
--content-type 'application/vnd.oai.openapi;version=3.0'
37-
--cache-control 'max-age=604800'
38-
- run: >
39-
aws s3 cp
40-
out/static/openapi.json
41-
s3://$BUCKET/$CIRCLE_TAG/openapi.json
42-
--content-type 'application/vnd.oai.openapi+json;version=3.0'
43-
--cache-control 'max-age=604800'
44-
- run: >
45-
aws s3api put-bucket-website
46-
--bucket $BUCKET
47-
--website-configuration '{
48-
"IndexDocument": {"Suffix": "index.html"},
49-
"RoutingRules": [
50-
{
51-
"Condition": {"KeyPrefixEquals": "latest"},
52-
"Redirect": {
53-
"HttpRedirectCode": "302",
54-
"ReplaceKeyPrefixWith": "'$CIRCLE_TAG'"
55-
}
56-
}
57-
]
58-
}'
28+
- run: ./test
5929

6030
publish-npm:
61-
docker: [image: circleci/node:16]
31+
docker: [image: circleci/node:14]
6232
steps:
6333
- attach_workspace: { at: . }
6434
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
@@ -67,22 +37,21 @@ jobs:
6737
workflows:
6838
main:
6939
jobs:
40+
- install:
41+
filters:
42+
tags: { only: /^v\d+\.\d+\.\d+$/ }
7043
- build:
44+
requires: [install]
7145
filters:
7246
branches: { ignore: /.*/ }
7347
tags: { only: /^v\d+\.\d+\.\d+$/ }
7448
- test:
49+
requires: [install]
7550
filters:
7651
tags: { only: /^v\d+\.\d+\.\d+$/ }
77-
- publish-static:
78-
context: authorized
79-
requires: [build]
80-
filters:
81-
branches: { ignore: /.*/ }
82-
tags: { only: /^v\d+\.\d+\.\d+$/ }
8352
- publish-npm:
8453
context: authorized
85-
requires: [build]
54+
requires: [install, build]
8655
filters:
8756
branches: { ignore: /.*/ }
8857
tags: { only: /^v\d+\.\d+\.\d+$/ }

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.*
2-
/out/
2+
node_modules/
3+
out/

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
commit-hooks=false
2+
git-tag-version=false
3+
@oas3:registry=https://gitlab.com/api/v4/packages/npm/

.vscode/launch.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"<node_internals>/**"
1313
],
1414
"runtimeExecutable": "npx",
15-
"program": "redoc-cli",
15+
"runtimeArgs": [
16+
"--yes"
17+
],
18+
"program": "[email protected]",
1619
"args": [
1720
"serve",
1821
"${workspaceFolder}/src/openapi.yaml",

.vscode/settings.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
// Place your settings in this file to overwrite default and user settings.
12
{
23
"editor.formatOnSave": true,
4+
"editor.codeActionsOnSave": {
5+
"source.fixAll": true,
6+
"source.organizeImports": true
7+
},
38
"editor.rulers": [
4-
100
5-
],
6-
"editor.tabSize": 4,
7-
"editor.insertSpaces": true
9+
100,
10+
]
811
}

Makefile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
PACKAGE_NAME?=
2+
TAG?=v0.0.0-local
13
SHELL:=$(PREFIX)/bin/sh
2-
TAG?=$(shell git describe --tags)
3-
VERSION:=$(shell npx --yes semver $(TAG))
4-
PACKAGE_NAME:=match-api-spec
5-
6-
rebuild: clean build
4+
VERSION:=$(shell `npm bin`/semver $(TAG))
75

86
build: \
97
out/static/version.txt \
@@ -12,7 +10,10 @@ build: \
1210
out/static/index.html \
1311
out/npm/ \
1412

13+
rebuild: clean build
14+
1515
clean:
16+
rm -rf bin
1617
rm -rf out
1718

1819
out/static/version.txt:
@@ -25,24 +26,24 @@ out/static/openapi.yaml: src/openapi.yaml
2526

2627
out/static/openapi.json: out/static/openapi.yaml
2728
@mkdir --parents $(@D)
28-
npx js-yaml $< > $@
29+
`npm bin`/js-yaml $< > $@
2930

3031
out/static/index.html: out/static/openapi.yaml
3132
@mkdir --parents $(@D)
32-
npx --yes redoc-cli@0.10.2 bundle $< --output $@
33+
`npm bin`/redoc-cli bundle $< --output $@
3334

3435
out/npm/: out/static/openapi.yaml
35-
npx --yes oas3ts-generator@1.1.3 package \
36+
`npm bin`/oas3ts-generator package \
3637
--package-dir $@ \
37-
--package-name @gameye/$(PACKAGE_NAME) \
38+
--package-name $(PACKAGE_NAME) \
3839
--request-type application/json \
39-
--response-type text/plain \
4040
--response-type application/json \
41-
--response-type application/x-tar \
41+
--response-type text/plain \
4242
$<
43-
( cd $@ ; npm install )
43+
( cd $@ ; npm install --unsafe-perm )
44+
4445

4546
.PHONY: \
46-
clean \
4747
build \
4848
rebuild \
49+
clean \

0 commit comments

Comments
 (0)