Skip to content

Commit

Permalink
revert constants format to camelcase
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfreder committed Dec 11, 2024
1 parent c261185 commit c46878d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { samSyncUrl } from '../../../shared/constants'
import { CloudFormationTemplateRegistry } from '../../../shared/fs/templateRegistry'
import { SYNC_MEMENTO_ROOT_KEY } from '../../../shared/sam/constants'
import { syncMementoRootKey } from '../../../shared/sam/constants'
import { createExitPrompter } from '../../../shared/ui/common/exitPrompter'
import { createTemplatePrompter, TemplateItem } from '../../../shared/ui/sam/templatePrompter'
import { Wizard } from '../../../shared/wizards/wizard'
Expand All @@ -17,6 +17,6 @@ export interface OpenTemplateParams {
export class OpenTemplateWizard extends Wizard<OpenTemplateParams> {
public constructor(state: Partial<OpenTemplateParams>, registry: CloudFormationTemplateRegistry) {
super({ initState: state, exitPrompterProvider: createExitPrompter })
this.form.template.bindPrompter(() => createTemplatePrompter(registry, SYNC_MEMENTO_ROOT_KEY, samSyncUrl))
this.form.template.bindPrompter(() => createTemplatePrompter(registry, syncMementoRootKey, samSyncUrl))
}
}
6 changes: 3 additions & 3 deletions packages/core/src/shared/sam/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from './utils'
import { getConfigFileUri, validateSamBuildConfig } from './config'
import { runInTerminal } from './processTerminal'
import { BUILD_MEMENTO_ROOT_KEY } from './constants'
import { buildMementoRootKey } from './constants'

export interface BuildParams {
readonly template: TemplateItem
Expand Down Expand Up @@ -140,7 +140,7 @@ export class BuildWizard extends Wizard<BuildParams> {
if (this.arg === undefined) {
// "Build" command was invoked on the command palette.
this.form.template.bindPrompter(() =>
createTemplatePrompter(this.registry, BUILD_MEMENTO_ROOT_KEY, samBuildUrl)
createTemplatePrompter(this.registry, buildMementoRootKey, samBuildUrl)
)
this.form.projectRoot.setDefault(({ template }) => getProjectRoot(template))
this.form.paramsSource.bindPrompter(async ({ projectRoot }) => {
Expand Down Expand Up @@ -232,7 +232,7 @@ export async function runBuild(arg?: TreeNode): Promise<SamBuildResult> {
const templatePath = params.template.uri.fsPath
buildFlags.push('--template', `${templatePath}`)

await updateRecentResponse(BUILD_MEMENTO_ROOT_KEY, 'global', 'templatePath', templatePath)
await updateRecentResponse(buildMementoRootKey, 'global', 'templatePath', templatePath)

try {
await vscode.window.withProgress(
Expand Down
12 changes: 5 additions & 7 deletions packages/core/src/shared/sam/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/naming-convention */
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

export const BUILD_PROCESS_MEMENTO_ROOT_KEY = 'samcli.build.processes'
export const GLOBAL_IDENTIFIER = 'global'
export const BUILD_MEMENTO_ROOT_KEY = 'samcli.build.params'
export const DEPLOY_MEMENTO_ROOT_KEY = 'samcli.deploy.params'
export const SYNC_MEMENTO_ROOT_KEY = 'samcli.sync.params'
export const buildProcessMementoRootKey = 'samcli.build.processes'
export const globalIdentifier = 'global'
export const buildMementoRootKey = 'samcli.build.params'
export const deployMementoRootKey = 'samcli.deploy.params'
export const syncMementoRootKey = 'samcli.sync.params'
10 changes: 4 additions & 6 deletions packages/core/src/shared/sam/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable header/header */
/* eslint-disable @typescript-eslint/naming-convention */
/*!
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
Expand All @@ -20,7 +18,7 @@ import { telemetry } from '../telemetry/telemetry'
import globals from '../extensionGlobals'
import { getLogger } from '../logger/logger'
import { ChildProcessResult } from '../utilities/processUtils'
import { BUILD_PROCESS_MEMENTO_ROOT_KEY, GLOBAL_IDENTIFIER } from './constants'
import { buildProcessMementoRootKey, globalIdentifier } from './constants'

/**
* @description determines the root directory of the project given Template Item
Expand Down Expand Up @@ -117,7 +115,7 @@ export async function updateRecentResponse(
* @Param templatePath The path to the template.yaml file
*/
function isBuildInProgress(templatePath: string): boolean {
return getRecentResponse(BUILD_PROCESS_MEMENTO_ROOT_KEY, GLOBAL_IDENTIFIER, templatePath) !== undefined
return getRecentResponse(buildProcessMementoRootKey, globalIdentifier, templatePath) !== undefined
}

/**
Expand All @@ -131,11 +129,11 @@ export function throwIfTemplateIsBeingBuilt(templatePath: string) {
}

export async function registerTemplateBuild(templatePath: string) {
await updateRecentResponse(BUILD_PROCESS_MEMENTO_ROOT_KEY, GLOBAL_IDENTIFIER, templatePath, 'true')
await updateRecentResponse(buildProcessMementoRootKey, globalIdentifier, templatePath, 'true')
}

export async function unregisterTemplateBuild(templatePath: string) {
await updateRecentResponse(BUILD_PROCESS_MEMENTO_ROOT_KEY, GLOBAL_IDENTIFIER, templatePath, undefined)
await updateRecentResponse(buildProcessMementoRootKey, globalIdentifier, templatePath, undefined)
}

export function getSamCliErrorMessage(stderr: string): string {
Expand Down

0 comments on commit c46878d

Please sign in to comment.