[TS/JS] Add rollup and config to generate iife flatbuffers bundle (#7449)

* Add rollup and config to generate iife flatbuffers bundle

* Atempt to use yarn and add deps

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Björn Harrtell
2022-08-30 01:37:43 +02:00
committed by GitHub
parent 41d9add7ef
commit ce382d6dd3
4 changed files with 25 additions and 2 deletions

View File

@@ -446,8 +446,10 @@ jobs:
- name: flatc
# FIXME: make test script not rely on flatc
run: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF . && make -j
- name: deps
run: yarn
- name: compile
run: npm run compile
run: yarn compile
- name: test
working-directory: tests
run: python3 TypeScriptTest.py

View File

@@ -17,7 +17,7 @@
},
"scripts": {
"test": "npm run compile && cd tests && python3 ./TypeScriptTest.py",
"compile": "tsc && tsc -p tsconfig.mjs.json",
"compile": "tsc && tsc -p tsconfig.mjs.json && rollup -c",
"prepublishOnly": "npm install --only=dev && npm run compile"
},
"repository": {
@@ -40,6 +40,7 @@
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"rollup": "^2.78.0",
"typescript": "^4.5.5"
}
}

8
rollup.config.js Normal file
View File

@@ -0,0 +1,8 @@
export default {
input: 'mjs/index.js',
output: {
file: 'flatbuffers.js',
format: 'iife',
name: 'flatbuffers'
}
}

View File

@@ -624,6 +624,11 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
@@ -945,6 +950,13 @@ rimraf@^3.0.2:
dependencies:
glob "^7.1.3"
rollup@^2.78.0:
version "2.78.0"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.78.0.tgz#00995deae70c0f712ea79ad904d5f6b033209d9e"
integrity sha512-4+YfbQC9QEVvKTanHhIAFVUFSRsezvQF8vFOJwtGfb9Bb+r014S+qryr9PSmw8x6sMnPkmFBGAvIFVQxvJxjtg==
optionalDependencies:
fsevents "~2.3.2"
run-parallel@^1.1.9:
version "1.2.0"
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"