diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/build.js b/build.js new file mode 100644 index 0000000..6bee570 --- /dev/null +++ b/build.js @@ -0,0 +1,33 @@ +const ctx = require('./source/context'), + config = require('./source/config'), + fs = require('fs'), + ejs = require('ejs') + +/** + * @param {string} message the message to display + * @param {'success'|'info'|'error'} type the type of message + */ +const log = (message, type = 'info') => { + for (const line of message.split('\n')) { + const fullMessage = ` [ ${type} ] ${line}` + if (type == 'error') { + console.error(fullMessage) + } else if (type == 'info') { + console.info(fullMessage) + } else { + console.log(fullMessage) + } + } +} + +const $ctx = () => ({...ctx, $ctx}) + +log(`Reading ${config.main} ...`) +ejs.renderFile(config.main, $ctx(), (err, txt) => { + if (err) return log(`${err}`, 'error') + log(`Writing to ${config.dest} ...`) + fs.writeFile(config.dest, txt, err => { + if (err) return log(`${err}`, 'error') + log(`Template written to ${config.dest} from ${config.main}`, 'success') + }) +}) \ No newline at end of file diff --git a/licenses/NoHarm.md b/licenses/NoHarm.md new file mode 100644 index 0000000..8683901 --- /dev/null +++ b/licenses/NoHarm.md @@ -0,0 +1,228 @@ +# Do No Harm License + +Version 0.3, July 2022 + +https://github.com/raisely/NoHarm + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +## 1. Preamble + +Most software today is developed with little to no thought of how it will be used, or the +consequences for our society and planet. + +As software developers, we engineer the infrastructure of the 21st century. We recognise that our +infrastructure has great power to shape the world and the lives of those we share it with, and we +choose to consciously take responsibility for the social and environmental impacts of what we build. + +We envisage a world free from injustice, inequality, and the reckless destruction of lives and our +planet. We reject slavery in all its forms, whether by force, indebtedness, or by algorithms that +hack human vulnerabilities. We seek a world where humankind is at peace with our neighbours, nature, +and ourselves. We want our work to enrich the physical, mental and spiritual wellbeing of all +society. + +We build software to further this vision of a just world, or at the very least, to not put that +vision further from reach. + +## 2. Definitions + +"License" must mean the terms and conditions for use, reproduction, and distribution as defined by +Sections 1 through 9 of this document. + +"Licensor" must mean the copyright owner or entity authorized by the copyright owner that is +granting the License. + +"Legal Entity" must mean the union of the acting entity and all other entities that control, are +controlled by, or are under common control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") must mean an individual or Legal Entity exercising permissions granted by this +License. + +"Source" must mean the preferred form for making modifications, including but not limited to +the software source code, documentation source, and configuration files. + +"Object" must mean any form resulting from mechanical transformation or translation of a +Source form, including but not limited to compiled object code, generated documentation, and +conversions to other media types. + +"Work" must mean the work of authorship, whether in Source or Object form, made available under the +License, as indicated by a copyright notice that is included in or attached to the work (an example +is provided in the Appendix below). + +"Derivative Works" must mean any work, whether in Source or Object form, that is based on (or +derived from) the Work and for which the editorial revisions, annotations, elaborations, or other +modifications represent, as a whole, an original work of authorship. For the purposes of this +License, Derivative Works must not include works that remain separable from, or merely link (or +bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" must mean any work of authorship, including the original version of the Work and any +modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted +to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity +authorized to submit on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent to the Licensor or +its representatives, including but not limited to communication on electronic mailing lists, source +code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor +for the purpose of discussing and improving the Work, but excluding communication that is +conspicuously marked or otherwise designated in writing by the copyright owner as "Not a +Contribution." + +"Contributor" must mean Licensor and any individual or Legal Entity on behalf of whom a +Contribution has been received by Licensor and subsequently incorporated within the Work. + +"Forest" (or "Forests") must mean 0.5 or more hectares of trees that were either planted more than 50 years ago +or were not planted by humans or human made equipment. + +"Deforestation" must mean the clearing, burning or destruction of 0.5 or more hectares of forests +within a 1 year period. + + + +## 3. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a +perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to +reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +## 4. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a +perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to +make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable by such Contributor that +are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or +a Contribution incorporated within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that Work must terminate as of the +date such litigation is filed. + +## 5. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with +or without modifications, and in Source or Object form, provided that You meet the following +conditions: + +1. You must give any other recipients of the Work or Derivative Works a copy of this License +2. You must cause any modified files to carry prominent notices stating that You changed the + files +3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, + patent, trademark, and attribution notices from the Source form of the Work, excluding those + notices that do not pertain to any part of the Derivative Works. +4. Neither the name of the copyright holder nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior written permission +5. This software must not be used by any organisation, website, product, or service that: + 1. Promotes, lobbies for or derives a majority of income from: + 1. **Abuses of human rights**: + * human trafficking + * sex trafficking + * slavery or indentured servitude + * discrimination based on age, gender, gender identity, race, sexuality, religion, nationality + * hate speech + + 2. **Environmental destruction**: + * the extraction or sale of fossil fuels + * the destruction of habitats for threatened or endangered species, + including through deforestation or burning of forests + * the abuse, inhumane killing or neglect of animals under human control + * industrial processes that generate waste products that threaten life + + 3. **Conflict and war**: + * warfare + * war crimes + * weapons manufacturing + * unprovoked violence + + 4. **Addictive or destructive products and services**: + * gambling + * tabaco + * products that encourage adversely addictive behaviours + + + 2. Dissuades, lobbies against, or derives a majority of income from actions that + discourage or frustrate: + * peace + * access to the rights set out in the + [Universal Declaration of Human Rights](./documents/UDHR.md) and the + [Convention on the Rights of the Child](./documents/CRC.md) + * peaceful assembly and association (including worker associations) + * a sustainable environment + * democratic processes + + +6. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative + Works that You distribute must include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not pertain to any part of the + Derivative Works, in at least one of the following places: within a NOTICE text file + distributed as part of the Derivative Works; within the Source form or documentation, if + provided along with the Derivative Works; or, within a display generated by the Derivative + Works, if and wherever such third-party notices normally appear. The contents of the NOTICE + file are for informational purposes only and do not modify the License. You may add Your own + attribution notices within Derivative Works that You distribute, alongside or as an addendum to + the NOTICE text from the Work, provided that such additional attribution notices cannot be + construed as modifying the License. + + +You may add Your own copyright statement to Your modifications and may provide additional or +different license terms and conditions for use, reproduction, or distribution of Your modifications, +or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of +the Work otherwise complies with the conditions stated in this License. + +## 6. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the +Work by You to the Licensor must be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein must supersede or modify +the terms of any separate license agreement you may have executed with Licensor regarding such +Contributions. + +## 7. Trademarks + +This License does not grant permission to use the trade names, trademarks, service marks, or product +names of the Licensor, except as required for reasonable and customary use in describing the origin +of the Work and reproducing the content of the NOTICE file. + +## 8. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties or conditions of +TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely +responsible for determining the appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +## 9. Limitation of Liability + +In no event and under no legal theory, whether in wrongdoing (including negligence), contract, or +otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or +agreed to in writing, must any Contributor be liable to You for damages, including any +direct, indirect, special, incidental, or consequential +damages of any character arising as a result of this +License or out of the use or inability to use the Work (including but not limited to damages for +loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial +damages or losses), even if such Contributor has been advised of the possibility of such damages. + +## 10. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee +for acceptance of support, warranty, indemnity, other liability obligations, or rights consistent with this License. +However, in accepting such obligations, You may act only on Your own +behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or +claims asserted against, such Contributor by reason of your accepting any such warranty or +additional liability. + +END OF TERMS AND CONDITIONS + +Copyright (year) [owner](url). + +Licensed under the Do No Harm License, Version 0.3 (the "License"); you may not use this file except +in compliance with the License. You may obtain a +[copy](https://github.com/raisely/NoHarm/licenses/apache-2.0.md) of the License. + +Unless required by applicable law or agreed to in writing, software distributed under the License is +distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions and limitations under the +License. diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..c4e64b1 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,295 @@ +{ + "name": "noharm", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "noharm", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "ejs": "^3.1.8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/ejs": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/jake": { + "version": "10.8.5", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + } + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "ejs": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", + "requires": { + "jake": "^10.8.5" + } + }, + "filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "requires": { + "minimatch": "^5.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "jake": { + "version": "10.8.5", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.5.tgz", + "integrity": "sha512-sVpxYeuAhWt0OTWITwT98oyV0GsXyMlXCF+3L1SuafBVUIr/uILGRB+NqwkzhgXKvoJpDIpQvqkUALgdmQsQxw==", + "requires": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "requires": { + "has-flag": "^4.0.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..47bf925 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "noharm", + "version": "1.0.0", + "description": "**A license for developers who write code for a better world**", + "main": "index.js", + "scripts": { + "build": "node build.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/IRod22/NoHarm.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/IRod22/NoHarm/issues" + }, + "homepage": "https://github.com/IRod22/NoHarm#readme", + "dependencies": { + "ejs": "^3.1.8" + } +} diff --git a/source/config.js b/source/config.js new file mode 100644 index 0000000..7701d2d --- /dev/null +++ b/source/config.js @@ -0,0 +1,4 @@ +module.exports = { + main: './templates/license.ejs', + dest: './licenses/NoHarm.md', +} \ No newline at end of file diff --git a/source/context.js b/source/context.js new file mode 100644 index 0000000..bcc3b45 --- /dev/null +++ b/source/context.js @@ -0,0 +1,32 @@ +/** + * @param {string[]} ls + */ +function join(ls, { + empty = '(empty)', + final_sep = 'and', + item_sep = ',' +} = {}) { + if ((!ls) && (ls.length <= 0)) + return empty + if (ls.length == 1) + return ls[0] + if (ls.length == 2) + return `${ls[0]} ${final_sep} ${ls[1]}` + ls = ls.slice() + const last = ls.pop() + return `${ls.join(`${item_sep} `)}${item_sep} ${final_sep} ${last}` +} + +/** + * @param {string} str + */ +function trim(str, spaces = 0) { + return str.split('\n').map((s, i) => i ? ' '.repeat(spaces) + s.trim() : s.trim()).join('\n') +} + +const ctx = { + ...require('./data'), + join, + trim, +} +module.exports = ctx \ No newline at end of file diff --git a/source/data.js b/source/data.js new file mode 100644 index 0000000..8045070 --- /dev/null +++ b/source/data.js @@ -0,0 +1,202 @@ +const forest_area = 0.5 +/** + * @typedef {{term:string, definition: string, synonyms?: string[]}} Definition + */ +// { term: '', definition: ``, synonyms: [] }, +/** + * @type {Definition[]} + */ +const definitions = [ + { term: 'License', definition: `the terms and conditions for use, reproduction, and distribution as defined by + Sections 1 through 9 of this document.` }, + { term: 'Licensor', definition: `the copyright owner or entity authorized by the copyright owner that is + granting the License.` }, + { term: 'Legal Entity', definition: `the union of the acting entity and all other entities that control, are + controlled by, or are under common control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the direction or management of such + entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity.` }, + { term: 'You', definition: `an individual or Legal Entity exercising permissions granted by this + License.`, synonyms: [ 'Your' ] }, + { term: 'Source', definition: `the preferred form for making modifications, including but not limited to + the software source code, documentation source, and configuration files.` }, + { term: 'Object', definition: `any form resulting from mechanical transformation or translation of a + Source form, including but not limited to compiled object code, generated documentation, and + conversions to other media types.` }, + { term: 'Work', definition: `the work of authorship, whether in Source or Object form, made available under the + License, as indicated by a copyright notice that is included in or attached to the work (an example + is provided in the Appendix below).` }, + { term: 'Derivative Works', definition: `any work, whether in Source or Object form, that is based on (or + derived from) the Work and for which the editorial revisions, annotations, elaborations, or other + modifications represent, as a whole, an original work of authorship. For the purposes of this + License, Derivative Works must not include works that remain separable from, or merely link (or + bind by name) to the interfaces of, the Work and Derivative Works thereof.` }, + { term: 'Contribution', definition: `any work of authorship, including the original version of the Work and any + modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted + to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity + authorized to submit on behalf of the copyright owner. For the purposes of this definition, + "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or + its representatives, including but not limited to communication on electronic mailing lists, source + code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor + for the purpose of discussing and improving the Work, but excluding communication that is + conspicuously marked or otherwise designated in writing by the copyright owner as "Not a + Contribution."` }, + { term: 'Contributor', definition: `Licensor and any individual or Legal Entity on behalf of whom a + Contribution has been received by Licensor and subsequently incorporated within the Work.` }, + { term: 'Forest', definition: `${forest_area} or more hectares of trees that were either planted more than 50 years ago + or were not planted by humans or human made equipment.`, synonyms: [ 'Forests' ] }, + { term: 'Deforestation', definition: `the clearing, burning or destruction of ${forest_area} or more hectares of forests + within a 1 year period.` }, +] + +/** + * @typedef {{text: string, items?: Item[], bulleted?: boolean}} Item + */ + +/** + * @param {string[]} points + * @returns {Item[]} + */ +const bullet = points => points.map(text => ({text, bulleted: true})) +/** + * @type {Item[]} + */ +const terms_of_redistribution = [ + { text: `You must give any other recipients of the Work or Derivative Works a copy of this License` }, + { text: `You must cause any modified files to carry prominent notices stating that You changed the + files` }, + { text: `You must retain, in the Source form of any Derivative Works that You distribute, all copyright, + patent, trademark, and attribution notices from the Source form of the Work, excluding those + notices that do not pertain to any part of the Derivative Works.` }, + { text: `Neither the name of the copyright holder nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior written permission` }, + { text: `This software must not be used by any organisation, website, product, or service that`, items: [ + { text: `Promotes, lobbies for or derives a majority of income from`, items: [ + { text: `**Abuses of human rights**`, items: bullet([ + 'human trafficking', + 'sex trafficking', + 'slavery or indentured servitude', + 'discrimination based on age, gender, gender identity, race, sexuality, religion, nationality', + 'hate speech', + ]) }, + { text: `**Environmental destruction**`, items: bullet([ + 'the extraction or sale of fossil fuels', + `the destruction of habitats for threatened or endangered species, + including through deforestation or burning of forests`, + 'the abuse, inhumane killing or neglect of animals under human control', + 'industrial processes that generate waste products that threaten life', + ]) }, + { text: `**Conflict and war**`, items: bullet([ + 'warfare', + 'war crimes', + 'weapons manufacturing', + 'unprovoked violence', + ]) }, + { text: `**Addictive or destructive products and services**`, items: bullet([ + 'gambling', + 'tabaco', + 'products that encourage adversely addictive behaviours', + ]) }, + ] }, + { text: `Dissuades, lobbies against, or derives a majority of income from actions that + discourage or frustrate`, items: bullet([ + 'peace', + `access to the rights set out in the + [Universal Declaration of Human Rights](./documents/UDHR.md) and the + [Convention on the Rights of the Child](./documents/CRC.md)`, + 'peaceful assembly and association (including worker associations)', + 'a sustainable environment', + 'democratic processes', + ]) }, + ] }, + { text: `If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative + Works that You distribute must include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not pertain to any part of the + Derivative Works, in at least one of the following places: within a NOTICE text file + distributed as part of the Derivative Works; within the Source form or documentation, if + provided along with the Derivative Works; or, within a display generated by the Derivative + Works, if and wherever such third-party notices normally appear. The contents of the NOTICE + file are for informational purposes only and do not modify the License. You may add Your own + attribution notices within Derivative Works that You distribute, alongside or as an addendum to + the NOTICE text from the Work, provided that such additional attribution notices cannot be + construed as modifying the License.` }, +] + +const data = { + license_name: 'Do No Harm', + version: { + major: 0, + minor: 3, + month: 'July', + year: 2022, + }, + repo_url: 'https://github.com/raisely/NoHarm', + actions: [ + 'use', + 'reproduction', + 'distribution', + ], + type_of_license: { + general: [ + 'perpetual', + 'worldwide', + 'non-exclusive', + 'no-charge', + 'royalty-free', + 'irrevocable', + ], + patent: [ + 'perpetual', + 'worldwide', + 'non-exclusive', + 'no-charge', + 'royalty-free', + 'irrevocable (except as stated in this section)', + ], + }, + permissions: { + general:[ + 'reproduce', + 'prepare Derivative Works of', + 'publicly display', + 'publicly perform', + 'sublicense', + 'distribute', + ], + patent: [ + 'make', + 'have made', + 'use', + 'offer to sell', + 'sell', + 'import', + 'otherwise transfer', + ], + }, + warranties: { + conditions: [ + 'title', + 'non-infringement', + 'merchantability', + 'fitness for a particular purpose', + ], + damages: [ + 'direct', + 'indirect', + 'special', + 'incidental', + 'consequential', + ], + assurances: [ + 'acceptance of support', + 'warranty', + 'indemnity', + 'other liability obligations', + 'rights consistent with this License', + ], + }, + definitions, + terms_of_redistribution, +} + +module.exports = data \ No newline at end of file diff --git a/templates/definitions.ejs b/templates/definitions.ejs new file mode 100644 index 0000000..1165739 --- /dev/null +++ b/templates/definitions.ejs @@ -0,0 +1,9 @@ +<% const renderSynonyms = syns => { + if(syns.length) {%> (or <%- syns.map(s => `"${s}"`).join(', ') %>)<%} +}; _%> +## 2. Definitions + +<% for (const { term, definition, synonyms = [] } of definitions) { _%> +"<%= term %>"<% renderSynonyms(synonyms); %> must mean <%- trim(definition) %> + +<% } %> \ No newline at end of file diff --git a/templates/grant_of_copyright.ejs b/templates/grant_of_copyright.ejs new file mode 100644 index 0000000..be73948 --- /dev/null +++ b/templates/grant_of_copyright.ejs @@ -0,0 +1,5 @@ +## 3. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a +<%= type_of_license.general.join(', ') %> copyright license to +<%= join(permissions.general) %> the Work and such Derivative Works in Source or Object form. \ No newline at end of file diff --git a/templates/grant_of_patent.ejs b/templates/grant_of_patent.ejs new file mode 100644 index 0000000..3af45f7 --- /dev/null +++ b/templates/grant_of_patent.ejs @@ -0,0 +1,12 @@ +## 4. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a +<%= type_of_license.patent.join(', ') %> patent license to +<%= join(permissions.patent) %> the Work, +where such license applies only to those patent claims licensable by such Contributor that +are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or +a Contribution incorporated within the Work constitutes direct or contributory patent infringement, +then any patent licenses granted to You under this License for that Work must terminate as of the +date such litigation is filed. \ No newline at end of file diff --git a/templates/license.ejs b/templates/license.ejs new file mode 100644 index 0000000..0c9e4ec --- /dev/null +++ b/templates/license.ejs @@ -0,0 +1,37 @@ +<% const renderVersion = () => {%><%= version.major %>.<%= version.minor %><%}; _%> +# <%= license_name %> License + +Version <% renderVersion() %>, <%= version.month %> <%= version.year %> + +<%= repo_url %> + +TERMS AND CONDITIONS FOR <%= join(actions).toUpperCase() %> + +<%- include('preamble') %> + +<%- include('definitions', $ctx()) %> + +<%- include('grant_of_copyright', $ctx()) %> + +<%- include('grant_of_patent', $ctx()) %> + +<%- include('redistribution', $ctx()) %> + +<%- include('submission_of_contributions', $ctx()) %> + +<%- include('trademarks', $ctx()) %> + +<%- include('warranty_and_liability', $ctx()) %> + +END OF TERMS AND CONDITIONS + +Copyright (year) [owner](url). + +Licensed under the <%= license_name %> License, Version <% renderVersion() %> (the "License"); you may not use this file except +in compliance with the License. You may obtain a +[copy](https://github.com/raisely/NoHarm/licenses/apache-2.0.md) of the License. + +Unless required by applicable law or agreed to in writing, software distributed under the License is +distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied. See the License for the specific language governing permissions and limitations under the +License. diff --git a/templates/preamble.ejs b/templates/preamble.ejs new file mode 100644 index 0000000..11e2fba --- /dev/null +++ b/templates/preamble.ejs @@ -0,0 +1,17 @@ +## 1. Preamble + +Most software today is developed with little to no thought of how it will be used, or the +consequences for our society and planet. + +As software developers, we engineer the infrastructure of the 21st century. We recognise that our +infrastructure has great power to shape the world and the lives of those we share it with, and we +choose to consciously take responsibility for the social and environmental impacts of what we build. + +We envisage a world free from injustice, inequality, and the reckless destruction of lives and our +planet. We reject slavery in all its forms, whether by force, indebtedness, or by algorithms that +hack human vulnerabilities. We seek a world where humankind is at peace with our neighbours, nature, +and ourselves. We want our work to enrich the physical, mental and spiritual wellbeing of all +society. + +We build software to further this vision of a just world, or at the very least, to not put that +vision further from reach. \ No newline at end of file diff --git a/templates/redistribution.ejs b/templates/redistribution.ejs new file mode 100644 index 0000000..8749469 --- /dev/null +++ b/templates/redistribution.ejs @@ -0,0 +1,27 @@ +<% function renderList({text, items = [], bulleted = false}, current = 1, nesting = 0) { + const point = bulleted ? '*' : `${current}.` + const spaces = nesting * 3, indention = spaces + point.length + 1 + if (items.length) { + %><%= ' '.repeat(spaces) + point %> <%- trim(text, indention) %>:<%= '\n' %><% + items.forEach((item, index) => { + renderList(item, index + 1, nesting + 1) + }) + } else { + %><%= ' '.repeat(spaces) + point %> <%- trim(text, indention) %><% + } + %><%- '\n' %><% +} _%> +## 5. Redistribution + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with +or without modifications, and in Source or Object form, provided that You meet the following +conditions: + +<% terms_of_redistribution.forEach((item, index) => { + renderList(item, index + 1) +}) %> + +You may add Your own copyright statement to Your modifications and may provide additional or +different license terms and conditions for use, reproduction, or distribution of Your modifications, +or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of +the Work otherwise complies with the conditions stated in this License. \ No newline at end of file diff --git a/templates/submission_of_contributions.ejs b/templates/submission_of_contributions.ejs new file mode 100644 index 0000000..ab32c61 --- /dev/null +++ b/templates/submission_of_contributions.ejs @@ -0,0 +1,7 @@ +## 6. Submission of Contributions + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the +Work by You to the Licensor must be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein must supersede or modify +the terms of any separate license agreement you may have executed with Licensor regarding such +Contributions. \ No newline at end of file diff --git a/templates/trademarks.ejs b/templates/trademarks.ejs new file mode 100644 index 0000000..69abe15 --- /dev/null +++ b/templates/trademarks.ejs @@ -0,0 +1,5 @@ +## 7. Trademarks + +This License does not grant permission to use the trade names, trademarks, service marks, or product +names of the Licensor, except as required for reasonable and customary use in describing the origin +of the Work and reproducing the content of the NOTICE file. \ No newline at end of file diff --git a/templates/warranty_and_liability.ejs b/templates/warranty_and_liability.ejs new file mode 100644 index 0000000..e30588f --- /dev/null +++ b/templates/warranty_and_liability.ejs @@ -0,0 +1,29 @@ +## 8. Disclaimer of Warranty + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties or conditions of +<%= join(warranties.conditions.map(c => c.toUpperCase()), { final_sep: 'or' }) %>. You are solely +responsible for determining the appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +## 9. Limitation of Liability + +In no event and under no legal theory, whether in wrongdoing (including negligence), contract, or +otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or +agreed to in writing, must any Contributor be liable to You for damages, including any +<%= join(warranties.damages, { final_sep: 'or' }) %> +damages of any character arising as a result of this +License or out of the use or inability to use the Work (including but not limited to damages for +loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial +damages or losses), even if such Contributor has been advised of the possibility of such damages. + +## 10. Accepting Warranty or Additional Liability + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee +for <%= join(warranties.assurances, { final_sep: 'or' }) %>. +However, in accepting such obligations, You may act only on Your own +behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You +agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or +claims asserted against, such Contributor by reason of your accepting any such warranty or +additional liability. \ No newline at end of file