1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-02 12:47:41 +02:00

Chore: Automatically create command index for desktop app

This commit is contained in:
Laurent Cozic 2021-09-04 13:43:25 +01:00
parent e6bff3f2e0
commit c529b972e3
18 changed files with 289 additions and 96 deletions

View File

@ -141,6 +141,9 @@ packages/app-desktop/commands/exportNotes.js.map
packages/app-desktop/commands/focusElement.d.ts
packages/app-desktop/commands/focusElement.js
packages/app-desktop/commands/focusElement.js.map
packages/app-desktop/commands/index.d.ts
packages/app-desktop/commands/index.js
packages/app-desktop/commands/index.js.map
packages/app-desktop/commands/openProfileDirectory.d.ts
packages/app-desktop/commands/openProfileDirectory.js
packages/app-desktop/commands/openProfileDirectory.js.map
@ -246,6 +249,9 @@ packages/app-desktop/gui/MainScreen/commands/gotoAnything.js.map
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.d.ts
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.js
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.js.map
packages/app-desktop/gui/MainScreen/commands/index.d.ts
packages/app-desktop/gui/MainScreen/commands/index.js
packages/app-desktop/gui/MainScreen/commands/index.js.map
packages/app-desktop/gui/MainScreen/commands/moveToFolder.d.ts
packages/app-desktop/gui/MainScreen/commands/moveToFolder.js
packages/app-desktop/gui/MainScreen/commands/moveToFolder.js.map
@ -402,21 +408,24 @@ packages/app-desktop/gui/NoteEditor/NoteEditor.js.map
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.d.ts
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js.map
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.d.ts
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.js
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.js.map
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.d.ts
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js.map
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.d.ts
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js.map
packages/app-desktop/gui/NoteEditor/commands/index.d.ts
packages/app-desktop/gui/NoteEditor/commands/index.js
packages/app-desktop/gui/NoteEditor/commands/index.js.map
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.d.ts
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js.map
packages/app-desktop/gui/NoteEditor/commands/showRevisions.d.ts
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js.map
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.d.ts
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js.map
packages/app-desktop/gui/NoteEditor/styles/index.d.ts
packages/app-desktop/gui/NoteEditor/styles/index.js
packages/app-desktop/gui/NoteEditor/styles/index.js.map
@ -471,12 +480,18 @@ packages/app-desktop/gui/NoteList/NoteList.js.map
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.d.ts
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.js
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.js.map
packages/app-desktop/gui/NoteList/commands/index.d.ts
packages/app-desktop/gui/NoteList/commands/index.js
packages/app-desktop/gui/NoteList/commands/index.js.map
packages/app-desktop/gui/NoteListControls/NoteListControls.d.ts
packages/app-desktop/gui/NoteListControls/NoteListControls.js
packages/app-desktop/gui/NoteListControls/NoteListControls.js.map
packages/app-desktop/gui/NoteListControls/commands/focusSearch.d.ts
packages/app-desktop/gui/NoteListControls/commands/focusSearch.js
packages/app-desktop/gui/NoteListControls/commands/focusSearch.js.map
packages/app-desktop/gui/NoteListControls/commands/index.d.ts
packages/app-desktop/gui/NoteListControls/commands/index.js
packages/app-desktop/gui/NoteListControls/commands/index.js.map
packages/app-desktop/gui/NoteListItem.d.ts
packages/app-desktop/gui/NoteListItem.js
packages/app-desktop/gui/NoteListItem.js.map
@ -573,6 +588,9 @@ packages/app-desktop/gui/Sidebar/Sidebar.js.map
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.d.ts
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.js
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.js.map
packages/app-desktop/gui/Sidebar/commands/index.d.ts
packages/app-desktop/gui/Sidebar/commands/index.js
packages/app-desktop/gui/Sidebar/commands/index.js.map
packages/app-desktop/gui/Sidebar/styles/index.d.ts
packages/app-desktop/gui/Sidebar/styles/index.js
packages/app-desktop/gui/Sidebar/styles/index.js.map
@ -900,6 +918,9 @@ packages/lib/commands/historyBackward.js.map
packages/lib/commands/historyForward.d.ts
packages/lib/commands/historyForward.js
packages/lib/commands/historyForward.js.map
packages/lib/commands/index.d.ts
packages/lib/commands/index.js
packages/lib/commands/index.js.map
packages/lib/commands/synchronize.d.ts
packages/lib/commands/synchronize.js
packages/lib/commands/synchronize.js.map

