diff --git a/BUILD.md b/BUILD.md index fb11d9dd4..2526e1af3 100644 --- a/BUILD.md +++ b/BUILD.md @@ -70,6 +70,8 @@ You can specify additional parameters when running the desktop or CLI applicatio Most of the application is written in JavaScript, however new classes and files should generally be written in [TypeScript](https://www.typescriptlang.org/). All TypeScript files are generated next to the .ts or .tsx file. So for example, if there's a file "lib/MyClass.ts", there will be a generated "lib/MyClass.js" next to it. It is implemented that way as it requires minimal changes to integrate TypeScript in the existing JavaScript code base. +In the current setup, `tsc` is executed from the root of the project, and will compile everything in CliClient, ElectronClient, etc. This is more convenient to have just one place to compile everything, and it also means there's only one watch command to run. However, one drawback is that TypeScript doesn't find types defined in node_modules folders in sub-directories. For example, if you install `immer` in ElectronClient, then try to use the package, TypeScript will report that it cannot find this module. In theory using `typeRoots`, it should be possible to make it find the right modules but it doesn't seem to work in this case. Currently the workaround is to install any such package at the root of the project. By doing so, TypeScript will find the type definitions and compilation will work. It's not ideal since the module is installed at the root even though it's not used, but for now that will work. + ## Hot reload If you'd like to auto-reload the desktop app on changes rather than having to quit and restart it manually each time, you can use [watchman-make](https://facebook.github.io/watchman/docs/watchman-make.html): diff --git a/Tools/gulp/utils.js b/Tools/gulp/utils.js index f4a424458..6ee70d2da 100644 --- a/Tools/gulp/utils.js +++ b/Tools/gulp/utils.js @@ -21,9 +21,10 @@ utils.execCommand = function(command) { exec(command, { maxBuffer: 1024 * 1024 }, (error, stdout) => { if (error) { - // Special case for robocopy, which will return an error code of "1" - // if successful - https://ss64.com/nt/robocopy-exit.html - if (command.indexOf('robocopy') === 0 && error.code <= 1) { + // Special case for robocopy, which will return non-zero error codes + // when sucessful. Doc is very imprecise but <= 7 seems more or less + // fine and >= 8 seems more errorish. https://ss64.com/nt/robocopy-exit.html + if (command.indexOf('robocopy') === 0 && error.code <= 7) { resolve(stdout.trim()); return; } @@ -31,7 +32,8 @@ utils.execCommand = function(command) { if (error.signal == 'SIGTERM') { resolve('Process was killed'); } else { - reject(error); + const newError = new Error(`Code: ${error.code}: ${error.message}: ${stdout.trim()}`); + reject(newError); } } else { resolve(stdout.trim()); diff --git a/joplin.code-workspace b/joplin.code-workspace index b48a97575..61b523be3 100644 --- a/joplin.code-workspace +++ b/joplin.code-workspace @@ -1,11 +1,11 @@ { "folders": [ { - "name": "Joplin", + "name": ".", "path": "." }, { - "name": "Joplin Nextcloud App", + "name": "D:/Web/www/nextcloud/apps/joplin", "path": "D:/Web/www/nextcloud/apps/joplin" }, ], @@ -65,7 +65,6 @@ "ElectronClient/lib/": true, "ElectronClient/locale/": true, "ElectronClient/build/": true, - "ElectronClient/dist/": true, "node_modules/": true, "docs/images/flags": true, "ReactNativeClient/android/.gradle/": true, @@ -79,6 +78,242 @@ "ReactNativeClient/node_modules/": true, "Server/db*.sqlite/": true, "Server/dist/": true, + "./ReactNativeClient/lib/joplin-renderer/**/node_modules/": true, + "./ReactNativeClient/lib/joplin-renderer/**/.vscode/": true, + "./ReactNativeClient/lib/joplin-renderer/**/copyLib.bat": true, + "./Modules/TinyMCE/JoplinLists/**/.DS_Store": true, + "./Modules/TinyMCE/JoplinLists/**/*~": true, + "./Modules/TinyMCE/JoplinLists/**/*.iws": true, + "./Modules/TinyMCE/JoplinLists/**/*.sublime-workspace": true, + "./Modules/TinyMCE/JoplinLists/**/.cache": true, + "./Modules/TinyMCE/JoplinLists/lib": true, + "./Modules/TinyMCE/JoplinLists/dist": true, + "./Modules/TinyMCE/JoplinLists/scratch": true, + "./Modules/TinyMCE/JoplinLists/**/node_modules": true, + "./Modules/TinyMCE/JoplinLists/config/repl": true, + "./Modules/TinyMCE/JoplinLists/*.log": true, + "./Modules/TinyMCE/JoplinLists/**/ephox-*.tgz": true, + "./Modules/TinyMCE/JoplinLists/**/package-lock.json": true, + "./Modules/TinyMCE/JoplinLists/**/jenkins-plumbing": true, + "./Modules/TinyMCE/IconPack/**/node_modules": true, + "./Modules/TinyMCE/IconPack/**/dist": true, + "./Clipper/popup/**/node_modules": true, + "./Clipper/popup/**/coverage": true, + "./Clipper/popup/**/build": true, + "./Clipper/popup/**/.DS_Store": true, + "./Clipper/popup/**/.env.local": true, + "./Clipper/popup/**/.env.development.local": true, + "./Clipper/popup/**/.env.test.local": true, + "./Clipper/popup/**/.env.production.local": true, + "./Clipper/popup/**/npm-debug.log*": true, + "./Clipper/popup/**/yarn-debug.log*": true, + "./Clipper/popup/**/yarn-error.log*": true, + "./ReactNativeClient/**/.DS_Store": true, + "./ReactNativeClient/**/build/": true, + "./ReactNativeClient/**/*.pbxuser": true, + "./ReactNativeClient/**/default.pbxuser": false, + "./ReactNativeClient/**/*.mode1v3": true, + "./ReactNativeClient/**/default.mode1v3": false, + "./ReactNativeClient/**/*.mode2v3": true, + "./ReactNativeClient/**/default.mode2v3": false, + "./ReactNativeClient/**/*.perspectivev3": true, + "./ReactNativeClient/**/default.perspectivev3": false, + "./ReactNativeClient/**/xcuserdata": true, + "./ReactNativeClient/**/*.xccheckout": true, + "./ReactNativeClient/**/*.moved-aside": true, + "./ReactNativeClient/**/DerivedData": true, + "./ReactNativeClient/**/*.hmap": true, + "./ReactNativeClient/**/*.ipa": true, + "./ReactNativeClient/**/*.xcuserstate": true, + "./ReactNativeClient/**/project.xcworkspace": true, + "./ReactNativeClient/**/.idea": true, + "./ReactNativeClient/**/.gradle": true, + "./ReactNativeClient/**/local.properties": true, + "./ReactNativeClient/**/*.iml": true, + "./ReactNativeClient/**/node_modules/": true, + "./ReactNativeClient/**/npm-debug.log": true, + "./ReactNativeClient/**/yarn-error.log": true, + "./ReactNativeClient/**/buck-out/": true, + "./ReactNativeClient/**/\\.buckd/": true, + "./ReactNativeClient/**/*.keystore": true, + "./ReactNativeClient/**/debug.keystore": false, + "./ReactNativeClient/**/ios/Pods/": true, + "./ReactNativeClient/fastlane/report.xml": true, + "./ReactNativeClient/fastlane/Preview.html": true, + "./ReactNativeClient/fastlane/screenshots": true, + "./ReactNativeClient/android/build*": true, + "./ReactNativeClient/android/app/build*": true, + "./ReactNativeClient/android/.project": true, + "./ReactNativeClient/**/android/.settings/": true, + "./ReactNativeClient/android/app/.classpath": true, + "./ReactNativeClient/android/app/.project": true, + "./ReactNativeClient/**/android/app/.settings/": true, + "./ReactNativeClient/**/android/app/src/debug/res/": true, + "./ReactNativeClient/**/pluginAssets/": true, + "./Tools/**/*-kct.*": true, + "./Tools/**/github_username_cache.json": true, + "./Tools/**/patreon_oauth_token.txt": true, + "./Clipper/content_scripts/**/*.bundle.js": true, + "./ElectronClient/**/node_modules/": true, + "./ElectronClient/**/packageInfo.js": true, + "./ElectronClient/**/dist/": true, + "./ElectronClient/**/lib/": true, + "./ElectronClient/gui/*.min.js": true, + "./ElectronClient/plugins/*.min.js": true, + "./ElectronClient/**/.DS_Store": true, + "./ElectronClient/**/gui/note-viewer/pluginAssets/": true, + "./ElectronClient/**/pluginAssets/": true, + "./CliClient/**/node_modules/": true, + "./CliClient/app/src": true, + "./CliClient/**/tests-build/": true, + "./CliClient/tests/src": true, + "./CliClient/**/config.json": true, + "./CliClient/app/lib": true, + "./CliClient/tests/fuzzing/client0": true, + "./CliClient/tests/fuzzing/client1": true, + "./CliClient/tests/fuzzing/client2": true, + "./CliClient/tests/fuzzing/sync": true, + "./CliClient/tests/fuzzing.*": true, + "./CliClient/tests/fuzzing -*": true, + "./CliClient/tests/logs/*": true, + "./CliClient/**/tests/cli-integration/": true, + "./CliClient/**/tests/tmp/": true, + "./CliClient/**/*.mo": true, + "./CliClient/**/*.*~": true, + "./CliClient/tests/sync": true, + "./CliClient/**/out.txt": true, + "./CliClient/**/linkToLocal.sh": true, + "./CliClient/**/yarn-error.log": true, + "./CliClient/tests/support/dropbox-auth.txt": true, + "./CliClient/**/build/": true, + "./Clipper/**/dist/": true, + "app/config/parameters.yml": true, + "app/config/parameters_dev.yml": true, + "app/config/parameters_prod.yml": true, + "build/": true, + "phpunit.xml": true, + "var/*": true, + "var/cache": false, + "var/cache/*": true, + "var/cache/.gitkeep": false, + "var/logs": false, + "var/logs/*": true, + "var/logs/.gitkeep": false, + "var/sessions": false, + "var/sessions/*": true, + "var/sessions/.gitkeep": false, + "var/SymfonyRequirements.php": false, + "vendor/": true, + "web/bundles/": true, + "**/*.sublime-workspace": true, + "**/Makefile.Debug": true, + "**/Makefile.Release": true, + "**/Makefile": true, + "QtClient/build-*": true, + "**/TODO.md": true, + "**/*.pro.user": true, + "**/QtClient/data/": true, + "**/app/data/uploads/": true, + "app/data/uploads/.gitkeep": false, + "**/sparse_test.php": true, + "**/INFO.md": true, + "web/env.php": true, + "**/sync_staging.sh": true, + "**/*.swp": true, + "**/_vieux/": true, + "**/_mydocs": true, + "**/.DS_Store": true, + "Assets/DownloadBadges*.psd": true, + "**/node_modules": true, + "Tools/github_oauth_token.txt": true, + "**/_releases": true, + "**/ReactNativeClient/lib/csstojs/": true, + "**/ReactNativeClient/lib/rnInjectedJs/": true, + "**/ElectronClient/gui/note-viewer/fonts/": true, + "ElectronClient/gui/note-viewer/lib.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/TinyMCE/supportedLocales.js": true, + "**/Clipper-source/": true, + "Clipper/joplin-webclipper-source.zip": true, + "**/joplin-webclipper-source.zip": true, + "Tools/commit_hook.txt": true, + ".vscode/*": true, + "CliClient/tests/support/plugins/codemirror_test/global.d.js": true, + "CliClient/tests/support/plugins/codemirror_test/src/index.js": true, + "CliClient/tests/support/plugins/withExternalModules/global.d.js": true, + "CliClient/tests/support/plugins/withExternalModules/src/index.js": true, + "ElectronClient/global.d.js": true, + "ElectronClient/gui/MultiNoteActions.js": true, + "ElectronClient/gui/NoteContentPropertiesDialog.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/AceEditor.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/styles/index.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/Toolbar.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/utils/index.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/utils/types.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/AceEditor/utils/useListIdent.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/CodeMirror.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/Editor.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/styles/index.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/Toolbar.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/index.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/types.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useLineSorting.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useListIdent.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollUtils.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.js": true, + "ElectronClient/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js": true, + "ElectronClient/gui/NoteEditor/NoteEditor.js": true, + "ElectronClient/gui/NoteEditor/styles/index.js": true, + "ElectronClient/gui/NoteEditor/utils/contextMenu.js": true, + "ElectronClient/gui/NoteEditor/utils/index.js": true, + "ElectronClient/gui/NoteEditor/utils/resourceHandling.js": true, + "ElectronClient/gui/NoteEditor/utils/types.js": true, + "ElectronClient/gui/NoteEditor/utils/useDropHandler.js": true, + "ElectronClient/gui/NoteEditor/utils/useFormNote.js": true, + "ElectronClient/gui/NoteEditor/utils/useMarkupToHtml.js": true, + "ElectronClient/gui/NoteEditor/utils/useMessageHandler.js": true, + "ElectronClient/gui/NoteEditor/utils/useNoteSearchBar.js": true, + "ElectronClient/gui/NoteEditor/utils/useSearchMarkers.js": true, + "ElectronClient/gui/NoteEditor/utils/useWindowCommandHandler.js": true, + "ElectronClient/gui/NoteListItem.js": true, + "ElectronClient/gui/NoteToolbar/NoteToolbar.js": true, + "ElectronClient/gui/plugin_service/UserWebview.js": true, + "ElectronClient/gui/ResourceScreen.js": true, + "ElectronClient/gui/ShareNoteDialog.js": true, + "ReactNativeClient/lib/AsyncActionQueue.js": true, + "ReactNativeClient/lib/checkPermissions.js": true, + "ReactNativeClient/lib/hooks/useImperativeHandlerDebugger.js": true, + "ReactNativeClient/lib/hooks/usePrevious.js": true, + "ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/checkbox.js": true, + "ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/fence.js": true, + "ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.js": true, + "ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/sanitize_html.js": true, + "ReactNativeClient/lib/JoplinServerApi.js": true, + "ReactNativeClient/lib/services/keychain/KeychainService.js": true, + "ReactNativeClient/lib/services/keychain/KeychainServiceDriver.dummy.js": true, + "ReactNativeClient/lib/services/keychain/KeychainServiceDriver.mobile.js": true, + "ReactNativeClient/lib/services/keychain/KeychainServiceDriver.node.js": true, + "ReactNativeClient/lib/services/keychain/KeychainServiceDriverBase.js": true, + "ReactNativeClient/lib/services/plugin_service/Plugin.js": true, + "ReactNativeClient/lib/services/plugin_service/PluginService.js": true, + "ReactNativeClient/lib/services/plugin_service/SandboxService.js": true, + "ReactNativeClient/lib/services/plugin_service/utils/manifestFromObject.js": true, + "ReactNativeClient/lib/services/plugin_service/utils/types.js": true, + "ReactNativeClient/lib/services/plugin_service/ViewController.js": true, + "ReactNativeClient/lib/services/plugin_service/WebviewController.js": true, + "ReactNativeClient/lib/services/ResourceEditWatcher.js": true, + "ReactNativeClient/lib/services/rest/actionApi.desktop.js": true, + "ReactNativeClient/lib/services/rest/errors.js": true, + "ReactNativeClient/lib/services/SettingUtils.js": true, + "ReactNativeClient/lib/services/UndoRedoService.js": true, + "ReactNativeClient/lib/ShareExtension.js": true, + "ReactNativeClient/lib/shareHandler.js": true, + "ReactNativeClient/PluginAssetsLoader.js": true, + "ReactNativeClient/setUpQuickActions.js": true, + "D:/Web/www/nextcloud/apps/joplin/Tools/**/github_oauth_token.txt": true, + "D:/Web/www/nextcloud/apps/joplin/Tools/**/node_modules/": true, + "D:/Web/www/nextcloud/apps/joplin/**/vendor/": true, + "D:/Web/www/nextcloud/apps/joplin/**/dist/": true }, "spellright.language": [ "en"