mirror of
https://github.com/dnlbauer/obsidian-dataview-autocompletion.git
synced 2026-09-10 14:15:29 +00:00
refactor: moved code to src and cleaned build script
This commit is contained in:
774
package-lock.json
generated
774
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@@ -4,8 +4,9 @@
|
||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||
"dev": "npx rollup --config rollup.config.js -w",
|
||||
"build": "npx rollup --config rollup.config.js --environment BUILD:production",
|
||||
"test": "npx jest",
|
||||
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
||||
},
|
||||
"keywords": [],
|
||||
@@ -19,6 +20,14 @@
|
||||
"esbuild": "0.17.3",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.4"
|
||||
"typescript": "4.7.4",
|
||||
"jest": "29.7.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rollup/plugin-commonjs": "^28.0.1",
|
||||
"@rollup/plugin-node-resolve": "^15.3.0",
|
||||
"rollup": "^2.79.2",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"rollup-plugin-typescript2": "^0.36.0"
|
||||
}
|
||||
}
|
||||
|
||||
60
rollup.config.js
Normal file
60
rollup.config.js
Normal file
@@ -0,0 +1,60 @@
|
||||
import nodeResolve from "@rollup/plugin-node-resolve";
|
||||
import commonjs from "@rollup/plugin-commonjs";
|
||||
import copy from "rollup-plugin-copy";
|
||||
import typescript2 from "rollup-plugin-typescript2";
|
||||
|
||||
const BASE_CONFIG = {
|
||||
input: "src/main.ts",
|
||||
external: ["obsidian"]
|
||||
};
|
||||
|
||||
const getRollupPlugins = (tsconfig, ...plugins) =>
|
||||
[
|
||||
typescript2(tsconfig),
|
||||
nodeResolve({ browser: true }),
|
||||
commonjs(),
|
||||
].concat(plugins);
|
||||
|
||||
const DEV_PLUGIN_CONFIG = {
|
||||
...BASE_CONFIG,
|
||||
output: {
|
||||
dir: "test-vault/.obsidian/plugins/dataview-suggester",
|
||||
sourcemap: "inline",
|
||||
format: "cjs",
|
||||
exports: "default",
|
||||
name: "Dataview Suggester (Development)",
|
||||
},
|
||||
plugins: getRollupPlugins(
|
||||
undefined,
|
||||
copy({
|
||||
targets: [
|
||||
{ src: "manifest.json", dest: "test-vault/.obsidian/plugins/dataview-suggester/" },
|
||||
{ src: "styles.css", dest: "test-vault/.obsidian/plugins/dataview-suggester/" },
|
||||
],
|
||||
})
|
||||
),
|
||||
};
|
||||
|
||||
const PROD_PLUGIN_CONFIG = {
|
||||
...BASE_CONFIG,
|
||||
output: {
|
||||
dir: "build",
|
||||
sourcemap: "inline",
|
||||
sourcemapExcludeSources: true,
|
||||
format: "cjs",
|
||||
exports: "default",
|
||||
name: "Dataview Suggester (Production)",
|
||||
},
|
||||
plugins: getRollupPlugins(),
|
||||
};
|
||||
|
||||
let configs = [];
|
||||
if (process.env.BUILD === "production") {
|
||||
configs.push(PROD_PLUGIN_CONFIG);
|
||||
} else if (process.env.BUILD === "dev") {
|
||||
configs.push(DEV_PLUGIN_CONFIG);
|
||||
} else {
|
||||
configs.push(DEV_PLUGIN_CONFIG);
|
||||
}
|
||||
|
||||
export default configs;
|
||||
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"sourceMap": true,
|
||||
"inlineSourceMap": false,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES6",
|
||||
|
||||
Reference in New Issue
Block a user