You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
.github
Assets
CliClient
Clipper
ElectronClient
Modules
ReactNativeClient
MarkdownEditor
android
images
ios
lib
locales
tools
buildReactNativeInjectedJs.js
encodeAssets.js
podInstall.js
.buckconfig
.flowconfig
.gitattributes
.gitignore
.watchmanconfig
PluginAssetsLoader.ts
app.json
clean_build.bat
gulpfile.js
index.android.js
index.ios.js
index.js
main.js
metro.config.js
package-lock.json
package.json
root.js
setUpQuickActions.ts
Tools
docs
patches
readme
.eslintignore
.eslintrc.js
.gitignore
.travis.yml
BUILD.md
CONTRIBUTING.md
Joplin_install_and_update.sh
LICENSE
README.md
SECURITY.md
_config.yml
appveyor.yml
gulpfile.js
joplin.code-workspace
joplin.sublime-project
lint-staged.config.js
package-lock.json
package.json
tsconfig.dev.json
tsconfig.json
* Improving CLI build * Improving CLI build * Remove requirement to build the tools * Moved Electron app one level down * Clean up Electron build * Moved tools to sub-dir * Updated root script * update root * update root * update root * update root * update root * update root * Updated build * Added doc * Update CI config * Should not lint index.js * Fixing jetify * Fixed linter errors * Fixed pod build * Fixed Windows build
24 lines
820 B
JavaScript
24 lines
820 B
JavaScript
// React Native WebView cannot load external JS files, however it can load
|
|
// arbitrary JS via the injectedJavaScript property. So we use this to load external
|
|
// files: First here we convert the JS file to a plain string, and that string
|
|
// is then loaded by eg. the Mermaid plugin, and finally injected in the WebView.
|
|
|
|
const fs = require('fs-extra');
|
|
|
|
const rnDir = `${__dirname}/..`;
|
|
const outputDir = `${rnDir}/lib/rnInjectedJs`;
|
|
|
|
async function copyJs(name, filePath) {
|
|
const js = await fs.readFile(filePath, 'utf-8');
|
|
const json = `module.exports = ${JSON.stringify(js)};`;
|
|
const outputPath = `${outputDir}/${name}.js`;
|
|
await fs.writeFile(outputPath, json);
|
|
}
|
|
|
|
async function main() {
|
|
await fs.mkdirp(outputDir);
|
|
await copyJs('webviewLib', `${rnDir}/lib/renderers/webviewLib.js`);
|
|
}
|
|
|
|
module.exports = main;
|