File tree Expand file tree Collapse file tree 5 files changed +46
-9
lines changed Expand file tree Collapse file tree 5 files changed +46
-9
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,12 @@ public function getFiles()
6060 'template ' => '/web/tsconfig.json.twig ' ,
6161 'minify ' => false ,
6262 ],
63+ [
64+ 'scope ' => 'default ' ,
65+ 'destination ' => 'rollup.config.js ' ,
66+ 'template ' => '/web/rollup.config.js.twig ' ,
67+ 'minify ' => false ,
68+ ],
6369 [
6470 'scope ' => 'default ' ,
6571 'destination ' => 'dist/cjs/package.json ' ,
Original file line number Diff line number Diff line change 1919 "url": "{{ sdk .gitURL }}"
2020 },
2121 "scripts": {
22- "build": "npm run build:types && npm run build:esm && npm run build:cjs && npm run build:iife ",
22+ "build": "npm run build:types && npm run build:libs ",
2323 "build:types": "tsc --declaration --emitDeclarationOnly --outDir types",
24- "build:esm": "tsc --module es6 --outDir dist/esm",
25- "build:cjs": "rollup dist/esm/sdk.js --format cjs --name Appwrite -e cross-fetch/polyfill --context global -m --no-esModule -o dist/cjs/sdk.js",
26- "build:iife": "rollup dist/esm/sdk.js --format iife --name Appwrite -e cross-fetch/polyfill --context window -m --no-esModule -o dist/iife/sdk.js"
24+ "build:libs": "rollup -c"
2725 },
2826 "devDependencies": {
27+ "@rollup/plugin-typescript": "^8.2.1",
2928 "playwright": "^1.10.0",
3029 "rollup": "^2.43.0",
3130 "serve-handler": "^6.1.3",
31+ "tslib": "^2.2.0",
3232 "typescript": "^4.2.3"
3333 },
3434 "dependencies": {
3535 "cross-fetch": "^3.1.0",
36- "form-data": "^4 .0.0"
36+ "isomorphic- form-data": "^2 .0.0"
3737 },
3838 "jsdelivr": "dist/iife/sdk.js",
3939 "unpkg": "dist/iife/sdk.js"
Original file line number Diff line number Diff line change 1+ import pkg from "./package.json";
2+ import typescript from "@rollup/plugin-typescript";
3+
4+ export default {
5+ external: Object.keys(pkg.dependencies),
6+ input: "src/sdk.ts",
7+ plugins: [typescript()],
8+ output: [
9+ {
10+ format: "cjs",
11+ file: pkg.main,
12+ esModule: false,
13+ sourcemap: true,
14+ },
15+ {
16+ format: "es",
17+ file: pkg.module,
18+ sourcemap: true,
19+ },
20+ {
21+ format: "iife",
22+ file: pkg.jsdelivr,
23+ name: "Appwrite",
24+ esModule: false,
25+ globals: {
26+ "cross-fetch": "window",
27+ "FormData": "FormData",
28+ },
29+ },
30+ ],
31+ };
Original file line number Diff line number Diff line change 1+ import "isomorphic-form-data";
2+ import { fetch } from "cross-fetch";
3+
14type Payload = {
25 [key: string]: any;
36}
@@ -6,9 +9,6 @@ type Headers = {
69 [key: string]: string;
710}
811
9- const FormData = typeof window === 'undefined' ? require('form-data') : window.FormData;
10- const fetch = typeof window === 'undefined' ? require('cross-fetch') : window.fetch;
11-
1212class {{spec .title | caseUcfirst }}Exception extends Error {
1313 code: number;
1414 response: string;
Original file line number Diff line number Diff line change 66 "declaration": false,
77 "esModuleInterop": true,
88 "inlineSourceMap": false,
9- "lib": ["ES6 ", "DOM"],
9+ "lib": ["ESNext ", "DOM"],
1010 "listEmittedFiles": false,
1111 "listFiles": false,
1212 "moduleResolution": "node",
You can’t perform that action at this time.
0 commit comments