Skip to content

Commit

Permalink
chore(parser): mark parser as GA (#2831)
Browse files Browse the repository at this point in the history
dreamorosi authored Jul 25, 2024
1 parent df71d78 commit d94d70b
Showing 3 changed files with 95 additions and 108 deletions.
138 changes: 67 additions & 71 deletions .github/scripts/release_patch_package_json.js
Original file line number Diff line number Diff line change
@@ -18,80 +18,76 @@ if (process.argv.length < 3) {
const basePath = resolve(process.argv[2]);
const packageJsonPath = join(basePath, 'package.json');
const alphaPackages = [];
const betaPackages = ['@aws-lambda-powertools/parser'];
const betaPackages = [];

(() => {
try {
// Read the original package.json file
const pkgJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
// Extract the fields we want to keep
const {
name,
version: originalVersion,
description,
author,
license,
homepage,
repository,
bugs,
keywords,
dependencies,
peerDependencies,
peerDependenciesMeta,
exports,
typesVersions,
main,
types,
files,
private,
type,
} = pkgJson;
// Read the original package.json file
const pkgJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
// Extract the fields we want to keep
const {
name,
version: originalVersion,
description,
author,
license,
homepage,
repository,
bugs,
keywords,
dependencies,
peerDependencies,
peerDependenciesMeta,
exports,
typesVersions,
main,
types,
files,
private: privateField,
type,
} = pkgJson;

let version = originalVersion;
// If the package is an alpha or beta package, update the version number to include a suffix
if (alphaPackages.includes(name)) {
version = `${version}-alpha`;
} else if (betaPackages.includes(name)) {
version = `${version}-beta`;
}

// Create a new package.json file with the updated version for the tarball
const newPkgJson = {
name,
version,
description,
author,
license,
homepage,
repository,
bugs,
keywords,
dependencies,
peerDependencies,
peerDependenciesMeta,
main,
types,
files,
type,
};
let version = originalVersion;
// If the package is an alpha or beta package, update the version number to include a suffix
if (alphaPackages.includes(name)) {
version = `${version}-alpha`;
} else if (betaPackages.includes(name)) {
version = `${version}-beta`;
}

// Not all utilities have these fields, so only add them if they exist to avoid
// having empty or undefined fields in the package.json file.
if (exports) {
newPkgJson.exports = exports;
}
if (typesVersions) {
newPkgJson.typesVersions = typesVersions;
}
if (private) {
newPkgJson.private = private;
}
// Create a new package.json file with the updated version for the tarball
const newPkgJson = {
name,
version,
description,
author,
license,
homepage,
repository,
bugs,
keywords,
dependencies,
peerDependencies,
peerDependenciesMeta,
main,
types,
files,
type,
};

// Temporarily update the original package.json file.
// This version will be picked up during the `npm publish` step, so that
// the version number and metadata in the registry are correct and match the tarball.
writeFileSync('package.json', JSON.stringify(newPkgJson, null, 2));
} catch (err) {
throw err;
// Not all utilities have these fields, so only add them if they exist to avoid
// having empty or undefined fields in the package.json file.
if (exports) {
newPkgJson.exports = exports;
}
if (typesVersions) {
newPkgJson.typesVersions = typesVersions;
}
})();
if (privateField) {
newPkgJson.private = privateField;
}

// Temporarily update the original package.json file.
// This version will be picked up during the `npm publish` step, so that
// the version number and metadata in the registry are correct and match the tarball.
writeFileSync('package.json', JSON.stringify(newPkgJson, null, 2));
})();
1 change: 0 additions & 1 deletion .markdownlintignore
Original file line number Diff line number Diff line change
@@ -18,5 +18,4 @@ packages/jmespath/README.md
packages/logger/README.md
packages/metrics/README.md
packages/parameters/README.md
packages/parser/README.md
packages/tracer/README.md
64 changes: 28 additions & 36 deletions packages/parser/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
# Powertools for AWS Lambda (TypeScript) - Parser Utility <!-- omit in toc -->


| ⚠️ **WARNING: Do not use this utility in production just yet!** ⚠️ |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This AWS Lambda Powertools for TypeScript utility is currently released as beta developer preview and is intended strictly for feedback and testing purposes only. <br/>This version is not stable, and significant breaking changes might incur before going [before the GA release](https://github.com/aws-powertools/powertools-lambda-typescript/milestone/16). | _ |



Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/typescript/latest/#features).

You can use the package in both TypeScript and JavaScript code bases.

- [Intro](#intro)
- [Key features](#key-features)
- [Usage](#usage)
- [Middleware](#middleware)
- [Decorator](#decorator)
- [Manual parsing](#manual-parsing)
- [Safe parsing](#safe-parsing)
- [Built-in schemas and envelopes](#built-in-schemas-and-envelopes)
- [Middleware](#middleware)
- [Decorator](#decorator)
- [Manual parsing](#manual-parsing)
- [Safe parsing](#safe-parsing)
- [Built-in schemas and envelopes](#built-in-schemas-and-envelopes)
- [Contribute](#contribute)
- [Roadmap](#roadmap)
- [Connect](#connect)
- [How to support Powertools for AWS Lambda (TypeScript)?](#how-to-support-powertools-for-aws-lambda-typescript)
- [Becoming a reference customer](#becoming-a-reference-customer)
- [Sharing your work](#sharing-your-work)
- [Using Lambda Layer](#using-lambda-layer)
- [Becoming a reference customer](#becoming-a-reference-customer)
- [Sharing your work](#sharing-your-work)
- [Using Lambda Layer](#using-lambda-layer)
- [Credits](#credits)
- [License](#license)

@@ -35,11 +28,11 @@ The parser utility provides data validation and parsing using [Zod](https://zod.

## Key features

* Define data schema as Zod schema, then parse, validate and extract only what you want
* Built-in envelopes to unwrap and validate popular AWS event sources payloads
* Extend and customize envelopes to fit your needs
* Safe parsing option to avoid throwing errors and custom error handling
* Available for Middy.js middleware and TypeScript method decorators
- Define data schema as Zod schema, then parse, validate and extract only what you want
- Built-in envelopes to unwrap and validate popular AWS event sources payloads
- Extend and customize envelopes to fit your needs
- Safe parsing option to avoid throwing errors and custom error handling
- Available for Middy.js middleware and TypeScript method decorators

## Usage

@@ -197,7 +190,6 @@ export const handler = async (

When parsing data, you can use the `safeParse` method to avoid throwing errors and handle them manually:


```typescript
import type { Context } from 'aws-lambda';
import { parser } from '@aws-lambda-powertools/parser/middleware';
@@ -304,28 +296,28 @@ Help us prioritize upcoming functionalities or utilities by [upvoting existing R

## Connect

* **Powertools for AWS Lambda on Discord**: `#typescript` - **[Invite link](https://discord.gg/B8zZKbbyET)**
* **Email**: [email protected]
- **Powertools for AWS Lambda on Discord**: `#typescript` - **[Invite link](https://discord.gg/B8zZKbbyET)**
- **Email**: <[email protected]>

## How to support Powertools for AWS Lambda (TypeScript)?

### Becoming a reference customer

Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (TypeScript) (become a reference)](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E) issue.
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (TypeScript) (become a reference)](https://s12d.com/become-a-reference-ts) issue.

The following companies, among others, use Powertools:

* [Hashnode](https://hashnode.com/)
* [Trek10](https://www.trek10.com/)
* [Elva](https://elva-group.com)
* [globaldatanet](https://globaldatanet.com/)
* [Bailey Nelson](https://www.baileynelson.com.au)
* [Perfect Post](https://www.perfectpost.fr)
* [Sennder](https://sennder.com/)
* [Certible](https://www.certible.com/)
* [tecRacer GmbH & Co. KG](https://www.tecracer.com/)
* [AppYourself](https://appyourself.net)
* [Alma Media](https://www.almamedia.fi)
- [Hashnode](https://hashnode.com/)
- [Trek10](https://www.trek10.com/)
- [Elva](https://elva-group.com)
- [globaldatanet](https://globaldatanet.com/)
- [Bailey Nelson](https://www.baileynelson.com.au)
- [Perfect Post](https://www.perfectpost.fr)
- [Sennder](https://sennder.com/)
- [Certible](https://www.certible.com/)
- [tecRacer GmbH & Co. KG](https://www.tecracer.com/)
- [AppYourself](https://appyourself.net)
- [Alma Media](https://www.almamedia.fi)

### Sharing your work

@@ -341,4 +333,4 @@ Credits for the Lambda Powertools for AWS Lambda (TypeScript) idea go to [DAZN](

## License

This library is licensed under the MIT-0 License. See the LICENSE file.
This library is licensed under the MIT-0 License. See the LICENSE file.

0 comments on commit d94d70b

Please sign in to comment.