|
18 | 18 | --> |
19 | 19 |
|
20 | 20 | # Getting Involved |
| 21 | + |
21 | 22 | Even if you do not plan to contribute to Apache Arrow itself or Arrow |
22 | 23 | integrations in other projects, we'd be happy to have you involved: |
23 | 24 |
|
@@ -68,29 +69,41 @@ Uses [lerna](https://github.com/lerna/lerna) to publish each build target to npm |
68 | 69 |
|
69 | 70 | 1. Once generated, the flatbuffers format code needs to be adjusted for our build scripts (assumes `gnu-sed`): |
70 | 71 |
|
71 | | -```shell |
72 | | -cd $ARROW_HOME |
73 | | - |
74 | | -flatc --ts -o ./js/src/fb ./format/{File,Schema,Message}.fbs |
75 | | - |
76 | | -cd ./js/src/fb |
77 | | - |
78 | | -# Rename the existing files to <filename>.bak.ts |
79 | | -mv File{,.bak}.ts && mv Schema{,.bak}.ts && mv Message{,.bak}.ts |
80 | | - |
81 | | -# Remove `_generated` from the ES6 imports of the generated files |
82 | | -sed -i '+s+_generated\";+\";+ig' *_generated.ts |
83 | | -# Fix all the `flatbuffers` imports |
84 | | -sed -i '+s+./flatbuffers+flatbuffers+ig' *_generated.ts |
85 | | -# Fix the Union createTypeIdsVector typings |
86 | | -sed -i -r '+s+static createTypeIdsVector\(builder: flatbuffers.Builder, data: number\[\] \| Uint8Array+static createTypeIdsVector\(builder: flatbuffers.Builder, data: number\[\] \| Int32Array+ig' Schema_generated.ts |
87 | | -# Add `/* tslint:disable:class-name */` to the top of `Schema.ts` |
88 | | -echo -e '/* tslint:disable:class-name */\n' | cat - Schema_generated.ts > Schema1.ts && mv Schema1.ts Schema_generated.ts |
89 | | -# Remove "_generated" suffix from TS files |
90 | | -mv File{_generated,}.ts && mv Schema{_generated,}.ts && mv Message{_generated,}.ts |
91 | | -``` |
92 | | -2. Manually remove `Tensor` and `SparseTensor` imports and exports |
93 | | -3. Execute `npm run lint` from the `js` directory to fix the linting errors |
| 72 | + ```shell |
| 73 | + cd $ARROW_HOME |
| 74 | + |
| 75 | + # Create a tmpdir to store modified flatbuffers schemas |
| 76 | + tmp_format_dir=$(mktemp -d) |
| 77 | + cp ./format/*.fbs $tmp_format_dir |
| 78 | + |
| 79 | + # Remove namespaces from the flatbuffers schemas |
| 80 | + sed -i '+s+namespace org.apache.arrow.flatbuf;++ig' $tmp_format_dir/*.fbs |
| 81 | + sed -i '+s+org.apache.arrow.flatbuf.++ig' $tmp_format_dir/*.fbs |
| 82 | + |
| 83 | + # Generate TS source from the modified Arrow flatbuffers schemas |
| 84 | + flatc --ts --no-ts-reexport -o ./js/src/fb $tmp_format_dir/{File,Schema,Message}.fbs |
| 85 | + |
| 86 | + # Remove the tmpdir |
| 87 | + rm -rf $tmp_format_dir |
| 88 | + |
| 89 | + cd ./js/src/fb |
| 90 | + |
| 91 | + # Rename the existing files to <filename>.bak.ts |
| 92 | + mv File{,.bak}.ts && mv Schema{,.bak}.ts && mv Message{,.bak}.ts |
| 93 | + |
| 94 | + # Remove `_generated` from the ES6 imports of the generated files |
| 95 | + sed -i '+s+_generated\";+\";+ig' *_generated.ts |
| 96 | + # Fix all the `flatbuffers` imports |
| 97 | + sed -i '+s+./flatbuffers+flatbuffers+ig' *_generated.ts |
| 98 | + # Fix the Union createTypeIdsVector typings |
| 99 | + sed -i -r '+s+static createTypeIdsVector\(builder: flatbuffers.Builder, data: number\[\] \| Uint8Array+static createTypeIdsVector\(builder: flatbuffers.Builder, data: number\[\] \| Int32Array+ig' Schema_generated.ts |
| 100 | + # Add `/* tslint:disable:class-name */` to the top of `Schema.ts` |
| 101 | + echo -e '/* tslint:disable:class-name */\n' | cat - Schema_generated.ts > Schema1.ts && mv Schema1.ts Schema_generated.ts |
| 102 | + # Remove "_generated" suffix from TS files |
| 103 | + mv File{_generated,}.ts && mv Schema{_generated,}.ts && mv Message{_generated,}.ts |
| 104 | + ``` |
| 105 | + |
| 106 | +2. Execute `npm run lint` from the `js` directory to fix the linting errors |
94 | 107 |
|
95 | 108 | [1]: mailto:dev-subscribe@arrow.apache.org |
96 | 109 | [2]: https://github.com/apache/arrow/tree/master/format |
|
0 commit comments