Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release for v0.2.6 #17

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5665752
Add `LICENSE` authoring [`@kamranahmedse`](https://github.com/kamrana…
Rindrics Jun 10, 2024
421b67c
Specify `ROUTE06, Inc.` as an author of this forked version
Rindrics Jun 10, 2024
aae13a6
Abolish PR template which does not fit our operation
Rindrics Jun 10, 2024
e333618
Merge pull request #10 from route06/issue-1-update-license
Rindrics Jun 11, 2024
17d39e5
Merge pull request #11 from route06/issue-2-abolish-pr_template
Rindrics Jun 11, 2024
236ebc7
Use jest as dev dependency to test package
Rindrics May 30, 2024
a9ed0b8
Transpile dependent packages under `node_modules/`
Rindrics May 30, 2024
92b3748
Test output of `printPlainSummary()` to confirm jest works
Rindrics May 30, 2024
cf07401
Run CI on pull request
Rindrics May 30, 2024
8ac9365
Run CI on push to `main`
Rindrics May 31, 2024
0e8c441
Separate workflow for check to use it also from CD workflow
Rindrics May 31, 2024
68953f6
Use `tagpr` to automate tagging when push to `main`
Rindrics May 31, 2024
d923671
Configure `prettier` to follow style of the fork origin
Rindrics May 31, 2024
8cbb692
Format codes with `prettier`
Rindrics May 31, 2024
4693d21
Introduce `ESLint`
Rindrics Jun 1, 2024
b975410
Lint codes
Rindrics Jun 1, 2024
c706a78
Lint & format on CI
Rindrics Jun 1, 2024
539f902
Return credentials early if they are found in file
Rindrics Feb 26, 2024
1358f08
Remove unnecessary `if` block
Rindrics Feb 26, 2024
cf064c4
Authorize using temporal credential generated from IAM role
Rindrics Feb 26, 2024
7be9167
Add dev targets to `Makefile`
Rindrics Jun 2, 2024
a814394
Pin runtime at `22.3` to reduce risk in compatibility
Rindrics Jun 13, 2024
a8e9029
Remove unnecessary comment line
Rindrics Jun 13, 2024
1b72947
Merge pull request #12 from route06/issue-3-enable-test
Rindrics Jun 13, 2024
986bd03
Merge pull request #13 from route06/issue-4-automate-release
Rindrics Jun 13, 2024
053e643
Merge pull request #15 from route06/issue-14-lint-format
Rindrics Jun 13, 2024
fcb59cc
Merge pull request #16 from route06/issue-6-add-rbac
Rindrics Jun 13, 2024
2d5cee2
Accept raw account ID to support account that has no account alias
Rindrics Mar 1, 2024
78d75ed
Fix typo
Rindrics Jun 3, 2024
0061817
Express unexpected cost by failing test
Rindrics Jun 3, 2024
bb84491
Correct boundary conditions to correct cost values
Rindrics Jun 3, 2024
2d9a375
Format code
Rindrics Jun 3, 2024
e01424d
Move function for generating mocked cost data to `testUtils.ts`
Rindrics Jun 3, 2024
115a2b2
Rename `mockPricingData` to `mockedPricingData`
Rindrics Jun 3, 2024
11674a8
Format codes
Rindrics Jun 3, 2024
38b8624
Express 'specific-period summary' function as test
Rindrics Jun 4, 2024
cbbdadb
Add 'specific-period summary' function
Rindrics Jun 4, 2024
152ee56
Use 'specific-period summary' function with default (='yesterday')
Rindrics Jun 4, 2024
a21584f
Add period notation to notify message header
Rindrics Jun 4, 2024
a376d43
Remove indent from `readme.md`
Rindrics Jun 4, 2024
87083ae
Unify parens into curly braces
Rindrics Jun 4, 2024
7a4949f
Map `-a` for `--role-arn`
Rindrics Jun 4, 2024
0eb8cb7
Map `-T` for `--target-account`
Rindrics Jun 4, 2024
f73e734
Merge pull request #20 from route06/issue-7-specify-accounts
Rindrics Jun 14, 2024
38dc2f3
Merge pull request #21 from route06/issue-8-fix-cost-aggregation-logic
Rindrics Jun 14, 2024
fdff859
Merge pull request #22 from route06/issue-9-aggregation-unit
Rindrics Jun 14, 2024
28eca71
[tagpr] prepare for the next release
github-actions[bot] Jun 14, 2024
d5d7e4d
[tagpr] update CHANGELOG.md
github-actions[bot] Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: "🐛 Bug Report"
name: '🐛 Bug Report'
about: Report a reproducible bug or regression.
title: ''
labels: bug
assignees: ''

---

## Current Behavior
Expand All @@ -17,4 +16,4 @@ assignees: ''

## Debug log

<!-- Re-run the command and paste the output here -->
<!-- Re-run the command and paste the output here -->
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ about: Suggest a new feature for this project
title: ''
labels: enhancement
assignees: ''

---

## Feature Request

**Is your feature request related to a problem? Please describe.**

<!-- A clear and concise description of what the problem is. Ex. I have an issue when [...] -->

**Describe the solution you'd like**

<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. -->

**Describe alternatives you've considered**

<!-- A clear and concise description of any alternative solutions or features you've considered. -->

## Are you willing to resolve this issue by submitting a Pull Request?
Expand All @@ -31,4 +33,4 @@ assignees: ''

<!--
👋 Have a great day and thank you for the feature request!
-->
-->
40 changes: 0 additions & 40 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

4 changes: 4 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
exclude:
labels:
- tagpr
29 changes: 29 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bump Semantic Version

on:
push:
branches:
- main

jobs:
check:
uses: ./.github/workflows/check.yaml

deploy:
needs: check
runs-on: ubuntu-latest
timeout-minutes: 5

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create pull request with incremented tag
id: run-tagpr
uses: Songmu/tagpr@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check Package

on:
workflow_call:

jobs:
ci:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
run: npm install -g pnpm

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'

- name: Install dependencies
run: make install

- name: Lint & format
run: make lint

- name: Run tests
run: make test
11 changes: 11 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI for before & after Pull Request Merge

on:
pull_request:
push:
branches:
- main

jobs:
call-common-checks:
uses: ./.github/workflows/check.yaml
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.3
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pnpm-lock.yaml
CHANGELOG.md
eslint.config.js
tsconfig.json
43 changes: 43 additions & 0 deletions .tagpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# config file for the tagpr in git config format
# The tagpr generates the initial configuration, which you can rewrite to suit your environment.
# CONFIGURATIONS:
# tagpr.releaseBranch
# Generally, it is "main." It is the branch for releases. The tagpr tracks this branch,
# creates or updates a pull request as a release candidate, or tags when they are merged.
#
# tagpr.versionFile
# Versioning file containing the semantic version needed to be updated at release.
# It will be synchronized with the "git tag".
# Often this is a meta-information file such as gemspec, setup.cfg, package.json, etc.
# Sometimes the source code file, such as version.go or Bar.pm, is used.
# If you do not want to use versioning files but only git tags, specify the "-" string here.
# You can specify multiple version files by comma separated strings.
#
# tagpr.vPrefix
# Flag whether or not v-prefix is added to semver when git tagging. (e.g. v1.2.3 if true)
# This is only a tagging convention, not how it is described in the version file.
#
# tagpr.changelog (Optional)
# Flag whether or not changelog is added or changed during the release.
#
# tagpr.command (Optional)
# Command to change files just before release.
#
# tagpr.template (Optional)
# Pull request template in go template format
#
# tagpr.release (Optional)
# GitHub Release creation behavior after tagging [true, draft, false]
# If this value is not set, the release is to be created.
#
# tagpr.majorLabels (Optional)
# Label of major update targets. Default is [major]
#
# tagpr.minorLabels (Optional)
# Label of minor update targets. Default is [minor]
#
[tagpr]
vPrefix = true
releaseBranch = main
release = false
versionFile = package.json
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

## [v0.2.6](https://github.com/route06/aws-cost-cli/commits/v0.2.6) - 2024-06-14
- Specify 'ROUTE06, Inc.' as an author of this forked version by @Rindrics in https://github.com/route06/aws-cost-cli/pull/10
- Abolish PR template which does not fit our operation by @Rindrics in https://github.com/route06/aws-cost-cli/pull/11
- Enable testing by 'jest' on CI by @Rindrics in https://github.com/route06/aws-cost-cli/pull/12
- Introduce 'tagpr' to automate bumping semantic version by @Rindrics in https://github.com/route06/aws-cost-cli/pull/13
- Introduce linter and formatter to the project by @Rindrics in https://github.com/route06/aws-cost-cli/pull/15
- Enable use case with RBAC to improve security by @Rindrics in https://github.com/route06/aws-cost-cli/pull/16
- Add function to get cost info of specific account under an organization by @Rindrics in https://github.com/route06/aws-cost-cli/pull/20
- Correct cost aggregation logic to resolve diff in monthly cost by @Rindrics in https://github.com/route06/aws-cost-cli/pull/21
- Allow users to choose aggregation unit for `Breakdown by service` by @Rindrics in https://github.com/route06/aws-cost-cli/pull/22
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
MIT License

Original Author: Kamran Ahmed
Copyright (c) 2023 Kamran Ahmed

Modified by: ROUTE06, Inc.
Copyright (c) 2024 ROUTE06, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BUILD_DIR = ./dist
SRC_DIR = ./src
NODE_MODULES = ./node_modules
SRC_FILES := $(shell find $(SRC_DIR) -type f)
BREAKDOWN_PERIOD ?= "yesterday"

.PHONY: all install build run

all: build

$(NODE_MODULES):
pnpm install

install: $(NODE_MODULES)

$(BUILD_DIR): $(SRC_FILES) $(NODE_MODULES)
pnpm build

build: $(BUILD_DIR)

run: build
node ./bin/index.js --profile "${AWS_PROFILE}" --access-key "${ACCESS_KEY}" --secret-key "${SECRET_KEY}" --role-arn "${ROLE_ARN}" --region "${AWS_REGION}" -S "${SLACK_TOKEN_AWS_COST_CLI}" -C "${SLACK_CHANNEL_ID}" --breakdown-period "${BREAKDOWN_PERIOD}"

test:
pnpm test

lint:
pnpm lint

format:
pnpm format
13 changes: 13 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-typescript"
]
}
13 changes: 13 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{
ignores: [
'**/dist/**',
'jest.config.cjs',
],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
);
32 changes: 32 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var esmModules = [
'chalk',
'ora',
'cli-cursor',
'restore-cursor',
'log-symbols',
'is-unicode-supported',
'strip-ansi',
'ansi-regex',
'is-interactive',
'stdin-discarder',
'aws-sdk-client-mock',
'node-fetch',
'data-uri-to-buffer',
'fetch-blob',
'formdata-polyfill',
];

module.exports = {
preset: 'ts-jest/presets/js-with-babel',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]sx?$': 'babel-jest',
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transformIgnorePatterns: [
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
],
testMatch: ['**/?(*.)+(test).[tj]s?(x)'],
};
Loading