Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve npm package size and documentation #44

Merged
merged 6 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Node-X12

An ASC X12 parser, generator, query engine, and mapper written for NodeJS.
Parsing supports reading from streams to conserve resources in memory-intensive
operations.
An ASC X12 parser, generator, query engine, and mapper written for NodeJS and
Deno. Parsing supports reading from Node streams to conserve resources in
memory-intensive operations.

[![Denoland/X Module](https://shield.deno.dev/x/x12)](https://deno.land/x/x12)
[![npm version](https://badge.fury.io/js/node-x12.svg)](https://badge.fury.io/js/node-x12)
Expand All @@ -16,6 +16,7 @@ operations.
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=aaronhuggins_node-x12&metric=alert_status)](https://sonarcloud.io/dashboard?id=aaronhuggins_node-x12)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=aaronhuggins_node-x12&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=aaronhuggins_node-x12)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=aaronhuggins_node-x12&metric=security_rating)](https://sonarcloud.io/dashboard?id=aaronhuggins_node-x12)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=aaronhuggins_node-x12&metric=coverage)](https://sonarcloud.io/summary/new_code?id=aaronhuggins_node-x12)

## Installing

Expand Down
19 changes: 19 additions & 0 deletions scripts/build_npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@ await build({
});

// post build steps
class Appender {
encoder = new TextEncoder();
file: Promise<Deno.FsFile>;
constructor(file: string) {
this.file = Deno.open(file, { append: true });
}
async write(line: string) {
(await this.file).write(this.encoder.encode(line + "\n"));
}
async close() {
(await this.file).close();
}
}

const npmignore = new Appender("npm/.npmignore");
await npmignore.write("esm/test/test-data/**");
await npmignore.write("script/test/test-data/**");
await npmignore.close();

await Deno.copyFile("LICENSE.md", "npm/LICENSE.md");
await Deno.copyFile("README.md", "npm/README.md");

Expand Down