Skip to content

Commit

Permalink
chore: update to use @stoplight/scripts
Browse files Browse the repository at this point in the history
BREAKING CHANGE: published build will no longer be nested in `dist`, which means old deep imports e.g. `@stoplight/spectral/dist/rulesets` should now be `@stoplight/spectral/rulesets`.

- use our standard build process, file conventions, and commit conventions
- relaxes some of the deps
  • Loading branch information
Marc MacLeod committed Dec 4, 2018
1 parent 6c11f7e commit a0018df
Show file tree
Hide file tree
Showing 13 changed files with 9,040 additions and 570 deletions.
72 changes: 17 additions & 55 deletions .circleci/config.yml
@@ -1,24 +1,17 @@
version: 2

jobs:
build:
test_node_8:
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: Fetch dependencies
command: yarn
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- run:
name: Download cc-test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- run: yarn
- run:
name: cc-before
command: |
Expand All @@ -28,57 +21,26 @@ jobs:
name: cc-after
command: |
./cc-test-reporter after-build --coverage-input-type lcov --exit-code $?
- run:
name: Run build
command: yarn build
publish-npm:
release:
docker:
- image: circleci/node:8
steps:
- checkout
- run:
name: Install publish dependencies
command: |
yarn global add semver
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- node_modules/
- run:
name: Set NPM token
command: |
cat <<EOF>.npmrc
@stoplight:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
- run:
name: Publish
command: |
export PATH=$PATH:/home/circleci/.yarn/bin
scripts/publish.spectral.sh
git remote remove origin
git remote add origin https://stoplight-bot:$BOT_ACCESS_TOKEN@github.com/stoplightio/spectral.git
git config user.email "support@stoplight.io"
git config user.name "Stoplight Bot"
git push origin --tags
- run: yarn
- run: yarn build
- run: yarn build.docs
- run: yarn release
- run: yarn release.docs

workflows:
version: 2
build_and_publish:
test_and_release:
jobs:
- build
- publish-npm:
requires:
- build
- test_node_8
- release:
filters:
branches:
only:
- develop
- master
only: master
requires:
- test_node_8
37 changes: 34 additions & 3 deletions .gitignore
@@ -1,3 +1,34 @@
node_modules/
lib/
coverage/
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
/dist
/docs-auto

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.vscode
.idea
.nyc_output
.DS_Store
.awcache
.cache-loader
.cache
.rpt2_cache

# logs
*.log*
*-debug.log*
*-error.log*
2 changes: 0 additions & 2 deletions .prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

9 changes: 0 additions & 9 deletions .vscode/launch.json

This file was deleted.

31 changes: 0 additions & 31 deletions .vscode/settings.json

This file was deleted.

3 changes: 3 additions & 0 deletions jest.config.js
@@ -0,0 +1,3 @@
module.exports = {
preset: '@stoplight/scripts',
};
112 changes: 67 additions & 45 deletions package.json
@@ -1,60 +1,82 @@
{
"name": "@stoplight/spectral",
"version": "0.1.0",
"description": "An object linting framework",
"author": "Stoplight, Inc. (support@stoplight.io)",
"version": "0.0.0",
"description": "A flexible object linter with out of the box OpenAPI v2 and v3 support.",
"keywords": [
"json linter",
"linter",
"json validator",
"validator",
"OpenAPI",
"Swagger",
"schema",
"API"
],
"sideEffects": false,
"homepage": "https://github.com/stoplightio/spectral",
"bugs": "https://github.com/stoplightio/spectral/issues",
"author": "Stoplight <support@stoplight.io>",
"repository": {
"type": "git",
"url": "https://github.com/stoplightio/spectral"
},
"license": "MIT",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "src/index.ts",
"files": [
"lib"
"**/*"
],
"engines": {
"node": ">=8.3.0"
},
"scripts": {
"build": "tsc -p tsconfig.json",
"format": "prettier --write \"src/**/*.{ts}\"",
"lint": "tslint src/**/*.{ts}",
"prepublishOnly": "yarn build",
"test": "jest",
"test.cover": "jest --coverage",
"test.prod": "yarn lint && yarn test --coverage --no-cache --maxWorkers 2",
"test.watch": "jest --watch"
"build": "sl-scripts build",
"build.docs": "sl-scripts build:typedoc",
"commit": "git-cz",
"lint": "sl-scripts lint",
"lint.fix": "yarn lint --fix",
"release": "sl-scripts release",
"release.docs": "sl-scripts release:docs",
"release.dryRun": "sl-scripts release --dry-run --debug",
"test": "sl-scripts test",
"test.prod": "yarn lint && yarn test --coverage --no-cache",
"test.update": "yarn test --updateSnapshot",
"test.watch": "yarn test --watch"
},
"dependencies": {
"ajv": "6.5.x",
"ajv": "6.x.x",
"jsonpath": "git://github.com/stoplightio/jsonpath.git#fe90d42",
"lodash": "^4.17.11",
"lodash": "4.x.x",
"should": "13.2.x"
},
"devDependencies": {
"@types/jest": "23.3.x",
"@types/jsonpath": "0.2.x",
"@types/lodash": "^4.14.118",
"@types/node": "10.12.x",
"jest": "23.6.x",
"prettier": "1.14.x",
"ts-jest": "23.10.x",
"tslib": "1.9.x",
"tslint": "5.11.x",
"tslint-config-prettier": "1.15.x",
"tslint-plugin-prettier": "2.0.x",
"typescript": "3.1.3"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"modulePathIgnorePatterns": [
"lib"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"testEnvironment": "node"
"@types/lodash": "4.x.x",
"@stoplight/scripts": "3.0.2",
"typescript": "3.2.1"
},
"lint-staged": {
"*.{ts,tsx}$": [
"yarn lint.fix",
"git add"
]
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
},
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"release": {
"extends": "@stoplight/scripts/release"
}
}

0 comments on commit a0018df

Please sign in to comment.