Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

Commit

Permalink
fix: do not compile anything
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Oct 2, 2019
1 parent a825e9c commit 67f21c3
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -22,7 +21,8 @@
}
},
"files": [
"dist"
"src",
"!__tests__"
],
"keywords": [
"cross-environment",
Expand All @@ -32,7 +32,6 @@
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.6.2",
"cross-spawn": "^7.0.0"
},
"devDependencies": {
Expand All @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/command.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/is-windows.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isWindows from '../is-windows'
const isWindows = require('../is-windows')

const {
platform,
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/variable.js
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
6 changes: 3 additions & 3 deletions src/command.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/is-windows.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export default () =>
module.exports = () =>
process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE)
6 changes: 4 additions & 2 deletions src/variable.js
Original file line number Diff line number Diff line change
@@ -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:."
Expand Down Expand Up @@ -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))
}

2 comments on commit 67f21c3

@Valentin1918
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you did it?

@kentcdodds
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really need to. The only feature we needed to compile was esmodules and we don't get a lot of benefit by using them. And by removing them, we can remove @babel/runtime as a dependency :)

Please sign in to comment.