Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On dev, rewrite scopes to required_scopes #5097

Draft
wants to merge 1 commit into
base: 12-11-when_creating_a_new_app_default_to_using_required_scopes_
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/app/src/cli/services/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,27 @@
await patchAppConfigurationFile({path: app.configuration.path, patch, schema: app.configSchema})
}

// Auto migrate scopes to required_scopes
// TODO I have no idea if there's a better place to do this

Check failure on line 116 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L116

[no-warning-comments] Unexpected 'todo' comment: 'TODO I have no idea if there's a better...'.
if (app.configuration.access_scopes?.scopes) {
const required_scopes = app.configuration.access_scopes?.scopes.split(',')

Check failure on line 118 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L118

[@typescript-eslint/naming-convention] Variable name `required_scopes` must match one of the following formats: camelCase, PascalCase, UPPER_CASE
const patch = {
access_scopes: {
scopes: undefined,
required_scopes: required_scopes,

Check failure on line 122 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L122

[object-shorthand] Expected property shorthand.
},
}
await patchAppConfigurationFile({path: app.configuration.path, patch, schema: app.configSchema})
}

if (!commandOptions.skipDependenciesInstallation && !app.usesWorkspaces) {
await installAppDependencies(app)
}

const graphiqlPort = commandOptions.graphiqlPort || (await getAvailableTCPPort(ports.graphiql))

Check warning on line 132 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L132

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
const {graphiqlKey} = commandOptions

if (graphiqlPort !== (commandOptions.graphiqlPort || ports.graphiql)) {

Check warning on line 135 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L135

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
renderWarning({
headline: [
'A random port will be used for GraphiQL because',
Expand Down Expand Up @@ -223,7 +236,7 @@
scopesMessage(getAppScopesArray(localApp.configuration)),
'\n',
'Scopes in Partner Dashboard:',
scopesMessage(remoteAccess?.scopes?.split(',') || []),

Check warning on line 239 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L239

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
],
nextSteps,
})
Expand Down Expand Up @@ -301,7 +314,7 @@
...frontEndOptions,
tunnelClient,
}),
getBackendPort() || backendConfig?.configuration.port || getAvailableTCPPort(),

Check warning on line 317 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L317

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.

Check warning on line 317 in packages/app/src/cli/services/dev.ts

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/app/src/cli/services/dev.ts#L317

[@typescript-eslint/prefer-nullish-coalescing] Prefer using nullish coalescing operator (`??`) instead of a logical or (`||`), as it is a safer operator.
getURLs(remoteAppConfig),
])
const proxyUrl = usingLocalhost ? `${frontendUrl}:${proxyPort}` : frontendUrl
Expand Down
Loading