{"id":15046605,"url":"https://github.com/aicore/template-nodejs","last_synced_at":"2025-10-27T21:30:39.870Z","repository":{"id":37010786,"uuid":"365304584","full_name":"aicore/template-nodejs","owner":"aicore","description":"A template project with nodejs with pure JS","archived":false,"fork":false,"pushed_at":"2025-02-02T16:51:00.000Z","size":622,"stargazers_count":3,"open_issues_count":14,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-06T06:09:16.646Z","etag":null,"topics":["build","c8","coverage","mocha-chai","nodejs","sample-project","template","test"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aicore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-07T17:17:32.000Z","updated_at":"2024-10-07T10:56:27.000Z","dependencies_parsed_at":"2024-01-25T12:01:18.760Z","dependency_job_id":"1e319408-477c-45a6-b341-a2880d11ff1c","html_url":"https://github.com/aicore/template-nodejs","commit_stats":{"total_commits":146,"total_committers":9,"mean_commits":16.22222222222222,"dds":0.4726027397260274,"last_synced_commit":"5ae3fb47efaf3edafa735ad4d46ba231731fbffc"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Ftemplate-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Ftemplate-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Ftemplate-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aicore%2Ftemplate-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aicore","download_url":"https://codeload.github.com/aicore/template-nodejs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238560481,"owners_count":19492534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","c8","coverage","mocha-chai","nodejs","sample-project","template","test"],"created_at":"2024-09-24T20:53:17.149Z","updated_at":"2025-10-27T21:30:34.514Z","avatar_url":"https://github.com/aicore.png","language":"JavaScript","readme":"# template-nodejs\nA template project for nodejs. Has integrated linting, testing,\ncoverage, reporting, GitHub actions for publishing to npm repository, dependency updates and other goodies.\n\nEasily use this template to quick start a production ready nodejs project template.\n\n## Code Guardian\n[![\u003capp\u003e build verification](https://github.com/aicore/template-nodejs/actions/workflows/build_verify.yml/badge.svg)](https://github.com/aicore/template-nodejs/actions/workflows/build_verify.yml)\n\n\u003ca href=\"https://sonarcloud.io/summary/new_code?id=aicore_template-nodejs-ts\"\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=alert_status\" alt=\"Sonar code quality check\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=security_rating\" alt=\"Security rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=vulnerabilities\" alt=\"vulnerabilities\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=coverage\" alt=\"Code Coverage\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=bugs\" alt=\"Code Bugs\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=reliability_rating\" alt=\"Reliability Rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=sqale_rating\" alt=\"Maintainability Rating\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=ncloc\" alt=\"Lines of Code\" /\u003e\n  \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=aicore_template-nodejs-ts\u0026metric=sqale_index\" alt=\"Technical debt\" /\u003e\n\u003c/a\u003e\n\n\n# TODOs after template use\n## !!!Please see all issues in the generated repository as an issue will be generated tracking the fix of each of the below items.  \n1. Update package.json with your app defaults\n2. Check Build actions on pull requests.\n3. create a home page in wiki by going to wiki link https://github.com/\u003cyour_org\u003e/\u003cyour_repo\u003e/wiki\n4. Goto github `repository` \u003e `settings`\u003e and uncheck `Allow merge commits`. this is usually automatically done by code guardian bots in core.ai org. so you may just need to verify it.\n5. In sonar cloud, enable Automatic analysis from `Administration\n   Analysis Method` for the first time before a pull request is raised: ![image](https://user-images.githubusercontent.com/5336369/148695840-65585d04-5e59-450b-8794-54ca3c62b9fe.png)\n6. Check codacy runs on pull requests, set codacy defaults. You may remove codacy if sonar cloud is only needed.\n7. Update the above Code Guardian badges; change all `id=aicore_template-nodejs-ts` to the sonar id of your project fields. see this PR: https://github.com/aicore/libcache/pull/13\n\n# Commands available\n\n## Building\nSince this is a pure JS template project, build command just runs test with coverage.\n```shell\n\u003e npm install   // do this only once.\n\u003e npm run build\n```\n\n## Linting\nTo lint the files in the project, run the following command:\n```shell\n\u003e npm run lint\n```\nTo Automatically fix lint errors:\n```shell\n\u003e npm run lint:fix\n```\n\n## Testing\nTo run all tests:\n```shell\n\u003e npm run test\n  Hello world Tests\n    ✔ should return Hello World\n    #indexOf()\n      ✔ should return -1 when the value is not present\n```\n\nAdditionally, to run unit/integration tests only, use the commands:\n```shell\n\u003e npm run test:unit\n\u003e npm run test:integ\n```\n\n## Coverage Reports\nTo run all tests with coverage:\n\n```shell\n\u003e npm run cover\n  Hello world Tests\n    ✔ should return Hello World\n    #indexOf()\n      ✔ should return -1 when the value is not present\n\n\n  2 passing (6ms)\n\n----------|---------|----------|---------|---------|-------------------\nFile      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s \n----------|---------|----------|---------|---------|-------------------\nAll files |     100 |      100 |     100 |     100 |                   \n index.js |     100 |      100 |     100 |     100 |                   \n----------|---------|----------|---------|---------|-------------------\n\n=============================== Coverage summary ===============================\nStatements   : 100% ( 5/5 )\nBranches     : 100% ( 2/2 )\nFunctions    : 100% ( 1/1 )\nLines        : 100% ( 5/5 )\n================================================================================\nDetailed unit test coverage report: file:///template-nodejs/coverage-unit/index.html\nDetailed integration test coverage report: file:///template-nodejs/coverage-integration/index.html\n```\nAfter running coverage, detailed reports can be found in the coverage folder listed in the output of coverage command.\nOpen the file in browser to view detailed reports.\n\nTo run unit/integration tests only with coverage\n```shell\n\u003e npm run cover:unit\n\u003e npm run cover:integ\n```\n\nSample coverage report:\n![image](https://user-images.githubusercontent.com/5336369/148687351-6d6c12a2-a232-433d-ab62-2cf5d39c96bd.png)\n\n### Unit and Integration coverage configs\nUnit and integration test coverage settings can be updated by configs `.nycrc.unit.json` and `.nycrc.integration.json`.\n\nSee https://github.com/istanbuljs/nyc for config options.\n\n# Publishing packages to NPM\n\n  ## Preparing for release\n  Please run `npm run release` on the `main` branch and push the changes to main. The release command will bump the npm version.\n  \n  !NB: NPM publish will faill if there is another release with the same version.\n  ## Publishing\nTo publish a package to npm, push contents to `npm` branch in \nthis repository. \n\n## Publishing `@aicore/package*`\nIf you are looking to publish to package owned by core.ai, you will need access to the GitHub Organization secret `NPM_TOKEN`.\n\nFor repos managed by [aicore](https://github.com/aicore) org in GitHub, Please contact your Admin to get access to core.ai's NPM tokens.\n\n\n## Publishing to your own npm account\nAlternatively, if you want to publish the package to your own npm account, please follow these docs:\n1. Create an automation access token by following this [link](https://docs.npmjs.com/creating-and-viewing-access-tokens).\n2. Add NPM_TOKEN to your repository secret by following this [link](https://docs.npmjs.com/using-private-packages-in-a-ci-cd-workflow)\n\nTo edit the publishing workflow, please see file: `.github/workflows/npm-publish.yml`\n\n\n# Dependency updates\n  We use Rennovate for dependency updates: https://blog.logrocket.com/renovate-dependency-updates-on-steroids/\n  * By default, dep updates happen on sunday every week.\n  * The status of dependency updates can be viewed here if you have this repo permissions in github: https://app.renovatebot.com/dashboard#github/aicore/template-nodejs\n  * To edit rennovate options, edit the rennovate.json file in root, see https://docs.renovatebot.com/configuration-options/\n  Refer \n  \n# Code Guardian\nSeveral automated workflows that check code integrity are integrated into this template.\nThese include:\n1. GitHub actions that runs build/test/coverage flows when a contributor raises a pull request\n2. [Sonar cloud](https://sonarcloud.io/) integration using `.sonarcloud.properties`\n   1. In sonar cloud, enable Automatic analysis from `Administration\n      Analysis Method` for the first time ![image](https://user-images.githubusercontent.com/5336369/148695840-65585d04-5e59-450b-8794-54ca3c62b9fe.png)\n\n## IDE setup\nSonarLint is currently available as a free plugin for jetbrains, eclipse, vscode and visual studio IDEs.\nUse sonarLint plugin for webstorm or any of the available\nIDEs from this link before raising a pull request: https://www.sonarlint.org/ .\n\nSonarLint static code analysis checker is not yet available as a Brackets\nextension.\n\n## Internals\n### Testing framework: Mocha , assertion style: chai\n See https://mochajs.org/#getting-started on how to write tests\n Use chai for BDD style assertions (expect, should etc..). See move here: https://www.chaijs.com/guide/styles/#expect\n\n### Mocks and spies:\n\n Since it is not that straight forward to mock es6 module imports, use the follow pull request as reference to mock\nimported libs:\n \n\n* sample pull request: https://github.com/aicore/libcache/pull/6/files\n* [setting up mocks](https://github.com/aicore/libcache/blob/485b1b6244f7022eb0a83d9f72d897fe712badbe/test/unit/setup-mocks.js)\n* [using the mocks](https://github.com/aicore/libcache/pull/6/files#diff-8ea7ccf28b28a0ae7b43e468abd3e9a8bb411bb329ad5cb45eb9a93709ed8dc5R2)\nensure to import `setup-mocks.js` as the first import of all files in tests.\n\n#### using sinon lib if the above method doesn't fit your case\nif you want to mock/spy on fn() for unit tests, use sinon. refer docs: https://sinonjs.org/\n\n### Note on coverage suite used here:\nwe use c8 for coverage https://github.com/bcoe/c8. Its reporting is based on nyc, so detailed docs can be found\n here: https://github.com/istanbuljs/nyc ; We didn't use nyc as it do not yet have ES module support\n see: https://github.com/digitalbazaar/bedrock-test/issues/16 . c8 is drop replacement for nyc coverage reporting tool\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicore%2Ftemplate-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faicore%2Ftemplate-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faicore%2Ftemplate-nodejs/lists"}