├── .github ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── documentation.md │ ├── bug_report.md │ └── regression.md ├── LICENSE └── PULL_REQUEST_TEMPLATE.md ├── .eslintrc ├── CHANGELOG.md ├── test ├── fixtures │ └── build.mmd ├── template.test.js └── index.test.js ├── SECURITY.md ├── .circleci └── config.yml ├── template.js ├── LICENSE ├── .gitignore ├── .npmignore ├── package.json ├── README.md ├── index.js └── CONTRIBUTING.md /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 👉 Please follow one of these issue templates https://github.com/warehouseai/diagrams/issues/new/choose 2 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "godaddy", 3 | "rules": { 4 | "no-console": 0, 5 | "no-process-env": 0, 6 | "no-process-exit": 0 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 1.0.0 4 | 5 | - [#1] Initial Implementation and tool extraction from Warehouse.ai. 6 | 7 | [#1]: https://github.com/warehouseai/diagrams/pull/1 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 📃 Documentation Bug 3 | about: You want to report something that is wrong or missing from the documentation. 4 | labels: "Type: Docs" 5 | --- 6 | 7 | ## 📃 Summary 8 | 11 | 12 | ## Expected documentation 13 | 16 | -------------------------------------------------------------------------------- /test/fixtures/build.mmd: -------------------------------------------------------------------------------- 1 | graph LR 2 | A>BUILD] 3 | B(fa:fa-toolbox carpenterd) 4 | C{fa:fa-broadcast-tower NSQ} 5 | D(fa:fa-spinner carpenterd-worker) 6 | E{fa:fa-box-open S3 compatible CDN} 7 | F{fa:fa-database No-SQL Database} 8 | 9 | A -.-> |"{ NODE_ENV: env, LOCALE: locale }"| B 10 | B --> |"enqueue build"|C 11 | D --> |"subscribe"| C 12 | D --> |"store build output"| E 13 | D --> |"build metadata"| F 14 | -------------------------------------------------------------------------------- /.github/LICENSE: -------------------------------------------------------------------------------- 1 | `ISSUE_TEMPLATE.md` and markdown files under the `ISSUE_TEMPLATE` directory are adapted from `react-native` under MIT. 2 | 3 | https://github.com/facebook/react-native/blob/master/.github/ISSUE_TEMPLATE.md 4 | https://github.com/facebook/react-native/blob/37bf2ce/.github/ISSUE_TEMPLATE.md 5 | 6 | https://github.com/facebook/react-native/tree/master/.github/ISSUE_TEMPLATE 7 | https://github.com/facebook/react-native/tree/37bf2ce/.github/ISSUE_TEMPLATE 8 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | ## Summary 8 | 9 | 13 | 14 | ## Changelog 15 | 16 | 20 | 21 | ## Test Plan 22 | 23 | 27 | -------------------------------------------------------------------------------- /test/template.test.js: -------------------------------------------------------------------------------- 1 | const { describe, it } = require('mocha'); 2 | const template = require('../template'); 3 | const assume = require('assume'); 4 | 5 | describe('Diagram template', function () { 6 | it('provides static HTML to render in puppeteer', function () { 7 | const result = template('', 'test'); 8 | 9 | assume(result).to.include('/font-awesome/5.8.1/css/all.min.css'); 10 | assume(result).to.include(''); 11 | 12 | assume(result).to.include('mermaidAPI.initialize({ theme: `test` })'); 13 | assume(result).to.include('mermaidAPI.render(\'container\', ``'); 14 | assume(result).to.include('document.body.appendChild(diagram);'); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: You want to report a reproducible bug. 4 | labels: "Type: Bug Report" 5 | --- 6 | 7 | ## 🐛 Bug Report 8 | 12 | 13 | ## To Reproduce 14 | 17 | 18 | ## Expected Behavior 19 | 22 | 23 | ## Code Example 24 | 30 | 31 | ## Environment 32 | 35 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | We take security very seriously at GoDaddy. We appreciate your efforts to 4 | responsibly disclose your findings, and will make every effort to acknowledge 5 | your contributions. 6 | 7 | ## Where should I report security issues? 8 | 9 | In order to give the community time to respond and upgrade, we strongly urge you 10 | report all security issues privately. 11 | 12 | To report a security issue in one of our Open Source projects email us directly 13 | at **oss@godaddy.com** and include the word "SECURITY" in the subject line. 14 | 15 | This mail is delivered to our Open Source Security team. 16 | 17 | After the initial reply to your report, the team will keep you informed of the 18 | progress being made towards a fix and announcement, and may ask for additional 19 | information or guidance. 20 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Javascript Node CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-javascript/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | - image: circleci/node:latest-browsers 10 | working_directory: ~/repo 11 | 12 | steps: 13 | - checkout 14 | 15 | # Download and cache dependencies 16 | - restore_cache: 17 | keys: 18 | - v1-dependencies-{{ checksum "package.json" }} 19 | # fallback to using the latest cache if no exact match is found 20 | - v1-dependencies- 21 | 22 | - run: npm install 23 | 24 | - save_cache: 25 | paths: 26 | - node_modules 27 | key: v1-dependencies-{{ checksum "package.json" }} 28 | 29 | # run tests! 30 | - run: npm test 31 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💥 Regression Report 3 | about: You want to report unexpected behavior that worked in previous releases. 4 | labels: "Type: Bug Report", "Impact: Regression" 5 | --- 6 | 7 | ## 💥 Regression Report 8 | 11 | 12 | ## Last working version 13 | 14 | Worked up to version: 15 | 16 | Stopped working in version: 17 | 18 | ## To Reproduce 19 | 20 | 23 | 24 | ## Expected Behavior 25 | 26 | 29 | 30 | ## Code Example 31 | 37 | 38 | ## Environment 39 | 42 | -------------------------------------------------------------------------------- /template.js: -------------------------------------------------------------------------------- 1 | module.exports = (chart, theme = 'forest') => ` 2 | 3 | 4 | 5 | 6 | 24 | 25 | 26 | 27 | 38 | 39 | 40 | `; 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 GoDaddy Operating Company, LLC. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # Diagram test output 64 | test/fixtures/*.png 65 | test/fixtures/*.html 66 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # test files 64 | test/ 65 | .circleci 66 | 67 | # Github developer experience 68 | .github 69 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@wrhs/diagrams", 3 | "version": "1.0.0", 4 | "description": "Utility tool to generate mermaid diagrams for Warehouse.ai", 5 | "main": "index.js", 6 | "bin": { 7 | "wrhs-diagrams": "./index.js" 8 | }, 9 | "scripts": { 10 | "test": "mocha \"test/**/*.js\"", 11 | "posttest": "npm run lint", 12 | "lint": "eslint-godaddy *.js" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/warehouseai/diagrams.git" 17 | }, 18 | "author": "GoDaddy Operating Company, LLC", 19 | "contributors": [ 20 | "Martijn Swaagman ", 21 | "Charlie Robbins " 22 | ], 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/warehouseai/diagrams/issues" 26 | }, 27 | "homepage": "https://github.com/warehouseai/diagrams#readme", 28 | "dependencies": { 29 | "argh": "^1.0.0", 30 | "canihaz": "^1.1.0" 31 | }, 32 | "cliDependencies": { 33 | "puppeteer": "^1.14.0" 34 | }, 35 | "devDependencies": { 36 | "assume": "^2.2.0", 37 | "eslint": "^5.16.0", 38 | "eslint-config-godaddy": "^3.0.0", 39 | "eslint-plugin-json": "^1.4.0", 40 | "eslint-plugin-mocha": "^5.3.0", 41 | "mocha": "^6.1.4", 42 | "puppeteer": "^1.17.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /test/index.test.js: -------------------------------------------------------------------------------- 1 | const childProcess = require('child_process'); 2 | const { describe, it } = require('mocha'); 3 | const assume = require('assume'); 4 | const util = require('util'); 5 | const path = require('path'); 6 | const fs = require('fs'); 7 | 8 | const exec = util.promisify(childProcess.exec); 9 | const readFile = util.promisify(fs.readFile); 10 | const stat = util.promisify(fs.stat); 11 | 12 | describe('Warehouse diagrams', function () { 13 | const bin = path.join(__dirname, '..', 'index.js'); 14 | const timeout = 2E4; 15 | 16 | this.timeout(timeout); 17 | 18 | it('generates images from mermaid diagram definitions', async function () { 19 | const { stderr } = await exec(`node ${ bin } --target=./fixtures --source=./fixtures`, { 20 | cwd: __dirname 21 | }); 22 | 23 | assume(stderr).to.equal(''); 24 | 25 | const stats = await stat(path.join(__dirname, 'fixtures', 'build.png')); 26 | 27 | assume(stats).to.be.an('object'); 28 | assume(stats.size).to.be.gt(4E4); 29 | assume(stats.mtimeMs).to.be.gt(Date.now() - timeout); 30 | }); 31 | 32 | it('can output static html for debugging', async function () { 33 | const { stderr } = await exec(`node ${ bin } --target=./fixtures --source=./fixtures`, { 34 | cwd: __dirname, 35 | env: { 36 | DEBUG: true 37 | } 38 | }); 39 | 40 | assume(stderr).to.equal(''); 41 | 42 | const html = await readFile(path.join(__dirname, 'fixtures', 'build.html'), { 43 | encoding: 'utf-8' 44 | }); 45 | 46 | assume(html).to.include('B --> |"enqueue build"|C'); 47 | assume(html).to.include('document.body.appendChild(diagram);'); 48 | assume(html).to.include('mermaidAPI.render(\'container\', `graph LR'); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `@wrhs/diagrams` 2 | 3 | > ⚠️ **DEPRECATED**: This package is no longer maintained and has been deprecated. Please use an alternative solution or contact the maintainers for more information. 4 | 5 | [![Version npm](https://img.shields.io/npm/v/@wrhs/diagrams.svg?style=flat-square)](https://www.npmjs.com/package/@wrhs/diagrams) 6 | [![License](https://img.shields.io/npm/l/@wrhs/diagrams.svg?style=flat-square)](https://github.com/warehouseai/diagrams/blob/master/LICENSE) 7 | [![npm Downloads](https://img.shields.io/npm/dm/@wrhs/diagrams.svg?style=flat-square)](https://npmcharts.com/compare/@wrhs/diagrams?minimal=true) 8 | [![Dependencies](https://img.shields.io/david/warehouseai/diagrams.svg?style=flat-square)](https://github.com/warehouseai/diagrams/blob/master/package.json) 9 | [![CircleCI](https://circleci.com/gh/warehouseai/diagrams.svg?style=svg)](https://circleci.com/gh/warehouseai/diagrams) 10 | 11 | Utility to generate consistent [Mermaid] diagrams for [Warehouse.ai] modules. 12 | 13 | ## Install 14 | 15 | ```sh 16 | npm install @wrhs/diagrams --save-dev 17 | ``` 18 | 19 | ## Usage 20 | 21 | The easiest way to use this tool is by adding an `npm` command to the 22 | consuming module's `package.json` 23 | 24 | ```json 25 | "scripts": { 26 | "diagrams": "wrhs-diagrams --source=./docs/diagrams --target=./docs --theme=forest" 27 | ... 28 | }, 29 | ``` 30 | 31 | This command can then be used from the consuming module by running 32 | 33 | ```sh 34 | npm run diagrams 35 | ``` 36 | 37 | ## API 38 | 39 | The tool uses puppeteer with [Mermaid's API][Mermaid] to generate `svg's` from 40 | the `.mmd` diagram definitions. [`canihaz`][canihaz] will install [Puppeteer] 41 | the first time this tool is used. It only has a single command, 42 | but it supports the following flags. 43 | 44 | - **--source**: Relative path to directory with `.mmd` source files, 45 | defaults to `./diagrams`. 46 | - **--target**: Relative path to directory to store `.png` output files, 47 | defaults to `./assets`. 48 | - **--file**: Relative path to source files `--file one.mmd --file two.mmd`. 49 | - **--theme**: Theme to be used for diagram styling, defaults to `forest`. 50 | 51 | _Note: If you need to assert the HTML used in [Puppeteer] to generate the 52 | chart set `DEBUG=true` to have the script output both an `.png` and `.html` 53 | file._ 54 | 55 | ## Test 56 | 57 | ```sh 58 | npm test 59 | ``` 60 | 61 | [Mermaid]: http://mermaidjs.github.io/ 62 | [canihaz]: https://github.com/3rd-Eden/canihaz 63 | [Puppeteer]: https://pptr.dev/ 64 | [Warehouse.ai]: https://github.com/godaddy/warehouse.ai/ 65 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const argh = require('argh')(process.argv); 4 | const template = require('./template'); 5 | const canihaz = require('canihaz'); 6 | const path = require('path'); 7 | const util = require('util'); 8 | const fs = require('fs'); 9 | 10 | const readFile = util.promisify(fs.readFile); 11 | const writeFile = util.promisify(fs.writeFile); 12 | const readdir = util.promisify(fs.readdir); 13 | 14 | // 15 | // Keep singleton reference to spawned browser instance. 16 | // 17 | let browser; 18 | 19 | // 20 | // Parse options from the CLI. 21 | // 22 | const sourceDir = path.resolve(process.cwd(), argh.source || 'diagrams'); 23 | const targetDir = path.resolve(process.cwd(), argh.target || 'assets'); 24 | 25 | async function snapshot(file) { 26 | try { 27 | const chart = await readFile(path.join(sourceDir, file), 'utf-8'); 28 | const output = { 29 | png: `${ path.basename(file, '.mmd') }.png`, 30 | html: `${ path.basename(file, '.mmd') }.html` 31 | }; 32 | 33 | console.log(`[${ file }] Render to string`); 34 | const rendered = template(chart, argh.theme); 35 | 36 | if (process.env.DEBUG) { 37 | console.log(`[${output.html}] Write file`); 38 | await writeFile(path.join(targetDir, output.html), rendered, 'utf8'); 39 | } 40 | 41 | const page = await browser.newPage(); 42 | await page.setViewport({ width: 1920, height: 1080 }); 43 | await page.setContent(rendered, { waitUntil: ['networkidle0'] }); 44 | 45 | const clip = await page.$eval('svg', svg => { 46 | const box = svg.getBoundingClientRect(); 47 | return { x: box.left, y: box.top, width: box.width, height: box.height }; 48 | }); 49 | 50 | console.log(`[${output.png}] Screenshot result`); 51 | await page.screenshot({ path: path.join(targetDir, output.png), clip, omitBackground: true }); 52 | } catch (error) { 53 | throw new Error(`Snapshot of diagram failed: ${ error.message }`); 54 | } 55 | } 56 | 57 | console.log('Requesting availability of puppeteer, it will be installed if unavailable.'); 58 | 59 | canihaz({ 60 | key: 'cliDependencies' 61 | }).puppeteer(async function puppetmaster(error, puppeteer) { 62 | if (error) throw error; 63 | 64 | let files = argh.file; 65 | if (files && !Array.isArray(files)) files = [argh.file]; 66 | 67 | try { 68 | browser = await puppeteer.launch({ 69 | headless: true, 70 | args: ['--no-sandbox', '--disable-setuid-sandbox'] 71 | }); 72 | 73 | const diagrams = files 74 | ? files.map(file => path.extname(file) === '.mmd' ? file : `${ file }.mmd`) 75 | : await readdir(sourceDir); 76 | 77 | for (const file of diagrams) { 78 | if (path.extname(file) === '.mmd') await snapshot(file); 79 | } 80 | 81 | await browser.close(); 82 | 83 | console.log('Chart images generated.'); 84 | } catch (err) { 85 | throw new Error(`Puppeteer failed: ${ err.message }`); 86 | } 87 | }); 88 | 89 | // 90 | // Ensure Chromium process is closed. 91 | // 92 | process.once('SIGINT', async function kill() { 93 | if (!browser) process.exit(); 94 | await browser.close(); 95 | }); 96 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Everyone is welcome to contribute to GoDaddy's Open Source Software. 4 | Contributing doesn’t just mean submitting pull requests. To get involved you 5 | can, report or triage bugs and participate in discussions on the evolution of 6 | each project. 7 | 8 | No matter how you want to get involved, we ask that you first learn what’s 9 | expected of anyone who participates in the project by reading the Contribution 10 | Guidelines. 11 | 12 | ## Answering Questions 13 | 14 | One of the most important and immediate ways you can support this project is 15 | to or [Github][issues]. Whether you’re 16 | helping a newcomer understand a feature or troubleshooting an edge case with a 17 | seasoned developer, your knowledge and experience with JS can go a long way 18 | to help others. 19 | 20 | ## Reporting Bugs 21 | 22 | **Do not report potential security vulnerabilities here. Refer to 23 | [SECURITY.md](./SECURITY.md) for more details about the process of reporting 24 | security vulnerabilities.** 25 | 26 | Before submitting a ticket, please be sure to have a simple replication of 27 | the behavior. If the issue is isolated to one of the dependencies of this 28 | project. Please create a Github issue in that project. All dependencies are 29 | open source software and can be easily found through [npm]. 30 | 31 | Submit a ticket for your issue, assuming one does not already exist: 32 | - Create it on our [Issue Tracker][issues] 33 | - Clearly describe the issue by following the template layout 34 | - Make sure to include steps to reproduce the bug. 35 | - A reproducible (unit) test could be helpful in solving the bug. 36 | - Describe the environment that (re)produced the problem. 37 | 38 | > For a bug to be actionable, it needs to be reproducible. If you or 39 | > contributors can’t reproduce the bug, try to figure out why. Please take 40 | > care to stay involved in discussions around solving the problem. 41 | 42 | ## Triaging bugs or contributing code 43 | 44 | If you're triaging a bug, try to reduce it. Once a bug can be reproduced, 45 | reduce it to the smallest amount of code possible. Reasoning about a sample 46 | or unit test that reproduces a bug in just a few lines of code is easier than 47 | reasoning about a longer sample. 48 | 49 | From a practical perspective, contributions are as simple as: 50 | - Forking the repository on GitHub. 51 | - Making changes to your forked repository. 52 | - When committing, reference your issue (if present) and include a note about 53 | the fix. 54 | - If possible, and if applicable, please also add/update unit tests for your 55 | changes. 56 | - Push the changes to your fork and submit a pull request to the 'master' 57 | branch of the projects' repository. 58 | 59 | If you are interested in making a large change and feel unsure about its 60 | overall effect, please make sure to first discuss the change and reach a 61 | consensus with core contributors. Then ask about the best way 62 | to go about making the change. 63 | 64 | ## Code Review 65 | 66 | Any open source project relies heavily on code review to improve software 67 | quality: 68 | 69 | > All significant changes, by all developers, must be reviewed before they 70 | > are committed to the repository. Code reviews are conducted on GitHub through 71 | > comments on pull requests or commits. The developer responsible for a code 72 | > change is also responsible for making all necessary review-related changes. 73 | 74 | Sometimes code reviews will take longer than you would hope for, especially 75 | for larger features. Here are some accepted ways to speed up review times for 76 | your patches: 77 | 78 | - Review other people’s changes. If you help out, everybody will be more 79 | willing to do the same for you. Goodwill is our currency. 80 | - Split your change into multiple smaller changes. The smaller your change, 81 | the higher the probability that somebody will take a quick look at it. 82 | - Remember that you’re asking for 83 | valuable time from other professional developers. 84 | 85 | **Note that anyone is welcome to review and give feedback on a change, but 86 | only people with commit access to the repository can approve it.** 87 | 88 | ## Attribution of Changes 89 | 90 | When contributors submit a change to this project, after that change is 91 | approved, other developers with commit access may commit it for the author. 92 | When doing so, it is important to retain correct attribution of the 93 | contribution. Generally speaking, Git handles attribution automatically. 94 | 95 | ## Code Documentation 96 | 97 | Ensure that every function in this project is documented and follows the 98 | standards set by [JSDoc]. Finally, please stick to the code style as defined 99 | by the [Godaddy JS styleguide][style]. 100 | 101 | # Additional Resources 102 | 103 | - [General GitHub Documentation](https://help.github.com/) 104 | - [GitHub Pull Request documentation](https://help.github.com/send-pull-requests/) 105 | - [JSDoc] 106 | 107 | [issues]: https://github.com/warehouseai/diagrams/issues 108 | [JSDoc]: http://usejsdoc.org/ 109 | [npm]: http://npmjs.org/ 110 | [style]: https://github.com/godaddy/javascript/#godaddy-style 111 | --------------------------------------------------------------------------------