{"id":19488687,"url":"https://github.com/ibrado/serverless-version-info","last_synced_at":"2025-08-18T05:11:34.329Z","repository":{"id":35093876,"uuid":"205757432","full_name":"ibrado/serverless-version-info","owner":"ibrado","description":"Serverless plugin to create environment variables with git and package version information","archived":false,"fork":false,"pushed_at":"2023-01-27T01:50:10.000Z","size":10,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-09T07:57:00.551Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ibrado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-02T01:50:27.000Z","updated_at":"2023-06-06T15:49:24.000Z","dependencies_parsed_at":"2023-02-15T04:02:30.546Z","dependency_job_id":null,"html_url":"https://github.com/ibrado/serverless-version-info","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ibrado/serverless-version-info","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Fserverless-version-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Fserverless-version-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Fserverless-version-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Fserverless-version-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibrado","download_url":"https://codeload.github.com/ibrado/serverless-version-info/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibrado%2Fserverless-version-info/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270628772,"owners_count":24619093,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-10T21:04:55.183Z","updated_at":"2025-08-18T05:11:34.158Z","avatar_url":"https://github.com/ibrado.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Version Info\n\nThis Serverless plugin generates version information from `package.json` and `git` commands at the time of deployment. This can be included e.g. in a handler's response headers.\n\n## Install\n\n```\nnpm install --save-dev serverless-version-info\n```\n\n## Usage\n\nAdd `serverless-version-info` to your `serverless.yml` plugin section:\n\n```yaml\nplugins:\n  - serverless-version-info\n```\n\nBy default, this adds a `LAMBDA_VERSION` environment variable. Use this in your code:\n\n```javascript\n  headers['X-Lambda-Version'] = process.env.LAMBDA_VERSION;\n```\n\nSample output header:\n\n```\nX-Lambda-Version: 1.2.3-15 (master/c9edfbe+2)\n```\n\n### Options\n\nTwo options are supported:\n\n```yaml\ncustom:\n  serverless-version-info:\n    eval: true        # (Default: true)  Perform eval()'s, see below\n    verbose: true     # (Default: false) Print the resulting values during deploy\n```\n\n### Template variables\n\nThis plugin supports the following template variables:\n\n\n| Variable     | Description                                                               | Example\n|--------------|---------------------------------------------------------------------------|----------\n| `ahead`      | Commits which have not been pushed to branch                              | 2\n| `behind`     | Commits in branch which are not in the local codebase                     | 0\n| `branch`     | Current `git` branch                                                      | master\n| `delta`      | Number of untracked, deleted, modified, or renamed files vs latest commit | 2\n| `hash`       | Short hash id of latest commit                                            | c9edfbe\n| `major`      | Major version number                                                      | 1\n| `minor`      | Minor version number                                                      | 2\n| `patch`      | Patch/revision count, i.e. number of commits                              | 15\n| `pkgVersion` | `version` in `package.json`                                               | 1.2.3\n| `stage`      | `process.env.STAGE` or `provider.stage` from `serverless.yml`             | prod\n| `timestamp`  | Unix/epoch timestamp in milliseconds, also `ts`                           | 1567771125936\n| `version`    | Semantic version derived from `pkgVersion` and `patch`                    | 1.2.15\n\nThese variables can be used in `serverless.yml` by prepending a `$` to them.\n\nThe default template is `$pkgVersion-$patch ($branch/$hash+$delta)`.\n\n### Customization\n\nBy default, `serverless-version-info` sets the `LAMBDA_VERSION` environment variable. You may change this and the template(s) used in `serverless.yml`:\n\n```yaml\ncustom:\n  serverless-version-info:\n    environment:\n      LAMBDA_DEPLOYED_VERSION: true # default template\n      X_VERSION_HEADER: \"$version-$delta ($branch/$hash)\" # 1.2.15-2 (master/c9edfbe)\n```\n\nIf you define custom environment variables, `LAMBDA_VERSION` will *not* be set unless you also specify it in the configuration.\n\n### Expression evaluation\n\n`serverless-version-info` supports basic `eval()` support for expressions bounded by `` $`..` `` or `$|..|`.\n\n\u003e NOTE: Nesting expressions using the same expression delimiters is currently not supported.\n\n```yaml\ncustom:\n  serverless-version-info:\n    verbose: true\n    environment:\n      SVI_TEST_1: \"$version-$delta ($branch/$hash)\"\n      SVI_TEST_2: \"$version-$delta $major.$minor ($branch/$hash) [$stage]\"\n      SVI_TEST_3: \"$major.$`($minor + $patch/10)`\"\n      SVI_TEST_4: \"$major.$`'${self:provider.stage}' === 'prod' ? '$minor' : '$|$minor+1|'`.$patch\"\n```\n\nwhich results in\n\n```\nServerless: serverless-version-info set SVI_TEST_1 to \"0.1.19-3 (master/c2f466b)\"\nServerless: serverless-version-info set SVI_TEST_2 to \"0.1.19-3 0.1 (master/c2f466b) [staging]\"\nServerless: serverless-version-info set SVI_TEST_3 to \"0.2.9\"\nServerless: serverless-version-info set SVI_TEST_4 to \"0.2.19\"\n```\n\n## See also\n\nFor general expression support in `serverless.yml`, please check out [serverless-eval-plugin](https://github.com/ibrado/serverless-eval-plugin.git).\n\n## Contribute\n\nPlease see the [Github repository](https://github.com/ibrado/serverless-version-info.git).\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrado%2Fserverless-version-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibrado%2Fserverless-version-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibrado%2Fserverless-version-info/lists"}