diff --git a/package.json b/package.json index 3438682..644eef1 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,15 @@ "name": "cross-env", "version": "0.0.0-semantically-released", "description": "Run scripts that set and use environment variables across platforms", - "main": "dist/index.js", + "main": "src/index.js", "bin": { - "cross-env": "dist/bin/cross-env.js", - "cross-env-shell": "dist/bin/cross-env-shell.js" + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" }, "engines": { "node": ">=8.0" }, "scripts": { - "build": "kcd-scripts build", "lint": "kcd-scripts lint", "test": "kcd-scripts test", "validate": "kcd-scripts validate" @@ -22,7 +21,8 @@ } }, "files": [ - "dist" + "src", + "!__tests__" ], "keywords": [ "cross-environment", @@ -32,7 +32,6 @@ "author": "Kent C. Dodds (http://kentcdodds.com/)", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.6.2", "cross-spawn": "^7.0.0" }, "devDependencies": { @@ -41,11 +40,10 @@ "eslintConfig": { "extends": "./node_modules/kcd-scripts/eslint.js" }, - "eslintIgnore": [ - "node_modules", - "coverage", - "dist" - ], + "// babel 1": "this disables all built-in plugins from kcd-scripts for tests", + "// babel 2": "that way we ensure that the tests run without compilation", + "// babel 3": "because this module is published as-is. It is not compiled.", + "babel": {}, "repository": { "type": "git", "url": "https://github.com/kentcdodds/cross-env.git" diff --git a/src/__tests__/command.js b/src/__tests__/command.js index 8c6ce12..bc96359 100644 --- a/src/__tests__/command.js +++ b/src/__tests__/command.js @@ -1,5 +1,5 @@ -import isWindowsMock from '../is-windows' -import commandConvert from '../command' +const isWindowsMock = require('../is-windows') +const commandConvert = require('../command') jest.mock('../is-windows') diff --git a/src/__tests__/index.js b/src/__tests__/index.js index e1b582b..0d5abae 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -1,5 +1,5 @@ -import crossSpawnMock from 'cross-spawn' -import isWindowsMock from '../is-windows' +const crossSpawnMock = require('cross-spawn') +const isWindowsMock = require('../is-windows') jest.mock('../is-windows') jest.mock('cross-spawn') diff --git a/src/__tests__/is-windows.js b/src/__tests__/is-windows.js index d57d7ee..2282765 100644 --- a/src/__tests__/is-windows.js +++ b/src/__tests__/is-windows.js @@ -1,4 +1,4 @@ -import isWindows from '../is-windows' +const isWindows = require('../is-windows') const { platform, diff --git a/src/__tests__/variable.js b/src/__tests__/variable.js index 313041e..4be7457 100644 --- a/src/__tests__/variable.js +++ b/src/__tests__/variable.js @@ -1,5 +1,5 @@ -import isWindowsMock from '../is-windows' -import varValueConvert from '../variable' +const isWindowsMock = require('../is-windows') +const varValueConvert = require('../variable') jest.mock('../is-windows') diff --git a/src/command.js b/src/command.js index af28f82..36100a5 100644 --- a/src/command.js +++ b/src/command.js @@ -1,7 +1,7 @@ -import path from 'path' -import isWindows from './is-windows' +const path = require('path') +const isWindows = require('./is-windows') -export default commandConvert +module.exports = commandConvert /** * Converts an environment variable usage to be appropriate for the current OS diff --git a/src/index.js b/src/index.js index 2f13e2f..d9bd227 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -import {spawn} from 'cross-spawn' -import commandConvert from './command' -import varValueConvert from './variable' +const {spawn} = require('cross-spawn') +const commandConvert = require('./command') +const varValueConvert = require('./variable') module.exports = crossEnv diff --git a/src/is-windows.js b/src/is-windows.js index 414598f..a82f47b 100644 --- a/src/is-windows.js +++ b/src/is-windows.js @@ -1,2 +1,2 @@ -export default () => +module.exports = () => process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE) diff --git a/src/variable.js b/src/variable.js index ff14c0c..1848a58 100644 --- a/src/variable.js +++ b/src/variable.js @@ -1,7 +1,9 @@ -import isWindows from './is-windows' +const isWindows = require('./is-windows') const pathLikeEnvVarWhitelist = new Set(['PATH', 'NODE_PATH']) +module.exports = varValueConvert + /** * This will transform UNIX-style list values to Windows-style. * For example, the value of the $PATH variable "/usr/bin:/usr/local/bin:." @@ -62,6 +64,6 @@ function resolveEnvVars(varValue) { * @param {String} originalName Original name of the env variable * @returns {String} Converted value */ -export default function varValueConvert(originalValue, originalName) { +function varValueConvert(originalValue, originalName) { return resolveEnvVars(replaceListDelimiters(originalValue, originalName)) }