Skip to content

Commit 3abdb4d

Browse files
committed
Updated dev dependencies to match sample plugin example
1 parent 777c65f commit 3abdb4d

File tree

6 files changed

+102
-16
lines changed

6 files changed

+102
-16
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
insert_final_newline = true
7+
indent_style = tab
8+
indent_size = 4
9+
tab_width = 4

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
npm node_modules
2+
build

.eslintrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": [
5+
"@typescript-eslint"
6+
],
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"parserOptions": {
13+
"sourceType": "module"
14+
},
15+
"rules": {
16+
"no-unused-vars": "off",
17+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
18+
"@typescript-eslint/ban-ts-comment": "off",
19+
"no-prototype-builtins": "off",
20+
"@typescript-eslint/no-empty-function": "off"
21+
}
22+
}

esbuild.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import esbuild from "esbuild";
2+
import process from "process";
3+
import builtins from 'builtin-modules'
4+
5+
const banner =
6+
`/*
7+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
8+
if you want to view the source, please visit the github repository of this plugin
9+
*/
10+
`;
11+
12+
const prod = (process.argv[2] === 'production');
13+
14+
esbuild.build({
15+
banner: {
16+
js: banner,
17+
},
18+
entryPoints: ['main.ts'],
19+
bundle: true,
20+
external: [
21+
'obsidian',
22+
'electron',
23+
'@codemirror/autocomplete',
24+
'@codemirror/closebrackets',
25+
'@codemirror/collab',
26+
'@codemirror/commands',
27+
'@codemirror/comment',
28+
'@codemirror/fold',
29+
'@codemirror/gutter',
30+
'@codemirror/highlight',
31+
'@codemirror/history',
32+
'@codemirror/language',
33+
'@codemirror/lint',
34+
'@codemirror/matchbrackets',
35+
'@codemirror/panel',
36+
'@codemirror/rangeset',
37+
'@codemirror/rectangular-selection',
38+
'@codemirror/search',
39+
'@codemirror/state',
40+
'@codemirror/stream-parser',
41+
'@codemirror/text',
42+
'@codemirror/tooltip',
43+
'@codemirror/view',
44+
...builtins],
45+
format: 'cjs',
46+
watch: !prod,
47+
target: 'es2016',
48+
logLevel: "info",
49+
sourcemap: prod ? false : 'inline',
50+
treeShaking: true,
51+
outfile: 'main.js',
52+
}).catch(() => process.exit(1));

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
"description": "An Obsidian plugin that helps you focus on your writing, a section at a time.",
55
"main": "main.js",
66
"scripts": {
7-
"dev": "rollup --config rollup.config.js -w",
8-
"build": "rollup --config rollup.config.js --environment BUILD:production"
7+
"dev": "node esbuild.config.mjs",
8+
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production"
99
},
1010
"keywords": [],
1111
"author": "",
1212
"license": "MIT",
1313
"devDependencies": {
14-
"@rollup/plugin-commonjs": "^18.0.0",
15-
"@rollup/plugin-node-resolve": "^11.2.1",
16-
"@rollup/plugin-typescript": "^8.2.1",
17-
"@types/node": "^14.14.37",
18-
"obsidian": "^0.12.0",
19-
"rollup": "^2.32.1",
20-
"tslib": "^2.2.0",
21-
"typescript": "^4.2.4"
14+
"@types/node": "^16.11.6",
15+
"@typescript-eslint/eslint-plugin": "^5.2.0",
16+
"@typescript-eslint/parser": "^5.2.0",
17+
"builtin-modules": "^3.2.0",
18+
"esbuild": "0.13.12",
19+
"obsidian": "^0.12.17",
20+
"tslib": "2.3.1",
21+
"typescript": "4.4.4"
2222
}
2323
}

tsconfig.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@
44
"inlineSourceMap": true,
55
"inlineSources": true,
66
"module": "ESNext",
7-
"target": "es6",
7+
"target": "ES6",
88
"allowJs": true,
99
"noImplicitAny": true,
1010
"moduleResolution": "node",
1111
"importHelpers": true,
12+
"isolatedModules": true,
1213
"lib": [
13-
"dom",
14-
"es5",
15-
"scripthost",
16-
"es2015"
14+
"DOM",
15+
"ES5",
16+
"ES6",
17+
"ES7"
1718
]
1819
},
1920
"include": [
2021
"**/*.ts"
2122
]
22-
}
23+
}

0 commit comments

Comments
 (0)