From 221118c0c0d0cde2c78682351545a0592be31938 Mon Sep 17 00:00:00 2001 From: Takayuki Sato Date: Mon, 1 Nov 2021 04:29:29 +0900 Subject: [PATCH] chore!: Normalize repository, dropping node <10.13 support (#12) --- .ci/.azure-pipelines-steps.yml | 38 -------------- .ci/.azure-pipelines.yml | 90 ---------------------------------- .eslintignore | 1 + .eslintrc | 6 ++- .github/workflows/dev.yml | 75 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 17 +++++++ .prettierignore | 3 ++ .travis.yml | 12 ----- LICENSE | 2 +- README.md | 20 +++----- appveyor.yml | 32 ------------ index.js | 5 +- package.json | 33 ++++++++----- test/.eslintrc | 3 -- test/index.js | 14 +++++- 15 files changed, 144 insertions(+), 207 deletions(-) delete mode 100644 .ci/.azure-pipelines-steps.yml delete mode 100644 .ci/.azure-pipelines.yml create mode 100644 .eslintignore create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/release.yml create mode 100644 .prettierignore delete mode 100644 .travis.yml delete mode 100644 appveyor.yml delete mode 100644 test/.eslintrc diff --git a/.ci/.azure-pipelines-steps.yml b/.ci/.azure-pipelines-steps.yml deleted file mode 100644 index 894c21e..0000000 --- a/.ci/.azure-pipelines-steps.yml +++ /dev/null @@ -1,38 +0,0 @@ -steps: -- script: npm i -g npm@$(npm_version) - displayName: Use legacy npm version $(npm_version) - condition: ne(variables['npm_version'], '') - -- task: NodeTool@0 - inputs: - versionSpec: '$(node_version)' - displayName: Use Node $(node_version) - -- script: npm install - displayName: npm install - -- script: npm test - displayName: Run tests - -- script: npm run coveralls - displayName: Run coveralls - env: - # Pretend to be AppVeyor for now - APPVEYOR: true - APPVEYOR_BUILD_NUMBER: $(Build.BuildNumber) - APPVEYOR_BUILD_ID: $(Agent.OS)_$(node_version) - APPVEYOR_REPO_COMMIT: $(Build.SourceVersion) - APPVEYOR_REPO_BRANCH: $(Build.SourceBranchName) - # Overwrite the AppVeyor Service Name - COVERALLS_SERVICE_NAME: Azure Pipelines - COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) - COVERALLS_PARALLEL: true - CI_PULL_REQUEST: $(System.PullRequest.PullRequestNumber) - -- script: npm run azure-pipelines - displayName: Write tests to xml - -- task: PublishTestResults@2 - inputs: - testResultsFiles: '**/test.xunit' - condition: succeededOrFailed() diff --git a/.ci/.azure-pipelines.yml b/.ci/.azure-pipelines.yml deleted file mode 100644 index 2d717af..0000000 --- a/.ci/.azure-pipelines.yml +++ /dev/null @@ -1,90 +0,0 @@ -trigger: -- master -- releases/* - -jobs: - - job: Test_Linux - displayName: Run Tests on Linux - pool: - vmImage: "Ubuntu 16.04" - strategy: - matrix: - Node_v12: - node_version: 12 - Node_v10: - node_version: 10 - Node_v8: - node_version: 8 - Node_v6: - node_version: 6 - Node_v4: - node_version: 4 - Node_v0_12: - node_version: 0.12 - Node_v0_10: - node_version: 0.10 - steps: - - template: .azure-pipelines-steps.yml - - - job: Test_Windows - displayName: Run Tests on Windows - pool: - vmImage: vs2017-win2016 - strategy: - matrix: - Node_v12: - node_version: 12 - Node_v10: - node_version: 10 - Node_v8: - node_version: 8 - Node_v6: - node_version: 6 - Node_v4: - node_version: 4 - npm_version: 2 - Node_v0_12: - node_version: 0.12 - npm_version: 2 - Node_v0_10: - node_version: 0.10 - npm_version: 2 - steps: - - template: .azure-pipelines-steps.yml - - - job: Test_MacOS - displayName: Run Tests on MacOS - pool: - vmImage: macos-10.13 - strategy: - matrix: - Node_v12: - node_version: 12 - Node_v10: - node_version: 10 - Node_v8: - node_version: 8 - Node_v6: - node_version: 6 - Node_v4: - node_version: 4 - Node_v0_12: - node_version: 0.12 - Node_v0_10: - node_version: 0.10 - steps: - - template: .azure-pipelines-steps.yml - - - job: Notify_Coveralls - displayName: Notify Coveralls that the parallel report is done - pool: - vmImage: "Ubuntu 16.04" - dependsOn: - - Test_Linux - - Test_Windows - - Test_MacOS - steps: - - script: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$BUILD_NAME&payload[status]=done" - env: - COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) - BUILD_NAME: $(Build.BuildNumber) diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..404abb2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/.eslintrc b/.eslintrc index a5a4a17..ddeaf31 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,7 @@ { - "extends": "gulp" + "extends": "gulp", + "rules": { + "max-len": 0, + "max-statements": 0 + } } diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..31627b0 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,75 @@ +name: dev +on: + pull_request: + push: + branches: + - master + - main +env: + CI: true + +jobs: + prettier: + name: Format code + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prettier + uses: gulpjs/prettier_action@v3.0 + with: + commit_message: 'chore: Run prettier' + prettier_options: '--write .' + + test: + name: Tests for Node ${{ matrix.node }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node: [10, 12, 14, 16] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - name: Set Node.js version + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - run: node --version + - run: npm --version + + - name: Install npm dependencies + run: npm install + + - name: Run lint + run: npm run lint + + - name: Run tests + run: npm test + + - name: Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + flag-name: ${{ matrix.os }}-node-${{ matrix.node }} + parallel: true + + coveralls: + needs: test + name: Finish up + + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8a10ce3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: release +on: + push: + branches: + - master + - main + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: GoogleCloudPlatform/release-please-action@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + release-type: node + package-name: release-please-action + bump-minor-pre-major: true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c96ebe0 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +coverage/ +.nyc_output/ +CHANGELOG.md diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eda5b00..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -sudo: false -language: node_js -node_js: - - '12' - - '10' - - '8' - - '6' - - '4' - - '0.12' - - '0.10' -after_script: - - npm run coveralls diff --git a/LICENSE b/LICENSE index 538c116..509ce71 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016, 2017, 2018 Blaine Bublitz and Eric Schoffstall +Copyright (c) 2016, 2017, 2018, 2021 Blaine Bublitz and Eric Schoffstall Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b4205c2..2df4576 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # fined -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] Find a file given a declaration of locations. @@ -64,21 +64,15 @@ This function returns a plain object which consists of following properties if a MIT -[downloads-image]: https://img.shields.io/npm/dm/fined.svg + +[downloads-image]: https://img.shields.io/npm/dm/fined.svg?style=flat-square [npm-url]: https://www.npmjs.com/package/fined -[npm-image]: https://img.shields.io/npm/v/fined.svg +[npm-image]: https://img.shields.io/npm/v/fined.svg?style=flat-square -[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=7&branchName=master -[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/fined?branchName=master - -[travis-url]: https://travis-ci.org/gulpjs/fined -[travis-image]: https://img.shields.io/travis/gulpjs/fined.svg?label=travis-ci - -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/fined -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/fined.svg?label=appveyor +[ci-url]: https://github.com/gulpjs/fined/actions?query=workflow:dev +[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/fined/dev?style=flat-square [coveralls-url]: https://coveralls.io/r/gulpjs/fined [coveralls-image]: https://img.shields.io/coveralls/gulpjs/fined/master.svg + -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 47b3ca2..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# http://www.appveyor.com/docs/appveyor-yml -# http://www.appveyor.com/docs/lang/nodejs-iojs - -environment: - matrix: - # node.js - - nodejs_version: "0.10" - - nodejs_version: "0.12" - - nodejs_version: "4" - - nodejs_version: "6" - - nodejs_version: "8" - - nodejs_version: "10" - - nodejs_version: "12" - -platform: - - x86 - - x64 - -install: - # https://www.appveyor.com/docs/lang/nodejs-iojs/#installing-any-version-of-nodejs-or-iojs - - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM - - npm install - -test_script: - - node --version - - npm --version - - cmd: npm test - -build: off - -# build version format -version: "{build}" diff --git a/index.js b/index.js index 1a66ab2..efd8863 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ var fs = require('fs'); var path = require('path'); -var isPlainObject = require('is-plain-object'); +var isPlainObject = require('is-plain-object').isPlainObject; var pick = require('object.pick'); var defaults = require('object.defaults/immutable'); var expandTilde = require('expand-tilde'); @@ -59,8 +59,7 @@ function expandPath(pathObj, defaultObj) { filePath = filePath.slice(parsed.root.length); findUp = false; basedir = parsed.root; - /* istanbul ignore if */ - } else if (parsed.root) { // Expanded path has a drive letter on Windows. + } else /* istanbul ignore next */ if (parsed.root) { // Expanded path has a drive letter on Windows. filePath = filePath.slice(parsed.root.length); basedir = path.resolve(parsed.root); } diff --git a/package.json b/package.json index 4ab5e72..b285748 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "repository": "gulpjs/fined", "license": "MIT", "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" }, "main": "index.js", "files": [ @@ -20,24 +20,31 @@ "scripts": { "lint": "eslint .", "pretest": "npm run lint", - "test": "nyc mocha --async-only", - "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", - "coveralls": "nyc report --reporter=text-lcov | coveralls" + "test": "nyc mocha --async-only" }, "dependencies": { "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", + "is-plain-object": "^5.0.0", "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" + "object.pick": "^1.3.0", + "parse-filepath": "^1.0.2" }, "devDependencies": { - "coveralls": "github:phated/node-coveralls#2.x", - "eslint": "^2.13.1", - "eslint-config-gulp": "^3.0.1", - "expect": "^1.20.2", - "mocha": "^3.5.3", - "nyc": "^10.3.2" + "eslint": "^7.32.0", + "eslint-config-gulp": "^5.0.1", + "eslint-plugin-node": "^11.1.0", + "expect": "^27.3.1", + "mocha": "^8.4.0", + "nyc": "^15.1.0" + }, + "nyc": { + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": { + "singleQuote": true }, "keywords": [ "find", diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index 06b940f..0000000 --- a/test/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "gulp/test" -} diff --git a/test/index.js b/test/index.js index d728ec9..adfb663 100644 --- a/test/index.js +++ b/test/index.js @@ -1231,7 +1231,7 @@ describe('Properties: `extensions`', function() { var expected = { path: path.resolve(cwd, 'test/fixtures/fined', 'app.js'), - extension: '.js', + extension: new String('.js'), }; var result = fined(pathObj, defaultObj); @@ -1622,6 +1622,12 @@ describe('Symbolic links', function() { }); it('returns symlink path when found link points to a directory', function(done) { + // Fail on Windows and Node v10,v11, because of: + // https://github.com/nodejs/node/pull/23724 + if (isWindows && ['v10','v11'].includes(process.version.split('.')[0])) { + this.skip(); + } + var pathObj = { path: '.', name: symlinkedFiles[4].name, @@ -1723,6 +1729,12 @@ describe('Symbolic links', function() { }); it('returns symlink path during findUp when symlink points to a directory', function(done) { + // Fail on Windows and Node v10,v11, because of: + // https://github.com/nodejs/node/pull/23724 + if (isWindows && ['v10','v11'].includes(process.version.split('.')[0])) { + this.skip(); + } + var pathObj = { path: path.basename(symlinkedFiles[4].dir), name: symlinkedFiles[4].name,