Skip to content

Commit

Permalink
chore: prepared for v.0.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Jul 19, 2024
1 parent 0aeedc3 commit 343b71f
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 63 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ permissions:

jobs:
tools-deps-update:
if: github.repository == 'marco-ippolito/amaro'
if: github.repository == 'nodejs/amaro'
runs-on: ubuntu-latest
strategy:
fail-fast: false # Prevent other jobs from aborting if one fails
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
43 changes: 43 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Contributing to Amaro

If you want to build Amaro yourself, you can build the project like this:

1. Clone this repository.
2. Run `npm install`.
3. Run `npm run build`.

The `dist/` directory now contains the Amaro build.
You can run the tests with `npm test`.

## Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

- (a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

- (b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

- (c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

- (d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

## Moderation Policy

The [Node.js Moderation Policy] applies to this project.

[Node.js Moderation Policy]:
https://github.com/nodejs/admin/blob/master/Moderation-Policy.md
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Marco Ippolito
Copyright (c) Marco Ippolito and Amaro contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ The main goal of this package is to provide a stable API for TypeScript parser,
To install Amaro, run:

```shell
npm install -g amaro
npm install amaro
```

## How to Use

By default Amaro exports a `transformSync` function that performs type stripping.
Stack traces are preserved, by replacing removed types with white spaces.

```javascript
const amaro = require('amaro');
const { code } = amaro.transformSync("const foo: string = 'bar';");
console.log(code); // "const foo = 'bar';"
```

## License (MIT)
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "amaro",
"version": "0.0.3",
"description": "Blessed Node.js TypeScript loader",
"description": "Node.js TypeScript wrapper",
"license": "MIT",
"type": "commonjs",
"main": "dist/index.js",
"homepage": "https://github.com/marco-ippolito/amaro#readme",
"homepage": "https://github.com/nodejs/amaro#readme",
"bugs": {
"url": "https://github.com/marco-ippolito/amaro/issues"
"url": "https://github.com/nodejs/amaro/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/marco-ippolito/amaro.git"
"url": "https://github.com/nodejs/amaro.git"
},
"scripts": {
"clean": "rimraf dist",
Expand All @@ -31,9 +31,6 @@
"rimraf": "^6.0.1",
"typescript": "^5.5.3"
},
"engines": {
"node": "^20.15.0"
},
"exports": {
"./package.json": "./package.json"
},
Expand Down
9 changes: 4 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
const { transformSync } = require("../lib/swc/wasm");
const swc = require("../lib/swc/wasm.js");

const DEFAULT_OPTIONS = {
mode: "strip-only",
};

// biome-ignore lint/suspicious/noExplicitAny: Swc types are not available
function transform(source: string, options?: any): string {
const { code } = transformSync(source, {
function transformSync(source: string, options?: any): string {
return swc.transformSync(source, {
...DEFAULT_OPTIONS,
...options,
});
return code;
}

module.exports = {
transform,
transformSync,
};
10 changes: 4 additions & 6 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const { test } = require("node:test");
const assert = require("node:assert");
const { transform } = require("../dist/index.js");
const { transformSync } = require("../dist/index.js");

test("should perform type stripping", () => {
assert.strictEqual(typeof transform, "function");
assert.strictEqual(
transform("const foo: string = 'bar';"),
"const foo = 'bar';",
);
assert.strictEqual(typeof transformSync, "function");
const { code } = transformSync("const foo: string = 'bar';");
assert.strictEqual(code, "const foo = 'bar';");
});

0 comments on commit 343b71f

Please sign in to comment.