27
.gitignore vendored
View File

@ -127,6 +127,9 @@ packages/app-desktop/commands/exportNotes.js.map
packages/app-desktop/commands/focusElement.d.ts
packages/app-desktop/commands/focusElement.js
packages/app-desktop/commands/focusElement.js.map
packages/app-desktop/commands/index.d.ts
packages/app-desktop/commands/index.js
packages/app-desktop/commands/index.js.map
packages/app-desktop/commands/openProfileDirectory.d.ts
packages/app-desktop/commands/openProfileDirectory.js
packages/app-desktop/commands/openProfileDirectory.js.map
@ -232,6 +235,9 @@ packages/app-desktop/gui/MainScreen/commands/gotoAnything.js.map
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.d.ts
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.js
packages/app-desktop/gui/MainScreen/commands/hideModalMessage.js.map
packages/app-desktop/gui/MainScreen/commands/index.d.ts
packages/app-desktop/gui/MainScreen/commands/index.js
packages/app-desktop/gui/MainScreen/commands/index.js.map
packages/app-desktop/gui/MainScreen/commands/moveToFolder.d.ts
packages/app-desktop/gui/MainScreen/commands/moveToFolder.js
packages/app-desktop/gui/MainScreen/commands/moveToFolder.js.map
@ -388,21 +394,24 @@ packages/app-desktop/gui/NoteEditor/NoteEditor.js.map
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.d.ts
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js
packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js.map
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.d.ts
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.js
packages/app-desktop/gui/NoteEditor/commands/editorCommandDeclarations.js.map
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.d.ts
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js.map
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.d.ts
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js.map
packages/app-desktop/gui/NoteEditor/commands/index.d.ts
packages/app-desktop/gui/NoteEditor/commands/index.js
packages/app-desktop/gui/NoteEditor/commands/index.js.map
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.d.ts
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js.map
packages/app-desktop/gui/NoteEditor/commands/showRevisions.d.ts
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js.map
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.d.ts
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js.map
packages/app-desktop/gui/NoteEditor/styles/index.d.ts
packages/app-desktop/gui/NoteEditor/styles/index.js
packages/app-desktop/gui/NoteEditor/styles/index.js.map
@ -457,12 +466,18 @@ packages/app-desktop/gui/NoteList/NoteList.js.map
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.d.ts
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.js
packages/app-desktop/gui/NoteList/commands/focusElementNoteList.js.map
packages/app-desktop/gui/NoteList/commands/index.d.ts
packages/app-desktop/gui/NoteList/commands/index.js
packages/app-desktop/gui/NoteList/commands/index.js.map
packages/app-desktop/gui/NoteListControls/NoteListControls.d.ts
packages/app-desktop/gui/NoteListControls/NoteListControls.js
packages/app-desktop/gui/NoteListControls/NoteListControls.js.map
packages/app-desktop/gui/NoteListControls/commands/focusSearch.d.ts
packages/app-desktop/gui/NoteListControls/commands/focusSearch.js
packages/app-desktop/gui/NoteListControls/commands/focusSearch.js.map
packages/app-desktop/gui/NoteListControls/commands/index.d.ts
packages/app-desktop/gui/NoteListControls/commands/index.js
packages/app-desktop/gui/NoteListControls/commands/index.js.map
packages/app-desktop/gui/NoteListItem.d.ts
packages/app-desktop/gui/NoteListItem.js
packages/app-desktop/gui/NoteListItem.js.map
@ -559,6 +574,9 @@ packages/app-desktop/gui/Sidebar/Sidebar.js.map
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.d.ts
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.js
packages/app-desktop/gui/Sidebar/commands/focusElementSideBar.js.map
packages/app-desktop/gui/Sidebar/commands/index.d.ts
packages/app-desktop/gui/Sidebar/commands/index.js
packages/app-desktop/gui/Sidebar/commands/index.js.map
packages/app-desktop/gui/Sidebar/styles/index.d.ts
packages/app-desktop/gui/Sidebar/styles/index.js
packages/app-desktop/gui/Sidebar/styles/index.js.map
@ -886,6 +904,9 @@ packages/lib/commands/historyBackward.js.map
packages/lib/commands/historyForward.d.ts
packages/lib/commands/historyForward.js
packages/lib/commands/historyForward.js.map
packages/lib/commands/index.d.ts
packages/lib/commands/index.js
packages/lib/commands/index.js.map
packages/lib/commands/synchronize.d.ts
packages/lib/commands/synchronize.js
packages/lib/commands/synchronize.js.map

