Skip to content

Commit 6008638

Browse files
committed
switching to yarn
1 parent f39cd46 commit 6008638

File tree

11 files changed

+5173
-176
lines changed

11 files changed

+5173
-176
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.eslintrc.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"plugins": ["jest", "@typescript-eslint"],
3+
"extends": ["plugin:github/es6"],
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"ecmaVersion": 9,
7+
"sourceType": "module",
8+
"project": "./tsconfig.json"
9+
},
10+
"rules": {
11+
"eslint-comments/no-use": "off",
12+
"import/no-namespace": "off",
13+
"no-unused-vars": "off",
14+
"@typescript-eslint/no-unused-vars": "error",
15+
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
16+
"@typescript-eslint/no-require-imports": "error",
17+
"@typescript-eslint/array-type": "error",
18+
"@typescript-eslint/await-thenable": "error",
19+
"@typescript-eslint/ban-ts-ignore": "error",
20+
"camelcase": "off",
21+
"@typescript-eslint/camelcase": "warn",
22+
"@typescript-eslint/class-name-casing": "error",
23+
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
24+
"@typescript-eslint/func-call-spacing": ["error", "never"],
25+
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
26+
"@typescript-eslint/no-array-constructor": "error",
27+
"@typescript-eslint/no-empty-interface": "error",
28+
"@typescript-eslint/no-explicit-any": "error",
29+
"@typescript-eslint/no-extraneous-class": "error",
30+
"@typescript-eslint/no-for-in-array": "error",
31+
"@typescript-eslint/no-inferrable-types": "error",
32+
"@typescript-eslint/no-misused-new": "error",
33+
"@typescript-eslint/no-namespace": "error",
34+
"@typescript-eslint/no-non-null-assertion": "warn",
35+
"@typescript-eslint/no-object-literal-type-assertion": "error",
36+
"@typescript-eslint/no-unnecessary-qualifier": "error",
37+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
38+
"@typescript-eslint/no-useless-constructor": "error",
39+
"@typescript-eslint/no-var-requires": "error",
40+
"@typescript-eslint/prefer-for-of": "warn",
41+
"@typescript-eslint/prefer-function-type": "warn",
42+
"@typescript-eslint/prefer-includes": "error",
43+
"@typescript-eslint/prefer-interface": "error",
44+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
45+
"@typescript-eslint/promise-function-async": "error",
46+
"@typescript-eslint/require-array-sort-compare": "error",
47+
"@typescript-eslint/restrict-plus-operands": "error",
48+
"semi": "off",
49+
"@typescript-eslint/semi": ["error", "never"],
50+
"@typescript-eslint/type-annotation-spacing": "error",
51+
"@typescript-eslint/unbound-method": "error"
52+
},
53+
"env": {
54+
"node": true,
55+
"es6": true,
56+
"jest/globals": true
57+
}
58+
}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
lib/
3+
node_modules/

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 100,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

action.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ inputs:
1010
appspec-file:
1111
description: 'Appspec file'
1212
required: true
13-
#outputs:
14-
# time: # id of output
15-
# description: 'The time we greeted you'
1613
runs:
1714
using: 'node12'
1815
main: 'dist/index.js'

index.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

package-lock.json

Lines changed: 0 additions & 113 deletions
This file was deleted.

package.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
"name": "github-action-codedeploy",
33
"version": "1.0.0",
44
"description": "codedeploy github action",
5-
"main": "index.js",
5+
"main": "lib/main.js",
66
"scripts": {
7-
"package": "ncc build index.js -m -o dist",
8-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"build": "tsc",
8+
"format": "prettier --write **/*.ts",
9+
"format-check": "prettier --check **/*.ts",
10+
"lint": "eslint src/**/*.ts",
11+
"pack": "ncc build",
12+
"test": "jest",
13+
"all": "yarn build && yarn format && yarn lint && yarn run pack && yarn test"
914
},
1015
"author": "Scott Hutchings",
1116
"license": "Apache-2.0",
@@ -14,6 +19,19 @@
1419
"aws-sdk": "^2.677.0"
1520
},
1621
"devDependencies": {
17-
"@zeit/ncc": "^0.22.3"
22+
"@types/jest": "^24.0.23",
23+
"@types/node": "^12.7.12",
24+
"@typescript-eslint/parser": "^2.8.0",
25+
"@zeit/ncc": "^0.20.5",
26+
"eslint": "^5.16.0",
27+
"eslint-plugin-github": "^2.0.0",
28+
"eslint-plugin-jest": "^22.21.0",
29+
"eslint-plugin-prettier": "^3.1.3",
30+
"jest": "^24.9.0",
31+
"jest-circus": "^24.9.0",
32+
"js-yaml": "^3.13.1",
33+
"prettier": "^1.19.1",
34+
"ts-jest": "^24.2.0",
35+
"typescript": "^3.6.4"
1836
}
1937
}

src/index.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import * as core from '@actions/core'
2+
import * as fs from 'fs'
3+
import client from 'aws-sdk/clients/codedeploy'
4+
5+
async function run () {
6+
try {
7+
const appName = core.getInput('application-name')
8+
const groupName = core.getInput('deployment-group-name')
9+
const appspecFile = core.getInput('appspec-file')
10+
core.debug(`Hello world! ${appName}, ${groupName}, ${appspecFile}`)
11+
12+
const appspecJson = fs.readFileSync(appspecFile, 'utf8')
13+
14+
core.debug('*** appspecJson ***')
15+
core.debug(appspecJson)
16+
core.debug('*** end appspecJson ***')
17+
18+
const codeDeploy = new client()
19+
const deployment = await codeDeploy.createDeployment({
20+
applicationName: appName,
21+
deploymentGroupName: groupName,
22+
revision: {
23+
revisionType: 'AppSpecContent',
24+
appSpecContent: {
25+
content: appspecJson
26+
}
27+
}
28+
}).promise()
29+
core.debug(`deployment: ${JSON.stringify(deployment)}`)
30+
await codeDeploy.waitFor('deploymentSuccessful', {
31+
deploymentId: deployment.deploymentId!
32+
}).promise()
33+
34+
process.exit(0)
35+
} catch (error) {
36+
console.error(error)
37+
core.setFailed(error.message)
38+
process.exit(1)
39+
}
40+
}
41+
42+
run()

tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
4+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
5+
"outDir": "./lib", /* Redirect output structure to the directory. */
6+
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
7+
"strict": true, /* Enable all strict type-checking options. */
8+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
9+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
10+
},
11+
"exclude": ["node_modules", "**/*.test.ts"]
12+
}

0 commit comments

Comments
 (0)