-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: .NET Support #73
Changes from 2 commits
2ca1e44
d688def
fdd6b16
0fc94c6
d9f8b3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,35 @@ original module. This code depends on the following maven package (should be def | |
|
||
The output directory will also include a tarball `[email protected]` that must be bundled in your project. | ||
|
||
### .NET Output | ||
|
||
To produce a .NET module from your source, use the `dotnet` option: | ||
|
||
```ts | ||
await srcmak('srcdir', { | ||
dotnet: { | ||
outdir: '/path/to/project/root', | ||
namespace: 'HelloWorld' | ||
} | ||
}); | ||
``` | ||
|
||
Or the `--dotnet-*` switches in the CLI: | ||
|
||
```bash | ||
$ jsii-srcmak /src/dir --dotnet-outdir=dir --dotnet-namespace=HelloWorld | ||
``` | ||
|
||
* The `outdir`/`--dotnet-outdir` option points to the root directory of your .NET project. | ||
* The `package`/`--dotnet-namespace` option is the .NET root namespace. | ||
|
||
The output directory will include a .NET project that corresponds to the | ||
original module. This code depends on the following NuGet package (It is already defined as a dependency in the generated project): | ||
|
||
- [jsii](https://www.nuget.org/packages/Amazon.JSII.Runtime/) | ||
|
||
The output directory will also include a tarball `[email protected]` that must be bundled in your project (It is already included as an embedded resource in the generated project). | ||
|
||
### Entrypoint | ||
|
||
The `entrypoint` option can be used to customize the name of the typescript entrypoint (default is `index.ts`). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,5 +44,12 @@ export async function srcmak(srcdir: string, options: Options = { }) { | |
await fs.mkdirp(target); // make sure target directory exists | ||
await ncp(source, target, { clobber: false }); | ||
} | ||
|
||
if (options.dotnet) { | ||
const reldir = options.dotnet.namespace; | ||
const source = path.resolve(path.join(workdir, 'dist/dotnet/', reldir)); | ||
const target = path.join(options.dotnet.outdir, reldir); | ||
await fs.move(source, target, { overwrite: true }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes sense as is since each module generates a standalone project. Applications would then have project dependencies on the generated projects. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! |
||
} | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with
csharp
here since this is producing source code and not a library (like Pacmak)