Merge branch 'master' into feat/yarn-lock-parser

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-05-18 16:28:42 +02:00
900 changed files with 27178 additions and 5301 deletions
+42
View File
@@ -1,5 +1,47 @@
# @backstage/cli
## 0.17.1
### Patch Changes
- 52fb9920ac: Fixed coverage configuration when using `BACKSTAGE_NEXT_TESTS`.
- 6cd1f50ae1: Extended lint rule to prevents imports of stories or tests from production code.
- 97cce67ac7: Add instructions to `create-github-app` command.
- 08e12a3a14: Add package global-agent to support behind a proxy for backstage-cli commands like versions:bump.
- 4d8736eded: Changed Rollup configuration for TypeScript definition plugin to ignore `css`,
`scss`, `sass`, `svg`, `eot`, `woff`, `woff2` and `ttf` files.
- cfc0f19699: Updated dependency `fs-extra` to `10.1.0`.
- 2737777e02: Added the ability to help a user get started with a new organization
- 344ea56acc: Bump `commander` to version 9.1.0
- 8ab2a8226b: Updated the `create-github-app` command to throw an error if the organization argument is a user or a non existing organization.
- 632be18bbc: Updated `create-github-app` command to prompt for read or write permissions to simplify setup.
- Updated dependencies
- @backstage/cli-common@0.1.9
- @backstage/config@1.0.1
- @backstage/release-manifests@0.0.3
- @backstage/config-loader@1.1.1
## 0.17.1-next.2
### Patch Changes
- 632be18bbc: Updated `create-github-app` command to prompt for read or write permissions to simplify setup.
- Updated dependencies
- @backstage/cli-common@0.1.9-next.0
- @backstage/config@1.0.1-next.0
- @backstage/release-manifests@0.0.3-next.0
- @backstage/config-loader@1.1.1-next.1
## 0.17.1-next.1
### Patch Changes
- 52fb9920ac: Fixed coverage configuration when using `BACKSTAGE_NEXT_TESTS`.
- 6cd1f50ae1: Extended lint rule to prevents imports of stories or tests from production code.
- 4d8736eded: Changed Rollup configuration for TypeScript definition plugin to ignore `css`,
`scss`, `sass`, `svg`, `eot`, `woff`, `woff2` and `ttf` files.
- 2737777e02: Added the ability to help a user get started with a new organization
## 0.17.1-next.0
### Patch Changes
+8 -2
View File
@@ -130,8 +130,14 @@ function createConfig(dir, extraConfig = {}) {
...(restrictedImports ?? []),
...(restrictedSrcImports ?? []),
],
// Avoid cross-package imports
patterns: ['**/../../**/*/src/**', '**/../../**/*/src'],
patterns: [
// Avoid cross-package imports
'**/../../**/*/src/**',
'**/../../**/*/src',
// Prevent imports of stories or tests
'*.stories*',
'*.test*',
],
},
],
+1 -1
View File
@@ -123,7 +123,7 @@ async function getProjectConfig(targetPath, displayName) {
...(displayName && { displayName }),
rootDir: path.resolve(targetPath, 'src'),
coverageDirectory: path.resolve(targetPath, 'coverage'),
coverageProvider: envOptions.nextTests ? undefined : 'v8',
coverageProvider: envOptions.nextTests ? 'babel' : 'v8',
collectCoverageFrom: ['**/*.{js,jsx,ts,tsx,mjs,cjs}', '!**/*.d.ts'],
moduleNameMapper: {
'\\.(css|less|scss|sss|styl)$': require.resolve('jest-css-modules'),
+12 -12
View File
@@ -1,7 +1,7 @@
{
"name": "@backstage/cli",
"description": "CLI for developing Backstage plugins and apps",
"version": "0.17.1-next.0",
"version": "0.17.1",
"private": false,
"publishConfig": {
"access": "public"
@@ -31,11 +31,11 @@
"backstage-cli": "bin/backstage-cli"
},
"dependencies": {
"@backstage/cli-common": "^0.1.8",
"@backstage/config": "^1.0.0",
"@backstage/config-loader": "^1.1.1-next.0",
"@backstage/cli-common": "^0.1.9",
"@backstage/config": "^1.0.1",
"@backstage/config-loader": "^1.1.1",
"@backstage/errors": "^1.0.0",
"@backstage/release-manifests": "^0.0.2",
"@backstage/release-manifests": "^0.0.3",
"@backstage/types": "^1.0.0",
"@hot-loader/react-dom-v16": "npm:@hot-loader/react-dom@^16.0.2",
"@hot-loader/react-dom-v17": "npm:@hot-loader/react-dom@^17.0.2",
@@ -126,13 +126,13 @@
"zod": "^3.11.6"
},
"devDependencies": {
"@backstage/backend-common": "^0.13.3-next.0",
"@backstage/config": "^1.0.0",
"@backstage/core-app-api": "^1.0.1",
"@backstage/core-components": "^0.9.3",
"@backstage/core-plugin-api": "^1.0.1",
"@backstage/dev-utils": "^1.0.2-next.0",
"@backstage/test-utils": "^1.0.2-next.0",
"@backstage/backend-common": "^0.13.3",
"@backstage/config": "^1.0.1",
"@backstage/core-app-api": "^1.0.2",
"@backstage/core-components": "^0.9.4",
"@backstage/core-plugin-api": "^1.0.2",
"@backstage/dev-utils": "^1.0.2",
"@backstage/test-utils": "^1.1.0",
"@backstage/theme": "^0.2.15",
"@types/diff": "^5.0.0",
"@types/express": "^4.17.6",
@@ -60,14 +60,20 @@ export class GithubCreateAppServer {
private baseUrl?: string;
private webhookUrl?: string;
static async run({ org }: { org: string }): Promise<GithubAppConfig> {
const encodedOrg = encodeURIComponent(org);
static async run(options: {
org: string;
readWrite: boolean;
}): Promise<GithubAppConfig> {
const encodedOrg = encodeURIComponent(options.org);
const actionUrl = `https://github.com/organizations/${encodedOrg}/settings/apps/new`;
const server = new GithubCreateAppServer(actionUrl);
const server = new GithubCreateAppServer(actionUrl, options.readWrite);
return server.start();
}
constructor(private readonly actionUrl: string) {
private constructor(
private readonly actionUrl: string,
private readonly readWrite: boolean,
) {
const webhookId = crypto
.randomBytes(15)
.toString('base64')
@@ -122,6 +128,13 @@ export class GithubCreateAppServer {
url: this.webhookUrl,
active: false,
},
...(this.readWrite && {
default_permissions: {
contents: 'write',
actions: 'write',
metadata: 'read',
},
}),
};
const manifestJson = JSON.stringify(manifest).replace(/\"/g, '&quot;');
@@ -17,16 +17,29 @@
import fs from 'fs-extra';
import chalk from 'chalk';
import { stringify as stringifyYaml } from 'yaml';
import inquirer, { Question, Answers } from 'inquirer';
import { paths } from '../../lib/paths';
import { GithubCreateAppServer } from './GithubCreateAppServer';
import fetch from 'node-fetch';
import openBrowser from 'react-dev-utils/openBrowser';
// This is an experimental command that at this point does not support GitHub Enterprise
// due to lacking support for creating apps from manifests.
// https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app-from-a-manifest
export default async (org: string) => {
const answers: Answers = await inquirer.prompt([
{
type: 'list',
name: 'appType',
message: chalk.blue('What will the app be used for [required]'),
choices: ['Read and Write (needed by Software Templates)', 'Read only'],
},
]);
const readWrite = answers.appType !== 'Read only';
await verifyGithubOrg(org);
const { slug, name, ...config } = await GithubCreateAppServer.run({ org });
const { slug, name, ...config } = await GithubCreateAppServer.run({
org,
readWrite,
});
const fileName = `github-app-${slug}-credentials.yaml`;
const content = `# Name: ${name}\n${stringifyYaml(config)}`;
@@ -67,8 +80,33 @@ async function verifyGithubOrg(org: string): Promise<void> {
}
if (response?.status === 404) {
throw new Error(
`GitHub organization '${org}' does not exist. Please verify the name and try again.`,
const questions: Question[] = [
{
type: 'confirm',
name: 'shouldCreateOrg',
message: `GitHub organization ${chalk.cyan(
org,
)} does not exist. Would you like to create a new Organization instead?`,
},
];
const answers = await inquirer.prompt(questions);
if (!answers.shouldCreateOrg) {
console.log(
chalk.yellow('GitHub organization must exist to create GitHub app'),
);
process.exit(1);
}
openBrowser('https://github.com/account/organizations/new');
console.log(
chalk.yellow(
'Please re-run this command when you have created your new organization',
),
);
process.exit(0);
}
}
+10
View File
@@ -154,6 +154,16 @@ export async function makeRollupConfigs(
file: resolvePath(distDir, 'index.d.ts'),
format: 'es',
},
external: [
/\.css$/,
/\.scss$/,
/\.sass$/,
/\.svg$/,
/\.eot$/,
/\.woff$/,
/\.woff2$/,
/\.ttf$/,
],
onwarn,
plugins: [dts()],
});