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

Commit 5a6e3b8

Browse files
thomasthiebaudKent C. Dodds
authored and
Kent C. Dodds
committed
fix(module): Add export for commonjs (#88)
* fix(module): Add export for commonjs Add commonjs export, so it is possible to require crossEnv using `require('cross-env')` (needed to use in js script without babel) 84 * fix(module): Only export crossEnv using commonjs
1 parent d09dea5 commit 5a6e3b8

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

.all-contributorsrc

+11
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@
8181
"code",
8282
"test"
8383
]
84+
},
85+
{
86+
"login": "thomasthiebaud",
87+
"name": "Thiebaud Thomas",
88+
"avatar_url": "https://avatars0.githubusercontent.com/u/3715715?v=3",
89+
"profile": "https://github.com/thomasthiebaud",
90+
"contributions": [
91+
"bug",
92+
"code",
93+
"test"
94+
]
8495
}
8596
]
8697
}

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Run scripts that set and use environment variables across platforms
1010
[![downloads][downloads-badge]][npm-stat]
1111

1212
[![MIT License][license-badge]][LICENSE]
13-
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
13+
[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)
1414
[![PRs Welcome][prs-badge]][prs]
1515
[![Donate][donate-badge]][donate]
1616
[![Code of Conduct][coc-badge]][coc]
@@ -102,8 +102,9 @@ much easier for windows users.
102102
Thanks goes to these people ([emoji key][emojis]):
103103

104104
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
105-
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) | [<img src="https://avatars1.githubusercontent.com/u/499038?v=3" width="100px;"/><br /><sub>Ya Zhuang </sub>](https://zhuangya.me)<br />🔌 [📖](https://github.com/kentcdodds/cross-env/commits?author=zhuangya) | [<img src="https://avatars3.githubusercontent.com/u/3440094?v=3" width="100px;"/><br /><sub>James Harris</sub>](https://wopian.me)<br />[📖](https://github.com/kentcdodds/cross-env/commits?author=wopian) | [<img src="https://avatars1.githubusercontent.com/u/8941730?v=3" width="100px;"/><br /><sub>compumike08</sub>](https://github.com/compumike08)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Acompumike08) [📖](https://github.com/kentcdodds/cross-env/commits?author=compumike08) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=compumike08) | [<img src="https://avatars1.githubusercontent.com/u/2270425?v=3" width="100px;"/><br /><sub>Daniel Rodríguez Rivero</sub>](https://github.com/danielo515)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Adanielo515) [💻](https://github.com/kentcdodds/cross-env/commits?author=danielo515) [📖](https://github.com/kentcdodds/cross-env/commits?author=danielo515) | [<img src="https://avatars2.githubusercontent.com/u/1508477?v=3" width="100px;"/><br /><sub>Jonas Keinholz</sub>](https://github.com/inyono)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ainyono) [💻](https://github.com/kentcdodds/cross-env/commits?author=inyono) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=inyono) | [<img src="https://avatars3.githubusercontent.com/u/1656170?v=3" width="100px;"/><br /><sub>Hugo Wood</sub>](https://github.com/hgwood/blog)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ahgwood) [💻](https://github.com/kentcdodds/cross-env/commits?author=hgwood) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=hgwood) |
105+
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) [📖](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) 🚇 [⚠️](https://github.com/kentcdodds/cross-env/commits?author=kentcdodds) | [<img src="https://avatars1.githubusercontent.com/u/499038?v=3" width="100px;"/><br /><sub>Ya Zhuang </sub>](https://zhuangya.me)<br />🔌 [📖](https://github.com/kentcdodds/cross-env/commits?author=zhuangya) | [<img src="https://avatars3.githubusercontent.com/u/3440094?v=3" width="100px;"/><br /><sub>James Harris</sub>](https://wopian.me)<br />[📖](https://github.com/kentcdodds/cross-env/commits?author=wopian) | [<img src="https://avatars1.githubusercontent.com/u/8941730?v=3" width="100px;"/><br /><sub>compumike08</sub>](https://github.com/compumike08)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Acompumike08) [📖](https://github.com/kentcdodds/cross-env/commits?author=compumike08) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=compumike08) | [<img src="https://avatars1.githubusercontent.com/u/2270425?v=3" width="100px;"/><br /><sub>Daniel Rodríguez Rivero</sub>](https://github.com/danielo515)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Adanielo515) [💻](https://github.com/kentcdodds/cross-env/commits?author=danielo515) [📖](https://github.com/kentcdodds/cross-env/commits?author=danielo515) | [<img src="https://avatars2.githubusercontent.com/u/1508477?v=3" width="100px;"/><br /><sub>Jonas Keinholz</sub>](https://github.com/inyono)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ainyono) [💻](https://github.com/kentcdodds/cross-env/commits?author=inyono) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=inyono) | [<img src="https://avatars3.githubusercontent.com/u/1656170?v=3" width="100px;"/><br /><sub>Hugo Wood</sub>](https://github.com/hgwood)<br />[🐛](https://github.com/kentcdodds/cross-env/issues?q=author%3Ahgwood) [💻](https://github.com/kentcdodds/cross-env/commits?author=hgwood) [⚠️](https://github.com/kentcdodds/cross-env/commits?author=hgwood) |
106106
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
107+
| [<img src="https://avatars0.githubusercontent.com/u/3715715?v=3" width="100px;"/><br /><sub>Thiebaud Thomas</sub>](https://github.com/thomasthiebaud)<br /> |
107108
<!-- ALL-CONTRIBUTORS-LIST:END -->
108109

109110
This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome!

src/bin/cross-env.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import crossEnv from '../'
3+
const crossEnv = require('..')
44

55
crossEnv(process.argv.slice(2))

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {spawn} from 'cross-spawn'
22
import commandConvert from './command'
33

4-
export default crossEnv
4+
module.exports = crossEnv
55

66
const envSetterRegex = /(\w+)=('(.+)'|"(.+)"|(.+))/
77

src/index.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import crossSpawnMock from 'cross-spawn'
2-
import crossEnv from '.'
2+
3+
const crossEnv = require('.')
34

45
beforeEach(() => {
56
crossSpawnMock.__mock.reset()

0 commit comments

Comments
 (0)