diff --git a/.babelrc b/.babelrc index 0bc78bd..11a8a70 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,4 @@ { - "presets": ["@babel/env", "@babel/preset-typescript"] + "presets": ["@babel/env", "@babel/preset-typescript"], + "ignore": ["**/*.spec.js", "**/*.spec.ts"] } diff --git a/.editorconfig b/.editorconfig index 4eb6462..29cb3d0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,10 @@ end_of_line = lf insert_final_newline = true indent_style = tab +[*.yml] +indent_style = space +indent_size = 2 + [package.json] indent_style = space indent_size = 2 diff --git a/.eslintrc.json b/.eslintrc.json index 3995a40..30b4bf9 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,9 +1,9 @@ { "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], "extends": [ "airbnb-base", "plugin:jest/recommended", - "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint" @@ -12,13 +12,21 @@ "ecmaVersion": 2018 }, "rules": { + "@typescript-eslint/no-shadow": "error", + "import/extensions": [ + "error", + { + "ts": "never" + } + ], "import/no-extraneous-dependencies": [ "error", { "devDependencies": ["**/*.spec.{js,ts}"] } ], - "import/prefer-default-export": "off" + "import/prefer-default-export": "off", + "no-shadow": "off" }, "settings": { "import/parsers": { diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml new file mode 100644 index 0000000..79ec955 --- /dev/null +++ b/.github/workflows/security-scan.yml @@ -0,0 +1,36 @@ +name: Security Scan + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + schedule: + # 13:44 on Saturdays + - cron: '44 13 * * 6' + workflow_dispatch: + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: ['javascript'] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..48516ad --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,48 @@ +name: Tests + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + schedule: + # 00:00 on Saturdays + - cron: '0 0 * * SAT' + workflow_dispatch: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [10.x, 14.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: '2' + + - name: Test on Node ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - run: npm install + - run: npm run lint + - run: npm run build + - run: npm run test + - run: npx testpack-cli --keep={ts-jest,typescript} src/e2e.spec.ts + + - name: Upload test coverage report to Codecov + uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: true + + - name: Run Snyk to check for vulnerabilities + uses: snyk/actions/node@master + env: + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} diff --git a/.publishrc b/.publishrc index 29754d3..e3ed75c 100644 --- a/.publishrc +++ b/.publishrc @@ -4,7 +4,7 @@ "uncommittedChanges": true, "untrackedFiles": true, "sensitiveData": true, - "branch": "master", + "branch": "main", "gitTag": true }, "confirm": true, diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e25d958..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - 'node' - - '8' -script: - - npm run travisci -cache: - directories: - - node_modules diff --git a/README.md b/README.md index bbd6892..49e1abe 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![npm package](https://badge.fury.io/js/strings-to-regex.svg)](https://badge.fury.io/js/strings-to-regex) ![node version](https://img.shields.io/node/v/strings-to-regex.svg) ![npm type definitions](https://img.shields.io/npm/types/strings-to-regex) -[![Build Status](https://travis-ci.org/wimpyprogrammer/strings-to-regex.svg?branch=master)](https://travis-ci.org/wimpyprogrammer/strings-to-regex) -[![codecov](https://codecov.io/gh/wimpyprogrammer/strings-to-regex/branch/master/graph/badge.svg)](https://codecov.io/gh/wimpyprogrammer/strings-to-regex) +![Tests status](https://github.com/wimpyprogrammer/strings-to-regex/workflows/Tests/badge.svg) +[![codecov](https://codecov.io/gh/wimpyprogrammer/strings-to-regex/branch/main/graph/badge.svg)](https://codecov.io/gh/wimpyprogrammer/strings-to-regex) [![Known Vulnerabilities](https://snyk.io/test/github/wimpyprogrammer/strings-to-regex/badge.svg)](https://snyk.io/test/github/wimpyprogrammer/strings-to-regex) Generate a compact Regular Expression that matches a finite set. diff --git a/demo/index.html b/demo/index.html index 8e15c81..3b7adce 100644 --- a/demo/index.html +++ b/demo/index.html @@ -42,7 +42,7 @@ /> - + @@ -169,7 +169,7 @@