1 | # Developers instructions #
|
2 |
|
3 | ## Running the tests locally ##
|
4 |
|
5 | 1. Make sure you have a version of [Node.js](https://nodejs.org) installed (any version >0.12 should work).
|
6 | 1. Create a test **craft ai** project and retrieve its **write token**.
|
7 | 2. At the root of your local clone, create a file named `.env` with the following content
|
8 |
|
9 | ```
|
10 | CRAFT_TOKEN=<retrieved_token>
|
11 | ```
|
12 |
|
13 | 3. Install the dependencies.
|
14 |
|
15 | ```console
|
16 | $ npm install
|
17 | ```
|
18 |
|
19 | 4. Run the tests!
|
20 |
|
21 | ```console
|
22 | $ npm run test
|
23 | ```
|
24 |
|
25 | 5. Additionaly, you can run a test server to run the test in a browser at <http://localhost:8080/webpack-dev-server/>.
|
26 |
|
27 | ```console
|
28 | $ npm run dev_browser
|
29 | ```
|
30 |
|
31 | ## Releasing a new version (needs administrator rights) ##
|
32 |
|
33 | 1. Make sure the build of the master branch is passing.
|
34 |
|
35 | [![Build](https://img.shields.io/travis/craft-ai/craft-ai-client-js/master.svg?style=flat-square)](https://travis-ci.org/craft-ai/craft-ai-client-js)
|
36 |
|
37 | 2. Checkout the master branch locally.
|
38 |
|
39 | ```console
|
40 | $ git fetch
|
41 | $ git checkout master
|
42 | $ git reset --hard origin/master
|
43 | ```
|
44 |
|
45 | 3. Update `README.md` from **craft ai** documentation found
|
46 | at <https://beta.craft.ai/doc/js>.
|
47 |
|
48 | ```console
|
49 | $ npm run update_readme
|
50 | ```
|
51 |
|
52 | > This will create a git commit.
|
53 |
|
54 | 4. Increment the version in `package.json` and move _Unreleased_ section
|
55 | of `CHANGELOG.md` to a newly created section for this version.
|
56 |
|
57 | ```console
|
58 | $ ./scripts/update_version.sh patch
|
59 | ```
|
60 |
|
61 | `./scripts/update_version.sh minor` and `./scripts/update_version.sh major` are
|
62 | also available - see [semver](http://semver.org) for a guideline on when to
|
63 | use which.
|
64 |
|
65 | > This will create a git commit and a git tag.
|
66 |
|
67 | 5. Push everything.
|
68 |
|
69 | ```console
|
70 | $ git push origin master
|
71 | $ git push --tags
|
72 | ```
|
73 |
|
74 | > This will trigger the publishing of this new version to [npm](https://www.npmjs.com/package/craft-ai) by [travis](https://travis-ci.org/craft-ai/craft-ai-client-js).
|
75 |
|
\ | No newline at end of file |