Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

Commit 5df0b6f

Browse files
authored
Merge pull request #920 from trey-wallis/dev
Dev
2 parents 39e2966 + 5c79c65 commit 5df0b6f

38 files changed

+417
-256
lines changed

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ jobs:
2525
name: ${{ github.ref_name }}
2626
tag_name: ${{ github.ref }}
2727
files: |
28-
main.js
29-
manifest.json
30-
styles.css
28+
dist/main.js
29+
dist/manifest.json
30+
dist/styles.css

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ main.css.map
2424
main.js
2525
main.js.map
2626

27-
# Ignore only the build styles.css
28-
/styles.css
29-
3027
# obsidian
3128
data.json
3229

@@ -36,4 +33,4 @@ pnpm-lock.yaml
3633
*.log
3734
.DS_Store
3835

39-
36+
dist/

CONTRIBUTING.md

+13-3
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,25 @@ Install dependencies
3636
bun install
3737
```
3838

39-
Create a symbolic link from the cloned repository to your Obsidan vault.
39+
Build the project. This will create a `dist` folder
40+
41+
```shell
42+
bun run build
43+
```
44+
45+
Create a symbolic link from the cloned repository to your Obsidan vault. Be sure to link the `dist` folder
4046

4147
Note: I recommend making a new Obsidian vault just for development.
4248

4349
```shell
44-
ln -s <repo-path> <dev-vault-path>/.obsidian/plugins
50+
ln -s <repository-path>/dist <development-vault-path>/.obsidian/plugins/obsidian-dataloom
4551
```
4652

47-
e.g. `ln -s /users/trey/desktop/obsidian-dataloom /users/trey/desktop/test-vault/.obsidian/plugins`
53+
e.g
54+
55+
```shell
56+
ln -s /users/trey/desktop/obsidian-dataloom/dist /users/trey/desktop/test-vault/.obsidian/plugins/obsidian-dataloom
57+
```
4858

4959
Checkout the `dev` branch and make a child branch off of it. The branching strategy is `<feature>` -> `dev` -> `master`.
5060

bun.lockb

622 Bytes
Binary file not shown.

esbuild.config.mjs

+72-62
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,80 @@
11
import esbuild from "esbuild";
22
import process from "process";
33
import builtins from "builtin-modules";
4-
import * as fs from "fs";
4+
import fs from "fs";
5+
import path from "path";
6+
7+
const banner = `/*
8+
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
9+
if you want to view the source, please visit the github repository of this plugin
10+
*/
11+
`;
512

613
const prod = process.argv[2] === "production";
714
const tools = process.argv[2] === "tools";
815

9-
esbuild
10-
.build({
11-
entryPoints: ["src/main.ts"],
12-
bundle: true,
13-
external: [
14-
"obsidian",
15-
"electron",
16-
"@codemirror/autocomplete",
17-
"@codemirror/closebrackets",
18-
"@codemirror/collab",
19-
"@codemirror/commands",
20-
"@codemirror/comment",
21-
"@codemirror/fold",
22-
"@codemirror/gutter",
23-
"@codemirror/highlight",
24-
"@codemirror/history",
25-
"@codemirror/language",
26-
"@codemirror/lint",
27-
"@codemirror/matchbrackets",
28-
"@codemirror/panel",
29-
"@codemirror/rangeset",
30-
"@codemirror/rectangular-selection",
31-
"@codemirror/search",
32-
"@codemirror/state",
33-
"@codemirror/stream-parser",
34-
"@codemirror/text",
35-
"@codemirror/tooltip",
36-
"@codemirror/view",
37-
...builtins,
38-
],
39-
format: "cjs",
40-
watch: prod
41-
? false
42-
: {
43-
onRebuild(error) {
44-
if (error) console.error("watch build failed:", error);
45-
else
46-
fs.rename("main.css", "styles.css", (err) => {
47-
if (err) console.error(err);
48-
});
49-
},
50-
},
16+
const rebuildPlugin = {
17+
name: "rebuild-handler",
18+
setup(build) {
19+
build.onEnd(async () => {
20+
await fs.promises.rename("dist/main.css", "dist/styles.css");
21+
await fs.promises.copyFile(
22+
path.join(path.resolve(), "manifest.json"),
23+
path.join(path.resolve(), "dist", "manifest.json")
24+
);
25+
});
26+
},
27+
};
28+
29+
const context = await esbuild.context({
30+
banner: {
31+
js: banner,
32+
},
33+
entryPoints: ["src/main.ts"],
34+
bundle: true,
35+
external: [
36+
"obsidian",
37+
"electron",
38+
"@codemirror/autocomplete",
39+
"@codemirror/closebrackets",
40+
"@codemirror/collab",
41+
"@codemirror/commands",
42+
"@codemirror/comment",
43+
"@codemirror/fold",
44+
"@codemirror/gutter",
45+
"@codemirror/highlight",
46+
"@codemirror/history",
47+
"@codemirror/language",
48+
"@codemirror/lint",
49+
"@codemirror/matchbrackets",
50+
"@codemirror/panel",
51+
"@codemirror/rangeset",
52+
"@codemirror/rectangular-selection",
53+
"@codemirror/search",
54+
"@codemirror/state",
55+
"@codemirror/stream-parser",
56+
"@codemirror/text",
57+
"@codemirror/tooltip",
58+
"@codemirror/view",
59+
...builtins,
60+
],
61+
format: "cjs",
62+
target: "es2018",
63+
logLevel: "info",
64+
sourcemap: prod ? false : "inline",
65+
define: {
66+
"process.env.ENABLE_REACT_DEVTOOLS": tools
67+
? JSON.stringify("true")
68+
: JSON.stringify("false"),
69+
},
70+
treeShaking: true,
71+
outdir: "dist",
72+
plugins: [rebuildPlugin],
73+
});
5174

52-
target: "es2016",
53-
logLevel: "info",
54-
sourcemap: !prod,
55-
define: {
56-
"process.env.ENABLE_REACT_DEVTOOLS": tools
57-
? JSON.stringify("true")
58-
: JSON.stringify("false"),
59-
},
60-
treeShaking: true,
61-
outfile: "main.js",
62-
})
63-
.then(() => {
64-
if (prod) {
65-
fs.rename("main.css", "styles.css", (err) => {
66-
if (err) console.error(err);
67-
});
68-
}
69-
})
70-
.catch(() => process.exit(1));
75+
if (prod) {
76+
await context.rebuild();
77+
process.exit(0);
78+
} else {
79+
await context.watch();
80+
}

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"fundingUrl": {
1010
"Buymeacoffee": "https://www.buymeacoffee.com/treywallis"
1111
},
12-
"version": "8.15.10"
12+
"version": "8.15.11"
1313
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-dataloom",
3-
"version": "8.15.10",
3+
"version": "8.15.11",
44
"description": "Weave together data from diverse sources into different views. Inspired by Excel Spreadsheets and Notion.so.",
55
"main": "main.js",
66
"scripts": {
@@ -36,7 +36,7 @@
3636
"@typescript-eslint/parser": "^5.59.8",
3737
"babel-jest": "^29.0.2",
3838
"builtin-modules": "^3.2.0",
39-
"esbuild": "^0.15.7",
39+
"esbuild": "^0.19.11",
4040
"eslint": "^8.41.0",
4141
"eslint-config-react-app": "^7.0.1",
4242
"eslint-plugin-react-hooks": "^4.6.0",
@@ -58,6 +58,7 @@
5858
"dayjs": "^1.11.10",
5959
"fuzzysort": "^2.0.4",
6060
"htmlparser2": "^9.0.0",
61+
"js-logger": "^1.6.1",
6162
"jsondiffpatch": "^0.5.0",
6263
"lucide": "^0.241.0",
6364
"markdown-it": "^13.0.1",

0 commit comments

Comments
 (0)