Skip to content

Commit

Permalink
Root stack fix (#8717)
Browse files Browse the repository at this point in the history
* fix: disable root stack update check

* fix: root stack hash and helper package versions
  • Loading branch information
akshbhu authored and sachscode committed Nov 11, 2021
1 parent a0a657c commit 5063651
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aws-amplify/cli-extensibility-helper": "1.1.0-ext15.0"
"@aws-amplify/cli-extensibility-helper": "1.0.1-ext15.0"
},
"devDependencies": {
"typescript": "^4.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class AmplifyUserPoolGroupTransform extends AmplifyCategoryTransform {
'build',
cognitoStackFileName,
);
writeCFNTemplate(template, cognitostackFilePath, {
await writeCFNTemplate(template, cognitostackFilePath, {
templateFormat: CFNTemplateFormat.JSON,
});
// write parameters.json file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aws-amplify/cli-extensibility-helper": "1.1.0-ext15.0"
"@aws-amplify/cli-extensibility-helper": "1.0.1-ext15.0"

},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aws-amplify/cli-extensibility-helper": "1.1.0-ext15.0"
"@aws-amplify/cli-extensibility-helper": "1.0.1-ext15.0"
},
"devDependencies": {
"typescript": "^4.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { pathManager } from 'amplify-cli-core';
import { rootStackFileName } from 'amplify-provider-awscloudformation';
import { hashElement, HashElementOptions } from 'folder-hash';
import * as fs from 'fs-extra';
import * as path from 'path';

export function getHashForRootStack(dirPath, files?: string[]) {
const options: HashElementOptions = {
Expand All @@ -19,10 +20,10 @@ export async function isRootStackModifiedSinceLastPush(hashFunction): Promise<bo
const localBackendDir = pathManager.getRootStackBuildDirPath(projectPath!);
const cloudBackendDir = pathManager.getCurrentCloudRootStackDirPath(projectPath!);
if (fs.existsSync(localBackendDir)) {
const localDirHash = await hashFunction(localBackendDir, ['*.json']);
const localCfnBuffer = fs.readFileSync(path.join(localBackendDir, rootStackFileName));
if (fs.existsSync(cloudBackendDir)) {
const cloudDirHash = await hashFunction(cloudBackendDir, ['*.json']);
return localDirHash !== cloudDirHash;
const cloudCfnBuffer = fs.readFileSync(path.join(cloudBackendDir, rootStackFileName));
return !localCfnBuffer.equals(cloudCfnBuffer);
} else {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@aws-amplify/cli-extensibility-helper": "1.1.0-ext15.0"
"@aws-amplify/cli-extensibility-helper": "1.0.1-ext15.0"
},
"devDependencies": {
"typescript": "^4.2.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class AmplifyRootStackTransform {
sandbox: {},
});
try {
sandboxNode.run(overrideCode).overrideProps(this._rootTemplateObj);
sandboxNode.run(overrideCode).override(this._rootTemplateObj);
} catch (err: $TSAny) {
const error = new Error(`Skipping override due to ${err}${os.EOL}`);
printer.error(`${error}`);
Expand Down Expand Up @@ -199,7 +199,7 @@ export class AmplifyRootStackTransform {
const rootStackFileName = `root-cloudformation-stack.json`;
const rootstackFilePath = path.join(pathManager.getBackendDirPath(), this._resourceName, 'build', rootStackFileName);
// write CFN template
writeCFNTemplate(template, rootstackFilePath, {
await writeCFNTemplate(template, rootstackFilePath, {
templateFormat: CFNTemplateFormat.JSON,
});
};
Expand Down

0 comments on commit 5063651

Please sign in to comment.