diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..c69a5cb18f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,31 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space + +[*.html] +indent_style = space +indent_size = 2 + +[*.{ts,json,js,tsx,jsx}] +indent_style = space +indent_size = 2 + +[*.md] +indent_size = 2 +indent_style = space + +[Dockerfile] +indent_style = space +indent_size = 2 + +[*.{yml,yaml}] +indent_size = 2 +indent_style = space diff --git a/.eslintrc.js b/.eslintrc.js index a7cf9c3694..c227c17938 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,21 +1,4 @@ -const copyrightTemplate = `/* - * Copyright 2020 Spotify AB - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -`; - +const path = require('path') const base = require('@spotify-backstage/cli/config/eslint'); module.exports = { @@ -25,8 +8,7 @@ module.exports = { 'notice/notice': [ 'error', { - template: copyrightTemplate, - onNonMatchingHeader: 'replace', + templateFile: path.resolve(__dirname, "scripts/copyright.js"), }, ], }, diff --git a/.github/ISSUE_TEMPLATE/bug_template.md b/.github/ISSUE_TEMPLATE/bug_template.md new file mode 100644 index 0000000000..8c1733a6a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_template.md @@ -0,0 +1,35 @@ +--- +name: 'Bug Report' +about: 'Create Bug Report' +--- + + + +## Expected Behavior + + +## Current Behavior + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + + +## Your Environment + +* NodeJS Version (v12): +* Operating System and Version (e.g. Ubuntu 14.04): +* Browser Information: \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_template.md b/.github/ISSUE_TEMPLATE/feature_template.md new file mode 100644 index 0000000000..17b543c27a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_template.md @@ -0,0 +1,18 @@ +--- +name: 'Feature Request' +about: 'Suggest new features and changes' +--- + + + +## Feature Suggestion + + + +## Possible Implementation + + +## Context + + + \ No newline at end of file diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml new file mode 100644 index 0000000000..31bf396f5f --- /dev/null +++ b/.github/workflows/cli.yml @@ -0,0 +1,49 @@ +name: CLI Test + +on: + pull_request: + paths: ['.github/workflows/cli.yml', 'packages/cli/**'] + types: [opened, reopened, edited, synchronize] + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + node-version: [12.x] + + name: Node ${{ matrix.node-version }} on ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - name: find location of yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: use node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: yarn install + - run: yarn build + # This creates a new plugin and pollutes the workspace, so it should be run last. + - name: verify app serve and plugin creation + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo sysctl fs.inotify.max_user_watches=524288 + fi + node scripts/cli-e2e-test.js + - name: yarn lint, test after plugin creation + working-directory: plugins/test-plugin + run: | + yarn lint + yarn test + env: + CI: true diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 599ad8a893..5c8e5c43b9 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -13,9 +13,8 @@ jobs: node-version: [12.x] steps: - - name: checkout code - uses: actions/checkout@v2 - - name: get yarn cache + - uses: actions/checkout@v2 + - name: find location of yarn cache id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" - uses: actions/cache@v1 @@ -31,19 +30,8 @@ jobs: - name: yarn install, build, and test run: | yarn install + yarn lint yarn build yarn test env: CI: true - # This creates a new plugin and pollutes the workspace, so it should be run last. - - name: verify app serve and plugin creation - run: | - sudo sysctl fs.inotify.max_user_watches=524288 - node scripts/cli-e2e-test.js - - name: yarn lint, test after plugin creation - working-directory: plugins/test-plugin - run: | - yarn lint - yarn test - env: - CI: true diff --git a/packages/cli/.eslintrc.js b/packages/cli/.eslintrc.js index 182a6df30a..f3f858836d 100644 --- a/packages/cli/.eslintrc.js +++ b/packages/cli/.eslintrc.js @@ -1,4 +1,5 @@ module.exports = { + ignorePatterns: ['templates/**'], rules: { 'no-console': 0, }, diff --git a/scripts/copyright.js b/scripts/copyright.js new file mode 100644 index 0000000000..4376d55847 --- /dev/null +++ b/scripts/copyright.js @@ -0,0 +1,15 @@ +/* + * Copyright <%= YEAR %> Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/yarn.lock b/yarn.lock index 9300d907cb..eaacf83d37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12713,7 +12713,7 @@ minimist-options@^3.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=