Skip to content

Commit

Permalink
refactor: update package configurations, sort package.json, and for…
Browse files Browse the repository at this point in the history
…matting rules
  • Loading branch information
bryantbiggs committed Oct 15, 2021
1 parent 73b0bd5 commit ac37862
Show file tree
Hide file tree
Showing 10 changed files with 4,309 additions and 472 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

21 changes: 20 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module',
Expand All @@ -12,6 +19,18 @@ module.exports = {
singleQuote: true,
},
],
'import/order': [
'error',
{
groups: ['index', 'sibling', 'parent', 'internal', 'external', 'builtin', 'object', 'type'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'eol-last': ['error', 'always'],
},
ignorePatterns: ['dist/', 'lib/', 'node_modules/', 'jest.config.js'],
};
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

2 changes: 2 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
bracketSpacing: false,
arrowParens: "avoid",
printWidth: 120,
tabWidth: 2
};
10 changes: 0 additions & 10 deletions .releaserc.json

This file was deleted.

4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

104 changes: 69 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,30 @@
{
"name": "terraform-min-max",
"version": "0.0.0",
"private": true,
"description": "GitHub action used to evaluate the Terraform minimum and maximum versions permitted",
"repository": {
"type": "git",
"url": "git+https://github.com/clowdhaus/terraform-min-max.git"
},
"keywords": [
"github",
"actions",
"terraform"
],
"author": "Clowd Haus, LLC",
"license": "Apache-2.0",
"homepage": "https://github.com/clowdhaus/terraform-min-max#readme",
"bugs": {
"url": "https://github.com/clowdhaus/terraform-min-max/issues"
},
"homepage": "https://github.com/clowdhaus/terraform-min-max#readme",
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/clowdhaus/terraform-min-max.git"
},
"license": "Apache-2.0",
"author": "Clowd Haus, LLC",
"main": "src/index.ts",
"scripts": {
"all": "yarn format && yarn lint && yarn compile",
"build": "tsc --diagnostics",
"compile": "ncc build -m",
"format": "prettier --write **/*ts",
"format": "prettier --write src/*ts .eslintrc.js",
"lint": "eslint '**/*.ts' --quiet --fix",
"release": "semantic-release",
"test": "npx ts-node src/search.ts"
},
"dependencies": {
"@actions/core": "^1.2.7",
"@actions/io": "^1.1.0",
"find-in-files": "^0.5.0",
"node-fetch": "^2.6.1",
"semver": "^7.3.5"
},
"devDependencies": {
"@types/find-in-files": "^0.5.0",
"@types/node": "^15.0.0",
"@types/node-fetch": "^2.5.10",
"@types/semver": "^7.3.5",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@vercel/ncc": "^0.28.3",
"eslint": "^7.25.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"prettier-plugin-package": "^1.3.0",
"typescript": "^4.2.4"
"release": "semantic-release"
},
"lint-staged": {
"*.ts": [
Expand All @@ -62,5 +37,64 @@
"*package.json": [
"prettier --write --plugin=prettier-plugin-package"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/io": "^1.1.1",
"find-in-files": "^0.5.0",
"node-fetch": "^3.0.0",
"semver": "^7.3.5"
},
"devDependencies": {
"@types/find-in-files": "^0.5.1",
"@types/node": "^16.11.0",
"@types/node-fetch": "^3.0.3",
"@types/semver": "^7.3.8",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"@vercel/ncc": "^0.31.1",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"lint-staged": "^11.2.3",
"prettier": "^2.4.1",
"prettier-plugin-package": "^1.3.0",
"semantic-release": "^18.0.0",
"typescript": "^4.4.4"
},
"release": {
"branches": [
"main"
],
"ci": false,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md",
"package.json"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
}
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {versionConstraintSearch} from './search';
import {getMinMaxVersions} from './versions';

import * as core from '@actions/core';
import { getMinMaxVersions } from './versions';
import { versionConstraintSearch } from './search';

async function run(): Promise<void> {
const directory = core.getInput('directory');
Expand All @@ -20,6 +21,6 @@ async function run(): Promise<void> {
}
}

run().catch((error) => {
run().catch(error => {
core.setFailed(error);
});
10 changes: 3 additions & 7 deletions src/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@ export interface Options {
export type MinMaxVersions = [string, string?];

export async function getMetadata(): Promise<Metadata> {
const result = fetch('https://releases.hashicorp.com/terraform/index.json')
.then((res) => res.json())
.catch((err) => {
throw new Error(`Failed to fetch version metadata. ${err}`);
});

return result;
const result = await fetch('https://releases.hashicorp.com/terraform/index.json');
const jsonObj = result.json() as unknown;
return <Metadata>jsonObj;
}

export async function getMinMaxVersions(versionConstraint: string, options: Options = {}): Promise<MinMaxVersions> {
Expand Down
Loading

0 comments on commit ac37862

Please sign in to comment.