Skip to content

Commit

Permalink
add backstage example
Browse files Browse the repository at this point in the history
  • Loading branch information
wKich committed Oct 5, 2021
1 parent 80d02b2 commit 7aee26e
Show file tree
Hide file tree
Showing 51 changed files with 20,823 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/backstage/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
node_modules
packages
!packages/backend/dist
plugins
3 changes: 3 additions & 0 deletions examples/backstage/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
root: true,
};
39 changes: 39 additions & 0 deletions examples/backstage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# macOS
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Coverage directory generated when running tests with coverage
coverage

# Dependencies
node_modules/

# Node version directives
.nvmrc

# dotenv environment variables file
.env
.env.test

# Build output
dist
dist-types

# Temporary change files created by Vim
*.swp

# MkDocs build output
site

# Local configuration files
*.local.yaml

# Sensitive credentials
*-credentials.yaml
4 changes: 4 additions & 0 deletions examples/backstage/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
dist-types
coverage
.vscode
10 changes: 10 additions & 0 deletions examples/backstage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# [Backstage](https://backstage.io)

This is your newly scaffolded Backstage App, Good Luck!

To start the app, run:

```sh
yarn install
yarn dev
```
8 changes: 8 additions & 0 deletions examples/backstage/app-config.production.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
app:
# Should be the same as backend.baseUrl when using the `app-backend` plugin
baseUrl: http://localhost:7000

backend:
baseUrl: http://localhost:7000
listen:
port: 7000
101 changes: 101 additions & 0 deletions examples/backstage/app-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
app:
title: Scaffolded Backstage App
baseUrl: http://localhost:3000

organization:
name: My Company

backend:
baseUrl: http://localhost:7000
listen:
port: 7000
csp:
connect-src: ["'self'", 'http:', 'https:']
# Content-Security-Policy directives follow the Helmet format: https://helmetjs.github.io/#reference
# Default Helmet Content-Security-Policy values can be removed by setting the key to false
cors:
origin: http://localhost:3000
methods: [GET, POST, PUT, DELETE]
credentials: true
database:
client: sqlite3
connection: ':memory:'
cache:
store: memory
# workingDirectory: /tmp # Use this to configure a working directory for the scaffolder, defaults to the OS temp-dir

integrations:
github:
- host: github.com
token: ${GITHUB_TOKEN}
### Example for how to add your GitHub Enterprise instance using the API:
# - host: ghe.example.net
# apiBaseUrl: https://ghe.example.net/api/v3
# token: ${GHE_TOKEN}

proxy:
'/test':
target: 'https://example.com'
changeOrigin: true

# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
# and an external cloud storage when deploying TechDocs for production use-case.
# https://backstage.io/docs/features/techdocs/how-to-guides#how-to-migrate-from-techdocs-basic-to-recommended-deployment-approach
techdocs:
builder: 'local' # Alternatives - 'external'
generator:
runIn: 'docker' # Alternatives - 'local'
publisher:
type: 'local' # Alternatives - 'googleGcs' or 'awsS3'. Read documentation for using alternatives.

auth:
# see https://backstage.io/docs/auth/ to learn about auth providers
providers: {}

scaffolder:
github:
token: ${GITHUB_TOKEN}
visibility: public # or 'internal' or 'private'

catalog:
rules:
- allow: [Component, System, API, Group, User, Resource, Location]
locations:
# Backstage example components
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-components.yaml

# Backstage example systems
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-systems.yaml

# Backstage example APIs
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-apis.yaml

# Backstage example resources
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/all-resources.yaml

# Backstage example organization groups
- type: url
target: https://github.com/backstage/backstage/blob/master/packages/catalog-model/examples/acme/org.yaml

