Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

replace-in-file

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

replace-in-file - npm Package Compare versions

Comparing version 5.0.2 to 6.0.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 6.0.0
From version 6.0.0 onwards, replace in file requires Node 10 or higher. If you need support for Node 8, please use version 5.x.x.
## 5.0.0

@@ -2,0 +5,0 @@ From version 5.0.0 onwards, replace in file requires Node 8 or higher. If you need support for Node 6, please use version 4.x.x.

@@ -68,3 +68,3 @@ 'use strict';

*/
replaceInFile.sync = function(config) {
function replaceInFileSync(config) {

@@ -88,3 +88,7 @@ //Parse config

replaceInFile.replaceInFile = replaceInFile; // Self-reference to support named import
replaceInFile.replaceInFileSync = replaceInFileSync;
replaceInFile.sync = replaceInFileSync;
//Export
module.exports = replaceInFile;

@@ -6,3 +6,3 @@ 'use strict';

*/
const replace = require('./replace-in-file');
import replace, {sync, replaceInFile, replaceInFileSync} from './replace-in-file'
const fs = require('fs');

@@ -1155,2 +1155,20 @@ const writeFile = Promise.promisify(fs.writeFile);

});
describe('module export', () => {
it('default module export refers to async replace implementation', () => {
expect(replace).to.be.a('function');
});
it('exports named replaceInFile, replaceInFileSync and sync from module facade', () => {
expect(replaceInFile).to.be.a('function');
expect(replaceInFileSync).to.be.a('function');
expect(sync).to.be.a('function');
});
it('exposes inner functions as own fields of replace', () => {
expect(replace.replaceInFile).to.equal(replace);
expect(replace.sync).to.equal(replaceInFileSync);
expect(replace.replaceInFileSync).to.equal(replaceInFileSync);
});
})
});

11

package.json
{
"name": "replace-in-file",
"version": "5.0.2",
"version": "6.0.0",
"description": "A simple utility to quickly replace text in one or more files.",

@@ -28,2 +28,5 @@ "homepage": "https://github.com/adamreisnz/replace-in-file#readme",

"types": "./types/index.d.ts",
"engines": {
"node": ">=10"
},
"scripts": {

@@ -36,5 +39,5 @@ "istanbul": "babel-node ./node_modules/istanbul/lib/cli cover ./node_modules/mocha/bin/_mocha lib/**/*.spec.js",

"dependencies": {
"chalk": "^3.0.0",
"chalk": "^4.0.0",
"glob": "^7.1.6",
"yargs": "^15.0.2"
"yargs": "^15.3.1"
},

@@ -49,3 +52,3 @@ "devDependencies": {

"istanbul": "^1.0.0-alpha.2",
"mocha": "^6.2.2"
"mocha": "^7.1.1"
},

@@ -52,0 +55,0 @@ "browserify": {

@@ -17,7 +17,7 @@ # Replace in file

> As the name implies, we offer an [all-in-one club management solution](https://helloclub.com/?source=npm) complete with booking system, membership renewals, online payments and even an integrated access control system.
> As the name implies, we offer an [all-in-one club and membership management solution](https://helloclub.com/?source=npm) complete with booking system, automated membership renewals, online payments and integrated access and light control.
> Clubs that have switched to Hello Club have been saving so much time managing their members and finances, and the members themselves really enjoy using it, with overwhelmingly positive feedback.
> If you belong to any kind of club (not just a sports club), or if you know someone who is a member or helps run a club, it'd be much appreciated if you could spare a minute to point them in [our direction](https://helloclub.com/?source=npm)!
> Check us out if you belong to any kind of club or if you know someone who helps run a club!

@@ -438,2 +438,2 @@ > Thank you so much for your time, now go and replace some data in your files! πŸŽ‰

Copyright 2015-2019, [Adam Reis](https://adam.reis.nz), Co-founder at [Hello Club](https://helloclub.com/?source=npm)
Copyright 2015-2020, Adam Reis, Co-founder at [Hello Club](https://helloclub.com/?source=npm)
declare module 'replace-in-file' {
function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
export function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
export function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
export default replaceInFile;

@@ -9,9 +9,18 @@

export function sync(config: ReplaceInFileConfig): ReplaceResult[];
export function replaceInFileSync(config: ReplaceInFileConfig): ReplaceResult[];
export function replaceInFile(config: ReplaceInFileConfig): Promise<ReplaceResult[]>;
export function replaceInFile(config: ReplaceInFileConfig, cb: (error: Error, results: ReplaceResult[]) => void): void;
}
export function sync(config: ReplaceInFileConfig): ReplaceResult[];
export function replaceInFileSync(config: ReplaceInFileConfig): ReplaceResult[];
export type From = string | RegExp | FromCallback;
export type To = string | ToCallback;
export interface ReplaceInFileConfig {
files: string | string[];
ignore?: string | string[];
from: string | RegExp | string[] | RegExp[] | FromCallback;
to: string | string[] | ToCallback;
from: From | Array<From>;
to: To | Array<To>;
countMatches?: boolean;

@@ -18,0 +27,0 @@ allowEmptyPaths?: boolean,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc