{"id":18862812,"url":"https://github.com/eik-lib/common","last_synced_at":"2026-05-22T02:12:23.014Z","repository":{"id":36151914,"uuid":"221899158","full_name":"eik-lib/common","owner":"eik-lib","description":"The eik.json schema and a gathering of shared utilities","archived":false,"fork":false,"pushed_at":"2026-02-12T22:51:17.000Z","size":8095,"stargazers_count":0,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-13T07:51:16.644Z","etag":null,"topics":["eik"],"latest_commit_sha":null,"homepage":"https://eik.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eik-lib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-15T10:18:58.000Z","updated_at":"2026-02-12T22:51:14.000Z","dependencies_parsed_at":"2023-02-17T04:31:32.313Z","dependency_job_id":"31b43953-15f3-4ea2-8ee9-60d5b716fa88","html_url":"https://github.com/eik-lib/common","commit_stats":{"total_commits":380,"total_committers":8,"mean_commits":47.5,"dds":0.531578947368421,"last_synced_commit":"02b9130235cb86abe47c38e71db5b7777420b12f"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/eik-lib/common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fcommon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fcommon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fcommon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fcommon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eik-lib","download_url":"https://codeload.github.com/eik-lib/common/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eik-lib%2Fcommon/sbom","scorecard":{"id":369963,"data":{"date":"2025-08-11","repo":{"name":"github.com/eik-lib/common","commit":"767e98ab585b665a7f18536e7b2bd519331f8f61"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"16 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/publish.yml:4","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/eik-lib/common/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/eik-lib/common/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/eik-lib/common/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/eik-lib/common/test.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:28","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:27","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v5.1.6 not signed: https://api.github.com/repos/eik-lib/common/releases/234115239","Warn: release artifact v5.1.5 not signed: https://api.github.com/repos/eik-lib/common/releases/225386086","Warn: release artifact v5.1.4 not signed: https://api.github.com/repos/eik-lib/common/releases/224699078","Warn: release artifact v5.1.3 not signed: https://api.github.com/repos/eik-lib/common/releases/224692332","Warn: release artifact v5.1.2 not signed: https://api.github.com/repos/eik-lib/common/releases/223758266","Warn: release artifact v5.1.6 does not have provenance: https://api.github.com/repos/eik-lib/common/releases/234115239","Warn: release artifact v5.1.5 does not have provenance: https://api.github.com/repos/eik-lib/common/releases/225386086","Warn: release artifact v5.1.4 does not have provenance: https://api.github.com/repos/eik-lib/common/releases/224699078","Warn: release artifact v5.1.3 does not have provenance: https://api.github.com/repos/eik-lib/common/releases/224692332","Warn: release artifact v5.1.2 does not have provenance: https://api.github.com/repos/eik-lib/common/releases/223758266"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish.yml:18"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'main'","Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":5,"reason":"SAST tool is not run on all commits -- score normalized to 5","details":["Warn: 11 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:43:40.177Z","repository_id":36151914,"created_at":"2025-08-18T12:43:40.177Z","updated_at":"2025-08-18T12:43:40.177Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29455702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["eik"],"created_at":"2024-11-08T04:35:49.037Z","updated_at":"2026-02-14T22:26:12.938Z","avatar_url":"https://github.com/eik-lib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @eik/common\n\nThis package contains common utilities and schemas used in other Eik modules.\n\n## Schema\n\nThe [schema for `eik.json`](https://eik.dev/docs/reference/eik-json#json-schema)\ncan be found here in this repo. Here is how you can use it in your `eik.json`.\n\n```json\n{\n\t\"$schema\": \"https://raw.githubusercontent.com/eik-lib/common/main/lib/schemas/eikjson.schema.json\",\n\t\"name\": \"my-app\",\n\t\"version\": \"1.0.0\",\n\t\"server\": \"https://eik.store.com\",\n\t\"files\": \"./public\",\n\t\"import-map\": [\"https://eik.store.com/map/store/v1\"]\n}\n```\n\n`@eik/common` has a JavaScript API to [check against the schema](#schemas).\n\n## API\n\n### helpers\n\n`helpers` has utility functions used by several other Eik modules.\n\n```js\nimport { helpers } from \"@eik/common\";\n\nlet config = helpers.getDefaults();\n```\n\nThese are the available functions on `helpers`.\n\n| Name                  | Description                                                                                                                                                                                      |\n| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `getDefaults`         | Reads configuration from `eik.json` or `package.json`. Includes defaults for missing optional settings.                                                                                          |\n| `localAssets`         | Sets up asset routes for local development. Mounted paths match those on Eik server and values are read from projects eik.json file.                                                             |\n| `typeSlug`            | Maps between Eik configuration values for the package type and its URL/file system value.                                                                                                        |\n| `typeTitle`           | Maps between a type config value and its title. Essentially uppercases the input.                                                                                                                |\n| `addTrailingSlash`    |                                                                                                                                                                                                  |\n| `removeTrailingSlash` |                                                                                                                                                                                                  |\n| `addLeadingSlash`     |                                                                                                                                                                                                  |\n| `removeLeadingSlash`  |                                                                                                                                                                                                  |\n| `resolveFiles`        | Uses an Eik JSON \"files\" definition to resolve files on disk into a data structure. Returns a list of [ResolvedFile](https://github.com/eik-lib/common/blob/main/lib/classes/resolved-files.js). |\n| `configStore`         | Collection of helper methods for reading and writing Eik configuration files.                                                                                                                    |\n| `fetchImportMaps`     | Helper to get import maps (array of URLs) with some common error handling.                                                                                                                       |\n\n#### localAssets\n\nSets up asset routes for local development. Mounted paths match those on Eik server and values are read from projects eik.json file.\n\nGiven this server and `eik.json`, the following routes would be added to your app.\n\n```js\nimport { helpers } from \"@eik/common\";\nimport express from \"express\";\n\nlet app = express();\n\nawait helpers.localAssets(app);\n```\n\n```json\n{\n\t\"name\": \"my-app\",\n\t\"version\": \"1.0.0\",\n\t\"server\": \"https://eik.store.com\",\n\t\"files\": {\n\t\t\"esm.js\": \"./assets/esm.js\",\n\t\t\"esm.css\": \"./assets/esm.css\",\n\t\t\"/\": \"./assets/**/*.map\"\n\t}\n}\n```\n\n```\n/pkg/my-app/1.0.0/esm.js\n/pkg/my-app/1.0.0/esm.css\n/pkg/my-app/1.0.0/esm.js.map\n/pkg/my-app/1.0.0/esm.css.map\n```\n\n### schemas\n\n`schemas` has functions to check values against the [`eik.json` schema](#schema).\nYou can check a value against the schema for `eik.json` as a whole, or for individual\nvalues in the schema.\n\n```js\nimport { schemas } from \"@eik/common\";\n\nlet { error, value } = schemas.validate.eikJSON(eikConfig);\nif (error) {\n\t// fallback\n}\n```\n\nIf you prefer, you can use the `assert` API which throws on error.\n\n```js\nimport { schemas } from \"@eik/common\";\n\ntry {\n\tschemas.assert.eikJSON(eikConfig);\n} catch {\n\t// fallback\n}\n```\n\nThese are the available functions on `schemas.validate` and `schemas.assert`.\n\n| Name        | Description                                                             |\n| ----------- | ----------------------------------------------------------------------- |\n| `eikJSON`   | Checks that the given value includes required fields that are valid     |\n| `name`      | Checks [name](https://eik.dev/docs/reference/eik-json#name)             |\n| `version`   | Checks [version](https://eik.dev/docs/reference/eik-json#version)       |\n| `type`      | Checks [type](https://eik.dev/docs/reference/eik-json#type)             |\n| `server`    | Checks [server](https://eik.dev/docs/reference/eik-json#server)         |\n| `files`     | Checks [files](https://eik.dev/docs/reference/eik-json#files)           |\n| `importMap` | Checks [import-map](https://eik.dev/docs/reference/eik-json#import-map) |\n| `out`       | Checks [out](https://eik.dev/docs/reference/eik-json#out)               |\n\n### stream\n\n`stream` has functions to check that a value is a Stream.\n\n```js\nimport { stream } from \"@eik/common\";\n\nif (stream.isStream(maybeStream)) {\n\t// yup, it's a Stream\n}\n\nif (stream.isReadableStream(maybeReadableStream)) {\n\t// yup, it's a ReadableStream\n}\n```\n\n### validators\n\n`validators` functions return the provided string normalized to lowercase, or throw an Error if the value does not pass the validation rules.\nWhere possible, prefer using the [`schemas` API](#schemas).\n\n```js\nimport { validators } from \"@eik/common\";\n\nlet alias = validators.alias(\"1\");\n```\n\nThese are the available functions on `validators`.\n\n| Name         | Description                                                      |\n| ------------ | ---------------------------------------------------------------- |\n| `alias`      | Checks that a value is a valid alias value (ex 1)                |\n| `name`       | Checks that a value is a valid package name                      |\n| `org`        | Checks that a value is a valid organisation name.                |\n| `origin`     | Check that a value looks like an HTTP origin.                    |\n| `version`    | Checks that a value is a valid semver version                    |\n| `semverType` | Checks that a value is a valid semver type (major, minor, patch) |\n| `type`       | Checks that the value is a valid Eik type (pkg, npm, map)        |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feik-lib%2Fcommon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feik-lib%2Fcommon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feik-lib%2Fcommon/lists"}