Skip to content

Commit

Permalink
feat: complete overhaul to Typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeolun committed Feb 5, 2024
1 parent bac4fbb commit d8ff846
Show file tree
Hide file tree
Showing 34 changed files with 80,123 additions and 20,094 deletions.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ root = true
end_of_line = lf
insert_final_newline = true

[*.js]
[*.ts]
charset = utf-8
indent_style = space
indent_size = 2
max_line_length = 100
max_line_length = 120

[{*.json,.travis.yml,.eslintrc,.babelrc}]
indent_style = space
Expand Down
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc.js

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/push.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
on: [push, pull_request]
name: Test and release
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16', '18', '20', 'lts/*', 'latest']
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run test
release:
name: Release
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm run release
- name: Deploy pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pids
logs
results
docs
lib

node_modules
npm-debug.log
Expand Down
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

14 changes: 14 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/changelog",
"@semantic-release/npm",
["@semantic-release/git", {
"assets": ["CHANGELOG.md", "package.json", "pnpm-lock.yaml"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}]
]
}
14 changes: 4 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ be interested in. Maybe somebody is trying to fix that stupid bug that bothers
you. Review the PR. Do you have any better ideas how to fix this problem? Let us
know.

Here is a helpful set of tips for making your own commits: https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message
Here is a helpful set of tips for making your own commits: https://www.conventionalcommits.org/en/v1.0.0/

## Issues

Expand All @@ -27,17 +27,11 @@ All commits that fix bugs or add features need appropriate unit tests.

Please adhere to the current code styling. We have included an `.editorconfig`
at the repo's root to facilitate uniformity regardless of your editor. See the
[editor config site][editorconfig] for integration details.
[editor config site](https://editorconfig.org/) for integration details.

We use [ESLint][eslint] for all JavaScript Linting. There should be no linting
We use [Biome](https://biomejs.dev/) for all TypeScript Linting. There should be no linting
errors and no new warnings for new work. You are welcome to configure your
editor to use ESLint or the `npm test` command will run unit tests and the
linter.



-[editorconfig]: http://editorconfig.org
-[eslint]: http://eslint.org
editor to use Biome or use the `pnpm lint` command.

## Visual Changes

Expand Down
71 changes: 26 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,51 @@
# JavaScript JIRA API for node.js #
# Typescript JIRA API for node.js #

A node.js module, which provides an object oriented wrapper for the Jira Rest API.
A Typescript wrapper for the Jira Rest API, now in Typescript. I had this as a fork of `jira-client` for a while, but I felt the need to completely split it up to modernize it (as well as give myself an easier time deploying).

[![Documentation](https://img.shields.io/badge/Documentation--green.svg)](https://jira-node.github.io/)
I've tried to keep the api as close to the original api as possible, but sometimes I've had to make compromises. Where possible any legacy calls have been removed, and replaced with what made most sense considering the latest versions of Jira Datacenter, Cloud, Software and Service Desk.

> [!WARNING]
> Types have been sourced wherever they exist (cloud has more type definitions, either in docs or openapi, than server/datacenter, but no guarantee they are compatible).
If you find any conflicts, or have any suggestions, please feel free to open an issue or a pull request.

[![License](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE.md)
[![Documentation](https://img.shields.io/badge/Documentation--green.svg)](https://ts-jira-client.github.io/)
[![Jira Rest API](https://img.shields.io/badge/Jira%20Rest%20API--green.svg)](https://docs.atlassian.com/software/jira/docs/api/REST/latest/)
[![Run tests](https://github.com/jira-node/node-jira-client/workflows/Run%20tests/badge.svg)](https://github.com/jira-node/node-jira-client/actions)
[![npm](https://img.shields.io/npm/v/jira-client.svg)](https://www.npmjs.com/package/jira-client)
[![Downloads](https://img.shields.io/npm/dm/jira-client.svg)](https://npmjs.com/jira-client)
[![Install Size](https://packagephobia.now.sh/badge?p=jira-client)](https://packagephobia.now.sh/result?p=jira-client)
[![dependency Status](https://david-dm.org/jira-node/node-jira-client/status.svg)](https://david-dm.org/jira-node/node-jira-client)
[![devDependency Status](https://david-dm.org/jira-node/node-jira-client/dev-status.svg)](https://david-dm.org/jira-node/node-jira-client?type=dev)
[![Run tests](https://github.com/aeolun/ts-jira-client/workflows/Test%20and%20release/badge.svg)](https://github.com/aeolun/ts-jira-client/actions)
[![npm](https://img.shields.io/npm/v/ts-jira-client.svg)](https://www.npmjs.com/package/ts-jira-client)
[![Downloads](https://img.shields.io/npm/dm/ts-jira-client.svg)](https://npmjs.com/ts-jira-client)
[![Install Size](https://packagephobia.now.sh/badge?p=ts-jira-client)](https://packagephobia.now.sh/result?p=ts-jira-client)

## Installation ##

Install with the node package manager [npm](http://npmjs.org):
Install with the node package manager [pnpm](https://pnpm.io/):

```shell
$ npm install jira-client
$ pnpm install ts-jira-client
```

## Examples ##

### Create the JIRA client ###

```javascript
// With ES5
var JiraApi = require('jira-client');

// With ES6
import JiraApi from 'jira-client';
```typescript
import { JiraApi } from 'ts-jira-client';

// Initialize
var jira = new JiraApi({
protocol: 'https',
host: 'jira.somehost.com',
protocol: 'https', // default is https
host: 'jira.somehost.com', // REQUIRED
username: 'username',
password: 'password',
apiVersion: '2',
strictSSL: true
apiVersion: '2', // default is 2
strictSSL: true // default is true
});
```

### Find the status of an issue ###

```javascript
// ES5
// We are using an ES5 Polyfill for Promise support. Please note that if you don't explicitly
// apply a catch exceptions will get swallowed. Read up on ES6 Promises for further details.
jira.findIssue(issueNumber)
.then(function(issue) {
console.log('Status: ' + issue.fields.status.name);
})
.catch(function(err) {
console.error(err);
});

// ES6
jira.findIssue(issueNumber)
.then(issue => {
console.log(`Status: ${issue.fields.status.name}`);
})
.catch(err => {
console.error(err);
});

// ES7
```typescript
async function logIssueName() {
try {
const issue = await jira.findIssue(issueNumber);
Expand All @@ -73,8 +54,8 @@ async function logIssueName() {
console.error(err);
}
}

logIssueName();
```

## Documentation ##
Can't find what you need in the readme? Check out our documentation here: https://jira-node.github.io/
Can't find what you need in the readme? Check out our documentation here: https://ts-jira-client.github.io/
17 changes: 17 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120,
"include": ["src/**/*.ts"],
"ignore": ["src/generated/**/*.d.ts"]
},
"linter": {
"include": ["src/**/*.ts"],
"ignore": ["src/generated/**/*.d.ts"]
},
"files": {
"maxSize": 2097152
}
}
12 changes: 0 additions & 12 deletions esdoc.json

This file was deleted.

Loading

0 comments on commit d8ff846

Please sign in to comment.