declapract-typescript-ehmpathy 0.22.2 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy-main-on-tag.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/bad-practices/old-names/.github/workflows/deploy-prod-on-tag.yml.declapract.ts +3 -0
- package/dist/practices/cicd-deploy-service/best-practice/.github/workflows/.deploy-sls.yml +1 -1
- package/dist/practices/cicd-integrate/bad-practices/old-names/.github/workflows/pr-release-on-main.yml.declapract.ts +3 -0
- package/dist/practices/cicd-integrate/bad-practices/old-names/.github/workflows/test-on-commit.yml.declapract.ts +3 -0
- package/dist/practices/package-json-order/best-practice/package.json.declapract.ts +1 -0
- package/dist/practices/serverless/best-practice/serverless.yml.declapract.ts +7 -2
- package/package.json +1 -1
- package/dist/practices/serverless/bad-practices/generic-deploy-script/package.json +0 -8
- package/dist/practices/serverless/bad-practices/generic-deploy-script/package.json.declapract.ts +0 -23
|
@@ -6,8 +6,9 @@ export const check = FileCheckType.CONTAINS; // i.e., check that the contents of
|
|
|
6
6
|
export const fix: FileFixFunction = (contents) => {
|
|
7
7
|
if (!contents) return { contents }; // do nothing if file dne; // TODO: update to provision file from declared contents
|
|
8
8
|
return {
|
|
9
|
+
// TODO: when we have special support for yml, do this better (i.e., instead of string replace, just add to the yml object after parsing it)
|
|
9
10
|
contents: contents
|
|
10
|
-
.replace(/runtime\: nodejs\d\d.x/, 'runtime:
|
|
11
|
+
.replace(/runtime\: nodejs\d\d.x/, 'runtime: nodejs16.x')
|
|
11
12
|
.replace('\nplugins:\n', '')
|
|
12
13
|
.replace(/ - serverless-offline .*\n/, '') // a plugin we no longer use (never used it, no need to have it)
|
|
13
14
|
.replace(/ - serverless-pseudo-parameters .*\n/, '') // a plugin we no longer use (serverless supports variables natively now)
|
|
@@ -21,6 +22,10 @@ export const fix: FileFixFunction = (contents) => {
|
|
|
21
22
|
.replace(
|
|
22
23
|
'NODE_ENV: ${self:custom.stageToNodeEnvMapping.${self:provider.stage}}\n deploymentBucket',
|
|
23
24
|
'NODE_ENV: ${self:custom.stageToNodeEnvMapping.${self:provider.stage}}\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: true # https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html\n deploymentBucket',
|
|
24
|
-
)
|
|
25
|
+
) // add this env flag
|
|
26
|
+
.replace(
|
|
27
|
+
/service: ([a-zA-Z0-9\-]+)\n\n?provider:/,
|
|
28
|
+
'service: $1\n\npackage:\n artifact: .artifact/contents.zip\n\nprovider:',
|
|
29
|
+
),
|
|
25
30
|
};
|
|
26
31
|
};
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"scripts": {
|
|
3
|
-
"deploy:release": "npm run build && sls deploy --verbose --stage $STAGE",
|
|
4
|
-
"deploy:send-notification": "curl -X POST -H 'Content-type: application/json' --data \"{\\\"text\\\":\\\"$([ -z $DEPLOYER_NAME ] && git config user.name || echo $DEPLOYER_NAME) has deployed $npm_package_name@v$npm_package_version:\nhttps://github.com/@declapract{variable.organizationName}/$npm_package_name/tree/v$npm_package_version\\\"}\" @declapract{variable.slackWebhookUrl}",
|
|
5
|
-
"deploy:dev": "STAGE=dev npm run deploy:release",
|
|
6
|
-
"deploy:prod": "STAGE=prod npm run deploy:release && npm run deploy:send-notification"
|
|
7
|
-
}
|
|
8
|
-
}
|
package/dist/practices/serverless/bad-practices/generic-deploy-script/package.json.declapract.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FileCheckFunction, FileFixFunction } from 'declapract';
|
|
2
|
-
|
|
3
|
-
export const check: FileCheckFunction = (contents) => {
|
|
4
|
-
if (!contents) throw new Error('does not match bad practice'); // no contents -> fine
|
|
5
|
-
const packageJSON = JSON.parse(contents);
|
|
6
|
-
if (packageJSON.scripts.deploy) return; // bad practice
|
|
7
|
-
throw new Error('does not match bad practice');
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const fix: FileFixFunction = (contents) => {
|
|
11
|
-
if (!contents) return { contents }; // do nothing if no contents
|
|
12
|
-
const packageJSON = JSON.parse(contents);
|
|
13
|
-
const updatedPackageJSON = {
|
|
14
|
-
...packageJSON,
|
|
15
|
-
scripts: {
|
|
16
|
-
...packageJSON.scripts,
|
|
17
|
-
deploy: undefined, // remove the deploy script
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
contents: JSON.stringify(updatedPackageJSON, null, 2),
|
|
22
|
-
};
|
|
23
|
-
};
|