diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba3586b..30f4dfb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,11 @@ include: - - local: /config/gitlab/ci-tools.yml - - local: /config/gitlab/ci-rules.yml + - local: /.gitlab/ci-tools.yml + - local: /.gitlab/ci-rules.yml stages: - status-pre - build + - image - publish - status-post @@ -15,7 +16,7 @@ build-node: - .build-node script: - - make ci + - make ci-full artifacts: when: always @@ -32,6 +33,49 @@ build-node: - out/cache - out/tmp +build-image-alpine-branch: + extends: + - .build-docker + stage: image + except: + - tags + script: + - ./scripts/docker-build.sh --push --default + variables: + IMAGE_ARCH: alpine + +build-image-alpine-tag: + extends: + - .build-docker + stage: image + only: + - tags + script: + - ./scripts/docker-build.sh --push --default + variables: + IMAGE_ARCH: alpine + +build-image-stretch-branch: + stage: image + extends: [.build-docker] + except: + - tags + script: + - ./scripts/docker-build.sh --push + variables: + IMAGE_ARCH: stretch + +build-image-stretch-tag: + stage: image + extends: + - .build-docker + only: + - tags + script: + - ./scripts/docker-build.sh --push + variables: + IMAGE_ARCH: stretch + # publish jobs publish-npm: stage: publish @@ -95,9 +139,9 @@ sonar-success: script: - make node_modules - sonar-scanner - -Dsonar.projectKey=${CI_PROJECT_NAMESPACE}_${CI_PROJECT_NAME} + -Dsonar.projectKey=ssube_salty-dog -Dsonar.projectVersion=${CI_COMMIT_REF_SLUG} - -Dsonar.organization=${CI_PROJECT_NAMESPACE}-github + -Dsonar.organization=ssube-github -Dsonar.sources=src/,test/ -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${SONAR_SECRET} diff --git a/config/gitlab/ci-rules.yml b/.gitlab/ci-rules.yml similarity index 100% rename from config/gitlab/ci-rules.yml rename to .gitlab/ci-rules.yml diff --git a/config/gitlab/ci-tools.yml b/.gitlab/ci-tools.yml similarity index 100% rename from config/gitlab/ci-tools.yml rename to .gitlab/ci-tools.yml diff --git a/Makefile b/Makefile index b09d624..97748e6 100755 --- a/Makefile +++ b/Makefile @@ -1,168 +1 @@ -# Git -export GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) -export GIT_COMMIT ?= $(shell git rev-parse HEAD) -export GIT_OPTIONS ?= -export GIT_REMOTES ?= $(shell git remote -v | awk '{ print $1; }' | sort | uniq) -export GIT_TAG ?= $(shell git tag -l --points-at HEAD | head -1) - -# Paths -# resolve the makefile's path and directory, from https://stackoverflow.com/a/18137056 -export MAKE_PATH ?= $(abspath $(lastword $(MAKEFILE_LIST))) -export ROOT_PATH ?= $(dir $(MAKE_PATH)) -export CONFIG_PATH ?= $(ROOT_PATH)/config -export DOCS_PATH ?= $(ROOT_PATH)/docs -export SCRIPT_PATH ?= $(ROOT_PATH)/scripts -export SOURCE_PATH ?= $(ROOT_PATH)/src -export TARGET_PATH ?= $(ROOT_PATH)/out -export TARGET_LOG ?= $(TARGET_PATH)/make.log -export TARGET_MAIN ?= $(TARGET_PATH)/index.js -export TEST_PATH ?= $(ROOT_PATH)/test -export VENDOR_PATH ?= $(ROOT_PATH)/vendor - -# CI -export CI_COMMIT_REF_SLUG ?= $(GIT_BRANCH) -export CI_COMMIT_SHA ?= $(GIT_COMMIT) -export CI_COMMIT_TAG ?= $(GIT_TAG) -export CI_ENVIRONMENT_SLUG ?= local -export CI_JOB_ID ?= 0 -export CI_PROJECT_PATH ?= $(shell ROOT_PATH=$(ROOT_PATH) ${SCRIPT_PATH}/ci-project-path.sh) -export CI_RUNNER_DESCRIPTION ?= $(shell hostname) -export CI_RUNNER_ID ?= $(shell hostname) -export CI_RUNNER_VERSION ?= 0.0.0 - -# Debug -export DEBUG_BIND ?= 127.0.0.1 -export DEBUG_PORT ?= 9229 - -# Versions -export NODE_VERSION := $(shell node -v || echo "none") -export RUNNER_VERSION := $(CI_RUNNER_VERSION) - - -# Node options -NODE_BIN := $(ROOT_PATH)/node_modules/.bin -NODE_CMD ?= $(shell env node) -NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy -NODE_INFO := $(shell node -v) - -# Tool options -COVER_OPTS ?= --reporter=lcov --reporter=text-summary --reporter=html --report-dir="$(TARGET_PATH)/coverage" --exclude-after-remap -MOCHA_OPTS ?= --check-leaks --colors --sort --ui bdd -RELEASE_OPTS ?= --commit-all - -.PHONY: all clean clean-deps clean-target configure help todo -.PHONY: build build-bundle build-docs build-image test test-check test-cover test-watch -.PHONY: yarn-install yarn-upgrade git-push git-stats license-check release release-dry upload-climate upload-codecov - -all: build test ## builds, bundles, and tests the application - @echo Success! - -clean: ## clean up everything added by the default target -clean: clean-deps clean-target - -clean-deps: ## clean up the node_modules directory - rm -rf node_modules - -clean-target: ## clean up the target directory - rm -rf $(TARGET_PATH) - -configure: ## create the target directory and other files not in git - mkdir -p $(TARGET_PATH) - -node_modules: yarn-install - -# from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html -help: ## print this help - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort \ - | sed 's/^.*\/\(.*\)/\1/' \ - | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' - -todo: - @echo "Remaining tasks:" - @echo "" - @grep -i "todo" -r docs/ src/ test/ || true - @echo "" - @echo "Pending tests:" - @echo "" - @grep "[[:space:]]xit" -r test/ || true - @echo "Casts to any:" - @echo "" - @grep "as any" -r src/ test/ || true - @echo "" - -# Build targets -build: ## builds, bundles, and tests the application -build: build-bundle build-docs - -build-bundle: node_modules - $(NODE_BIN)/rollup --config $(CONFIG_PATH)/rollup.js - sed -i '1s;^;#! /usr/bin/env node\n\n;' $(TARGET_PATH)/index.js - -build-docs: ## generate html docs - $(NODE_BIN)/api-extractor run --config $(CONFIG_PATH)/api-extractor.json --local -v - $(NODE_BIN)/api-documenter markdown -i $(TARGET_PATH)/api -o $(DOCS_PATH)/api - -build-image: ## build a docker image - $(SCRIPT_PATH)/docker-build.sh --push - -test: ## run mocha unit tests -test: test-cover - -test-check: ## run mocha unit tests with coverage reports - $(NODE_BIN)/c8 $(COVER_OPTS) \ - $(NODE_BIN)/mocha $(MOCHA_OPTS) \ - $(TARGET_PATH)/test.js - -test-cover: ## run mocha unit tests with coverage reports -test-cover: test-check - sed -i $(TARGET_PATH)/coverage/lcov.info \ - -e '/external ".*"$$/,/end_of_record/d' \ - -e '/ sync$$/,/end_of_record/d' \ - -e '/test sync/,/end_of_record/d' \ - -e '/node_modules/,/end_of_record/d' \ - -e '/bootstrap$$/,/end_of_record/d' \ - -e '/universalModuleDefinition/,/end_of_record/d' - sed -n '/^SF/,$$p' -i $(TARGET_PATH)/coverage/lcov.info - sed '1s;^;TN:\n;' -i $(TARGET_PATH)/coverage/lcov.info - -test-watch: - $(NODE_BIN)/nyc $(COVER_OPTS) $(NODE_BIN)/mocha $(MOCHA_OPTS) --watch $(TARGET_PATH)/test-bundle.js - -yarn-install: ## install dependencies from package and lock file - yarn - -yarn-global: ## install bundle as a global tool - yarn global add file:$(ROOT_PATH) - -yarn-update: ## check yarn for outdated packages - yarn upgrade-interactive --latest - -# release targets -git-push: ## push to both gitlab and github (this assumes you have both remotes set up) - git push $(GIT_OPTIONS) github $(GIT_BRANCH) - git push $(GIT_OPTIONS) gitlab $(GIT_BRANCH) - -# from https://gist.github.com/amitchhajer/4461043#gistcomment-2349917 -git-stats: ## print git contributor line counts (approx, for fun) - git ls-files | while read f; do git blame -w -M -C -C --line-porcelain "$$f" |\ - grep -I '^author '; done | sort -f | uniq -ic | sort -n - -license-check: ## check license status - licensed cache - licensed status - -release: ## create a release - $(NODE_BIN)/standard-version --sign $(RELEASE_OPTS) - GIT_OPTIONS=--tags $(MAKE) git-push - -release-dry: ## test creating a release - $(NODE_BIN)/standard-version --sign $(RELEASE_OPTS) --dry-run - -upload-climate: - cc-test-reporter format-coverage -t lcov -o $(TARGET_PATH)/coverage/codeclimate.json -p $(ROOT_PATH) $(TARGET_PATH)/coverage/lcov.info - cc-test-reporter upload-coverage --debug -i $(TARGET_PATH)/coverage/codeclimate.json -r "$(shell echo "${CODECLIMATE_SECRET}" | base64 -d)" - -upload-codecov: - codecov --disable=gcov --file=$(TARGET_PATH)/coverage/lcov.info --token=$(shell echo "${CODECOV_SECRET}" | base64 -d) - include $(shell find $(ROOT_PATH) -name '*.mk' | grep -v node_modules) diff --git a/config/common.mk b/config/common.mk new file mode 100644 index 0000000..c2177db --- /dev/null +++ b/config/common.mk @@ -0,0 +1,92 @@ +SHELL := bash + +# Git +export GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) +export GIT_COMMIT ?= $(shell git rev-parse HEAD) +export GIT_OPTIONS ?= +export GIT_REMOTES ?= $(shell git remote -v | awk '{ print $1; }' | sort | uniq) +export GIT_TAG ?= $(shell git tag -l --points-at HEAD | head -1) + +# Paths +# resolve the makefile's path and directory, from https://stackoverflow.com/a/18137056 +export MAKE_PATH ?= $(abspath $(firstword $(MAKEFILE_LIST))) +export ROOT_PATH ?= $(dir $(MAKE_PATH)) +export CONFIG_PATH ?= $(ROOT_PATH)/config +export DOCS_PATH ?= $(ROOT_PATH)/docs +export SCRIPT_PATH ?= $(ROOT_PATH)/scripts +export SOURCE_PATH ?= $(ROOT_PATH)/src +export TARGET_PATH ?= $(ROOT_PATH)/out +export TARGET_LOG ?= $(TARGET_PATH)/make.log +export TARGET_MAIN ?= $(TARGET_PATH)/index.js +export TEST_PATH ?= $(ROOT_PATH)/test +export VENDOR_PATH ?= $(ROOT_PATH)/vendor + +# CI +export CI_COMMIT_REF_SLUG ?= $(GIT_BRANCH) +export CI_COMMIT_SHA ?= $(GIT_COMMIT) +export CI_COMMIT_TAG ?= $(GIT_TAG) +export CI_ENVIRONMENT_SLUG ?= local +export CI_JOB_ID ?= 0 +export CI_PROJECT_PATH ?= $(shell ROOT_PATH=$(ROOT_PATH) ${SCRIPT_PATH}/ci-project-path.sh) +export CI_RUNNER_DESCRIPTION ?= $(shell hostname) +export CI_RUNNER_ID ?= $(shell hostname) +export CI_RUNNER_VERSION ?= 0.0.0 + +.PHONY: all ci clean clean-target configure help release release-dry todo + +# Targets that must be provided by other files: bundle, build, cover, docs, clean-deps + +all: lint build cover docs ## builds, bundles, and tests the application + @echo Success! + +clean: ## clean up everything added by the default target +clean: clean-deps clean-target + +clean-target: ## clean up the target directory + rm -rf out/ + +configure: ## create the target directory and other files not in git + mkdir -p $(TARGET_PATH) + +# from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +help: ## print this help + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort \ + | sed 's/^.*\/\(.*\)/\1/' \ + | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +RELEASE_ARGS ?= --commit-all --sign + +release: ## tag and push a release +release: node_modules + if [[ "$(GIT_BRANCH)" != master ]]; \ + then \ + echo "Please merge to master before releasing."; \ + exit 1; \ + fi + yarn standard-version $(RELEASE_ARGS) + GIT_ARGS=--follow-tags $(MAKE) push + +release-dry: ## test creating a release + RELEASE_ARGS="$(RELEASE_ARGS) --dry-run" make release + +todo: + @echo "Remaining tasks:" + @echo "" + @grep -i "todo" -r docs/ src/ test/ || true + @echo "" + @echo "Pending tests:" + @echo "" + @grep "[[:space:]]xit" -r test/ || true + @echo "" + @echo "Casts to any:" + @echo "" + @grep "as any" -r src/ test/ || true + @echo "" + @echo "Uses of null:" + @echo "" + @grep -P -e "null(?!able)" -r src/ test/ || true + @echo "" + @echo "Uses of ==:" + @echo "" + @grep -e "[^=!]==[^=]" -r src/ test/ || true + @echo "" diff --git a/config/git.mk b/config/git.mk new file mode 100644 index 0000000..afc3982 --- /dev/null +++ b/config/git.mk @@ -0,0 +1,12 @@ +.PHONY: push git-stats git-push + +push: git-push + +# from https://gist.github.com/amitchhajer/4461043#gistcomment-2349917 +git-stats: ## print git contributor line counts (approx, for fun) + git ls-files | while read f; do git blame -w -M -C -C --line-porcelain "$$f" |\ + grep -I '^author '; done | sort -f | uniq -ic | sort -n + +git-push: ## push to both github and gitlab + git push $(GIT_ARGS) github $(GIT_BRANCH) + git push $(GIT_ARGS) gitlab $(GIT_BRANCH) diff --git a/config/image.mk b/config/image.mk new file mode 100644 index 0000000..a9f5d87 --- /dev/null +++ b/config/image.mk @@ -0,0 +1,18 @@ +.PHONY: image image-build image-run + +image: ## build the docker image + docker build $(DOCKER_ARGS) -f Dockerfile -t $(DOCKER_IMAGE) . + +image-build: ## build a docker image + $(SCRIPT_PATH)/docker-build.sh --push + +image-run: ## run the development image +image-run: + podman run --rm -it \ + -e SSH_AUTH_SOCK=${SSH_AUTH_SOCK} \ + -v /run/user/$(shell id -u)/:/run/user/$(shell id -u)/:ro \ + -v $(shell dirname ${SSH_AUTH_SOCK}):$(shell dirname ${SSH_AUTH_SOCK}):rw \ + -v ${HOME}/.gnupg/:/root/.gnupg/:rw \ + -v $(ROOT_PATH):$(ROOT_PATH):rw \ + -w $(ROOT_PATH) \ + docker.artifacts.apextoaster.com/apextoaster/node:16.6 bash diff --git a/config/node.mk b/config/node.mk new file mode 100644 index 0000000..39fdec1 --- /dev/null +++ b/config/node.mk @@ -0,0 +1,73 @@ +export NODE_VERSION := $(shell node -v 2>/dev/null || echo "none") +export PACKAGE_NAME := $(shell jq -r '.name' package.json 2>/dev/null || echo "unknown") +export PACKAGE_VERSION := $(shell jq -r '.version' package.json 2>/dev/null || echo "unknown") +export RUNNER_VERSION := $(CI_RUNNER_VERSION) + +# Debug +export DEBUG_BIND ?= 127.0.0.1 +export DEBUG_PORT ?= 9229 + +# Node options +NODE_CMD ?= $(shell env node) +NODE_DEBUG ?= --inspect-brk=$(DEBUG_BIND):$(DEBUG_PORT) --nolazy + +.PHONY: build ci clean-deps cover deps docs lint test yarn-global yarn-upgrade + +# directory targets +node_modules: deps + +out: build + +# phony targets +build: ## build the app +build: node_modules + yarn tsc + cat $(TARGET_PATH)/src/version.js | envsubst > $(TARGET_PATH)/src/version-out.js + mv $(TARGET_PATH)/src/version-out.js $(TARGET_PATH)/src/version.js + +ci: clean-target lint build cover docs + +clean-deps: ## clean up the node_modules directory + rm -rf node_modules/ + +COVER_ARGS := --all \ + --check-coverage \ + --exclude ".eslintrc.js" \ + --exclude "config/**" \ + --exclude "docs/**" \ + --exclude "examples/**" \ + --exclude "out/coverage/**" \ + --exclude "vendor/**" \ + --reporter=text-summary \ + --reporter=lcov \ + --report-dir=out/coverage + +cover: ## run tests with coverage +cover: node_modules out + yarn c8 $(COVER_ARGS) yarn mocha $(MOCHA_ARGS) "out/**/Test*.js" + +deps: + yarn + +docs: + yarn api-extractor run -c config/api-extractor.json + yarn api-documenter markdown -i out/api -o docs/api + +lint: ## run eslint +lint: node_modules + yarn eslint src/ --ext .ts,.tsx + +MOCHA_ARGS := --async-only \ + --check-leaks \ + --forbid-only \ + --require source-map-support/register \ + --require out/test/setup.js \ + --recursive \ + --sort + +test: ## run tests +test: node_modules out + yarn mocha $(MOCHA_ARGS) "out/**/Test*.js" + +yarn-upgrade: ## check yarn for potential upgrades + yarn upgrade-interactive --latest diff --git a/config/project.mk b/config/project.mk new file mode 100644 index 0000000..419eb89 --- /dev/null +++ b/config/project.mk @@ -0,0 +1,5 @@ +ci-full: ci + +upload-climate: + cc-test-reporter format-coverage -t lcov -o $(TARGET_PATH)/coverage/codeclimate.json -p $(ROOT_PATH) $(TARGET_PATH)/coverage/lcov.info + cc-test-reporter upload-coverage --debug -i $(TARGET_PATH)/coverage/codeclimate.json -r "$(shell echo "${CODECLIMATE_SECRET}" | base64 -d)" diff --git a/config/rollup-external.json b/config/rollup-external.json deleted file mode 100644 index 5278383..0000000 --- a/config/rollup-external.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "names": [ - "chai", - "js-yaml", - "process", - "sinon", - "source-map", - "source-map-support" - ] -} diff --git a/config/rollup-globals.json b/config/rollup-globals.json deleted file mode 100644 index 0967ef4..0000000 --- a/config/rollup-globals.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/config/rollup-named.json b/config/rollup-named.json deleted file mode 100644 index 8591319..0000000 --- a/config/rollup-named.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "node_modules/chai/index.js": [ - "expect", - "use" - ], - "node_modules/lodash/lodash.js": [ - "isNil" - ] -} \ No newline at end of file diff --git a/config/rollup-stub.json b/config/rollup-stub.json deleted file mode 100644 index 782e0e2..0000000 --- a/config/rollup-stub.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "names": [] -} diff --git a/config/rollup.js b/config/rollup.js deleted file mode 100644 index 9ccf458..0000000 --- a/config/rollup.js +++ /dev/null @@ -1,127 +0,0 @@ -import { join, sep } from 'path'; -import commonjs from 'rollup-plugin-commonjs'; -import { eslint } from 'rollup-plugin-eslint'; -import json from 'rollup-plugin-json'; -import multiEntry from 'rollup-plugin-multi-entry'; -import resolve from 'rollup-plugin-node-resolve'; -import replace from 'rollup-plugin-replace'; -import typescript from 'rollup-plugin-typescript2'; -import yaml from 'rollup-plugin-yaml'; - -const flag_debug = process.env['DEBUG'] === 'TRUE'; - -const metadata = require('../package.json'); - -const external = require('./rollup-external.json').names; -const namedExports = require('./rollup-named.json'); - -const rootPath = process.env['ROOT_PATH']; -const targetPath = process.env['TARGET_PATH']; - -const bundle = { - external, - input: { - include: [ - join(rootPath, 'src', 'index.ts'), - join(rootPath, 'test', 'harness.ts'), - join(rootPath, 'test', '**', 'Test*.ts'), - ], - }, - manualChunks(id) { - if (id.includes(`${sep}test${sep}`)) { - return 'test'; - } - - if (id.match(/commonjs-external/i) || id.match(/commonjsHelpers/)) { - return 'vendor'; - } - - if (id.match(/node-resolve:/)) { - return 'vendor'; - } - - if (id.includes(`chai`) || id.includes(`sinon`) || id.includes('source-map')) { - return 'test'; - } - - if (id.includes(`${sep}node_modules${sep}`)) { - return 'vendor'; - } - - if (id.includes(`${sep}src${sep}index`)) { - return 'index'; - } - - if (id.includes(`${sep}src${sep}`) || id.includes(`${sep}rules${sep}`)) { - return 'main'; - } - - if (id.includes(process.env['HOME'])) { - return 'linked'; - } - - if (id.length === 30 && id.match(/^[a-f0-9]+$/)) { - return 'vendor'; - } - - if (flag_debug) { - console.log('file does not belong to any chunk:', id); - } - - return 'nochunk'; - }, - output: { - dir: targetPath, - chunkFileNames: '[name].js', - entryFileNames: 'entry-[name].js', - exports: 'named', - format: 'module', - minifyInternalExports: false, - sourcemap: true, - }, - plugins: [ - multiEntry(), - json(), - yaml(), - replace({ - delimiters: ['{{ ', ' }}'], - values: { - BUILD_JOB: process.env['CI_JOB_ID'], - BUILD_RUNNER: process.env['CI_RUNNER_DESCRIPTION'], - GIT_BRANCH: process.env['CI_COMMIT_REF_SLUG'], - GIT_COMMIT: process.env['CI_COMMIT_SHA'], - NODE_VERSION: process.env['NODE_VERSION'], - PACKAGE_NAME: metadata.name, - PACKAGE_VERSION: metadata.version, - }, - }), - resolve({ - preferBuiltins: true, - }), - commonjs({ - namedExports, - }), - eslint({ - exclude: [ - join('node_modules', '**'), - join('src', 'resource'), - join('src', '**', '*.json'), - join('src', '**', '*.yml'), - ], - include: [ - join('src', '**', '*.ts'), - join('test', '**', '*.ts'), - ], - throwOnError: true, - useEslintrc: true, - }), - typescript({ - cacheRoot: join(targetPath, 'cache', 'rts2'), - rollupCommonJSResolveHack: true, - }), - ], -}; - -export default [ - bundle, -]; diff --git a/config/tsconfig.json b/config/tsconfig.json index 51f8865..8b1f7f1 100755 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -26,7 +26,6 @@ "chai-as-promised", "mocha", "node", - "rollup-resources", "sinon-chai" ], "typeRoots": [ diff --git a/docs/api/js-yaml-schema.includeoptions.md b/docs/api/js-yaml-schema.includeoptions.md index 8e6ba02..3a4de63 100644 --- a/docs/api/js-yaml-schema.includeoptions.md +++ b/docs/api/js-yaml-schema.includeoptions.md @@ -20,5 +20,5 @@ export interface IncludeOptions | [join](./js-yaml-schema.includeoptions.join.md) | | (...path: Array<string>) => string | | | [read](./js-yaml-schema.includeoptions.read.md) | | IncludeReader | | | [resolve](./js-yaml-schema.includeoptions.resolve.md) | | (path: string) => string | | -| [schema](./js-yaml-schema.includeoptions.schema.md) | | Optional<Schema> | | +| [schema](./js-yaml-schema.includeoptions.schema.md) | | Maybe<Schema> | | diff --git a/docs/api/js-yaml-schema.includeoptions.schema.md b/docs/api/js-yaml-schema.includeoptions.schema.md index 9c44cb0..9efd539 100644 --- a/docs/api/js-yaml-schema.includeoptions.schema.md +++ b/docs/api/js-yaml-schema.includeoptions.schema.md @@ -7,5 +7,5 @@ Signature: ```typescript -schema: Optional; +schema: Maybe; ``` diff --git a/package.json b/package.json index 24af54e..6429653 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "author": "ssube", "license": "MIT", "devDependencies": { - "@apextoaster/js-utils": "0.4.1", + "@apextoaster/js-utils": "0.5.0-0", "@istanbuljs/nyc-config-typescript": "1.0.2", "@istanbuljs/schema": "0.1.3", "@microsoft/api-documenter": "7.19.16", diff --git a/src/lib.ts b/src/lib.ts index c59d8d0..a2e733a 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -1,5 +1,5 @@ import { VERSION_INFO } from './version'; -export default { +export { VERSION_INFO, }; diff --git a/src/resource/json.json b/src/resource/json.json deleted file mode 100644 index 1f97972..0000000 --- a/src/resource/json.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "foo": {} -} \ No newline at end of file diff --git a/src/resource/yaml.yml b/src/resource/yaml.yml deleted file mode 100644 index 9b1b394..0000000 --- a/src/resource/yaml.yml +++ /dev/null @@ -1 +0,0 @@ -foo: {} \ No newline at end of file diff --git a/test/harness.ts b/test/harness.ts deleted file mode 100644 index df38bdd..0000000 --- a/test/harness.ts +++ /dev/null @@ -1,22 +0,0 @@ -import chai from 'chai'; -import chaiAsPromised from 'chai-as-promised'; -import sinonChai from 'sinon-chai'; -import sourceMapSupport from 'source-map-support'; - -sourceMapSupport.install({ - environment: 'node', - handleUncaughtExceptions: true, - hookRequire: true, -}); - -/** - * This will break the whole test run if any test leaks an unhandled rejection. - */ -process.on('unhandledRejection', (reason, _promise) => { - // eslint-disable-next-line no-console - console.error('unhandled error during tests', reason); - process.exit(1); -}); - -chai.use(chaiAsPromised); -chai.use(sinonChai); diff --git a/test/setup.ts b/test/setup.ts new file mode 100644 index 0000000..00dbdab --- /dev/null +++ b/test/setup.ts @@ -0,0 +1,20 @@ +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import sinonChai from 'sinon-chai'; + +export function setupTests(): void { + /** + * This will break the whole test run if any test leaks an unhandled rejection. + */ + process.on('unhandledRejection', (reason, promise) => { + /* c8 ignore next 3 */ + // eslint-disable-next-line no-console + console.error('unhandled error during tests', reason); + process.exit(1); + }); + + chai.use(chaiAsPromised); + chai.use(sinonChai); +} + +setupTests(); diff --git a/vendor/rollup-resources/index.d.ts b/vendor/rollup-resources/index.d.ts deleted file mode 100644 index 1e52a09..0000000 --- a/vendor/rollup-resources/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare module "*.json" { - export const data: unknown; - export default data; -} - -declare module "*.yml" { - export const data: unknown; - export default data; -} diff --git a/yarn.lock b/yarn.lock index 379479e..cf962c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@apextoaster/js-utils@0.4.1": - version "0.4.1" - resolved "https://artifacts.apextoaster.com/repository/group-npm/@apextoaster/js-utils/-/js-utils-0.4.1.tgz#846a2ddd4cb7b514836f2a82d924657c5e124d9c" - integrity sha512-OfTVr9YU1XmAE9Ug8e8w1P7HlDXX1FIVbU/WBOu+yXmlJUBeTLEWfyK+ztiY/Wz2ckNycUyYSP/BBRQ5XNXLFw== +"@apextoaster/js-utils@0.5.0-0": + version "0.5.0-0" + resolved "https://artifacts.apextoaster.com/repository/group-npm/@apextoaster/js-utils/-/js-utils-0.5.0-0.tgz#6c94a3a8a2530b8b4b97aee21984e6ae15488daf" + integrity sha512-4uMjuogP86Z3OZVEu05PZTXBJi6YriNItfpZuQAgq4nqK8Vz3AIdHJoKGqycKmr22h3+/ASQzuWm+zcEJxrjUQ== "@babel/code-frame@^7.0.0": version "7.5.5"