View File

@ -5,6 +5,7 @@ const tasks = {
// copyLib: require('./packages/tools/gulp/tasks/copyLib'),
// tsc: require('./packages/tools/gulp/tasks/tsc'),
updateIgnoredTypeScriptBuild: require('./packages/tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
buildCommandIndex: require('./packages/tools/gulp/tasks/buildCommandIndex'),
// deleteBuildDirs: require('./packages/tools/gulp/tasks/deleteBuildDirs'),
completePublishAll: {
fn: async () => {

View File

@ -12,6 +12,7 @@
"bootstrapServerOnly": "lerna bootstrap --force-local --no-ci --include-dependents --include-dependencies --scope @joplin/server",
"build": "lerna run build && npm run tsc",
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
"buildCommandIndex": "gulp buildCommandIndex",
"buildDoc": "./packages/tools/build-all.sh",
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/",
"buildSettingJsonSchema": "npm start --prefix=packages/app-cli -- settingschema ../../docs/schema/settings.json",

View File

@ -38,68 +38,26 @@ const PluginManager = require('@joplin/lib/services/PluginManager');
import RevisionService from '@joplin/lib/services/RevisionService';
import MigrationService from '@joplin/lib/services/MigrationService';
import { loadCustomCss, injectCustomStyles } from '@joplin/lib/CssUtils';
import mainScreenCommands from './gui/MainScreen/commands/index';
import noteEditorCommands from './gui/NoteEditor/commands/index';
import noteListCommands from './gui/NoteList/commands/index';
import noteListControlsCommands from './gui/NoteListControls/commands/index';
import sidebarCommands from './gui/Sidebar/commands/index';
import appCommands from './commands/index';
import libCommands from '@joplin/lib/commands/index';
// import populateDatabase from '@joplin/lib/services/debug/populateDatabase';
const commands = [
require('./gui/MainScreen/commands/editAlarm'),
require('./gui/MainScreen/commands/exportPdf'),
require('./gui/MainScreen/commands/gotoAnything'),
require('./gui/MainScreen/commands/commandPalette'),
require('./gui/MainScreen/commands/hideModalMessage'),
require('./gui/MainScreen/commands/moveToFolder'),
require('./gui/MainScreen/commands/newFolder'),
require('./gui/MainScreen/commands/newNote'),
require('./gui/MainScreen/commands/newSubFolder'),
require('./gui/MainScreen/commands/newTodo'),
require('./gui/MainScreen/commands/openFolder'),
require('./gui/MainScreen/commands/openNote'),
require('./gui/MainScreen/commands/openTag'),
require('./gui/MainScreen/commands/print'),
require('./gui/MainScreen/commands/renameFolder'),
require('./gui/MainScreen/commands/renameTag'),
require('./gui/MainScreen/commands/search'),
require('./gui/MainScreen/commands/setTags'),
require('./gui/MainScreen/commands/showModalMessage'),
require('./gui/MainScreen/commands/showNoteContentProperties'),
require('./gui/MainScreen/commands/showNoteProperties'),
require('./gui/MainScreen/commands/showPrompt'),
require('./gui/MainScreen/commands/showShareFolderDialog'),
require('./gui/MainScreen/commands/showShareNoteDialog'),
require('./gui/MainScreen/commands/showSpellCheckerMenu'),
require('./gui/MainScreen/commands/toggleEditors'),
require('./gui/MainScreen/commands/toggleLayoutMoveMode'),
require('./gui/MainScreen/commands/toggleNoteList'),
require('./gui/MainScreen/commands/toggleSideBar'),
require('./gui/MainScreen/commands/toggleVisiblePanes'),
require('./gui/NoteEditor/commands/focusElementNoteBody'),
require('./gui/NoteEditor/commands/focusElementNoteTitle'),
require('./gui/NoteEditor/commands/showLocalSearch'),
require('./gui/NoteEditor/commands/showRevisions'),
require('./gui/NoteList/commands/focusElementNoteList'),
require('./gui/NoteListControls/commands/focusSearch'),
require('./gui/Sidebar/commands/focusElementSideBar'),
];
const commands = mainScreenCommands
.concat(noteEditorCommands)
.concat(noteListCommands)
.concat(noteListControlsCommands)
.concat(sidebarCommands);
// Commands that are not tied to any particular component.
// The runtime for these commands can be loaded when the app starts.
const globalCommands = [
require('./commands/copyDevCommand'),
require('./commands/exportFolders'),
require('./commands/exportNotes'),
require('./commands/focusElement'),
require('./commands/openProfileDirectory'),
require('./commands/replaceMisspelling'),
require('./commands/startExternalEditing'),
require('./commands/stopExternalEditing'),
require('./commands/toggleExternalEditing'),
require('./commands/toggleSafeMode'),
require('./commands/restoreNoteRevision'),
require('@joplin/lib/commands/historyBackward'),
require('@joplin/lib/commands/historyForward'),
require('@joplin/lib/commands/synchronize'),
];
const globalCommands = appCommands.concat(libCommands);
import editorCommandDeclarations from './gui/NoteEditor/commands/editorCommandDeclarations';
import editorCommandDeclarations from './gui/NoteEditor/editorCommandDeclarations';
import ShareService from '@joplin/lib/services/share/ShareService';
import checkForUpdates from './checkForUpdates';

View File

@ -0,0 +1,29 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as copyDevCommand from './copyDevCommand';
import * as exportFolders from './exportFolders';
import * as exportNotes from './exportNotes';
import * as focusElement from './focusElement';
import * as openProfileDirectory from './openProfileDirectory';
import * as replaceMisspelling from './replaceMisspelling';
import * as restoreNoteRevision from './restoreNoteRevision';
import * as startExternalEditing from './startExternalEditing';
import * as stopExternalEditing from './stopExternalEditing';
import * as toggleExternalEditing from './toggleExternalEditing';
import * as toggleSafeMode from './toggleSafeMode';
const index: any[] = [
copyDevCommand,
exportFolders,
exportNotes,
focusElement,
openProfileDirectory,
replaceMisspelling,
restoreNoteRevision,
startExternalEditing,
stopExternalEditing,
toggleExternalEditing,
toggleSafeMode,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -37,6 +37,7 @@ import { reg } from '@joplin/lib/registry';
import removeKeylessItems from '../ResizableLayout/utils/removeKeylessItems';
import { localSyncInfoFromState } from '@joplin/lib/services/synchronizer/syncInfoUtils';
import { showMissingMasterKeyMessage } from '@joplin/lib/services/e2ee/utils';
import commands from './commands/index';
const { connect } = require('react-redux');
const { PromptDialog } = require('../PromptDialog.min.js');
@ -110,39 +111,6 @@ const defaultLayout: LayoutItem = {
],
};
const commands = [
require('./commands/editAlarm'),
require('./commands/exportPdf'),
require('./commands/gotoAnything'),
require('./commands/commandPalette'),
require('./commands/hideModalMessage'),
require('./commands/moveToFolder'),
require('./commands/newFolder'),
require('./commands/newNote'),
require('./commands/newSubFolder'),
require('./commands/newTodo'),
require('./commands/openFolder'),
require('./commands/openNote'),
require('./commands/openTag'),
require('./commands/print'),
require('./commands/renameFolder'),
require('./commands/renameTag'),
require('./commands/search'),
require('./commands/setTags'),
require('./commands/showModalMessage'),
require('./commands/showNoteContentProperties'),
require('./commands/showNoteProperties'),
require('./commands/showPrompt'),
require('./commands/showShareFolderDialog'),
require('./commands/showShareNoteDialog'),
require('./commands/showSpellCheckerMenu'),
require('./commands/toggleEditors'),
require('./commands/toggleLayoutMoveMode'),
require('./commands/toggleNoteList'),
require('./commands/toggleSideBar'),
require('./commands/toggleVisiblePanes'),
];
class MainScreenComponent extends React.Component<Props, State> {
private waitForNotesSavedIID_: any;

View File

@ -0,0 +1,65 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as commandPalette from './commandPalette';
import * as editAlarm from './editAlarm';
import * as exportPdf from './exportPdf';
import * as gotoAnything from './gotoAnything';
import * as hideModalMessage from './hideModalMessage';
import * as moveToFolder from './moveToFolder';
import * as newFolder from './newFolder';
import * as newNote from './newNote';
import * as newSubFolder from './newSubFolder';
import * as newTodo from './newTodo';
import * as openFolder from './openFolder';
import * as openNote from './openNote';
import * as openTag from './openTag';
import * as print from './print';
import * as renameFolder from './renameFolder';
import * as renameTag from './renameTag';
import * as search from './search';
import * as setTags from './setTags';
import * as showNoteContentProperties from './showNoteContentProperties';
import * as showNoteProperties from './showNoteProperties';
import * as showPrompt from './showPrompt';
import * as showShareFolderDialog from './showShareFolderDialog';
import * as showShareNoteDialog from './showShareNoteDialog';
import * as showSpellCheckerMenu from './showSpellCheckerMenu';
import * as toggleEditors from './toggleEditors';
import * as toggleLayoutMoveMode from './toggleLayoutMoveMode';
import * as toggleNoteList from './toggleNoteList';
import * as toggleSideBar from './toggleSideBar';
import * as toggleVisiblePanes from './toggleVisiblePanes';
const index: any[] = [
commandPalette,
editAlarm,
exportPdf,
gotoAnything,
hideModalMessage,
moveToFolder,
newFolder,
newNote,
newSubFolder,
newTodo,
openFolder,
openNote,
openTag,
print,
renameFolder,
renameTag,
search,
setTags,
showNoteContentProperties,
showNoteProperties,
showPrompt,
showShareFolderDialog,
showShareNoteDialog,
showSpellCheckerMenu,
toggleEditors,
toggleLayoutMoveMode,
toggleNoteList,
toggleSideBar,
toggleVisiblePanes,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -0,0 +1,15 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as focusElementNoteBody from './focusElementNoteBody';
import * as focusElementNoteTitle from './focusElementNoteTitle';
import * as showLocalSearch from './showLocalSearch';
import * as showRevisions from './showRevisions';
const index: any[] = [
focusElementNoteBody,
focusElementNoteTitle,
showLocalSearch,
showRevisions,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { FormNote, ScrollOptionTypes } from './types';
import editorCommandDeclarations from '../commands/editorCommandDeclarations';
import editorCommandDeclarations from '../editorCommandDeclarations';
import CommandService, { CommandDeclaration, CommandRuntime, CommandContext } from '@joplin/lib/services/CommandService';
import time from '@joplin/lib/time';
import { reg } from '@joplin/lib/registry';

View File

@ -0,0 +1,9 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as focusElementNoteList from './focusElementNoteList';
const index: any[] = [
focusElementNoteList,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -0,0 +1,9 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as focusSearch from './focusSearch';
const index: any[] = [
focusSearch,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -0,0 +1,9 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as focusElementSideBar from './focusElementSideBar';
const index: any[] = [
focusElementSideBar,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -19,6 +19,7 @@ const tasks = {
},
tsc: require('@joplin/tools/gulp/tasks/tsc'),
updateIgnoredTypeScriptBuild: require('@joplin/tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
buildCommandIndex: require('@joplin/tools/gulp/tasks/buildCommandIndex'),
};
utils.registerGulpTasks(gulp, tasks);
@ -29,6 +30,7 @@ const buildParallel = [
'copyPluginAssets',
'copyTinyMceLangs',
'updateIgnoredTypeScriptBuild',
'buildCommandIndex',
];
gulp.task('build', gulp.parallel(...buildParallel));

View File

@ -0,0 +1,13 @@
// AUTO-GENERATED using `gulp buildCommandIndex`
import * as historyBackward from './historyBackward';
import * as historyForward from './historyForward';
import * as synchronize from './synchronize';
const index: any[] = [
historyBackward,
historyForward,
synchronize,
];
export default index;
// AUTO-GENERATED using `gulp buildCommandIndex`

View File

@ -0,0 +1,56 @@
const utils = require('../utils');
const glob = require('glob');
const rootDir = utils.rootDir();
const pathUtils = require('@joplin/lib/path-utils');
async function processDirectory(dir) {
const tsFiles = glob.sync('*.ts', {
cwd: dir,
}).filter(f => f !== 'index.ts');
const fileContent = [];
for (const tsFile of tsFiles) {
const f = pathUtils.filename(tsFile);
fileContent.push(`import * as ${f} from './${f}';`);
}
fileContent.push('');
fileContent.push('const index:any[] = [');
for (const tsFile of tsFiles) {
const f = pathUtils.filename(tsFile);
fileContent.push(`\t${f},`);
}
fileContent.push('];');
fileContent.push('');
fileContent.push('export default index;');
const destFile = `${dir}/index.ts`;
console.info(`Generating ${destFile}...`);
await utils.insertContentIntoFile(
destFile,
'// AUTO-GENERATED using `gulp buildCommandIndex`',
fileContent.join('\n'),
true
);
}
module.exports = {
src: '',
fn: async function() {
await processDirectory(`${rootDir}/packages/app-desktop/commands`);
await processDirectory(`${rootDir}/packages/app-desktop/gui/MainScreen/commands`);
await processDirectory(`${rootDir}/packages/app-desktop/gui/NoteEditor/commands`);
await processDirectory(`${rootDir}/packages/app-desktop/gui/NoteList/commands`);
await processDirectory(`${rootDir}/packages/app-desktop/gui/NoteListControls/commands`);
await processDirectory(`${rootDir}/packages/app-desktop/gui/Sidebar/commands`);
await processDirectory(`${rootDir}/packages/lib/commands`);
},
};

View File

@ -166,4 +166,20 @@ utils.setPackagePrivateField = async function(filePath, value) {
await fs.writeFile(filePath, JSON.stringify(obj, null, 2), 'utf8');
};
utils.insertContentIntoFile = async (filePath, marker, contentToInsert, createIfNotExist = false) => {
const fs = require('fs-extra');
const fileExists = await fs.pathExists(filePath);
if (!fileExists) {
if (!createIfNotExist) throw new Error(`File not found: ${filePath}`);
await fs.writeFile(filePath, `${marker}\n${contentToInsert}\n${marker}`);
} else {
let content = await fs.readFile(filePath, 'utf-8');
// [^]* matches any character including new lines
const regex = new RegExp(`${marker}[^]*?${marker}`);
content = content.replace(regex, `${marker}\n${contentToInsert}\n${marker}`);
await fs.writeFile(filePath, content);
}
};
module.exports = utils;