diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index c3fa6e4e23..f154c586fa 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -14,8 +14,6 @@ jobs: env: CI: true NODE_OPTIONS: --max-old-space-size=4096 - BACKSTAGE_CACHE_DIR: /.backstage-build-cache - BACKSTAGE_CACHE_MAX_ENTRIES: 2 steps: - uses: actions/checkout@v2 @@ -36,13 +34,6 @@ jobs: with: path: node_modules key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} - - name: cache build cache - uses: actions/cache@v2 - with: - path: .backstage-build-cache - key: build-cache-${{ github.sha }} - restore-keys: | - build-cache- - name: use node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 52f2760469..3ef0c1fee3 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -15,8 +15,6 @@ jobs: env: CI: true NODE_OPTIONS: --max-old-space-size=4096 - BACKSTAGE_CACHE_DIR: /.backstage-build-cache - BACKSTAGE_CACHE_MAX_ENTRIES: 2 steps: - uses: actions/checkout@v2 @@ -35,13 +33,6 @@ jobs: with: path: node_modules key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} - - name: cache build cache - uses: actions/cache@v2 - with: - path: .backstage-build-cache - key: build-cache-${{ github.sha }} - restore-keys: | - build-cache- - name: use node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: diff --git a/docs/service_specification.schema.json b/docs/service_specification.schema.json new file mode 100644 index 0000000000..a17f67d30a --- /dev/null +++ b/docs/service_specification.schema.json @@ -0,0 +1,122 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "backstage.io/v1alpha1", + "type": "object", + "title": "A JSON Schema for Backstage catalog entities.", + "description": "Each descriptor file has a number of entities. This schema matches each of those.", + "examples": [ + { + "apiVersion": "backstage.io/v1alpha1", + "kind": "Component", + "metadata": { + "name": "LoremService", + "description": "Creates Lorems like a pro.", + "labels": { + "product_name": "Random value Generator" + }, + "annnotations": { + "docs": "https://github.com/..../tree/develop/doc" + }, + "teams": [ + { + "name": "Team super great", + "email": "greatTeam@geemel.com" + } + ] + }, + "spec": { + "type": "service", + "lifecycle": "production", + "owner": "tools@example.com" + } + } + ], + "required": ["apiVersion", "kind", "metadata"], + "additionalProperties": false, + "properties": { + "apiVersion": { + "type": "string", + "description": "Version of the specification format for a particular file is written against.", + "enum": ["backstage.io/v1alpha1", "backstage.io/v1beta1"] + }, + "kind": { + "type": "string", + "description": "High level entity type being described, from the Backstage system model.", + "enum": ["Component"] + }, + "metadata": { + "$ref": "#/definitions/metadata" + }, + "spec": { + "$ref": "#/definitions/spec" + } + }, + "definitions": { + "metadata": { + "type": "object", + "description": "Metadata about the entity, i.e. things that aren't directly part of the entity specification itself.", + "required": ["name"], + "additionalProperties": true, + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z0-9A-Z_.-]{1,63}$", + "description": "The name of the entity. This name is both meant for human eyes to recognize the entity, and for machines and other components to reference the entity" + }, + "description": { + "type": "string", + "description": "A human readable description of the entity, to be shown in Backstage. Should be kept short and informative." + }, + "namespace": { + "type": "string", + "description": "The name of a namespace that the entity belongs to." + }, + "labels": { + "type": "object", + "description": "Labels are optional key/value pairs of that are attached to the entity, and their use is identical to kubernetes object labels.", + "additionalProperties": true, + "patternProperties": { + "^([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\\.[a-zA-Z]{2,}/)?[a-z0-9A-Z_\\-\\.]{1,63}$": { + "type": "string", + "pattern": "^[a-z0-9A-Z_.-]{1,63}$" + } + } + }, + "annnotations": { + "type": "object", + "description": "Arbitrary non-identifying metadata attached to the entity, identical in use to kubernetes object annotations.", + "additionalProperties": true, + "patternProperties": { + "^([a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\\.[a-zA-Z]{2,}/)?[a-z0-9A-Z_\\-\\.]{1,63}$": { + "type": "string", + "pattern": "^[a-z0-9A-Z_.-]{1,63}$" + } + } + } + } + }, + "spec": { + "type": "object", + "description": "Actual specification data that describes the entity. TODO: shape depend on `kind`", + "required": ["type", "lifecycle", "owner"], + "additionalProperties": true, + "properties": { + "type": { + "type": "string", + "description": "The type of component.", + "examples": ["service"] + }, + "lifecycle": { + "type": "string", + "description": "The lifecycle step that this component is in.", + "examples": ["production"] + }, + "owner": { + "type": "string", + "description": "The owner of the component.", + "examples": ["tools@example.com"] + } + } + } + } +} diff --git a/lerna.json b/lerna.json index aa535f7aeb..5d63f88c11 100644 --- a/lerna.json +++ b/lerna.json @@ -2,5 +2,5 @@ "packages": ["packages/*", "plugins/*"], "npmClient": "yarn", "useWorkspaces": true, - "version": "0.1.1-alpha.8" + "version": "0.1.1-alpha.9" } diff --git a/packages/app/package.json b/packages/app/package.json index 9a296a913c..6aa82a0b36 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,21 +1,21 @@ { "name": "example-app", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": true, "dependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/plugin-catalog": "^0.1.1-alpha.8", - "@backstage/plugin-circleci": "^0.1.1-alpha.8", - "@backstage/plugin-explore": "^0.1.1-alpha.8", - "@backstage/plugin-gitops-profiles": "^0.1.1-alpha.8", - "@backstage/plugin-lighthouse": "^0.1.1-alpha.8", - "@backstage/plugin-register-component": "^0.1.1-alpha.8", - "@backstage/plugin-scaffolder": "^0.1.1-alpha.8", - "@backstage/plugin-sentry": "^0.1.1-alpha.8", - "@backstage/plugin-tech-radar": "^0.1.1-alpha.8", - "@backstage/plugin-welcome": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/plugin-catalog": "^0.1.1-alpha.9", + "@backstage/plugin-circleci": "^0.1.1-alpha.9", + "@backstage/plugin-explore": "^0.1.1-alpha.9", + "@backstage/plugin-gitops-profiles": "^0.1.1-alpha.9", + "@backstage/plugin-lighthouse": "^0.1.1-alpha.9", + "@backstage/plugin-register-component": "^0.1.1-alpha.9", + "@backstage/plugin-scaffolder": "^0.1.1-alpha.9", + "@backstage/plugin-sentry": "^0.1.1-alpha.9", + "@backstage/plugin-tech-radar": "^0.1.1-alpha.9", + "@backstage/plugin-welcome": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "prop-types": "^15.7.2", diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index c265a7f489..1a52e06013 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/backend-common", "description": "Common functionality library for Backstage backends", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "private": false, @@ -40,7 +40,7 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "@types/compression": "^1.7.0", "@types/http-errors": "^1.6.3", "@types/morgan": "^1.9.0", diff --git a/packages/backend/package.json b/packages/backend/package.json index 7e9dbb71a7..7a0ad95e67 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -1,6 +1,6 @@ { "name": "example-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.cjs.js", "types": "src/index.ts", "private": true, @@ -17,20 +17,20 @@ "migrate:create": "knex migrate:make -x ts" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", - "@backstage/catalog-model": "^0.1.1-alpha.8", - "@backstage/plugin-auth-backend": "^0.1.1-alpha.8", - "@backstage/plugin-catalog-backend": "^0.1.1-alpha.8", - "@backstage/plugin-identity-backend": "^0.1.1-alpha.8", - "@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.8", - "@backstage/plugin-sentry-backend": "^0.1.1-alpha.8", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@backstage/catalog-model": "^0.1.1-alpha.9", + "@backstage/plugin-auth-backend": "^0.1.1-alpha.9", + "@backstage/plugin-catalog-backend": "^0.1.1-alpha.9", + "@backstage/plugin-identity-backend": "^0.1.1-alpha.9", + "@backstage/plugin-scaffolder-backend": "^0.1.1-alpha.9", + "@backstage/plugin-sentry-backend": "^0.1.1-alpha.9", "express": "^4.17.1", "knex": "^0.21.1", "sqlite3": "^4.2.0", "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "@types/express": "^4.17.6", "@types/express-serve-static-core": "^4.17.5", "@types/helmet": "^0.0.47" diff --git a/packages/catalog-model/package.json b/packages/catalog-model/package.json index 170fb36281..60208aeebb 100644 --- a/packages/catalog-model/package.json +++ b/packages/catalog-model/package.json @@ -1,12 +1,12 @@ { "name": "@backstage/catalog-model", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.cjs.js", "module": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -22,14 +22,15 @@ "clean": "backstage-cli clean" }, "dependencies": { + "@types/yup": "^0.28.2", "lodash": "^4.17.15", "yup": "^0.28.5" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "@types/jest": "^25.2.2", "@types/lodash": "^4.14.151", - "@types/yup": "^0.28.2", "yaml": "^1.9.2" }, "files": [ diff --git a/packages/cli/package.json b/packages/cli/package.json index a4c862351e..96ca8e4a4f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/cli", "description": "CLI for developing Backstage plugins and apps", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public" @@ -29,8 +29,8 @@ "backstage-cli": "bin/backstage-cli" }, "dependencies": { - "@backstage/config": "^0.1.1-alpha.7", - "@backstage/config-loader": "^0.1.1-alpha.7", + "@backstage/config": "0.1.1-alpha.9", + "@backstage/config-loader": "^0.1.1-alpha.9", "@hot-loader/react-dom": "^16.13.0", "@lerna/package-graph": "^3.18.5", "@lerna/project": "^3.18.0", @@ -40,8 +40,8 @@ "@spotify/eslint-config": "^7.0.1", "@sucrase/webpack-loader": "^2.0.0", "@types/start-server-webpack-plugin": "^2.2.0", - "@types/webpack-node-externals": "^1.7.1", "@types/webpack-env": "^1.15.2", + "@types/webpack-node-externals": "^1.7.1", "bfj": "^7.0.2", "chalk": "^4.0.0", "chokidar": "^3.3.1", diff --git a/packages/cli/src/commands/build-cache/index.ts b/packages/cli/src/commands/build-cache/index.ts deleted file mode 100644 index 72199ec42e..0000000000 --- a/packages/cli/src/commands/build-cache/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ - -import { Command } from 'commander'; -import { run } from '../../lib/run'; -import { withCache, parseOptions } from '../../lib/buildCache'; - -/* - * The build-cache command is used to make builds a no-op if there are no changes to the package. - * It supports both local development where the output directory remains intact, as well as CI - * where the output directory is stored in a separate cache dir. - */ -export default async (cmd: Command, args: string[]) => { - const options = await parseOptions(cmd); - - await withCache(options, async () => { - await run(args[0], args.slice(1)); - }); -}; diff --git a/packages/cli/src/commands/clean/clean.ts b/packages/cli/src/commands/clean/clean.ts index 91531a53ed..2fa3e4a18f 100644 --- a/packages/cli/src/commands/clean/clean.ts +++ b/packages/cli/src/commands/clean/clean.ts @@ -15,20 +15,9 @@ */ import fs from 'fs-extra'; -import { resolve as resolvePath, relative as relativePath } from 'path'; import { paths } from '../../lib/paths'; -import { getDefaultCacheOptions } from '../../lib/buildCache'; export default async function clean() { - const cacheOptions = getDefaultCacheOptions(); - const packagePath = getPackagePath(cacheOptions.cacheDir); - await fs.remove(cacheOptions.output); - await fs.remove(packagePath); + await fs.remove(paths.resolveTarget('dist')); await fs.remove(paths.resolveTarget('coverage')); } - -function getPackagePath(cacheDir: string) { - const relativePackagePath = relativePath(paths.targetRoot, paths.targetDir); - const packagePath = resolvePath(cacheDir, relativePackagePath); - return packagePath; -} diff --git a/packages/cli/src/commands/watch-deps/index.ts b/packages/cli/src/commands/watch-deps/index.ts deleted file mode 100644 index 61f403883c..0000000000 --- a/packages/cli/src/commands/watch-deps/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -import { Command } from 'commander'; -import { run } from '../../lib/run'; -import { createLogPipe } from '../../lib/logging'; -import { watchDeps, Options } from '../../lib/watchDeps'; - -/* - * The watch-deps command is meant to improve iteration speed while working in a large monorepo - * with packages that are built independently, meaning packages depends on each other's build output. - * - * The command traverses all dependencies of the current package within the monorepo, and starts - * watching for updates in all those packages. If a change is detected, we stop listening for changes, - * and instead start up watch mode for that package. Starting watch mode means running the first - * available yarn script out of "build:watch", "watch", or "build" --watch. - */ -export default async (cmd: Command, args: string[]) => { - const options: Options = {}; - - if (cmd.build) { - options.build = true; - } - - await watchDeps(options); - - if (args?.length) { - // Use log pipe to avoid clearing the terminal - const logPipe = createLogPipe(); - - await run(args[0], args.slice(1), { - stdoutLogFunc: logPipe(process.stdout), - stderrLogFunc: logPipe(process.stderr), - }); - } -}; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index a8b6250a20..e67a52c795 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -126,29 +126,6 @@ const main = (argv: string[]) => { .description('Restores the changes made by the prepack command') .action(lazyAction(() => import('./commands/pack'), 'post')); - program - .command('watch-deps') - .option('--build', 'Build all dependencies on startup') - .description('Watch all dependencies while running another command') - .action(lazyAction(() => import('./commands/watch-deps'), 'default')); - - program - .command('build-cache') - .description('Wrap build command with a cache') - .option( - '--input ', - 'List of input directories that invalidate the cache [.]', - (value, acc) => acc.concat(value), - [], - ) - .option('--output ', 'Output directory to cache', 'dist') - .option( - '--cache-dir ', - 'Cache dir', - '/node_modules/.cache/backstage-builds', - ) - .action(lazyAction(() => import('./commands/build-cache'), 'default')); - program .command('clean') .description('Delete cache directories') diff --git a/packages/cli/src/lib/buildCache/archive.ts b/packages/cli/src/lib/buildCache/archive.ts deleted file mode 100644 index b4a736240d..0000000000 --- a/packages/cli/src/lib/buildCache/archive.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -import fs from 'fs-extra'; -import tar from 'tar'; -import { dirname } from 'path'; - -// packages all files in inputDir into an archive at archivePath, deleting any existing archive -export async function createArchive( - archivePath: string, - inputDir: string, -): Promise { - await fs.remove(archivePath); - await fs.ensureDir(dirname(archivePath)); - await tar.create({ gzip: true, file: archivePath, cwd: inputDir }, ['.']); -} - -// extracts archive at archive path into outputDir, deleting any existing files at outputDir -export async function extractArchive( - archivePath: string, - outputDir: string, -): Promise { - await fs.remove(outputDir); - await fs.ensureDir(outputDir); - await tar.extract({ file: archivePath, cwd: outputDir }); -} diff --git a/packages/cli/src/lib/buildCache/cache.ts b/packages/cli/src/lib/buildCache/cache.ts deleted file mode 100644 index d49eedaba9..0000000000 --- a/packages/cli/src/lib/buildCache/cache.ts +++ /dev/null @@ -1,214 +0,0 @@ -/* - * 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. - */ - -import fs from 'fs-extra'; -import { resolve as resolvePath, relative as relativePath } from 'path'; -import { runPlain, runCheck } from '../run'; -import { Options } from './options'; -import { extractArchive, createArchive } from './archive'; -import { paths } from '../paths'; -import { version, isDev } from '../version'; - -const INFO_FILE = '.backstage-build-cache'; - -// Result from a cache query -export type CacheQueryResult = { - // True if there was a cache hit - hit: boolean; - // If there is a cache hit and this method is defined, it needs to be called to restore the - // output contents before continuing. - copy?: (outputDir: string) => Promise; - // Call after a successful build to archive the output content. - // The content will be archived using the same key as was used to query the cache. - archive: (outputDir: string, maxEntries: number) => Promise; -}; - -// Key that determines whether cached output can be reused -export type CacheKey = string[]; - -type CacheEntry = { - // Key for the input of this cache entry - key: CacheKey; - // Path to the archive of this cache entry - path: string; -}; - -// Struct containing information about cache entries on the filesystem. -// Stored inside the INFO_FILE as JSON. -type CacheInfo = { - // Optional key entry for the contents of the current directory. Used to key the - // output present in the outputs folder, where the info file resides inside the output folder. - key?: CacheKey; - // Optional list of cache archives present in the same directory. Resides in the external - // cache location inside one info file for each package. - entries?: CacheEntry[]; -}; - -export class Cache { - // Read the current cache state form the filesystem. - static async read(options: Options) { - const relativePackagePath = relativePath(paths.targetRoot, paths.targetDir); - const location = resolvePath(options.cacheDir, relativePackagePath); - - const outputInfo = await readCacheInfo(options.output); - const localKey = outputInfo?.key; - - const { entries = [] } = (await readCacheInfo(location)) ?? {}; - return new Cache(location, entries, localKey); - } - - // Generates a key based on the contents of the input paths. - // Returns undefined if it's not possible to generate a stable key. - static async readInputKey( - inputPaths: string[], - ): Promise { - const allInputPaths = inputPaths.slice(); - - // If we're executing the cli inside the backstage repo, we add the cli src as cache key as well - if (isDev) { - allInputPaths.unshift(paths.ownDir); - } - - // Make sure we don't have any uncommitted changes to the input, in that case we skip caching. - const noChanges = await runCheck( - 'git', - 'diff', - '--quiet', - 'HEAD', - '--', - ...allInputPaths, - ); - if (!noChanges) { - return undefined; - } - - const trees = []; - for (const inputPath of allInputPaths) { - const output = await runPlain('git', 'ls-tree', 'HEAD', inputPath); - const [, , sha] = output.split(/\s+/, 3); - // If we can't get a tree sha it means we're outside of tracked files, so treat as dirty - if (!sha) { - return undefined; - } - trees.push(sha); - } - - if (isDev) { - return trees; - } - // If we're executing as a dependency, use the version as a key - return [version, ...trees]; - } - - constructor( - private readonly location: string, - private readonly entries: CacheEntry[] = [], - private readonly localKey?: CacheKey, - ) {} - - // Query for the presense of cached output for a given key - query(key: CacheKey): CacheQueryResult { - const { location } = this; - - const archive = async (outputDir: string, maxEntries: number) => { - await writeCacheInfo(outputDir, { key }); - - const timestamp = new Date().toISOString().replace(/-|:|\..*/g, ''); - const rand = Math.random().toString(36).slice(2, 6); - const archiveName = `cache-${timestamp}-${rand}.tgz`; - const archivePath = resolvePath(location, archiveName); - - // Read existing entries and prepend the new one - const { entries = [] } = (await readCacheInfo(location)) ?? {}; - - // Check if there's already aan entry for this key, in that case we just wanna bump it - const entryIndex = entries.findIndex((e) => compareKeys(e.key, key)); - if (entryIndex !== -1) { - const [existingEntry] = entries.splice(entryIndex, 1); - entries.unshift(existingEntry); - - await writeCacheInfo(location, { entries }); - return; - } - - // Create and add new archive to entries - await createArchive(archivePath, outputDir); - entries.unshift({ key, path: archiveName }); - - // Remove old cache entries - const removedEntries = entries.splice(maxEntries); - for (const entry of removedEntries) { - try { - await fs.remove(resolvePath(location, entry.path)); - } catch (error) { - process.stderr.write(`failed to remove old cache entry, ${error}\n`); - } - } - - await writeCacheInfo(location, { entries }); - }; - - if (compareKeys(this.localKey, key)) { - return { hit: true, archive }; - } - - const matchingEntry = this.entries.find((e) => compareKeys(e.key, key)); - if (!matchingEntry) { - return { hit: false, archive }; - } - - return { - hit: true, - archive, - copy: async (outputDir: string) => { - const archivePath = resolvePath(location, matchingEntry.path); - await extractArchive(archivePath, outputDir); - }, - }; - } -} - -// Compares to cache keys, returning true if they are both defined and equal -function compareKeys(a?: CacheKey, b?: CacheKey): boolean { - if (!a || !b) { - return false; - } - return a.join(',') === b.join(','); -} - -// Read and parse a cache info file in the given directory -async function readCacheInfo( - parentDir: string, -): Promise { - const infoFile = resolvePath(parentDir, INFO_FILE); - const exists = await fs.pathExists(infoFile); - if (!exists) { - return undefined; - } - - const infoData = await fs.readFile(infoFile); - const cacheInfo = JSON.parse(infoData.toString('utf8')) as CacheInfo; - return cacheInfo; -} - -// Write a cache info file to the given directory -async function writeCacheInfo( - parentDir: string, - cacheInfo: CacheInfo, -): Promise { - const infoData = Buffer.from(JSON.stringify(cacheInfo, null, 2), 'utf8'); - await fs.writeFile(resolvePath(parentDir, INFO_FILE), infoData); -} diff --git a/packages/cli/src/lib/buildCache/options.ts b/packages/cli/src/lib/buildCache/options.ts deleted file mode 100644 index 9a6a379fce..0000000000 --- a/packages/cli/src/lib/buildCache/options.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - */ - -import { resolve as resolvePath } from 'path'; -import { Command } from 'commander'; -import { paths } from '../paths'; - -const DEFAULT_CACHE_DIR = '/node_modules/.cache/backstage-builds'; -const DEFAULT_MAX_ENTRIES = 10; - -export type Options = { - inputs: string[]; - output: string; - cacheDir: string; - maxCacheEntries: number; -}; - -function transformPath(path: string): string { - return resolvePath(path.replace(//g, paths.targetRoot)); -} - -export async function parseOptions(cmd: Command): Promise { - const inputs = cmd.input.map(transformPath) as string[]; - if (inputs.length === 0) { - inputs.push(transformPath('.')); - } - const output = transformPath(cmd.output); - const cacheDir = transformPath( - process.env.BACKSTAGE_CACHE_DIR || cmd.cacheDir, - ); - const maxCacheEntries = - Number(process.env.BACKSTAGE_CACHE_MAX_ENTRIES) || DEFAULT_MAX_ENTRIES; - return { inputs, output, cacheDir, maxCacheEntries }; -} - -export function getDefaultCacheOptions(): Options { - return { - inputs: [transformPath('.')], - output: transformPath('dist'), - cacheDir: transformPath( - process.env.BACKSTAGE_CACHE_DIR || DEFAULT_CACHE_DIR, - ), - maxCacheEntries: - Number(process.env.BACKSTAGE_CACHE_MAX_ENTRIES) || DEFAULT_MAX_ENTRIES, - }; -} diff --git a/packages/cli/src/lib/buildCache/withCache.ts b/packages/cli/src/lib/buildCache/withCache.ts deleted file mode 100644 index d21de94865..0000000000 --- a/packages/cli/src/lib/buildCache/withCache.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -import fs from 'fs-extra'; -import { Cache } from './cache'; -import { Options } from './options'; - -function print(msg: string) { - process.stdout.write(`[build-cache] ${msg}\n`); -} - -// Wrap a build function with a cache, which won't call the build function on cache hit -export async function withCache( - options: Options, - buildFunc: () => Promise, -): Promise { - const key = await Cache.readInputKey(options.inputs); - if (!key) { - print('input directory is dirty, skipping cache'); - await fs.remove(options.output); - await buildFunc(); - return; - } - - const cache = await Cache.read(options); - - const cacheResult = cache.query(key); - if (cacheResult.hit) { - if (cacheResult.copy) { - print('external cache hit, copying archive to output folder'); - await cacheResult.copy(options.output); - } else { - print('cache hit, nothing to be done'); - } - return; - } - - print('cache miss, need to build'); - await fs.remove(options.output); - await buildFunc(); - - await cacheResult.archive(options.output, options.maxCacheEntries); -} diff --git a/packages/cli/src/lib/watchDeps/compiler.ts b/packages/cli/src/lib/watchDeps/compiler.ts deleted file mode 100644 index 5ea8efc3e6..0000000000 --- a/packages/cli/src/lib/watchDeps/compiler.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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. - */ - -import { spawn } from 'child_process'; -import { LogPipe } from '../logging'; -import chalk from 'chalk'; -import { Package } from './packages'; - -export function startCompiler(pkg: Package, logPipe: LogPipe) { - // First we figure out which yarn script is a available, falling back to "build --watch" - const scriptName = ['build:watch', 'watch'].find( - (script) => script in pkg.scripts, - ); - const args = scriptName ? [scriptName] : ['build', '--watch']; - - // Start the watch script inside the dependency - const watch = spawn('yarn', ['run', ...args], { - cwd: pkg.location, - env: { FORCE_COLOR: 'true', ...process.env }, - stdio: 'pipe', - shell: true, - }); - - watch.stdin.end(); - watch.stdout.on('data', logPipe(process.stdout)); - const logErr = logPipe(process.stderr); - watch.stderr.on('data', logErr); - - const promise = new Promise((resolve, reject) => { - watch.on('error', (error) => { - reject(error); - }); - - watch.on('close', (code: number) => { - if (code !== 0) { - const msg = `Compiler exited with code ${code}`; - logErr(chalk.red(msg)); - reject(new Error(msg)); - } else { - resolve(); - } - }); - }); - - return { - promise, - close() { - watch.kill('SIGINT'); - }, - }; -} diff --git a/packages/cli/src/lib/watchDeps/packages.ts b/packages/cli/src/lib/watchDeps/packages.ts deleted file mode 100644 index 7a45524b45..0000000000 --- a/packages/cli/src/lib/watchDeps/packages.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -import { paths } from '../paths'; - -const LernaProject = require('@lerna/project'); -const PackageGraph = require('@lerna/package-graph'); - -export type Package = { - name: string; - location: string; - scripts: { [name in string]: string }; -}; - -// Uses lerna to find all local deps of the root package, excluding itself or any package in the blacklist -export async function findAllDeps( - rootPackageName: string, - blacklist: string[], -): Promise { - const project = new LernaProject(paths.targetDir); - const packages = await project.getPackages(); - const graph = new PackageGraph(packages); - - const deps = new Map(); - const searchNames = [rootPackageName]; - - while (searchNames.length) { - const name = searchNames.pop()!; - - if (deps.has(name)) { - continue; - } - - const node = graph.get(name); - if (!node) { - throw new Error(`Package '${name}' not found`); - } - - searchNames.push(...node.localDependencies.keys()); - deps.set(name, node.pkg); - } - - deps.delete(rootPackageName); - for (const name of blacklist) { - deps.delete(name); - } - - return [...deps.values()]; -} diff --git a/packages/cli/src/lib/watchDeps/watchDeps.ts b/packages/cli/src/lib/watchDeps/watchDeps.ts deleted file mode 100644 index c986749d3b..0000000000 --- a/packages/cli/src/lib/watchDeps/watchDeps.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -import chalk from 'chalk'; -import fs from 'fs-extra'; -import { createLogPipeFactory } from './logger'; -import { findAllDeps } from './packages'; -import { startWatcher, startPackageWatcher } from './watcher'; -import { startCompiler } from './compiler'; -import { run } from '../run'; -import { paths } from '../paths'; - -const PACKAGE_BLACKLIST = [ - // We never want to watch for changes in the cli, but all packages will depend on it. - '@backstage/cli', -]; - -const WATCH_LOCATIONS = ['package.json', 'src', 'assets']; - -export type Options = { - build?: boolean; -}; - -// Start watching for dependency changes. -// The returned promise resolves when watchers have started for all current dependencies. -export async function watchDeps(options: Options = {}) { - const localPackagePath = paths.resolveTarget('package.json'); - - // Rotate through different prefix colors to make it easier to differenciate between different deps - const createLogPipe = createLogPipeFactory([ - chalk.yellow, - chalk.blue, - chalk.magenta, - chalk.green, - chalk.cyan, - ]); - - // Find all direct and transitive local dependencies of the current package. - const packageData = await fs.readFile(localPackagePath, 'utf8'); - const packageJson = JSON.parse(packageData); - const packageName = packageJson.name; - - const deps = await findAllDeps(packageName, PACKAGE_BLACKLIST); - - if (options.build) { - await run('lerna', [ - 'run', - '--scope', - packageName, - '--include-dependencies', - 'build', - ]); - } - - // We lazily watch all our deps, as in we don't start the actual watch compiler until a change is detected - const watcher = await startWatcher(deps, WATCH_LOCATIONS, (pkg) => { - startCompiler(pkg, createLogPipe(pkg.name)).promise.catch((error) => { - process.stderr.write(`${error}\n`); - }); - }); - - await startPackageWatcher(localPackagePath, async () => { - const newDeps = await findAllDeps(packageName, PACKAGE_BLACKLIST); - await watcher.update(newDeps); - }); -} diff --git a/packages/cli/src/lib/watchDeps/watcher.ts b/packages/cli/src/lib/watchDeps/watcher.ts deleted file mode 100644 index bcfe766b63..0000000000 --- a/packages/cli/src/lib/watchDeps/watcher.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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. - */ - -import { resolve as resolvePath } from 'path'; -import chalk from 'chalk'; -import chokidar from 'chokidar'; -import { Package } from './packages'; -import { createLogFunc } from '../logging'; - -export type Watcher = { - update(newPackages: Package[]): Promise; -}; - -/* - * Watch for changes inside a collection of packages. When a change is detected, stop - * watching and call the callback with the package the change occured in. - * - * The returned promise is resolved once all watchers are ready. - */ -export async function startWatcher( - packages: Package[], - paths: string[], - callback: (pkg: Package) => void, -): Promise { - const watchedPackageLocations = new Set(); - const log = createLogFunc(process.stdout); - - const watchPackage = async (pkg: Package) => { - let signalled = false; - watchedPackageLocations.add(pkg.location); - - const watchLocations = paths.map((path) => resolvePath(pkg.location, path)); - const watcher = chokidar - .watch(watchLocations, { - cwd: pkg.location, - ignoreInitial: true, - disableGlobbing: true, - }) - .on('all', () => { - if (!signalled) { - signalled = true; - callback(pkg); - } - watcher.close(); - }); - - return new Promise((resolve, reject) => { - watcher.on('ready', resolve); - watcher.on('error', reject); - }); - }; - - const update = async (newPackages: Package[]) => { - const promises = new Array>(); - - for (const pkg of newPackages) { - if (watchedPackageLocations.has(pkg.location)) { - continue; - } - - log(chalk.green(`Starting watch of new dependency ${pkg.name}`)); - promises.push(watchPackage(pkg)); - } - - await Promise.all(promises); - }; - - await Promise.all(packages.map(watchPackage)); - - return { update }; -} - -/** - * Watch a package.json for updates - */ -export function startPackageWatcher(packagePath: string, callback: () => void) { - let changed = false; - let working = false; - - const notifyDeps = async () => { - changed = true; - if (working) { - return; - } - working = true; - changed = false; - - try { - await callback(); - } finally { - working = false; - // Keep going if a change was emitted while working - if (changed) { - notifyDeps(); - } - } - }; - - const watcher = chokidar - .watch(packagePath, { - ignoreInitial: true, - disableGlobbing: true, - }) - .on('all', () => { - notifyDeps(); - }); - - return new Promise((resolve, reject) => { - watcher.on('ready', resolve); - watcher.on('error', reject); - }); -} diff --git a/packages/config-loader/package.json b/packages/config-loader/package.json index de6b26363a..01aa0ed735 100644 --- a/packages/config-loader/package.json +++ b/packages/config-loader/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/config-loader", "description": "Config loading functionality used by Backstage backend, and CLI", - "version": "0.1.1-alpha.7", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -30,7 +30,7 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/config": "^0.1.1-alpha.7", + "@backstage/config": "0.1.1-alpha.9", "fs-extra": "^9.0.0", "yaml": "^1.9.2", "yup": "^0.28.5" diff --git a/packages/config/package.json b/packages/config/package.json index c67264d4c9..8bf4001e62 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/config", "description": "Config API used by Backstage core, backend, and CLI", - "version": "0.1.1-alpha.7", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", diff --git a/packages/core-api/package.json b/packages/core-api/package.json index 80a94b2e34..2659a23ef6 100644 --- a/packages/core-api/package.json +++ b/packages/core-api/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core-api", "description": "Internal Core API used by Backstage plugins and apps", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -30,8 +30,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/config": "^0.1.1-alpha.7", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/config": "0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@types/react": "^16.9", @@ -42,8 +42,8 @@ "zen-observable": "^0.8.15" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/test-utils-core": "^0.1.1-alpha.7", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/test-utils-core": "0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/packages/core/package.json b/packages/core/package.json index ccf2bce628..69b0590802 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/core", "description": "Core API used by Backstage plugins and apps", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -30,9 +30,9 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/config": "^0.1.1-alpha.7", - "@backstage/core-api": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/config": "0.1.1-alpha.9", + "@backstage/core-api": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -55,8 +55,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 5e6d26111d..af1f813148 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/dev-utils", "description": "Utilities for developing Backstage plugins.", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@testing-library/jest-dom": "^5.7.0", diff --git a/packages/storybook/package.json b/packages/storybook/package.json index c02557910b..21222cf412 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,6 +1,6 @@ { "name": "storybook", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "description": "Storybook build for core package", "private": true, "scripts": { @@ -14,7 +14,7 @@ ] }, "dependencies": { - "@backstage/theme": "^0.1.1-alpha.8" + "@backstage/theme": "^0.1.1-alpha.9" }, "devDependencies": { "@storybook/addon-actions": "^5.3.17", diff --git a/packages/test-utils-core/package.json b/packages/test-utils-core/package.json index f0b98add94..a71a23c844 100644 --- a/packages/test-utils-core/package.json +++ b/packages/test-utils-core/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/test-utils-core", "description": "Utilities to test Backstage core", - "version": "0.1.1-alpha.7", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index a82ec779b8..7c5a229aba 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/test-utils", "description": "Utilities to test Backstage plugins and apps.", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -30,10 +30,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/core-api": "^0.1.1-alpha.8", - "@backstage/test-utils-core": "^0.1.1-alpha.7", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/core-api": "^0.1.1-alpha.9", + "@backstage/test-utils-core": "0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", diff --git a/packages/theme/package.json b/packages/theme/package.json index 95a7605c05..72a10eb1f3 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/theme", "description": "material-ui theme for use with Backstage.", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -32,7 +32,7 @@ "@material-ui/core": "^4.9.1" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8" + "@backstage/cli": "^0.1.1-alpha.9" }, "files": [ "dist/**/*.{js,d.ts}" diff --git a/plugins/auth-backend/package.json b/plugins/auth-backend/package.json index 69e4a99acc..e0f9252773 100644 --- a/plugins/auth-backend/package.json +++ b/plugins/auth-backend/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-auth-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -20,12 +20,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", - "@types/cookie-parser": "^1.4.2", - "@types/jwt-decode": "2.2.1", - "@types/passport": "^1.0.3", - "@types/passport-github2": "^1.2.4", - "@types/passport-google-oauth20": "^2.0.3", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "body-parser": "^1.19.0", "compression": "^1.7.4", "cookie-parser": "^1.4.5", @@ -44,12 +40,17 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "@types/body-parser": "^1.19.0", + "@types/cookie-parser": "^1.4.2", + "@types/jwt-decode": "2.2.1", + "@types/passport-github2": "^1.2.4", + "@types/passport-google-oauth20": "^2.0.3", "@types/passport-saml": "^1.1.2", + "@types/passport": "^1.0.3", "jest-fetch-mock": "^3.0.3" }, "files": [ - "dist" + "dist/**/*.{js,d.ts}" ] } diff --git a/plugins/auth-backend/src/providers/github/provider.ts b/plugins/auth-backend/src/providers/github/provider.ts index 0f8f185015..0bcd80cf2c 100644 --- a/plugins/auth-backend/src/providers/github/provider.ts +++ b/plugins/auth-backend/src/providers/github/provider.ts @@ -96,6 +96,7 @@ export function createGithubProvider( } envProviders[env] = new OAuthProvider(new GithubAuthProvider(opts), { + disableRefresh: true, providerId: 'github', secure, baseUrl, diff --git a/plugins/auth-backend/src/providers/google/provider.ts b/plugins/auth-backend/src/providers/google/provider.ts index 971f588dce..9675d4eef2 100644 --- a/plugins/auth-backend/src/providers/google/provider.ts +++ b/plugins/auth-backend/src/providers/google/provider.ts @@ -143,6 +143,7 @@ export function createGoogleProvider( } envProviders[env] = new OAuthProvider(new GoogleAuthProvider(opts), { + disableRefresh: false, providerId: 'google', secure, baseUrl, diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index a350ab4454..a12aa4e21d 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-catalog-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -21,8 +21,9 @@ "mock-data": "./scripts/mock-data" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", - "@backstage/catalog-model": "^0.1.1-alpha.8", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@backstage/catalog-model": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "express": "^4.17.1", "express-promise-router": "^3.0.3", "fs-extra": "^9.0.0", @@ -38,7 +39,7 @@ "yup": "^0.28.5" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "@types/lodash": "^4.14.151", "@types/node-fetch": "^2.5.7", "@types/supertest": "^2.0.8", @@ -48,7 +49,7 @@ "supertest": "^4.0.2" }, "files": [ - "dist", - "migrations" + "dist/**/*.{js,d.ts}", + "migrations/**/*.{js,d.ts}" ] } diff --git a/plugins/catalog/package.json b/plugins/catalog/package.json index 500adaf0b5..37a0397862 100644 --- a/plugins/catalog/package.json +++ b/plugins/catalog/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-catalog", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,11 +22,11 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.1.1-alpha.8", - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/plugin-scaffolder": "^0.1.1-alpha.8", - "@backstage/plugin-sentry": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/catalog-model": "^0.1.1-alpha.9", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/plugin-scaffolder": "^0.1.1-alpha.9", + "@backstage/plugin-sentry": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -39,9 +39,9 @@ "swr": "^0.2.2" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^10.2.1", "@testing-library/react-hooks": "^3.3.0", diff --git a/plugins/circleci/package.json b/plugins/circleci/package.json index 60787b146e..0104c5cc7b 100644 --- a/plugins/circleci/package.json +++ b/plugins/circleci/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-circleci", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -31,12 +31,11 @@ "postpack": "backstage-cli postpack" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", - "@types/react-lazylog": "^4.5.0", "circleci-api": "^4.0.0", "moment": "^2.25.3", "react": "^16.13.1", @@ -47,13 +46,14 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", "@types/jest": "^25.2.2", "@types/node": "^12.0.0", + "@types/react-lazylog": "^4.5.0", "@types/testing-library__jest-dom": "^5.0.4", "jest-fetch-mock": "^3.0.3" }, diff --git a/plugins/explore/package.json b/plugins/explore/package.json index f0f631eb09..ad3205f514 100644 --- a/plugins/explore/package.json +++ b/plugins/explore/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-explore", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,8 +22,8 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -33,9 +33,9 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/gitops-profiles/package.json b/plugins/gitops-profiles/package.json index 441f2dd77c..c9dca36e08 100644 --- a/plugins/gitops-profiles/package.json +++ b/plugins/gitops-profiles/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-gitops-profiles", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,8 +22,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -33,8 +33,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/gitops-profiles/src/api.ts b/plugins/gitops-profiles/src/api.ts index ad95b1cd52..20e4dc4307 100644 --- a/plugins/gitops-profiles/src/api.ts +++ b/plugins/gitops-profiles/src/api.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { createApiRef } from '@backstage/core-api'; +import { createApiRef } from '@backstage/core'; export interface CloneFromTemplateRequest { templateRepository: string; diff --git a/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.test.tsx b/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.test.tsx index d7e65c2a26..463e493afc 100644 --- a/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.test.tsx +++ b/plugins/gitops-profiles/src/components/ProfileCatalog/ProfileCatalog.test.tsx @@ -20,7 +20,7 @@ import mockFetch from 'jest-fetch-mock'; import ProfileCatalog from './ProfileCatalog'; import { ThemeProvider } from '@material-ui/core'; import { lightTheme } from '@backstage/theme'; -import { ApiProvider, ApiRegistry } from '@backstage/core-api'; +import { ApiProvider, ApiRegistry } from '@backstage/core'; import { gitOpsApiRef, GitOpsRestApi } from '../../api'; describe('ProfileCatalog', () => { diff --git a/plugins/graphiql/package.json b/plugins/graphiql/package.json index 0a6f25e616..49293acbfb 100644 --- a/plugins/graphiql/package.json +++ b/plugins/graphiql/package.json @@ -1,7 +1,7 @@ { "name": "@backstage/plugin-graphiql", "description": "Backstage plugin for browsing GraphQL APIs", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "private": false, "publishConfig": { "access": "public", @@ -32,8 +32,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -44,9 +44,9 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/identity-backend/package.json b/plugins/identity-backend/package.json index 862fb273d2..9c2ca5341f 100644 --- a/plugins/identity-backend/package.json +++ b/plugins/identity-backend/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-identity-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -20,7 +20,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "compression": "^1.7.4", "cors": "^2.8.5", "express": "^4.17.1", @@ -32,10 +33,10 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "jest-fetch-mock": "^3.0.3" }, "files": [ - "dist" + "dist/**/*.{js,d.ts}" ] } diff --git a/plugins/identity-backend/src/adapters/StaticJsonAdapter.ts b/plugins/identity-backend/src/adapters/StaticJsonAdapter.ts new file mode 100644 index 0000000000..9a58da2e85 --- /dev/null +++ b/plugins/identity-backend/src/adapters/StaticJsonAdapter.ts @@ -0,0 +1,82 @@ +/* + * 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. + */ + +import { + Group, + GroupsResponse, + IdentityApi, + GroupsRequest, + GroupsJson, +} from './types'; + +export class StaticJsonAdapter implements IdentityApi { + private readonly groups: Group[]; + + constructor(userGroups: GroupsJson) { + this.groups = userGroups.groups; + } + + getUserGroups(req: GroupsRequest): Promise { + return new Promise(resolve => { + const { user, type } = req; + const userGroups = this._getUserGroups(this.groups, user); + const groups = this.filterGroupsByType(userGroups, type); + resolve({ groups }); + }); + } + + _getUserGroups(groups: Group[], user: string) { + const userGroups: Set = new Set(); + groups.forEach(group => { + if (this.isUserInGroup(group, user)) { + userGroups.add(group); + } + + if (group.children) { + const userSubGroups = this._getUserGroups(group.children, user) ?? []; + const isUserInSubGroup = Boolean(userSubGroups.length); + if (isUserInSubGroup) { + userGroups.add(group); + } + userSubGroups.forEach(subGroup => userGroups.add(subGroup)); + } + }); + return Array.from(userGroups); + } + + private filterGroupsByType = (userGroups: Group[], type: string) => { + const groups = type + ? userGroups + .filter((group: Group) => group.type === type) + .map(group => ({ name: group.name, type: group.type })) + : userGroups.map(group => ({ + name: group.name, + type: group.type, + })); + return groups; + }; + + private isUserInGroup = (group: Group, user: string): boolean => { + if (group.members) { + const groupMembers = group.members; + const groupsWithUser = groupMembers.filter( + member => member.name === user, + ); + return Boolean(groupsWithUser.length); + } + return false; + }; +} diff --git a/packages/cli/src/lib/watchDeps/index.ts b/plugins/identity-backend/src/adapters/index.ts similarity index 94% rename from packages/cli/src/lib/watchDeps/index.ts rename to plugins/identity-backend/src/adapters/index.ts index a6fc92ca91..357391a25b 100644 --- a/packages/cli/src/lib/watchDeps/index.ts +++ b/plugins/identity-backend/src/adapters/index.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export * from './watchDeps'; +export * from './StaticJsonAdapter'; diff --git a/packages/cli/src/lib/watchDeps/logger.ts b/plugins/identity-backend/src/adapters/types.ts similarity index 55% rename from packages/cli/src/lib/watchDeps/logger.ts rename to plugins/identity-backend/src/adapters/types.ts index 59eb400301..59fd1324d1 100644 --- a/packages/cli/src/lib/watchDeps/logger.ts +++ b/plugins/identity-backend/src/adapters/types.ts @@ -14,20 +14,29 @@ * limitations under the License. */ -import { createLogPipe } from '../logging'; +export type User = { + name: string; +}; -export type ColorFunc = (msg: string) => string; +export type Group = { + name: string; + type: string; + members?: User[]; + children?: Group[]; +}; -// A factory for creating log pipes that rotate between different coloring functions -export function createLogPipeFactory(colorFuncs: ColorFunc[]) { - let colorIndex = 0; +export type GroupsJson = { + groups: Group[]; +}; - return (name: string) => { - const colorFunc = colorFuncs[colorIndex]; +export type GroupsResponse = { + groups: Group[]; +}; - colorIndex = (colorIndex + 1) % colorFuncs.length; - - const prefix = `${colorFunc(name)}: `; - return createLogPipe({ prefix }); - }; +export type GroupsRequest = { + user: string; + type: string; +}; +export interface IdentityApi { + getUserGroups(req: GroupsRequest): Promise; } diff --git a/packages/cli/src/lib/buildCache/index.ts b/plugins/identity-backend/src/adapters/userGroups.ts similarity index 59% rename from packages/cli/src/lib/buildCache/index.ts rename to plugins/identity-backend/src/adapters/userGroups.ts index 70bcbd36b8..806ca1f43f 100644 --- a/packages/cli/src/lib/buildCache/index.ts +++ b/plugins/identity-backend/src/adapters/userGroups.ts @@ -13,6 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -export * from './withCache'; -export * from './options'; +export const userGroups = { + groups: [ + { + name: 'engineering', + type: 'org', + children: [ + { + name: 'authentication', + type: 'team', + members: [{ name: 'kent' }, { name: 'dobbs' }], + }, + { + name: 'checkout', + type: 'team', + members: [{ name: 'don' }, { name: 'abramev' }], + }, + ], + }, + ], +}; diff --git a/plugins/identity-backend/src/service/router.ts b/plugins/identity-backend/src/service/router.ts index 52e73db0fb..9c6515ac04 100644 --- a/plugins/identity-backend/src/service/router.ts +++ b/plugins/identity-backend/src/service/router.ts @@ -17,21 +17,32 @@ import express from 'express'; import Router from 'express-promise-router'; import { Logger } from 'winston'; +import { StaticJsonAdapter } from '../adapters'; +import { IdentityApi } from '../adapters/types'; +import { userGroups } from '../adapters/userGroups'; export interface RouterOptions { logger: Logger; } +const makeRouter = (adapter: IdentityApi): express.Router => { + const router = Router(); + router.get('/users/:user/groups', async (req, res) => { + const user = req.params.user; + const type = req.query.type?.toString() ?? ''; + + const response = await adapter.getUserGroups({ user, type }); + res.send(response); + }); + return router; +}; + export async function createRouter( options: RouterOptions, ): Promise { - const router = Router(); const logger = options.logger; - router.use('/ping', (_, res) => { - logger.info('heartbeat for identity service'); - res.send('pong'); - }); - - return router; + logger.info('Initializing identity API backend'); + const adapter = new StaticJsonAdapter(userGroups); + return makeRouter(adapter); } diff --git a/plugins/lighthouse/package.json b/plugins/lighthouse/package.json index f53ae0930d..a3c65d05ea 100644 --- a/plugins/lighthouse/package.json +++ b/plugins/lighthouse/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-lighthouse", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", @@ -22,8 +22,8 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -34,9 +34,9 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", - "@backstage/test-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", + "@backstage/test-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/register-component/package.json b/plugins/register-component/package.json index d5fc49405d..d999ab1dcc 100644 --- a/plugins/register-component/package.json +++ b/plugins/register-component/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-register-component", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,10 +22,10 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/catalog-model": "^0.1.1-alpha.8", - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/plugin-catalog": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/catalog-model": "^0.1.1-alpha.9", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/plugin-catalog": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -37,8 +37,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/scaffolder-backend/package.json b/plugins/scaffolder-backend/package.json index 3d8d95164e..d74c8ffdb6 100644 --- a/plugins/scaffolder-backend/package.json +++ b/plugins/scaffolder-backend/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-scaffolder-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -21,7 +21,8 @@ "mock-data": "./scripts/mock-data" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "compression": "^1.7.4", "cors": "^2.8.5", "dockerode": "^3.2.0", @@ -34,9 +35,12 @@ "winston": "^3.2.1" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "@types/fs-extra": "^9.0.1", "@types/supertest": "^2.0.8", "supertest": "^4.0.2" - } + }, + "files": [ + "dist/**/*.{js,d.ts}" + ] } diff --git a/plugins/scaffolder/package.json b/plugins/scaffolder/package.json index 66738acea6..84132a42f9 100644 --- a/plugins/scaffolder/package.json +++ b/plugins/scaffolder/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-scaffolder", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,8 +22,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -33,8 +33,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/sentry-backend/package.json b/plugins/sentry-backend/package.json index 8652ecda7c..a23cc1ab09 100644 --- a/plugins/sentry-backend/package.json +++ b/plugins/sentry-backend/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-sentry-backend", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.cjs.js", @@ -20,7 +20,8 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/backend-common": "^0.1.1-alpha.8", + "@backstage/backend-common": "^0.1.1-alpha.9", + "@types/express": "^4.17.6", "axios": "^0.19.2", "compression": "^1.7.4", "cors": "^2.8.5", @@ -33,10 +34,10 @@ "yn": "^4.0.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", "jest-fetch-mock": "^3.0.3" }, "files": [ - "dist" + "dist/**/*.{js,d.ts}" ] } diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index dcec4eceb0..7a8197ab87 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -1,11 +1,11 @@ { "name": "@backstage/plugin-sentry", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", - "private": true, + "private": false, "publishConfig": { "access": "public", "main": "dist/index.esm.js", @@ -22,11 +22,12 @@ "clean": "backstage-cli clean" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", + "@types/react": "^16.9", "react": "^16.13.1", "react-dom": "^16.13.1", "react-sparklines": "^1.7.0", @@ -34,8 +35,8 @@ "timeago.js": "^4.0.2" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/tech-radar/package.json b/plugins/tech-radar/package.json index 00d008bbd1..e0146e8a72 100644 --- a/plugins/tech-radar/package.json +++ b/plugins/tech-radar/package.json @@ -1,6 +1,6 @@ { "name": "@backstage/plugin-tech-radar", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", @@ -22,9 +22,9 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/test-utils-core": "^0.1.1-alpha.7", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/test-utils-core": "0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -37,8 +37,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/plugins/welcome/package.json b/plugins/welcome/package.json index 388f0335a7..6780f7df98 100644 --- a/plugins/welcome/package.json +++ b/plugins/welcome/package.json @@ -1,10 +1,10 @@ { "name": "@backstage/plugin-welcome", - "version": "0.1.1-alpha.8", + "version": "0.1.1-alpha.9", "main": "dist/index.esm.js", "main:src": "src/index.ts", "types": "src/index.ts", - "private": true, + "private": false, "license": "Apache-2.0", "publishConfig": { "access": "public", @@ -22,8 +22,8 @@ "start": "backstage-cli plugin:serve" }, "dependencies": { - "@backstage/core": "^0.1.1-alpha.8", - "@backstage/theme": "^0.1.1-alpha.8", + "@backstage/core": "^0.1.1-alpha.9", + "@backstage/theme": "^0.1.1-alpha.9", "@material-ui/core": "^4.9.1", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", @@ -33,8 +33,8 @@ "react-use": "^14.2.0" }, "devDependencies": { - "@backstage/cli": "^0.1.1-alpha.8", - "@backstage/dev-utils": "^0.1.1-alpha.8", + "@backstage/cli": "^0.1.1-alpha.9", + "@backstage/dev-utils": "^0.1.1-alpha.9", "@testing-library/jest-dom": "^5.7.0", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^10.2.4", diff --git a/yarn.lock b/yarn.lock index 38dfb4d533..a8b1cfb937 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17790,9 +17790,9 @@ svgo@^1.0.0, svgo@^1.2.2: util.promisify "~1.0.0" swr@^0.2.2: - version "0.2.2" - resolved "https://registry.npmjs.org/swr/-/swr-0.2.2.tgz#6e1b3e5c0e545c4fdb36ae3aa38cd94d0f9a88b7" - integrity sha512-D/z+PTUchZhoUA0tNC8TNJivf7Hc61WPxbUdXPi+VxRloddWYNP1ZicaEgyAph42ZnKl1L7twcZr4q6d0UMXcg== + version "0.2.3" + resolved "https://registry.npmjs.org/swr/-/swr-0.2.3.tgz#e0fb260d27f12fafa2388312083368f45127480d" + integrity sha512-JhuuD5ojqgjAQpZAhoPBd8Di0Mr1+ykByVKuRJdtKaxkUX/y8kMACWKkLgLQc8pcDOKEAnbIreNjU7HfqI9nHQ== dependencies: fast-deep-equal "2.0.1"