format and update packages
This commit is contained in:
parent
e416434bf3
commit
f1f8a3f7b0
8 changed files with 1222 additions and 5263 deletions
|
|
@ -47,7 +47,7 @@ esbuild
|
||||||
],
|
],
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
watch: !prod,
|
watch: !prod,
|
||||||
target: 'es2016',
|
target: 'es2018',
|
||||||
logLevel: 'info',
|
logLevel: 'info',
|
||||||
sourcemap: prod ? false : 'inline',
|
sourcemap: prod ? false : 'inline',
|
||||||
treeShaking: true,
|
treeShaking: true,
|
||||||
|
|
|
||||||
6424
package-lock.json
generated
6424
package-lock.json
generated
File diff suppressed because it is too large
Load diff
27
package.json
27
package.json
|
|
@ -16,26 +16,23 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@popperjs/core": "^2.11.5",
|
"@popperjs/core": "^2.11.5",
|
||||||
"@tsconfig/svelte": "^3.0.0",
|
"@tsconfig/svelte": "^3.0.0",
|
||||||
"@types/jest": "^28.1.3",
|
"@types/jest": "^29.5.3",
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^18.16.20",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||||
"@typescript-eslint/parser": "^5.2.0",
|
"@typescript-eslint/parser": "^5.30.0",
|
||||||
"builtin-modules": "^3.2.0",
|
"builtin-modules": "^3.3.0",
|
||||||
"esbuild": "0.13.12",
|
"esbuild": "^0.14.47",
|
||||||
"esbuild-svelte": "^0.7.1",
|
"esbuild-svelte": "^0.7.1",
|
||||||
"eslint-plugin-only-warn": "^1.0.3",
|
"eslint-plugin-only-warn": "^1.0.3",
|
||||||
"jest": "^28.1.2",
|
"jest": "^29.6.1",
|
||||||
"jest-fetch-mock": "^3.0.3",
|
"jest-fetch-mock": "^3.0.3",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
"svelte": "^3.50.1",
|
"svelte": "^3.53.1",
|
||||||
"svelte-preprocess": "^4.10.7",
|
"svelte-preprocess": "^4.10.7",
|
||||||
"ts-jest": "^28.0.5",
|
"ts-jest": "^29.1.1",
|
||||||
"tslib": "2.3.1",
|
"tslib": "2.4.0",
|
||||||
"typescript": "4.4.4",
|
"typescript": "^4.9.5",
|
||||||
"prettier": "2.7.1"
|
"prettier": "2.7.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {}
|
||||||
"ts-node": "^10.8.1",
|
|
||||||
"yarn": "^1.22.19"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {ButtonComponent, Component, MarkdownRenderer, Modal, Setting} from 'obsidian';
|
import { ButtonComponent, Component, MarkdownRenderer, Modal, Setting } from 'obsidian';
|
||||||
import MediaDbPlugin from 'src/main';
|
import MediaDbPlugin from 'src/main';
|
||||||
import { MediaTypeModel } from 'src/models/MediaTypeModel';
|
import { MediaTypeModel } from 'src/models/MediaTypeModel';
|
||||||
import { PREVIEW_MODAL_DEFAULT_OPTIONS, PreviewModalData, PreviewModalOptions } from '../utils/ModalHelper';
|
import { PREVIEW_MODAL_DEFAULT_OPTIONS, PreviewModalData, PreviewModalOptions } from '../utils/ModalHelper';
|
||||||
|
|
@ -51,13 +51,13 @@ export class MediaDbPreviewModal extends Modal {
|
||||||
|
|
||||||
for (const result of this.elements) {
|
for (const result of this.elements) {
|
||||||
previewWrapper.createEl('h3', { text: result.englishTitle });
|
previewWrapper.createEl('h3', { text: result.englishTitle });
|
||||||
const fileDiv = previewWrapper.createDiv({ cls: 'media-db-plugin-preview'});
|
const fileDiv = previewWrapper.createDiv({ cls: 'media-db-plugin-preview' });
|
||||||
|
|
||||||
let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions);
|
let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions);
|
||||||
fileContent = `\n${fileContent}\n`;
|
fileContent = `\n${fileContent}\n`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, "", this.markdownComponent);
|
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, '', this.markdownComponent);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(`mdb | error during rendering of preview`, e);
|
console.warn(`mdb | error during rendering of preview`, e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,10 +170,15 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Date format')
|
.setName('Date format')
|
||||||
.setDesc(fragWithHTML("Your custom date format. Use <em>\'YYYY-MM-DD\'</em> for example.<br>" +
|
.setDesc(
|
||||||
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
|
fragWithHTML(
|
||||||
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
|
"Your custom date format. Use <em>'YYYY-MM-DD'</em> for example.<br>" +
|
||||||
this.plugin.dateFormatter.getPreview() + "</a></b>"))
|
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
|
||||||
|
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
|
||||||
|
this.plugin.dateFormatter.getPreview() +
|
||||||
|
'</a></b>'
|
||||||
|
)
|
||||||
|
)
|
||||||
.addText(cb => {
|
.addText(cb => {
|
||||||
cb.setPlaceholder(DEFAULT_SETTINGS.customDateFormat)
|
cb.setPlaceholder(DEFAULT_SETTINGS.customDateFormat)
|
||||||
.setValue(this.plugin.settings.customDateFormat === DEFAULT_SETTINGS.customDateFormat ? '' : this.plugin.settings.customDateFormat)
|
.setValue(this.plugin.settings.customDateFormat === DEFAULT_SETTINGS.customDateFormat ? '' : this.plugin.settings.customDateFormat)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
// obsidian already uses moment, so no need to package it twice!
|
// obsidian already uses moment, so no need to package it twice!
|
||||||
// import { moment } from 'obsidian'; // doesn't work for release build
|
// import { moment } from 'obsidian'; // doesn't work for release build
|
||||||
// obsidian uses a namespace-style import for moment, which ES6 doesn't allow anymore
|
// obsidian uses a namespace-style import for moment, which ES6 doesn't allow anymore
|
||||||
const obsidian = require('obsidian');
|
// const obsidian = require('obsidian');
|
||||||
const moment = obsidian.moment;
|
// const moment = obsidian.moment;
|
||||||
|
|
||||||
|
import { moment } from 'obsidian';
|
||||||
|
|
||||||
export class DateFormatter {
|
export class DateFormatter {
|
||||||
toFormat: string;
|
toFormat: string;
|
||||||
|
|
@ -33,7 +35,7 @@ export class DateFormatter {
|
||||||
* You can set a date format by calling `setFormat()`.
|
* You can set a date format by calling `setFormat()`.
|
||||||
*
|
*
|
||||||
* @param dateString the date string to be formatted
|
* @param dateString the date string to be formatted
|
||||||
* @param dateFormat the current format of `dateString`. When this is `null` and the actual format of the
|
* @param dateFormat the current format of `dateString`. When this is `null` and the actual format of the
|
||||||
* given date string is not `C2822` or `ISO` format, this function will try to guess the format by using the native `Date` module.
|
* given date string is not `C2822` or `ISO` format, this function will try to guess the format by using the native `Date` module.
|
||||||
* @param locale the locale of `dateString`. This is needed when `dateString` includes a month or day name and its locale format differs
|
* @param locale the locale of `dateString`. This is needed when `dateString` includes a month or day name and its locale format differs
|
||||||
* from the locale of this machine.
|
* from the locale of this machine.
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export class YAMLConverter {
|
||||||
} else if (typeof value === 'number') {
|
} else if (typeof value === 'number') {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
} else if (typeof value === 'string') {
|
} else if (typeof value === 'string') {
|
||||||
return '"' + value.replace("\"", "\\\"") + '"';
|
return '"' + value.replace('"', '\\"') + '"';
|
||||||
} else if (typeof value === 'object') {
|
} else if (typeof value === 'object') {
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"esModuleInterop": true,
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"lib": ["DOM", "ES5", "ES6", "ES7"]
|
"lib": ["DOM", "ES5", "ES6", "ES7", "Es2021"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"]
|
"include": ["**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue