Skip to content

Commit 1010ac2

Browse files
authored
Revert "Use npm package scope" (microsoft#104)
1 parent f91b23e commit 1010ac2

File tree

18 files changed

+41
-42
lines changed

18 files changed

+41
-42
lines changed

Docs/dynamic-invoke.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
For a minimal example of this scenario, see
44
[../examples/dynamic-invoke/](../examples/dynamic-invoke/).
55

6-
1. Add a dependency on the `@microsoft/node-api-dotnet` npm package to your JavaScript project:
6+
1. Add a dependency on the `node-api-dotnet` npm package to your JavaScript project:
77
```
8-
npm install @microsoft/node-api-dotnet
8+
npm install node-api-dotnet
99
```
1010
> :warning: Until this package is published, you'll need to
1111
[build it from source](../README-DEV.md).<br>Then get the package from
1212
`out/pkg/node-api-dotnet-{version}.tgz`.
1313
14-
2. Import the `@microsoft/node-api-dotnet` package in your JavaScript code:
14+
2. Import the `node-api-dotnet` package in your JavaScript code:
1515
```JavaScript
16-
const dotnet = require('@microsoft/node-api-dotnet');
16+
const dotnet = require('node-api-dotnet');
1717
```
1818
Or if using ES modules:
1919
```JavaScript
20-
import dotnet from '@microsoft/node-api-dotnet';
20+
import dotnet from 'node-api-dotnet';
2121
```
2222
2323
3. Load a .NET assembly from its path:
@@ -41,9 +41,9 @@ For a minimal example of this scenario, see
4141
> :warning: Generic types and methods are not yet supported very well -- with the exception of
4242
generic collections which work great.
4343
44-
5. **Optional**: Use the `@microsoft/node-api-dotnet-generator` tool to generate type definitions for the assembly:
44+
5. **Optional**: Use the `node-api-dotnet-generator` tool to generate type definitions for the assembly:
4545
```
46-
npm exec @microsoft/node-api-dotnet-generator -- -typedefs ExampleAssembly.d.ts --assembly path/to/ExampleAssembly.dll --reference path/to/DependencyAssembly.dll
46+
npm exec node-api-dotnet-generator -- -typedefs ExampleAssembly.d.ts --assembly path/to/ExampleAssembly.dll --reference path/to/DependencyAssembly.dll
4747
```
4848
> :warning: Any dependencies need to be explicitly referenced with the `--reference` option.
4949

Docs/node-module.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,21 @@ For a minimal example of this scenario, see
5353
`obj\{Configuration}\{TargetFramerwork}\{RuntimeIdentifier}\generated\
5454
Microsoft.JavaScript.NodeApi.Generator\Microsoft.JavaScript.NodeApi.Generator.ModuleGenerator`
5555
56-
5. Switching over to the JavaScript project, add a dependency on the `@microsoft/node-api-dotnet` npm package:
56+
5. Switching over to the JavaScript project, add a dependency on the `node-api-dotnet` npm package:
5757
```
58-
npm install @microsoft/node-api-dotnet
58+
npm install node-api-dotnet
5959
```
6060
> :warning: Until this package is published, you'll need to
6161
[build it from source](../README-DEV.md).<br>Then get the package from
6262
`out/pkg/node-api-dotnet-{version}.tgz`.
6363
64-
6. Import the `@microsoft/node-api-dotnet` package in your JavaScript code:
64+
6. Import the `node-api-dotnet` package in your JavaScript code:
6565
```JavaScript
66-
const dotnet = require('@microsoft/node-api-dotnet');
66+
const dotnet = require('node-api-dotnet');
6767
```
6868
Or if using ES modules:
6969
```JavaScript
70-
import dotnet from '@microsoft/node-api-dotnet';
70+
import dotnet from 'node-api-dotnet';
7171
```
7272
7373
7. Load your .NET module assembly from its path using the `dotnet.require()` function. Also provide
@@ -114,7 +114,7 @@ For a minimal example of this scenario, see
114114
dotnet publish
115115
```
116116
117-
A native module does not depend on the `@microsoft/node-api-dotnet` package, so it can be removed from the
117+
A native module does not depend on the `node-api-dotnet` package, so it can be removed from the
118118
JavaScript project's `package.json`. Then update the JavaScript code to `require()` the .NET
119119
AOT module directly. Be sure to reference the published `.node` file location, which might be
120120
different from the built `.dll` location.

Docs/presentation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Requirements:
4949
---
5050
## Dynamically invoke .NET APIs from JS
5151
```js
52-
const dotnet =require('@microsoft/node-api-dotnet');
52+
const dotnet =require('node-api-dotnet');
5353
dotnet.Console.WriteLine('Hello from .NET!');
5454

5555
const MyAssembly = dotnet.load('path/to/MyAssembly.dll');

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and it isn't yet all packaged up nicely in a way that can be easily consumed._
1818
### Minimal example - JS calling .NET
1919
```JavaScript
2020
// JavaScript
21-
const Console = require('@microsoft/node-api-dotnet').Console;
21+
const Console = require('node-api-dotnet').Console;
2222
Console.WriteLine('Hello from .NET!');
2323
```
2424

@@ -55,7 +55,7 @@ The `node-api-dotnet` package manages hosting the .NET runtime in the JS process
5555
`node-api-dotnet` module, and additional .NET assemblies can be loaded by file path:
5656
```JavaScript
5757
// JavaScript
58-
const dotnet = require('@microsoft/node-api-dotnet');
58+
const dotnet = require('node-api-dotnet');
5959
const ExampleAssembly = dotnet.load('path/to/ExampleAssembly.dll');
6060
const exampleObj = new ExampleAssembly.ExampleClass(...args);
6161
```
@@ -103,7 +103,7 @@ If writing TypeScript, or type-checked JavaScript, there is a tool to generate t
103103
definitions for .NET APIs. Soon, it should also generate a small `.js` file that exports the
104104
assembly in a more natural way as a JS module.
105105
```bash
106-
$ npm exec @microsoft/node-api-dotnet-generator --assembly ExampleAssembly.dll --typedefs ExampleAssembly.d.ts
106+
$ npm exec node-api-dotnet-generator --assembly ExampleAssembly.dll --typedefs ExampleAssembly.d.ts
107107
```
108108
```TypeScript
109109
// TypeScript
@@ -263,7 +263,7 @@ Thanks to these design choices, JS to .NET calls are [more than twice as fast](
263263
#### Instructions
264264
For calling .NET from JS, choose between one of the following scenarios:
265265
- [Dynamically invoke .NET APIs from JavaScript](./Docs/dynamic-invoke.md)<br/>
266-
Dynamic invocation is simpler to set up: all you need is the `@microsoft/node-api-dotnet` npm package and
266+
Dynamic invocation is simpler to set up: all you need is the `node-api-dotnet` npm package and
267267
the path to a .NET assembly you want to call. But it has some limitations (not all kinds of APIs
268268
are supported), and is not quite as fast as a C# module, because marshalling code must be
269269
generated at runtime.

examples/dotnet-dynamic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ The `example.js` script loads .NET and calls `Console.WriteLine()`.
55
| Command | Explanation
66
|----------------------------------|--------------------------------------------------
77
| `dotnet pack ../..` | Build Node API .NET packages.
8-
| `npm install` | Install npm packages into the example project.
8+
| `npm install` | Install `node-api-dotnet` npm package into the example project.
99
| `node example.js` | Run example JS code that uses that package to dynamically invoke a .NET API.

examples/dotnet-dynamic/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
const dotnet = require('@microsoft/node-api-dotnet');
4+
const dotnet = require('node-api-dotnet');
55
const Console = dotnet.Console;
66
Console.WriteLine('Hello from .NET!');

examples/dotnet-dynamic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-api-dotnet-examples-dotnet-dynamic",
33
"dependencies": {
4-
"@microsoft/node-api-dotnet": "file:../../out/pkg/node-api-dotnet"
4+
"node-api-dotnet": "file:../../out/pkg/node-api-dotnet"
55
}
66
}

examples/dotnet-module/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ doc-comments for the module's APIs via the auto-generated `.d.ts` file.
1414
### .NET Framework
1515
To use .NET Framework, apply the follwing change to `example.js`:
1616
```diff
17-
-const dotnet = require('@microsoft/node-api-dotnet');
18-
+const dotnet = require('@microsoft/node-api-dotnet/net472');
17+
-const dotnet = require('node-api-dotnet');
18+
+const dotnet = require('node-api-dotnet/net472');
1919
```

examples/dotnet-module/example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4-
const dotnet = require('@microsoft/node-api-dotnet');
4+
const dotnet = require('node-api-dotnet');
55

66
/** @type {import('./bin/dotnet-module').Example} */
77
const Example = dotnet.require('./bin/dotnet-module').Example;

examples/dotnet-module/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-api-dotnet-examples-dotnet-module",
33
"dependencies": {
4-
"@microsoft/node-api-dotnet": "file:../../out/pkg/node-api-dotnet"
4+
"node-api-dotnet": "file:../../out/pkg/node-api-dotnet"
55
}
66
}

0 commit comments

Comments
 (0)