Skip to content

Commit

Permalink
Merge pull request #18 from aminya/node-18 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Aug 24, 2022
2 parents 65a0707 + 739e624 commit 35a1666
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 38 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI
on:
pull_request:
push:
branches:
- master

jobs:
Tests:
Expand All @@ -15,22 +17,21 @@ jobs:
- macos-latest
- windows-latest
node_version:
# - 10 # the tests do not run but it works fine
- 12
- 14
- 18
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: node_modules
with:
path: node_modules
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ matrix.node_arch }}-${{ hashFiles('package.json') }}

- name: Install Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}

Expand All @@ -42,10 +43,3 @@ jobs:

- name: Tests
run: npm run test

Skip:
if: contains(github.event.head_commit.message, '[skip ci]')
runs-on: ubuntu-latest
steps:
- name: Skip CI 🚫
run: echo skip ci
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# jsdoc2flow

Convert JSDoc comments into Flow annotations
Convert JSDoc comments into Flow/Typescript annotations

![CI](https://github.com/dannysu/jsdoc2flow/workflows/CI/badge.svg)

Expand Down Expand Up @@ -98,9 +98,11 @@ Options:
-h, --help display help for command
```

After conversion to Flow, you can convert your code to TypeScript using [`@khanacademy/flow-to-ts`](https://www.npmjs.com/package/@khanacademy/flow-to-ts)

## API

```javascript
```js
const Converter = require("jsdoc2flow")
const converter = new Converter(opts)

Expand Down Expand Up @@ -130,15 +132,13 @@ You can document using `@typedef` to define custom types:

- Alias

```
/**
* @typedef {number} MyNumber
*/
```js
/** @typedef {number} MyNumber */
```

- Custom Object

```
```js
/**
* @typedef {object} MyObject
* @property {string} str
Expand All @@ -148,7 +148,7 @@ You can document using `@typedef` to define custom types:

For callback and functions, you can use `@callback`:

```
```js
/**
* @callback MyCallback
* @param {number} arg1
Expand All @@ -158,7 +158,7 @@ For callback and functions, you can use `@callback`:

## @type Annotation

```
```js
/** @type {number} */
const count = 1;
/** @type {MyObject} */
Expand Down
40 changes: 24 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"name": "jsdoc2flow",
"version": "0.13.2",
"description": "Convert JSDoc comments into Flow annotations",
"version": "1.0.0",
"description": "Convert JSDoc comments into Flow/Typescript annotations",
"main": "src/index.js",
"scripts": {
"format": "prettier --write .",
"postversion": "git push --tags && npm publish && git push origin master",
"test": "mocha \"test/**/*-tests.js\"",
"lint": "eslint . --fix"
},
"type": "commonjs",
"prettier": "prettier-config-atomic",
"dependencies": {
"@babel/eslint-parser": "^7.13.14",
"@babel/plugin-syntax-flow": "^7.12.13",
"@babel/plugin-syntax-jsx": "^7.12.13",
"awilix": "4.3.3",
"commander": "7.2.0",
"comment-parser": "^1.1.5",
"@babel/eslint-parser": "^7.18.9",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-syntax-jsx": "^7.18.6",
"awilix": "7.0.3",
"commander": "9.4.0",
"comment-parser": "^1.3.1",
"doctrine": "3.0.0",
"eslint": "7.25.0",
"eslint": "8.22.0",
"espree-attachcomment": "^7",
"fs-extra": "9.1.0",
"fs-extra": "10.1.0",
"lodash": "4.17.21"
},
"devDependencies": {
"eslint-config-atomic": "^1.14.2",
"eslint-visitor-keys": "^2.0.0",
"mocha": "8.3.2",
"prettier-config-atomic": "^2.0.2",
"eslint-config-atomic": "^1.18.1",
"eslint-visitor-keys": "^3.3.0",
"mocha": "10.0.0",
"prettier-config-atomic": "^3.0.10",
"should": "13.2.3"
},
"bin": "./bin/cli.js",
Expand All @@ -47,8 +48,15 @@
"jsdoc",
"flow",
"js2typescript",
"js2ts"
"js2ts",
"typescript",
"ts",
"dts",
"dts-gen"
],
"author": "Amin Yahyaabadi <aminyahyaabadi74@gmail.com>, Danny Su <contact@dannysu.com>",
"license": "MIT"
"license": "MIT",
"engines": {
"node": "^18 || ^17 || ^16 || ^14.17 || ^12.22"
}
}
2 changes: 1 addition & 1 deletion src/visitor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict"

const doctrine = require("doctrine")
const { parse } = require("comment-parser/lib")
const { parse } = require("comment-parser")

const _ = require("lodash")

Expand Down

0 comments on commit 35a1666

Please sign in to comment.