diff --git a/.github/funding.yml b/.github/funding.yml index 1a630e9..d75846b 100644 --- a/.github/funding.yml +++ b/.github/funding.yml @@ -1,3 +1,4 @@ github: sindresorhus open_collective: sindresorhus +tidelift: npm/gulp-chmod custom: https://sindresorhus.com/donate diff --git a/.github/security.md b/.github/security.md new file mode 100644 index 0000000..5358dc5 --- /dev/null +++ b/.github/security.md @@ -0,0 +1,3 @@ +# Security Policy + +To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..18531b3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,23 @@ +name: CI +on: + - push + - pull_request +jobs: + test: + name: Node.js ${{ matrix.node-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: + - 14 + - 12 + - 10 + - 8 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f98fed0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '12' - - '10' - - '8' diff --git a/index.js b/index.js index 4022188..3e00617 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ 'use strict'; const through = require('through2'); -const deepAssign = require('deep-assign'); +const merge = require('lodash.merge'); const Mode = require('stat-mode'); const defaultMode = 0o777 & (~process.umask()); @@ -55,7 +55,7 @@ module.exports = (fileMode, directoryMode) => { if (typeof currentMode === 'object') { const statMode = new Mode(file.stat); - deepAssign(statMode, normalize(currentMode)); + merge(statMode, normalize(currentMode)); file.stat.mode = statMode.stat.mode; } else { file.stat.mode = currentMode; diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 2b4593c..192288c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { "node": ">=8" @@ -28,12 +28,12 @@ "permissions" ], "dependencies": { - "deep-assign": "^1.0.0", - "stat-mode": "^0.3.0", + "lodash.merge": "^4.6.2", + "stat-mode": "^1.0.0", "through2": "^3.0.1" }, "devDependencies": { - "mocha": "^6.1.4", + "mocha": "^6.2.0", "vinyl": "^2.1.0", "xo": "^0.24.0" } diff --git a/readme.md b/readme.md index dae407a..fab5f3e 100644 --- a/readme.md +++ b/readme.md @@ -1,22 +1,20 @@ -# gulp-chmod [![Build Status](https://travis-ci.org/sindresorhus/gulp-chmod.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-chmod) +# gulp-chmod > [Change permissions](https://en.wikipedia.org/wiki/Chmod) of [Vinyl](https://github.com/gulpjs/vinyl) files - ## Install +```sh +npm install --save-dev gulp-chmod ``` -$ npm install --save-dev gulp-chmod -``` - ## Usage ```js -const gulp = require('gulp'); -const chmod = require('gulp-chmod'); +import gulp from 'gulp'; +import chmod from 'gulp-chmod'; -gulp.task('default', () => +export default () => ( gulp.src('src/app.js') .pipe(chmod(0o755)) .pipe(gulp.dest('dist')) @@ -26,10 +24,10 @@ gulp.task('default', () => or ```js -const gulp = require('gulp'); -const chmod = require('gulp-chmod'); +import gulp from 'gulp'; +import chmod from 'gulp-chmod'; -gulp.task('default', () => +export default () => ( gulp.src('src/app.js') .pipe(chmod({ owner: { @@ -48,16 +46,15 @@ gulp.task('default', () => ); ``` - ## API -### chmod(fileMode, [directoryMode]) +### chmod(fileMode, directoryMode?) #### fileMode Type: `number | object` -Can either be a [chmod](http://ss64.com/bash/chmod.html) octal number or an object with the individual permissions specified. +Can either be a [chmod](https://ss64.com/bash/chmod.html) octal number or an object with the individual permissions specified. Values depends on the current file, but these are the possible keys: @@ -99,19 +96,18 @@ Same as `fileMode`, but applies to directories. Specify `true` to use the same value as `fileMode`. - ## Tip Combine it with [gulp-filter](https://github.com/sindresorhus/gulp-filter) to only change permissions on a subset of the files. ```js -const gulp = require('gulp'); -const gFilter = require('gulp-filter'); -const chmod = require('gulp-chmod'); +import gulp from 'gulp'; +import chmod from 'gulp-chmod'; +import gulpFilter from 'gulp-filter'; -const filter = gFilter('src/cli.js', {restore: true}); +const filter = gulpFilter('src/cli.js', {restore: true}); -gulp.task('default', () => +export default = () => ( gulp.src('src/*.js') // Filter a subset of the files .pipe(filter) @@ -123,7 +119,6 @@ gulp.task('default', () => ); ``` - ## Related - [gulp-chown](https://github.com/sindresorhus/gulp-chown) - Change owner of Vinyl files