Skip to content

Commit 508041b

Browse files
Docs & scripts
- Created CONTRIBUTING.md - Updated README.md - Added package.json scripts
1 parent 6a60715 commit 508041b

File tree

3 files changed

+75
-14
lines changed

3 files changed

+75
-14
lines changed

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contribution
2+
3+
# Git Flow
4+
5+
The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches.
6+
Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch.
7+
8+
# Pull request
9+
10+
Target your pull request on `develop` branch. Other pull request won't be accepted.
11+
12+
# How to build
13+
14+
1. Clone
15+
16+
2. Run
17+
18+
```sh
19+
npm install
20+
```
21+
22+
3. Run
23+
24+
```sh
25+
npm run build
26+
```
27+
28+
4. Check `build` folder

README.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Modularized port of googlecode project crypto-js.
55
## Node.js (Install)
66

77
Requirements:
8-
* Node.js
9-
* npm (Node.js package manager)
8+
9+
- Node.js
10+
- npm (Node.js package manager)
1011

1112
```bash
1213
npm install crypto-js
@@ -15,6 +16,7 @@ npm install crypto-js
1516
### Usage
1617

1718
Modular include:
19+
1820
```javascript
1921
var AES = require("crypto-js/aes");
2022
var SHA256 = require("crypto-js/sha256");
@@ -23,29 +25,67 @@ console.log(SHA256("Message"));
2325
```
2426

2527
Including all libraries, for access to extra methods:
28+
2629
```javascript
2730
var CryptoJS = require("crypto-js");
2831
console.log(CryptoJS.HmacSHA1("Message", "Key"));
2932
```
3033

3134
## Client (browser)
3235

36+
Requirements:
37+
38+
- Node.js
39+
- Bower (package manager for frontend)
40+
41+
```bash
42+
bower install crypto-js
43+
```
44+
3345
### Usage
3446

3547
Modular include:
48+
3649
```javascript
50+
require.config({
51+
packages: [
52+
{
53+
name: 'crypto-js',
54+
location: 'path-to/bower_components/crypto-js',
55+
main: 'index'
56+
}
57+
]
58+
});
59+
3760
require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) {
3861
console.log(SHA256("Message"));
3962
});
4063
```
4164

4265
Including all libraries, for access to extra methods:
66+
4367
```javascript
44-
require("crypto-js", function (CryptoJS) {
68+
// Above-mentioned will work or use this simple form
69+
require.config({
70+
paths: {
71+
'require-js': 'path-to/bower_components/crypto-js/crypto-js'
72+
}
73+
});
74+
75+
require(["crypto-js"], function (CryptoJS) {
4576
console.log(CryptoJS.HmacSHA1("Message", "Key"));
4677
});
4778
```
4879

80+
### Usage without RequireJS
81+
82+
```html
83+
<script type="text/javascript" src="path-to/bower_components/crypto-js/crypto-js.js"></script>
84+
<script type="text/javascript">
85+
var encrypted = CryptoJS.AES(...);
86+
var encrypted = CryptoJS.SHA256(...);
87+
</script>
88+
4989
## API
5090

5191
See: https://code.google.com/p/crypto-js
@@ -122,17 +162,6 @@ See: https://code.google.com/p/crypto-js
122162
- ```crypto-js/pad-zeropadding```
123163
- ```crypto-js/pad-nopadding```
124164

125-
## Contribution
126-
127-
### Git Flow
128-
129-
The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches.
130-
Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch.
131-
132-
### Pull request
133-
134-
Target your pull request on `develop` branch. Other pull request won't be accepted.
135-
136165
## License
137166

138167
[The MIT License (MIT)](http://opensource.org/licenses/MIT)

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
"url": "http://opensource.org/licenses/MIT"
2222
}
2323
],
24+
"scripts": {
25+
"build": "grunt build",
26+
"check": "grunt default"
27+
},
2428
"main": "index.js",
2529
"dependencies": {},
2630
"devDependencies": {

0 commit comments

Comments
 (0)