Skip to content

Commit 0781ac8

Browse files
authored
refactor: undo monorepo (#260)
* docs: add unmonorepo WebApi design spec * chore: ignore local worktrees * test: add unmonorepo feature spec helpers * test: add layout migration codemod * refactor: migrate sources to unified feature layout * refactor: unmonorepo webapi package * fix: restore WebAPI naming * Fix runtime test output suffix * Flatten unmonorepo public module surface * fix: keep generated type modules internal * fix: keep DOM globals internal * docs: add API surface usage summary * fix: simplify public global modules
1 parent e864f13 commit 0781ac8

600 files changed

Lines changed: 6070 additions & 5864 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -56,62 +56,32 @@ jobs:
5656
id: vars
5757
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
5858

59-
- name: Update workspace versions to -<commit-hash>
59+
- name: Update package version to -<commit-hash>
6060
env:
6161
PACKAGE_VERSION: ${{ steps.package-version.outputs.current-version }}-experimental-${{ env.COMMIT_HASH }}
6262
run: |
6363
node <<'NODE'
6464
const fs = require("node:fs");
65-
const path = require("node:path");
66-
67-
const packagesDir = path.join(process.cwd(), "packages");
68-
const version = process.env.PACKAGE_VERSION;
69-
const packages = fs
70-
.readdirSync(packagesDir)
71-
.filter((dir) => fs.existsSync(path.join(packagesDir, dir, "package.json")))
72-
.map((dir) => {
73-
const packageJsonPath = path.join(packagesDir, dir, "package.json");
74-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
75-
return { packageJsonPath, packageJson };
76-
});
77-
const workspaceNames = new Set(packages.map(({ packageJson }) => packageJson.name));
78-
79-
for (const { packageJsonPath, packageJson } of packages) {
80-
packageJson.version = version;
81-
82-
for (const field of ["dependencies", "peerDependencies", "devDependencies"]) {
83-
if (!packageJson[field]) continue;
84-
85-
for (const dependencyName of Object.keys(packageJson[field])) {
86-
if (workspaceNames.has(dependencyName)) {
87-
packageJson[field][dependencyName] = version;
88-
}
89-
}
90-
}
91-
92-
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
93-
}
65+
const packageJsonPath = "package.json";
66+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
67+
packageJson.version = process.env.PACKAGE_VERSION;
68+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`);
9469
NODE
9570
96-
- name: Package npm workspaces
97-
run: npm pack --workspaces
71+
- name: Package npm package
72+
run: npm pack
9873

9974
- name: Upload npm package artifact
10075
uses: actions/upload-artifact@v7
10176
with:
10277
name: npm-packages
10378
path: "*.tgz"
10479

105-
- name: Publish npm packages
80+
- name: Publish npm package
10681
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
10782
env:
10883
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
109-
run: |
110-
for package in packages/*; do
111-
if [ -f "$package/package.json" ]; then
112-
npm publish --workspace "$package" --access public --tag experimental
113-
fi
114-
done
84+
run: npm publish --access public --tag experimental
11585

11686
deploy-docs:
11787
needs: build

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
dist/
66
tmp/
77
docs/public/llm.txt
8+
.npm-cache/
9+
*.tgz
810
*~
11+
.worktrees/
912

1013
**/lib/bs/
1114
**/lib/ocaml
@@ -14,4 +17,6 @@ docs/public/llm.txt
1417

1518
rescript.lock
1619

17-
**/*.res.js
20+
src/**/*.js
21+
tests/**/*.js
22+
**/*.res.js

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ and add `@rescript/webapi` to your `rescript.json`:
1717
```json
1818
{
1919
"dependencies": [
20-
+ "@rescript/webapi"
21-
],
22-
"compiler-flags": [
23-
+ "-open WebAPI.Global"
20+
"@rescript/webapi"
2421
]
2522
}
2623
```
2724

25+
## Usage
26+
27+
```rescript
28+
let location = WebAPI.Window.current->WebAPI.Window.location
29+
let href = location.href
30+
location->WebAPI.Location.reload
31+
```
32+
2833
## Documentation
2934

3035
More information can be found on https://rescript-lang.github.io/experimental-rescript-webapi/

astro.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export default defineConfig({
5555
{
5656
slug: "design-philosophy",
5757
},
58+
{
59+
slug: "api-surface",
60+
},
5861
{
5962
label: "Examples",
6063
link: "examples",

0 commit comments

Comments
 (0)