diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 510731c1..00000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/* -index.d.ts diff --git a/.eslintrc b/.eslintrc index 63de4775..111719d6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -39,5 +39,10 @@ }, "env": { "node": true - } + }, + "ignorePatterns": [ + "node_modules/*", + "index.d.ts", + "coverage", + ] } diff --git a/.github/workflows/node-aught.yml b/.github/workflows/node-aught.yml new file mode 100644 index 00000000..d0f17ab9 --- /dev/null +++ b/.github/workflows/node-aught.yml @@ -0,0 +1,14 @@ +name: 'Tests: node.js < 10' + +on: [pull_request, push] + +permissions: + contents: read + +jobs: + tests: + uses: ljharb/actions/.github/workflows/node.yml@main + with: + range: '>= 6 < 10' + type: minors + command: npm run ci-test diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml new file mode 100644 index 00000000..88d49f9b --- /dev/null +++ b/.github/workflows/node-pretest.yml @@ -0,0 +1,10 @@ +name: 'Tests: pretest/posttest' + +on: [pull_request, push] + +permissions: + contents: read + +jobs: + tests: + uses: ljharb/actions/.github/workflows/pretest.yml@main diff --git a/.github/workflows/node-tens.yml b/.github/workflows/node-tens.yml new file mode 100644 index 00000000..f39714e0 --- /dev/null +++ b/.github/workflows/node-tens.yml @@ -0,0 +1,14 @@ +name: 'Tests: node.js >= 10' + +on: [pull_request, push] + +permissions: + contents: read + +jobs: + tests: + uses: ljharb/actions/.github/workflows/node.yml@main + with: + range: '>= 10' + type: minors + command: npm run ci-test diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 00000000..18181913 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,22 @@ +name: Automatic Rebase + +on: [pull_request_target] + +permissions: + contents: read + +jobs: + _: + permissions: + contents: write # for ljharb/rebase to push code to rebase + pull-requests: read # for ljharb/rebase to get info about PR + + name: "Automatic Rebase" + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: ljharb/rebase@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml new file mode 100644 index 00000000..a685b8ac --- /dev/null +++ b/.github/workflows/require-allow-edits.yml @@ -0,0 +1,18 @@ +name: Require “Allow Edits” + +on: [pull_request_target] + +permissions: + contents: read + +jobs: + _: + permissions: + pull-requests: read # for ljharb/require-allow-edits to check 'allow edits' on PR + + name: "Require “Allow Edits”" + + runs-on: ubuntu-latest + + steps: + - uses: ljharb/require-allow-edits@main diff --git a/.npmignore b/.npmignore index 31fcb79e..f6eab27b 100644 --- a/.npmignore +++ b/.npmignore @@ -7,3 +7,6 @@ sftp-config.json coverage/ node_modules/ test/ + +yarn.lock +README.md.bak diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f22a5d90..00000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -sudo: false - -language: node_js -node_js: - - "6" - - "8" - - "10" - - "12" - -os: -- osx -- linux -- windows - -install: - - travis_retry npm install - -script: - - uname -a - - node --version - - npm --version - - if [ "$TRAVIS_OS_NAME" != "windows" ]; then npm run ci-lint; fi - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then npm run test; else npm run ci-test; fi - - npm run check - -after_success: - - "cat coverage/lcov.info | ./node_modules/.bin/coveralls" - -notifications: - webhooks: - urls: - - "https://webhooks.gitter.im/e/3569d7edff0d38f93cd7" - on_success: always - on_failure: always - on_start: false diff --git a/lib/form_data.js b/lib/form_data.js index cf836b0b..93164426 100644 --- a/lib/form_data.js +++ b/lib/form_data.js @@ -60,7 +60,7 @@ FormData.prototype.append = function(field, value, options) { } // https://github.com/felixge/node-form-data/issues/38 - if (util.isArray(value)) { + if (Array.isArray(value)) { // Please convert your array into string // the way web server expects it this._error(new Error('Arrays are not supported.')); diff --git a/package.json b/package.json index a2fcb88d..9ced4589 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Felix Geisendörfer (http://debuggable.com/)", "name": "form-data", "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", - "version": "3.0.1", + "version": "3.0.2", "repository": { "type": "git", "url": "git://github.com/form-data/form-data.git" @@ -11,13 +11,16 @@ "browser": "./lib/browser", "typings": "./index.d.ts", "scripts": { - "pretest": "rimraf coverage test/tmp", - "test": "istanbul cover test/run.js", - "posttest": "istanbul report lcov text", - "lint": "eslint lib/*.js test/*.js test/integration/*.js", + "pretest": "npm run lint", + "pretests-only": "rimraf coverage test/tmp", + "tests-only": "istanbul cover test/run.js", + "posttests-only": "istanbul report lcov text", + "test": "npm run tests-only", + "posttest": "npx npm@'>=10.2' audit --production", + "lint": "eslint --ext=js,mjs .", "report": "istanbul report lcov text", "ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8", - "ci-test": "npm run test && npm run browser && npm run report", + "ci-test": "npm run tests-only && npm run browser && npm run report", "predebug": "rimraf coverage test/tmp", "debug": "verbose=1 ./test/run.js", "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage",