Skip to content

Commit fbfb385

Browse files
author
Andrews
committed
fix pre-config
1 parent 1b929f0 commit fbfb385

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
"pre-config": "node scripts/pre-configure.js",
2828
"post-config": "node scripts/post-configure.js",
2929
"deconfig": "node -e \"require('./scripts/deconfigure.js')()\"",
30-
"create-artifacts-bucket": "aws s3 mb s3://$npm_package_config_artifactsS3Bucket --region $npm_package_config_primaryAwsRegion",
30+
"create-artifacts-bucket": "aws s3api get-bucket-location --bucket $npm_package_config_artifactsS3Bucket --region $npm_package_config_primaryAwsRegion || aws s3 mb s3://$npm_package_config_artifactsS3Bucket --region $npm_package_config_primaryAwsRegion",
3131
"delete-artifacts-bucket": "aws s3 rm s3://$npm_package_config_artifactsS3Bucket/lambda-function.zip --region $npm_package_config_primaryAwsRegion; aws s3 rm s3://$npm_package_config_artifactsS3Bucket/dev-portal-express-proxy-api.yaml --region $npm_package_config_primaryAwsRegion; aws s3 rb s3://$npm_package_config_artifactsS3Bucket --region $npm_package_config_primaryAwsRegion",
3232
"upload-site": "cd ./dev-portal && npm run build && aws s3 sync ./build s3://$npm_package_config_siteS3Bucket --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --region $npm_package_config_primaryAwsRegion && cd ..",
3333
"delete-stack": "aws cloudformation delete-stack --stack-name $npm_package_config_cloudFormationStackName --region $npm_package_config_primaryAwsRegion",
3434
"lambdas-npm-install": "cd lambdas/backend && npm install && cd meteringservice-preview-sdk-js-06-23-2016 && npm install && cd ../../listener && npm install && cd ../cognito-cloudformation-custom-resource && npm install && cd ../..",
3535
"subscribe-listener": "aws sns subscribe --topic-arn $npm_package_config_marketplaceSubscriptionTopic --protocol lambda --notification-endpoint arn:aws:lambda:$npm_package_config_primaryAwsRegion:$npm_package_config_accountId:function:$npm_package_config_listenerLambdaFunctionName --region us-east-1",
36-
"setup": "aws s3api get-bucket-location --bucket $npm_package_config_artifactsS3Bucket --region $npm_package_config_primaryAwsRegion || npm run create-artifacts-bucket && npm run lambdas-npm-install && npm run package-deploy",
37-
"post-setup": "npm run post-config && cd dev-portal && npm install && cd .. && npm run upload-site && cd dev-portal && npm home",
36+
"setup": "npm install && npm run pre-config && npm run create-artifacts-bucket && npm run lambdas-npm-install && npm run package-deploy && npm run post-setup",
37+
"post-setup": "npm run post-config && cd dev-portal && npm install && npm run upload-site && npm home",
3838
"clean": "npm run delete-artifacts-bucket && npm run delete-stack"
3939
},
4040
"license": "Apache-2.0",

scripts/pre-configure.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ inquirer.prompt(questions).then((answers) => {
5555
}).catch(e => {console.log(e)})
5656

5757
function modifyPackageFile(artifactsS3BucketName, clientS3BucketName, primaryAwsRegion, apiGatewayApiName, cloudFormationStackName/*, expressLambdaFunctionName*/, accountId) {
58-
const packageJsonPath = `${rootDir}./package.json`
58+
const packageJsonPath = `${rootDir}/package.json`
5959
const packageJson = fs.readFileSync(packageJsonPath, 'utf8')
6060
const packageJsonModified = packageJson
6161
.replace(/YOUR_ARTIFACTS_BUCKET_NAME/g, artifactsS3BucketName)
@@ -70,7 +70,7 @@ function modifyPackageFile(artifactsS3BucketName, clientS3BucketName, primaryAws
7070
}
7171

7272
function modifyUiPackageFile(clientS3BucketName, primaryAwsRegion) {
73-
const packageJsonPath = `${rootDir}./dev-portal/package.json`
73+
const packageJsonPath = `${rootDir}/dev-portal/package.json`
7474
const packageJson = fs.readFileSync(packageJsonPath, 'utf8')
7575
const packageJsonModified = packageJson
7676
.replace(/YOUR_CLIENT_BUCKET_NAME/g, clientS3BucketName)
@@ -80,7 +80,7 @@ function modifyUiPackageFile(clientS3BucketName, primaryAwsRegion) {
8080
}
8181

8282
function modifyExpressServer(clientS3BucketName, primaryAwsRegion) {
83-
const expressServerPath = `${rootDir}./lambdas/backend/express-server.js`
83+
const expressServerPath = `${rootDir}/lambdas/backend/express-server.js`
8484
const expressServer = fs.readFileSync(expressServerPath, 'utf8')
8585
const expressServerModified = expressServer
8686
.replace(/YOUR_CLIENT_BUCKET_NAME/g, clientS3BucketName)
@@ -90,7 +90,7 @@ function modifyExpressServer(clientS3BucketName, primaryAwsRegion) {
9090
}
9191

9292
function modifySwaggerFile(accountId, primaryAwsRegion, apiGatewayApiName/*, expressLambdaFunctionName*/) {
93-
const swaggerDefinitionPath = `${rootDir}./lambdas/backend/dev-portal-express-proxy-api.yaml`
93+
const swaggerDefinitionPath = `${rootDir}/lambdas/backend/dev-portal-express-proxy-api.yaml`
9494
const swaggerDefinition = fs.readFileSync(swaggerDefinitionPath, 'utf8')
9595
const simpleProxyApiModified = swaggerDefinition
9696
.replace(/YOUR_ACCOUNT_ID/g, accountId)

0 commit comments

Comments
 (0)