Skip to content

Commit 1f48544

Browse files
authored
Merge pull request #4359 from matrix-org/dbkr/backport_4355
Move `type:module` declaration into package.json. (Backport 4355)
2 parents 43e5887 + 7ef4062 commit 1f48544

File tree

5 files changed

+22
-27
lines changed

5 files changed

+22
-27
lines changed
File renamed without changes.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
"keywords": [
3232
"matrix-org"
3333
],
34-
"main": "./lib/index.js",
35-
"browser": "./lib/browser-index.js",
34+
"type": "module",
35+
"main": "./src/index.js",
36+
"browser": "./src/browser-index.js",
3637
"matrix_src_main": "./src/index.ts",
3738
"matrix_src_browser": "./src/browser-index.ts",
3839
"matrix_lib_main": "./lib/index.js",

scripts/release/pre-release.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ do
1212
jq ".$i = .matrix_lib_$i" package.json > package.json.new && mv package.json.new package.json && yarn prettier --write package.json
1313
fi
1414
done
15-
16-
# Ensure that "type": "module" is present
17-
jq '.type = "module"' package.json > package.json.new && mv package.json.new package.json && yarn prettier --write package.json

scripts/switch_package_to_release.cjs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
3+
const fsProm = require("fs/promises");
4+
5+
const PKGJSON = "package.json";
6+
7+
async function main() {
8+
const pkgJson = JSON.parse(await fsProm.readFile(PKGJSON, "utf8"));
9+
for (const field of ["main", "typings"]) {
10+
if (pkgJson["matrix_lib_" + field] !== undefined) {
11+
pkgJson[field] = pkgJson["matrix_lib_" + field];
12+
}
13+
}
14+
15+
await fsProm.writeFile(PKGJSON, JSON.stringify(pkgJson, null, 2));
16+
}
17+
18+
main();

scripts/switch_package_to_release.js

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

scripts/switch_package_to_release.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
switch_package_to_release.cjs

0 commit comments

Comments
 (0)