CONTRIBUTING.md 2.12 KB
Newer Older
S Anand's avatar
S Anand committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File structure

- `dist/` has output files. It is re-created via  `npm run build`. It has:
  - [g1.js](dist/g1.js) - non-minified source created via rollup on [index.js](index.js)
  - [g1.min.js](dist/g1.min.js) - minified source created via rollup on [index.js](index.js)
  - `<module>.min.js` for each module - minified source created via rollup on `index-<module>.js`
- `./` has setup files.
  - [index.js](index.js) is the rollup configuration to create the full `g1` package
  - `index-<module>.js` is the rollup configuration to create each module
  - Other support files
- `src/` has source files. This includes:
  - `<module>.js` - underlying source for each module, which may import other dependencies. TODO: rename jquery.* to this
  - `<library>.js` - for internally used libraries
- `test/` has test cases. It is run via `npm test`. It has:
  - `test-<module>.html` for each browser module
  - `test-<library>.js` for each library that can be tested directly on node.js
  - `server.js` runs tests on [Puppeteer](https://github.com/GoogleChrome/puppeteer)
  - `tape.js` is dynamically created using browserify to help with test cases. This is not committed
  - Other test dependencies

S Anand's avatar
S Anand committed
21
# Set up
S Anand's avatar
S Anand committed
22
23
24
25
26

To set up locally, clone this repo and run:

    yarn install
    npm run build     # Optional: build the dist/ directory
S Anand's avatar
S Anand committed
27
28
29
30
31
32
33
34
35

Here is a list of npm commands available:

    npm test          # Run all unit tests
    npm run lint      # Check for basic errors using eslint
    npm run server    # Start a HTTP server at the current folder for manual testing
    npm run dev       # Start a rollup watch that re-builds dist/ if files change

# Release
S Anand's avatar
S Anand committed
36
37
38
39
40

To publish a new version on npm:

    # Run tests on dev branch
    git checkout dev
S Anand's avatar
S Anand committed
41
    npm run lint
S Anand's avatar
S Anand committed
42
43
44
    npm test

    # Update package.json version
S Anand's avatar
S Anand committed
45
    # Update CHANGELOG.md
S Anand's avatar
S Anand committed
46
    # Ensure that there are no build errors on the server
S Anand's avatar
S Anand committed
47
    git commit . -m"DOC: Release version x.x.x"
S Anand's avatar
S Anand committed
48
49
50
51
52
53
54
55
56
57
    git push

    # Merge into dev branch
    git checkout master
    git merge dev
    git tag -a v0.x.x           # Add a one-line summary
    git push --follow-tags
    npm publish               # as sanand0

    git checkout dev