diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6ad6af0 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,32 @@ +orbs: + node: circleci/node@5.0.3 + +version: 2.1 + +parameters: + node_version: + type: string + default: '16.15.1' + +commands: + install_deps: + steps: + - node/install-packages: + pkg-manager: yarn + cache-version: v1-all + cache-only-lockfile: true + app-dir: ~/repo + override-ci-command: yarn install --pure-lockfile --no-progress + +jobs: + build: + executor: + name: node/default + tag: << pipeline.parameters.node_version >> + working_directory: ~/repo + steps: + - checkout + - install_deps + - run: yarn test + - run: yarn type-check + - run: yarn lint:ci diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b2dadf3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = space +indent_size = 2 diff --git a/.eslintignore b/.eslintignore new file mode 100755 index 0000000..94e2829 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +coverage/ +lib/ +renovate.json +tsconfig.json diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..472eed7 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,6 @@ +{ + "root": true, + "extends": [ + "@shelf/eslint-config/typescript" + ] +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..391f0a4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +*.js text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..656d610 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +.vscode/ +.serverless/ +coverage/ +lib/ +node_modules/ + +*.log +junit.xml +draft.js +*.draft.js +draft.ts +*.draft.ts +yarn.lock + +.env +.DS_Store + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/shelf + +# File-based project format +*.iws + +.idea/$CACHE_FILE$ +.idea/$PRODUCT_WORKSPACE_FILE$ +.idea/.gitignore +!.husky/_/husky.sh diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 0000000..6809ccc --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,31 @@ +#!/bin/sh +if [ -z "$husky_skip_init" ]; then + debug () { + if [ "$HUSKY_DEBUG" = "1" ]; then + echo "husky (debug) - $1" + fi + } + + readonly hook_name="$(basename "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + export readonly husky_skip_init=1 + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + fi + + exit $exitCode +fi diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100755 index 0000000..749d927 --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1,3 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +git update-index --again diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..bf6c97c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" +yarn lint-staged --shell "/bin/sh" --verbose + diff --git a/.husky/validate-circleci-config.sh b/.husky/validate-circleci-config.sh new file mode 100755 index 0000000..27348d6 --- /dev/null +++ b/.husky/validate-circleci-config.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if ! command -v circleci > /dev/null 2>&1; then + echo "\033[0;31m" \ + "Please, install CircleCI CLI to validate config:" \ + "https://circleci.com/docs/2.0/local-cli/" + + exit 0 +fi + +circleci config validate diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..077a50e --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..79ee123 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..d23208f --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6d517b2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/opensource-npm-template.iml b/.idea/opensource-npm-template.iml new file mode 100644 index 0000000..0bddd18 --- /dev/null +++ b/.idea/opensource-npm-template.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..4c6280e --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/README.md b/README.md new file mode 100644 index 0000000..05be0ee --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# xxxxxx [![CircleCI](https://circleci.com/gh/shelfio/xxxxxx/tree/master.svg?style=svg)](https://circleci.com/gh/shelfio/xxxxxx/tree/master)![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) + +> xxxxxx description + +## Install + +``` +$ yarn add @shelf/xxxxxx +``` + +## Usage + +```js +const {getFoo} = require('@shelf/xxxxxx'); + +getFoo(); +``` + +## Publish + +```sh +$ git checkout master +$ yarn version +$ yarn publish +$ git push origin master --tags +``` + +## License + +MIT © [Shelf](https://shelf.io) diff --git a/license b/license new file mode 100644 index 0000000..98fd94c --- /dev/null +++ b/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Gemshelf Inc. (shelf.io) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json new file mode 100644 index 0000000..18a938d --- /dev/null +++ b/package.json @@ -0,0 +1,66 @@ +{ + "name": "@shelf/xxxxxx", + "version": "0.0.0", + "description": "xxxxxx", + "license": "MIT", + "author": { + "name": "Vlad Holubiev", + "email": "vlad@shelf.io", + "url": "https://shelf.io" + }, + "main": "lib", + "types": "lib/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "rm -rf lib/ && yarn build:types && yarn build:code", + "build:code": "babel src --out-dir lib --ignore '**/*.test.ts' --extensions '.ts' && find ./lib -name '*.test.d.ts' -delete", + "build:types": "tsc --emitDeclarationOnly --declaration --isolatedModules false --declarationDir lib", + "coverage": "yarn test --coverage", + "lint": "yarn lint:ci --fix", + "lint:ci": "eslint . --ext .js,.ts,.json", + "prepack": "yarn build", + "test": "TZ=UTC jest src", + "type-check": "tsc --noEmit", + "type-check:watch": "npm run type-check -- --watch" + }, + "lint-staged": { + "*.{html,md,yml}": [ + "prettier --write" + ], + "*.{js,ts,json}": [ + "eslint --fix" + ], + ".circleci/config.yml": [ + ".husky/validate-circleci-config.sh" + ] + }, + "babel": { + "extends": "@shelf/babel-config/backend" + }, + "prettier": "@shelf/prettier-config", + "dependencies": {}, + "devDependencies": { + "@babel/cli": "7.19.3", + "@babel/core": "7.20.5", + "@shelf/babel-config": "1.2.0", + "@shelf/eslint-config": "2.26.0", + "@shelf/prettier-config": "1.0.0", + "@shelf/tsconfig": "0.0.9", + "@types/jest": "29.2.4", + "@types/node": "16", + "eslint": "8.29.0", + "husky": "8.0.2", + "jest": "29.3.1", + "lint-staged": "13.1.0", + "prettier": "2.8.1", + "typescript": "4.9.4" + }, + "engines": { + "node": ">=16" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..25594b1 --- /dev/null +++ b/renovate.json @@ -0,0 +1,8 @@ +{ + "extends": ["config:base"], + "labels": ["dependencies", "backend"], + "ignoreDeps": [ + "cimg/node", + "@types/node" + ] +} diff --git a/src/index.test.ts b/src/index.test.ts new file mode 100644 index 0000000..7fe80c6 --- /dev/null +++ b/src/index.test.ts @@ -0,0 +1,5 @@ +import {getFoo} from './index'; + +it('should return bar', () => { + expect(getFoo()).toEqual('bar'); +}); diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..494c403 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +export function getFoo(): string { + return 'bar'; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..5bbaf96 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@shelf/tsconfig/backend", + "compilerOptions": { + "strict": true + }, + "exclude": ["node_modules"], + "include": ["src"] +} diff --git a/wallaby.config.js b/wallaby.config.js new file mode 100644 index 0000000..881fb4d --- /dev/null +++ b/wallaby.config.js @@ -0,0 +1,12 @@ +module.exports = () => { + return { + autoDetect: true, + files: ['package.json', 'src/**/*.ts', '!src/**/*.test.ts'], + tests: ['src/**/*.test.ts'], + env: { + params: { + env: 'TZ=UTC', + }, + }, + }; +};