Skip to content

Commit f308838

Browse files
authored
Bring over the last bits of info from old docs on package management interop (#276)
1 parent 59ee704 commit f308838

File tree

5 files changed

+21
-69
lines changed

5 files changed

+21
-69
lines changed

data/sidebar_manual_latest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"inlining-constants",
4747
"use-illegal-identifier-names",
4848
"generate-converters-accessors",
49-
"browser-support-polyfills"
49+
"browser-support-polyfills",
50+
"libraries"
5051
],
5152
"Build System": [
5253
"build-overview",
@@ -56,8 +57,7 @@
5657
"build-performance"
5758
],
5859
"Guides": [
59-
"converting-from-js",
60-
"libraries"
60+
"converting-from-js"
6161
],
6262
"Extra": [
6363
"newcomer-examples",
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
---
2-
title: "Libraries"
3-
description: "ReScript libraries"
2+
title: "Libraries & Publishing"
3+
description: "Install & publish ReScript packages"
44
canonical: "/docs/manual/latest/libraries"
55
---
66

7-
# Libraries
7+
# Libraries & Publishing
88

9-
ReScript libraries are just like JavaScript libraries: hosted on [NPM](http://npmjs.com).
9+
ReScript libraries are just like JavaScript libraries: published & hosted on [NPM](http://npmjs.com). You can reuse your `npm`, `yarn` and `package.json`-related tools to manage them!
1010

11-
If you can't find what you're looking for: sometimes **you don't need a wrapper** to use a JS library:
11+
## Tips & Tricks
12+
13+
### Publish
14+
15+
We recommend you to check in your compiled JavaScript output, for its [various benefits](interop-with-js-build-systems.md#popular-js-build-systems). If not, then at least consider publishing the JavaScript output by un-ignoring them in your [npmignore](https://docs.npmjs.com/cli/v7/using-npm/developers#keeping-files-out-of-your-package). This way, your published ReScript package comes with plain JavaScript files that JS users can consume. If your project's good, JS users might not even realize that they've installed a library written in ReScript!
16+
17+
### Find Libraries
18+
19+
Search `rescript`-related packages on NPM, or use our [Package Index](/packages).
20+
21+
If you can't find what you're looking for, remember that **you don't need a wrapper** to use a JS library:
1222

1323
- Most JS data types, such as array and objects, [map over cleanly to ReScript and vice-versa](shared-data-types.md).
1424
- You also have access to the familiar [JS API](api/js).
15-
- You can use a JavaScript library without needing to bind to them first. Check the [`external`](external) page.
25+
- You can use a JavaScript library without needing to install dedicated binding libraries. Check the [`external`](external) page.

pages/docs/manual/latest/shared-data-types.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Unlike most compiled-to-js languages, in ReScript, **you don't need to write dat
2121
- Record. Record compiles to JS object. Therefore you can also treat JS objects as records. If they're too dynamic, consider modeling them on the ReScript side as a hashmap/dictionary [`Js.Dict`](api/js/dict) or a ReScript object.
2222
- Object. ReScript objects are JavaScript objects, vice-versa.
2323
- Function. They compile to clean JS functions.
24+
- Module. ReScript files are considered top-level modules, and are compiled to JS files 1 to 1. Nested modules are compiled to JavaScript objects.
2425
- Unit. The `unit` type, which has a single value `()`, compiles to `undefined` too. Likewise, you can treat an incoming JS `undefined` as `()`.
2526

2627
<!-- TODO: talk about poly variant -->

pages/docs/manual/v8.0.0/shared-data-types.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Unlike most compiled-to-js languages, in ReScript, **you don't need to write dat
2121
- Record. Record compiles to JS object. Therefore you can also treat JS objects as records. If they're too dynamic, consider modeling them on the ReScript side as a hashmap/dictionary [`Js.Dict`](api/js/dict) or a ReScript object.
2222
- Object. ReScript objects are JavaScript objects, vice-versa.
2323
- Function. They compile to clean JS functions.
24+
- Module. ReScript files are considered top-level modules, and are compiled to JS files 1 to 1. Nested modules are compiled to JavaScript objects.
2425
- Unit. The `unit` type, which has a single value `()`, compiles to `undefined` too. Likewise, you can treat an incoming JS `undefined` as `()`.
2526

2627
<!-- TODO: talk about poly variant -->

pages/docs/reason-compiler/latest/interop-overview.mdx

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)