diff --git a/packages/app-desktop/tools/compileScripts.js b/packages/app-desktop/tools/compileScripts.js index 24d0f3175a..6ee7339ce8 100644 --- a/packages/app-desktop/tools/compileScripts.js +++ b/packages/app-desktop/tools/compileScripts.js @@ -48,20 +48,6 @@ function convertJsx(paths) { }); } -function build(path) { - chdir(path); - - const result = spawnSync('yarn', ['run', 'build'], { shell: true }); - if (result.status !== 0) { - const msg = []; - if (result.stdout) msg.push(result.stdout.toString()); - if (result.stderr) msg.push(result.stderr.toString()); - console.error(msg.join('\n')); - if (result.error) console.error(result.error); - process.exit(result.status); - } -} - module.exports = function() { convertJsx([ `${__dirname}/../gui`, @@ -70,8 +56,6 @@ module.exports = function() { `${__dirname}/../plugins`, ]); - build(`${__dirname}/../../pdf-viewer`); - const libContent = [ fs.readFileSync(`${basePath}/packages/lib/string-utils-common.js`, 'utf8'), fs.readFileSync(`${basePath}/packages/lib/markJsUtils.js`, 'utf8'), diff --git a/packages/pdf-viewer/README.md b/packages/pdf-viewer/README.md index 441d0eb49e..d7b1a18c2e 100644 --- a/packages/pdf-viewer/README.md +++ b/packages/pdf-viewer/README.md @@ -1,17 +1,29 @@ # PDF VIEWER -//Todo +A custom built PDF viewer for Joplin's use. +The viewer is designed to be rendered in an iframe. +This package produces the build files in `/dist` folder. -## Usage +## Installation & Usage -```javascript -import viewer from '@joplin/pdf-viewer'; +From root of the project: + +```bash +yarn install +``` +This step will also run `yarn build` and build the viewer on post-install and populate the `/dist` folder. +We are using `weback` for build process. + +When working on the viewer, after code updates you need to rebuild the viewer: + +```bash +yarn build ``` -## Notes +Alternatively, you can use `yarn watch` to rebuild automatically on code changes. -//Todo +```bash +yarn watch +``` -## License - -MIT +The build process of `app-desktop` takes care of copying the content of `/dist` and the root html file to appropriate location. diff --git a/packages/pdf-viewer/package.json b/packages/pdf-viewer/package.json index ec3cf0c653..5ba7bb3fb1 100644 --- a/packages/pdf-viewer/package.json +++ b/packages/pdf-viewer/package.json @@ -10,10 +10,11 @@ }, "scripts": { "tsc": "tsc --project tsconfig.json", - "watch": "tsc --watch --preserveWatchOutput --project tsconfig.json", - "build": "webpack --config webpack.config.js", + "watch": "webpack --watch --config webpack.config.js --mode=development", + "build": "webpack --config webpack.config.js --mode=production", "test": "jest", - "test-ci": "yarn test" + "test-ci": "yarn test", + "postinstall": "yarn build" }, "author": "Joplin", "license": "MIT",