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

chore: monorepo #1679

Merged
merged 30 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fa97e0e
chore: monorepo
P0lip Jun 18, 2021
cd829fe
lerna initial
Jun 18, 2021
22d1e51
chore: more reasonable package.json
P0lip Jun 18, 2021
806cb6e
Merge branch 'chore/monorepo' into chore/lerna
Jun 18, 2021
8221205
yarn.lock
Jun 18, 2021
50f01db
chore(rulesets): package.json + no deps on no longer existing files
P0lip Jun 18, 2021
eb0074d
chore: cli version
Jun 18, 2021
0904e7b
chore: ver 0.0.0
Jun 18, 2021
08ea7e0
chore: publish from-package
Jun 18, 2021
21d648b
chore: io package
P0lip Jun 18, 2021
10a6ace
Merge branch 'chore/monorepo' of https://github.com/stoplightio/spect…
Jun 18, 2021
fe313e4
chore: use yarn workspaces
P0lip Jun 18, 2021
17b88f2
chore: setup build & Jest
P0lip Jun 20, 2021
fdc1747
chore: sort out dependencies
P0lip Jun 21, 2021
a8c0779
chore: setup Karma
P0lip Jun 21, 2021
95ecfa9
revert: reduce diff
P0lip Jun 21, 2021
d821cb1
chore: ts build
P0lip Jun 21, 2021
dc2ee8c
chore: test-harness
P0lip Jun 21, 2021
1f3e1e7
chore: use lerna bootstrap in CI
P0lip Jun 21, 2021
c133e82
chore: deps
P0lip Jun 21, 2021
e42a032
revert: \!
P0lip Jun 21, 2021
22a1ca7
build: lint docs
P0lip Jun 21, 2021
cbe6869
chore: lint commit messages
P0lip Jun 21, 2021
2481c0a
chore: downgrade Karma
P0lip Jun 21, 2021
be58d98
docs: cli flags
P0lip Jun 21, 2021
c7b1134
chore: do not forget about npx
P0lip Jun 21, 2021
44660ac
chore: windoooows
P0lip Jun 21, 2021
5118147
chore: --experimental-modules for Node 12.8 on Windows
P0lip Jun 21, 2021
032c6bc
chore: redundant commit-msg hook
P0lip Jun 21, 2021
1e0c7b0
chore: now?
P0lip Jun 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 37 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ commands:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
command: |
npx lerna bootstrap
! git diff --name-only | grep yarn.lock
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
Expand All @@ -34,11 +36,30 @@ commands:
name: Build the code
command: yarn build

lint:
lint-code:
steps:
- run:
name: Lint code
command: yarn lint.eslint

lint-documentation:
steps:
- run:
name: Lint documentation
command: yarn lint.prettier

lint-changelog:
steps:
- run:
name: Lint the code
command: yarn lint
name: Lint changelog
command: yarn lint.changelog

lint-commit-message:
steps:
- run:
name: Lint commit messages
command: |
echo "$(git log -1 --pretty=format:"%s")" | npx commitlint

test-node:
steps:
Expand All @@ -50,10 +71,7 @@ commands:
steps:
- run:
name: Create the Spectral Binary
command: yarn build.binary
- run:
name: Create output directory
command: mkdir ./test-harness/tmp
command: npx lerna run build.binary --scope=@stoplight/spectral-cli
- run:
name: Run harness tests
command: yarn test.harness
Expand All @@ -64,7 +82,6 @@ commands:
- cached-dependencies
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: npm version from-git
- run: yarn inline-version
- run: yarn build

jobs:
Expand All @@ -74,7 +91,10 @@ jobs:
steps:
- checkout
- cached-dependencies
- lint
- lint-commit-message
- lint-changelog
- lint-code
- lint-documentation

test:
parameters:
Expand Down Expand Up @@ -111,17 +131,18 @@ jobs:
name: windows/default
steps:
- checkout
- install-and-build
- run: npx lerna bootstrap -- --ignore-engines
- run: yarn build
- test-node

build-windows-binary:
executor:
name: windows/default
steps:
- prepare-release
- run: npx pkg . --targets windows --out-path ./binaries
- run: yarn lerna exec "pkg . --targets windows --out-path ./binaries" --scope=@stoplight/spectral-cli
- persist_to_workspace:
root: ./
root: ./packages/cli/
paths:
- binaries

Expand Down Expand Up @@ -194,9 +215,9 @@ jobs:
else
npm publish
fi
- run: npx pkg . --targets linux,macos,alpine --out-path ./binaries
- run: lerna exec "pkg . --targets linux,macos,alpine --out-path ./binaries" --scope=@stoplight/spectral-cli
- persist_to_workspace:
root: ./
root: ./packages/cli/
paths:
- binaries

Expand All @@ -211,7 +232,7 @@ jobs:
command: go get github.com/tcnksm/ghr
- run:
name: "Publish Release artifacts on GitHub"
command: ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} /tmp/binaries
command: ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${CIRCLE_TAG} /tmp/packages/cli/binaries

workflows:
commit:
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/__fixtures__/**
/test-harness/**/*.yaml
/packages/*/dist
17 changes: 10 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,31 @@
"overrides": [
{
"files": [
"src/**/*.ts"
"packages/*/src/**/*.ts"
],
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"plugins": ["import"],
"rules": {
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }],
"@typescript-eslint/strict-boolean-expressions": "warn",
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/ban-types": "warn"
"@typescript-eslint/ban-types": "warn",