# Backstage example templates
- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/react-ssr-template/template.yaml
rules:
- allow: [Template]
- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/springboot-grpc-template/template.yaml
rules:
- allow: [Template]
- type: url
target: https://github.com/spotify/cookiecutter-golang/blob/master/template.yaml
rules:
- allow: [Template]
- type: url
target: https://github.com/backstage/software-templates/blob/main/scaffolder-templates/docs-template/template.yaml
rules:
- allow: [Template]
13 changes: 13 additions & 0 deletions examples/backstage/catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage
description: An example of a Backstage application.
# Example for optional annotations
# annotations:
# github.com/project-slug: backstage/backstage
# backstage.io/techdocs-ref: dir:.
spec:
type: website
owner: [email protected]
lifecycle: experimental
6 changes: 6 additions & 0 deletions examples/backstage/lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"packages": ["packages/*", "plugins/*"],
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.1.0"
}
58 changes: 58 additions & 0 deletions examples/backstage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "root",
"version": "1.0.0",
"private": true,
"engines": {
"node": "14 || 16"
},
"scripts": {
"dev": "concurrently \"yarn start\" \"yarn start-backend\"",
"start": "yarn workspace app start",
"start-backend": "yarn workspace backend start",
"build": "lerna run build",
"build-image": "yarn workspace backend build-image",
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"clean": "backstage-cli clean && lerna run clean",
"diff": "lerna run diff --",
"test": "lerna run test --since origin/master -- --coverage",
"test:all": "lerna run test -- --coverage",
"lint": "lerna run lint --since origin/master --",
"lint:all": "lerna run lint --",
"prettier:check": "prettier --check .",
"create-plugin": "backstage-cli create-plugin --scope internal --no-private",
"remove-plugin": "backstage-cli remove-plugin"
},
"resolutions": {
"graphql-language-service-interface": "2.8.2",
"graphql-language-service-parser": "1.9.0"
},
"workspaces": {
"packages": [
"packages/*",
"plugins/*"
]
},
"devDependencies": {
"@backstage/cli": "^0.7.14",
"@spotify/prettier-config": "^11.0.0",
"concurrently": "^6.0.0",
"lerna": "^4.0.0",
"prettier": "^2.3.2"
},
"prettier": "@spotify/prettier-config",
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md}": [
"prettier --write"
]
},
"jest": {
"transformModules": [
"@asyncapi/react-component"
]
}
}
3 changes: 3 additions & 0 deletions examples/backstage/packages/app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
5 changes: 5 additions & 0 deletions examples/backstage/packages/app/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"baseUrl": "http://localhost:3001",
"fixturesFolder": false,
"pluginsFile": false
}
21 changes: 21 additions & 0 deletions examples/backstage/packages/app/cypress/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"plugins": ["cypress"],
"extends": ["plugin:cypress/recommended"],
"rules": {
"jest/expect-expect": [
"error",
{
"assertFunctionNames": ["expect", "cy.contains"]
}
],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true,
"optionalDependencies": true,
"peerDependencies": true,
"bundledDependencies": true
}
]
}
}
6 changes: 6 additions & 0 deletions examples/backstage/packages/app/cypress/integration/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
describe('App', () => {
it('should render the catalog', () => {
cy.visit('/');
cy.contains('My Company Catalog');
});
});
73 changes: 73 additions & 0 deletions examples/backstage/packages/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "app",
"version": "0.0.0",
"private": true,
"bundled": true,
"dependencies": {
"@backstage/catalog-model": "^0.9.3",
"@backstage/cli": "^0.7.14",
"@backstage/core-app-api": "^0.1.15",
"@backstage/core-components": "^0.6.0",
"@backstage/core-plugin-api": "^0.1.9",
"@backstage/integration-react": "^0.1.11",
"@backstage/plugin-api-docs": "^0.6.10",
"@backstage/plugin-catalog": "^0.6.17",
"@backstage/plugin-catalog-import": "^0.7.0",
"@backstage/plugin-catalog-react": "^0.5.1",
"@backstage/plugin-github-actions": "^0.4.20",
"@backstage/plugin-org": "^0.3.25",
"@backstage/plugin-scaffolder": "^0.11.6",
"@backstage/plugin-search": "^0.4.13",
"@backstage/plugin-tech-radar": "^0.4.9",
"@backstage/plugin-techdocs": "^0.12.0",
"@backstage/plugin-user-settings": "^0.3.7",
"@backstage/test-utils": "^0.1.17",
"@backstage/theme": "^0.2.10",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"history": "^5.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^15.3.3"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/user-event": "^12.0.7",
"@types/jest": "^26.0.7",
"@types/node": "^14.14.32",
"@types/react-dom": "*",
"cross-env": "^7.0.0",
"cypress": "^7.3.0",
"eslint-plugin-cypress": "^2.10.3",
"start-server-and-test": "^1.10.11"
},
"scripts": {
"start": "backstage-cli app:serve",
"build": "backstage-cli app:build",
"test": "backstage-cli test",
"lint": "backstage-cli lint",
"clean": "backstage-cli clean",
"test:e2e": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:dev",
"test:e2e:ci": "cross-env PORT=3001 start-server-and-test start http://localhost:3001 cy:run",
"cy:dev": "cypress open",
"cy:run": "cypress run"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"files": [
"dist"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit 7aee26e

Please sign in to comment.