Skip to content

Commit

Permalink
Merge pull request #254 from arnested/js
Browse files Browse the repository at this point in the history
Refactor to use JavaScript instead of TypeScript
  • Loading branch information
arnested authored Jun 9, 2022
2 parents 2a74f6e + db4419e commit f446d64
Show file tree
Hide file tree
Showing 20 changed files with 39,146 additions and 35,725 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
dist/
lib/
node_modules/
jest.config.js
64 changes: 11 additions & 53 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,12 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
"extends": ["eslint:recommended"],
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module"
},
"env": {
"node": true,
"es6": true,
"jest": true
}
}
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]
Expand Down
45 changes: 22 additions & 23 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CodeQL"
name: 'CodeQL'

on:
workflow_run:
Expand All @@ -7,7 +7,7 @@ on:
types:
- completed
pull_request:
branches: [ main ]
branches: [main]
schedule:
- cron: '20 18 * * 5'

Expand All @@ -20,26 +20,25 @@ jobs:
fail-fast: false
matrix:
language:
- 'javascript'
- 'javascript'

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

- run: |
npm install
npm run build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

- run: |
npm install
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
14 changes: 0 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Rebuild dist
id: dist
run: |
npm install
npm run build
npm run package
git config user.name github-actions
git config user.email [email protected]
git add dist/index.js
(git commit -m 'Publish dist' && echo '::set-output name=changed::true') || echo '::set-output name=changed::false'
- name: Push rebuild dist
if: ${{ steps.dist.outputs.changed == 'true' }}
run: |
git push origin main
- name: Bump version and push tag
uses: anothrNick/[email protected]
if: ${{ steps.dist.outputs.changed == 'true' }}
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ jobs:
- uses: actions/checkout@v3
- run: |
npm install
- run: |
npm run build
- run: |
npm run package
- uses: ./
id: go-version-1
with:
Expand Down
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ working-directory:
unsupported:
description: Include unsupported versions of Go
required: false
default: "true"
default: 'true'
unstable:
description: Include unstable versions of Go (beta, release candidates)
required: false
default: "false"
default: 'false'
patch-level:
description: Include the patch levels on the versions (default is major.minor)
required: false
default: "false"
default: 'false'
```
## Outputs
Expand Down Expand Up @@ -117,9 +117,9 @@ jobs:
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: arnested/go-version-action@v1
id: versions
- uses: actions/checkout@v3
- uses: arnested/go-version-action@v1
id: versions
test:
name: Test
runs-on: ubuntu-latest
Expand All @@ -128,14 +128,14 @@ jobs:
matrix:
version: ${{ fromJSON(needs.go-versions.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.version }}
check-latest: true
- name: go test
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./...
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.version }}
check-latest: true
- name: go test
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./...
```

![The workflow summary](docs/action-matrix-summary.png)
Expand Down
3 changes: 1 addition & 2 deletions __tests__/main.test.ts → __tests__/main.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import fs from 'fs'
import {
getGoModVersion,
getVersions,
gomod,
latest,
matrix,
minimal,
modulename
} from '../src/go-versions'
} from '../src/go-versions.js'

test('test module name', () => {
const content = gomod('__tests__/testdata/go.mod')
Expand Down
Loading

0 comments on commit f446d64

Please sign in to comment.