"import/no-extraneous-dependencies": ["error", { "devDependencies": ["**/*.{test,spec}.ts", "**/__helpers__/tester.ts"] }]
}
},

{
"files": [
"src/cli/**/*.ts"
"packages/cli/src/**/*.ts"
],
"rules": {
"no-console": "warn"
Expand All @@ -59,7 +62,7 @@

{
"files": [
"src/**/__tests__/*.ts",
"packages/*/src/**/__tests__/*.ts",
"test-harness/**/*.{ts,js}"
],
"rules": {
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

/binaries
/rulesets
/__karma__/__fixtures__/
packages/cli/binaries
/test-harness/tmp/
packages/*/dist

# testing
/coverage
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
npx --no-install commitlint --edit $1
25 changes: 13 additions & 12 deletions docs/guides/2-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,23 @@ spectral lint ./reference/**/*.oas*.{json,yml,yaml}
Other options include:

```text
--version Show version number [boolean]
--help Show help [boolean]
--encoding, -e text encoding to use [string] [default: "utf8"]
--version Show version number [boolean]
--help Show help [boolean]
-e, --encoding text encoding to use
[string] [choices: "utf8", "ascii", "utf-8", "utf16le", "ucs2", "ucs-2", "base64", "latin1"] [default: "utf8"]
--format, -f formatter to use for outputting results
[string] [choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty"] [default: "stylish"]
--output, -o output to a file instead of stdout [string]
--resolver path to custom json-ref-resolver instance [string]
--ruleset, -r path/URL to a ruleset file [string]
[string] [choices: "json", "stylish", "junit", "html", "text", "teamcity", "pretty"] [default: "stylish"]
--output, -o output to a file instead of stdout [string]
--resolver path to custom json-ref-resolver instance [string]
--ruleset, -r path/URL to a ruleset file [string]
--fail-severity, -F results of this level or above will trigger a failure exit code
[string] [choices: "error", "warn", "info", "hint"] [default: "error"]
--display-only-failures, -D only output results equal to or greater than --fail-severity
[boolean] [default: false]
--ignore-unknown-format do not warn about unmatched formats [boolean] [default: false]
--fail-on-unmatched-globs fail on unmatched glob patterns [boolean] [default: false]
--verbose, -v increase verbosity [boolean]
--quiet, -q no logging - output only [boolean]
[boolean] [default: false]
--ignore-unknown-format do not warn about unmatched formats [boolean] [default: false]
--fail-on-unmatched-globs fail on unmatched glob patterns [boolean] [default: false]
--verbose, -v increase verbosity [boolean]
--quiet, -q no logging - output only [boolean]
```

The Spectral CLI supports loading documents as YAML or JSON, and validation of OpenAPI v2/v3 documents via our built-in ruleset.
Expand Down
44 changes: 43 additions & 1 deletion docs/migration-guides/6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,49 @@

## Core

### Functions
1. `run` does not accept `{ documentUri }`. Please use `Document` and specify the source of the document there.

Workaround:

```ts
import { Document, Spectral } from "@stoplight/spectral-core";
import { Json as JsonParser } from "@stoplight/spectral-parsers";
import * as path from "@stoplight/path";

const s = new Spectral();

const doc = new Document(
`{
"street": null
}`,
JsonParser,
path.join(__dirname, "street-doc.json"),
);

await spectral.run(doc);
```

2. Spectral constructor

```ts
import { Document, Spectral } from "@stoplight/spectral-core";
import { Json as JsonParser } from "@stoplight/spectral-parsers";
import * as path from "@stoplight/path";

const s = new Spectral();

const doc = new Document(
`{
"street": null
}`,
JsonParser,
path.join(__dirname, "street-doc.json"),
);

await spectral.run(doc);
```

## Functions

1. `schema` function uses Ajv v8 in favor of Ajv v6. It is preferred to provide JSON Schema Draft 7 schemas or newer, albeit older drafts are also supported via json-schema-migrate.
`oasVersion` is no longer supported. Use `oasSchema` function from the OAS ruleset if you want to supply OAS Schema Object.
Expand Down
2 changes: 0 additions & 2 deletions docs/reference/asyncapi-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ info:
title: Descriptive API
description: >+
Some description about the general point of this API, and why it exists when another similar but different API also exists.

```

### asyncapi-info-license-url
Expand Down Expand Up @@ -314,7 +313,6 @@ tags:
- name: Invoice Items
description: |+
Giant long explanation about what this business concept is, because other people _might_ not have a clue!

```

**Recommended:** No
Expand Down
8 changes: 1 addition & 7 deletions docs/reference/openapi-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,7 @@ info:
version: "1.0.0"
title: Descriptive API
description: >+
Some description about the general point of this API, and why it exists when another similar but different API also exists.

## Authentication

This API uses OAuth2 and tokens can be requested from [Dev Portal: Tokens](https://example.org/developers/tokens).

Some description about the general point of this API, and why it exists when another similar but different API also exists.## AuthenticationThis API uses OAuth2 and tokens can be requested from [Dev Portal: Tokens](https://example.org/developers/tokens).
```

### info-license
Expand Down Expand Up @@ -354,7 +349,6 @@ tags:
- name: Invoice Items
description: |+
Giant long explanation about what this business concept is, because other people _might_ not have a clue!

```

**Recommended:** No
Expand Down
Loading