This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-23 09:11:18 +00:00
|
|
|
"""Enable ESM Modules for generated Web API"""
|
|
|
|
from json import loads, dumps
|
|
|
|
|
|
|
|
TSCONFIG_ESM = {
|
2022-01-30 20:34:37 +00:00
|
|
|
"compilerOptions": {
|
|
|
|
"declaration": True,
|
|
|
|
"target": "es6",
|
|
|
|
"module": "esnext",
|
|
|
|
"moduleResolution": "node",
|
|
|
|
"outDir": "./dist/esm",
|
|
|
|
"typeRoots": ["node_modules/@types"],
|
|
|
|
},
|
|
|
|
"exclude": ["dist", "node_modules"],
|
2021-08-23 09:11:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
with open("web-api/package.json", encoding="utf-8") as _package:
|
|
|
|
package = loads(_package.read())
|
2021-08-23 14:12:31 +00:00
|
|
|
package["license"] = "GPL-3.0-only"
|
2021-08-23 09:11:18 +00:00
|
|
|
package["module"] = "./dist/esm/index.js"
|
|
|
|
package["sideEffects"] = False
|
2022-01-30 20:34:37 +00:00
|
|
|
package["scripts"]["build"] = "tsc && tsc --project tsconfig.esm.json"
|
2021-08-23 09:11:18 +00:00
|
|
|
|
|
|
|
open("web-api/package.json", "w+", encoding="utf-8").write(dumps(package))
|
|
|
|
open("web-api/tsconfig.esm.json", "w+", encoding="utf-8").write(dumps(TSCONFIG_ESM))
|