This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added examples to the main repo and added tests steps making sure the…
…y work (#23) * docs: Added examples to the main repo and added tests steps making sure they work * doc: Removed examples * docs: Added back examples folder * Change to travis to build master only
- Loading branch information
1 parent
08a43e2
commit f07d3fe
Showing
19 changed files
with
128 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ indent_size = 4 | |
end_of_line = lf | ||
charset = utf-8 | ||
|
||
[package.json] | ||
[package.json,.yml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Examples for babel-plugin-webpack-alias | ||
|
||
This is there to demonstrate how to use [`babel-plugin-webpack-alias`](https://github.com/trayio/babel-plugin-webpack-alias) with popular testing frameworks. | ||
|
||
These examples are as minimal as possible, they work just by running the command: | ||
```console | ||
$ npm install && npm test | ||
``` | ||
|
||
If your own configuration of [`babel-plugin-webpack-alias`](https://github.com/trayio/babel-plugin-webpack-alias) doesn't work, you can clone this repo and play with the examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"presets": ["es2015"], | ||
"plugins": [ | ||
["webpack-alias", {"config": "${PWD}/webpack.config.js"}] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Just run: | ||
|
||
```console | ||
$ npm install && npm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import sum from 'alias/sum'; | ||
|
||
export default num => sum(num, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default (a, b) => a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "babel-plugin-webpack-alias-ava", | ||
"version": "1.0.0", | ||
"description": "babel-plugin-webpack-alias example with AVA", | ||
"scripts": { | ||
"test": "PWD=$(pwd) ava" | ||
}, | ||
"keywords": [], | ||
"author": "Adrien Antoine <[email protected]> (http://tray.io)", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"ava": "^0.16.0", | ||
"babel-plugin-webpack-alias": "../..", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-register": "^6.14.0" | ||
}, | ||
"ava": { | ||
"require": [ | ||
"babel-register" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import add10 from '../add10'; | ||
import test from 'ava'; | ||
|
||
test('should test add10 without errors', t => { | ||
t.is(add10(5), 15); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
resolve: { | ||
alias: { | ||
'alias': path.join(__dirname, 'deep/folder/alias'), | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["es2015"], | ||
"plugins": ["webpack-alias"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Just run: | ||
|
||
```console | ||
$ npm install && npm test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import sum from 'alias/sum'; | ||
|
||
export default num => sum(num, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default (a, b) => a + b; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "babel-plugin-webpack-alias-mocha", | ||
"version": "1.0.0", | ||
"description": "babel-plugin-webpack-alias example with mocha", | ||
"scripts": { | ||
"test": "mocha --compilers js:babel-register" | ||
}, | ||
"keywords": [], | ||
"author": "Adrien Antoine <[email protected]> (http://tray.io)", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"babel-plugin-webpack-alias": "../..", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-register": "^6.14.0", | ||
"chai": "^3.5.0", | ||
"mocha": "^3.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import add10 from '../add10'; | ||
import { expect } from 'chai'; | ||
|
||
describe('alias test', () => { | ||
it('should test add10 without errors', () => { | ||
expect(add10(5)).to.equal(15); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var path = require('path'); | ||
|
||
module.exports = { | ||
resolve: { | ||
alias: { | ||
'alias': path.join(__dirname, 'deep/folder/alias'), | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters