diff --git a/.github/workflows/pr-chat.yml b/.github/workflows/pr-chat.yml new file mode 100644 index 0000000..3910279 --- /dev/null +++ b/.github/workflows/pr-chat.yml @@ -0,0 +1,25 @@ +name: PR Chat +on: + pull_request_target: + types: [opened, ready_for_review, closed] + +jobs: + main: + runs-on: ubuntu-latest + if: ${{ !github.event.pull_request.draft }} + steps: + - name: Checkout Actions + uses: actions/checkout@v2 + with: + repository: "microsoft/vscode-github-triage-actions" + ref: stable + path: ./actions + - name: Install Actions + run: npm install --production --prefix ./actions + - name: Run Code Review Chat + uses: ./actions/code-review-chat + with: + token: ${{secrets.GITHUB_TOKEN}} + slack_token: ${{ secrets.SLACK_TOKEN }} + slack_bot_name: "VSCodeBot" + notification_channel: codereview diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6a36701 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +on: [push] + +name: Tests + +jobs: + build: + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install root project dependencies + run: npm install + - name: Build and run tests + run: npm test \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3b203ef..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -sudo: false - -node_js: - - "16" diff --git a/.vscode/launch.json b/.vscode/launch.json index 21a22ca..ec67fbb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,7 @@ "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "stopOnEntry": false, "args": [ + "./lib/umd/test", "--timeout", "999999", "--colors" diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5dddcad --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "git.branchProtection": [ + "main" + ], + "git.branchProtectionPrompt": "alwaysCommitToNewBranch", + "git.branchRandomName.enable": true, + "githubPullRequests.assignCreated": "${user}", + "githubPullRequests.defaultMergeMethod": "squash" +} \ No newline at end of file diff --git a/README.md b/README.md index 7440435..5fd92d9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,8 @@ Scanner and parser for JSON with comments. [![npm Package](https://img.shields.io/npm/v/jsonc-parser.svg?style=flat-square)](https://www.npmjs.org/package/jsonc-parser) [![NPM Downloads](https://img.shields.io/npm/dm/jsonc-parser.svg)](https://npmjs.org/package/jsonc-parser) -[![Build Status](https://travis-ci.org/microsoft/node-jsonc-parser.svg?branch=main)](https://travis-ci.org/Microsoft/node-jsonc-parser) +[![Build Status](https://github.com/microsoft/node-jsonc-parser/workflows/Tests/badge.svg)](https://github.com/microsoft/node-jsonc-parser/workflows/Tests) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) Why? ---- diff --git a/build/pipeline.yml b/build/pipeline.yml new file mode 100644 index 0000000..d56cd8e --- /dev/null +++ b/build/pipeline.yml @@ -0,0 +1,50 @@ +name: $(Date:yyyyMMdd)$(Rev:.r) + +trigger: + branches: + include: + - main +pr: none + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +parameters: + - name: publishPackage + displayName: 🚀 Publish jsonc-parser + type: boolean + default: false + +extends: + template: azure-pipelines/npm-package/pipeline.yml@templates + parameters: + npmPackages: + - name: jsonc-parser + + testPlatforms: + - name: Linux + nodeVersions: + - 16.x + - name: MacOS + nodeVersions: + - 16.x + - name: Windows + nodeVersions: + - 16.x + + buildSteps: + - script: npm ci + displayName: Install dependencies + + testSteps: + - script: npm ci + displayName: Install dependencies + - script: npm test + displayName: Test npm package + + publishPackage: ${{ parameters.publishPackage }} diff --git a/build/post-publish.js b/build/post-publish.js deleted file mode 100644 index e523eaf..0000000 --- a/build/post-publish.js +++ /dev/null @@ -1,41 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const cp = require('child_process'); -const path = require('path'); -const fs = require('fs'); -const readline = require('readline'); -const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; - -function updateNextTag() { - - // read package.json from the current working directory - var packageJSON = JSON.parse(fs.readFileSync('package.json').toString()); - var name = packageJSON.name; - var version = packageJSON.version; - if (version.indexOf('next') !== -1) { - return; - } - - opts = {}; - opts.stdio = 'inherit'; - - console.log(name + ": set 'next' tag to latest version"); - - const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); - - rl.question('Enter OTP token: ', (token) => { - const result = cp.spawnSync(npm, ['--otp', token, 'dist-tags', 'add', name + '@' + version, 'next'], opts); - - rl.close(); - - if (result.error || result.status !== 0) { - process.exit(1); - } - }); -} - -updateNextTag(); - diff --git a/package.json b/package.json index 448d814..497fa80 100644 --- a/package.json +++ b/package.json @@ -25,16 +25,13 @@ "rimraf": "^3.0.2" }, "scripts": { - "prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs", - "postpublish": "node ./build/post-publish.js", + "prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs", "compile": "tsc -p ./src && npm run lint", "compile-esm": "tsc -p ./src/tsconfig.esm.json", "remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js", "clean": "rimraf lib", "watch": "tsc -w -p ./src", "test": "npm run compile && mocha ./lib/umd/test", - "lint": "eslint src/**/*.ts", - "preversion": "npm test", - "postversion": "git push && git push --tags" + "lint": "eslint src/**/*.ts" } }