-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6f9d3ab
Showing
12 changed files
with
5,085 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": [ "env", "stage-1" ] | ||
} |
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,24 @@ | ||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
dist | ||
|
||
# IDEs and editors | ||
/.idea | ||
/.vscode | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
Thumbs.db | ||
|
||
*.log |
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,17 @@ | ||
Lerna and Yarn Workspaces Concepts | ||
================================== | ||
This is an example to demonstrate Lerna and Yarn Workspaces concepts. | ||
|
||
Getting Started | ||
--------------- | ||
```bash | ||
$ yarn | ||
$ yarn build | ||
$ yarn start | ||
``` | ||
|
||
Testing | ||
------- | ||
```bash | ||
$ yarn 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,9 @@ | ||
{ | ||
"lerna": "2.9.0", | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "independent", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true | ||
} |
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,43 @@ | ||
{ | ||
"name": "lerna-workspaces-concepts", | ||
"description": "Example to demonstrate Lerna and Yarn Workspaces concepts", | ||
"version": "1.0.0", | ||
"private": true, | ||
"author": "Naresh Bhatia", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/nareshbhatia/lerna-workspaces-concepts.git" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"del-dist": "lerna exec --parallel -- del-cli dist", | ||
"prebuild": "yarn del-dist", | ||
"build": "lerna exec -- babel src -d dist --ignore test.js", | ||
"start": "node packages/weather-app/dist/weather-app" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^22.4.3", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-1": "^6.24.1", | ||
"del-cli": "^1.1.0", | ||
"jest": "^22.4.3", | ||
"lerna": "^2.9.0" | ||
}, | ||
"jest": { | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 90, | ||
"functions": 95, | ||
"lines": 95, | ||
"statements": 95 | ||
} | ||
}, | ||
"collectCoverage": true | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"name": "temp-utils", | ||
"description": "Temperature utilities", | ||
"version": "1.0.0", | ||
"author": "Naresh Bhatia", | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"dependencies": { | ||
"lodash": "^4.17.5" | ||
} | ||
} |
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 { c2f, f2c, average } from './temp-utils'; |
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,16 @@ | ||
import reduce from 'lodash/reduce'; | ||
|
||
export function c2f(c) { | ||
return c * 1.8 + 32; | ||
} | ||
|
||
export function f2c(f) { | ||
return (f - 32) / 1.8; | ||
} | ||
|
||
export function average(temps) { | ||
const sum = reduce(temps, function(sum, temp) { | ||
return sum + temp; | ||
}, 0); | ||
return sum / temps.length; | ||
} |
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,13 @@ | ||
import { c2f, f2c, average } from './temp-utils'; | ||
|
||
test('converts 100 centigrade to 212 fahrenheit', () => { | ||
expect(c2f(100)).toBe(212); | ||
}); | ||
|
||
test('converts 212 fahrenheit to 100 centigrade', () => { | ||
expect(f2c(212)).toBe(100); | ||
}); | ||
|
||
test('calculates the average of [10, 20, 30] as 20', () => { | ||
expect(average([10, 20, 30])).toBe(20); | ||
}); |
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,11 @@ | ||
{ | ||
"name": "weather-app", | ||
"description": "Weather App", | ||
"version": "1.0.0", | ||
"author": "Naresh Bhatia", | ||
"license": "MIT", | ||
"main": "weather-app.js", | ||
"dependencies": { | ||
"temp-utils": "^1.0.0" | ||
} | ||
} |
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 @@ | ||
import { c2f, f2c, average } from 'temp-utils'; | ||
|
||
console.log(`100 degrees C = ${c2f(100)} degrees F`); | ||
console.log(`212 degrees F = ${f2c(212)} degrees C`); | ||
console.log(`average of [10, 20, 30] = ${average([10, 20, 30])}`); |
Oops, something went wrong.