From 0b829df32f41214c062997cf87b0cdd74a82a03e Mon Sep 17 00:00:00 2001 From: nojaja Date: Fri, 23 Dec 2022 12:45:00 +0900 Subject: [PATCH 1/4] Fixed an unmatched error when @ was used as a comment ex. ``` /** * delimiter definitions * @ ; : , */ ``` Error: unmatched input: "@" --- lib/tokenize.js | 2 +- test/fixtures/description-no-tags2.js | 8 ++++++++ test/tags.js | 11 +++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/fixtures/description-no-tags2.js diff --git a/lib/tokenize.js b/lib/tokenize.js index ae2b7d6..8322ba4 100644 --- a/lib/tokenize.js +++ b/lib/tokenize.js @@ -213,7 +213,7 @@ module.exports = function(str, options, state) { } }) - .capture('description', /^[^\S\n]{0,3}(?!@|`{3,4}|~{3,4}| {4})[^\n]*/) + .capture('description', /^[^\S\n]{0,3}(?!@(\S+)|`{3,4}|~{3,4}| {4})[^\n]*/) /** * Lex the string diff --git a/test/fixtures/description-no-tags2.js b/test/fixtures/description-no-tags2.js new file mode 100644 index 0000000..6348a59 --- /dev/null +++ b/test/fixtures/description-no-tags2.js @@ -0,0 +1,8 @@ +/** + * delimiter definitions + * @ 2022.12.23 + */ +/* + * @ + */ +const atdelimiter = 0x40; \ No newline at end of file diff --git a/test/tags.js b/test/tags.js index 67ec4c6..274b289 100644 --- a/test/tags.js +++ b/test/tags.js @@ -126,6 +126,17 @@ describe('tags', function() { }); }); + it('should tokenize a comment with no tags', function() { + const tok = tokenize(fixtures['description-no-tags2']); + + assert.deepEqual(tok, { + description: 'delimiter definitions\n@ 2022.12.23\n/\n/* \n@\n/\nconst atdelimiter = 0x40;', + footer: '', + examples: [], + tags: [] + }); + }); + it('should tokenize multi-line tags', function() { const tok = tokenize([ '/**', From 26a65ca046c7b47868708a6e824cf50917b9f2f1 Mon Sep 17 00:00:00 2001 From: nojaja Date: Mon, 12 Jun 2023 13:25:39 +0900 Subject: [PATCH 2/4] =?UTF-8?q?npm=E3=81=B8=E3=81=AE=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E5=87=A6=E7=90=86=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d1b2e60 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Publish package to GitHub Packages + +on: + release: + types: [created] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Test + run: | + npm ci + npm run test + + publish-npm: + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14.x' + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm run build + - run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} \ No newline at end of file diff --git a/package.json b/package.json index 5d714b5..e59ce9c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "tokenize-comment", + "name": "@nojaja/tokenize-comment", "description": "Uses snapdragon to tokenize a single JavaScript block comment into an object, with description, tags, and code example sections that can be passed to any other comment parsers for further parsing.", "version": "3.0.1", "homepage": "https://github.com/jonschlinkert/tokenize-comment", From d71241b72e4249e01e1bb14c5c19314b242208ae Mon Sep 17 00:00:00 2001 From: nojaja Date: Mon, 12 Jun 2023 13:30:47 +0900 Subject: [PATCH 3/4] fix workflows/release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1b2e60..c32e0c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: - name: Test run: | - npm ci + npm install npm run test publish-npm: @@ -34,7 +34,7 @@ jobs: with: node-version: '14.x' registry-url: https://registry.npmjs.org/ - - run: npm ci + - run: npm install - run: npm run build - run: npm publish --access=public env: From 59dfa158ad8f6e7682578d17ddc0c498aa5af589 Mon Sep 17 00:00:00 2001 From: nojaja Date: Mon, 12 Jun 2023 13:33:46 +0900 Subject: [PATCH 4/4] fix workflows/release.yml --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c32e0c8..ed2d3af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,8 +34,6 @@ jobs: with: node-version: '14.x' registry-url: https://registry.npmjs.org/ - - run: npm install - - run: npm run build - run: npm publish --access=public env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} \ No newline at end of file