From 1250667cb3f2adeb8546ef3088d8d053ad26d456 Mon Sep 17 00:00:00 2001 From: Oded Niv Date: Tue, 16 Jan 2018 13:36:19 +0200 Subject: [PATCH 1/2] use 'coffeescript' package --- lib/moduleEnv.js | 13 +++++++++++-- package-lock.json | 8 ++++---- package.json | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js index a9f410a..2f9743c 100644 --- a/lib/moduleEnv.js +++ b/lib/moduleEnv.js @@ -89,6 +89,10 @@ function jsExtension(module, filename) { } function coffeeExtension(module, filename) { + if (!coffee) { + throw new Error("please add 'coffeescript' to your devDependencies"); + } + var content = stripBOM(fs.readFileSync(filename, "utf8")); restoreExtensions(); @@ -113,9 +117,14 @@ function stripBOM(content) { } try { - coffee = require("coffee-script"); + coffee = require("coffeescript"); } catch (err) { - // We are not able to provide coffee-script support, but that's ok as long as the user doesn't want it. + try { + // Trying to load deprecated package + coffee = require("coffee-script"); + } catch (err) { + // We are not able to provide coffee-script support, but that's ok as long as the user doesn't want it. + } } exports.load = load; diff --git a/package-lock.json b/package-lock.json index 7cbcd08..a84273a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -238,10 +238,10 @@ } } }, - "coffee-script": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.12.7.tgz", - "integrity": "sha512-fLeEhqwymYat/MpTPUjSKHVYYl0ec2mOyALEMLmzr5i1isuG+6jfI2j2d5oBO3VIzgUXgBVIcOT9uH1TFxBckw==", + "coffeescript": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-2.1.1.tgz", + "integrity": "sha512-Tl2z6/rNMqJ2LqWlVxLKwLF9FniwJpweonfSLCwhX8NFCEsGBcFIErtfKd8+t4XHDSYRshj9FXxPX53BT3lC9w==", "dev": true }, "commander": { diff --git a/package.json b/package.json index 1079122..a3b58c7 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "url": "git://github.com/jhnns/rewire.git" }, "devDependencies": { - "coffee-script": "^1.8.0", + "coffeescript": "^2.1.1", "expect.js": "^0.3.1", "mocha": "^4.0.1" }, From b0a287097865721d1f22a7bf8f61d2cb2e16ad10 Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Tue, 10 Apr 2018 00:39:55 +0200 Subject: [PATCH 2/2] Fix wrong badge link in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8a589d..db80abb 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ rewire [![](https://img.shields.io/npm/v/rewire.svg)](https://www.npmjs.com/package/rewire) [![](https://img.shields.io/npm/dm/rewire.svg)](https://www.npmjs.com/package/rewire) [![Dependency Status](https://david-dm.org/jhnns/rewire.svg)](https://david-dm.org/jhnns/rewire) -[![Build Status](https://travis-ci.org/jhnns/rewire.svg?branch=master)](https://travis-ci.org/rewire/jhnns) +[![Build Status](https://travis-ci.org/jhnns/rewire.svg?branch=master)](https://travis-ci.org/jhnns/rewire) [![Coverage Status](https://img.shields.io/coveralls/jhnns/rewire.svg)](https://coveralls.io/r/jhnns/rewire?branch=master) rewire adds a special setter and getter to modules so you can modify their behaviour for better unit testing. You may