Skip to content

Commit

Permalink
Merge pull request #920 from trey-wallis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
decaf-dev authored Jan 3, 2024
2 parents 39e2966 + 5c79c65 commit 5df0b6f
Show file tree
Hide file tree
Showing 38 changed files with 417 additions and 256 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref }}
files: |
main.js
manifest.json
styles.css
dist/main.js
dist/manifest.json
dist/styles.css
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ main.css.map
main.js
main.js.map

# Ignore only the build styles.css
/styles.css

# obsidian
data.json

Expand All @@ -36,4 +33,4 @@ pnpm-lock.yaml
*.log
.DS_Store


dist/
16 changes: 13 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,25 @@ Install dependencies
bun install
```

Create a symbolic link from the cloned repository to your Obsidan vault.
Build the project. This will create a `dist` folder

```shell
bun run build
```

Create a symbolic link from the cloned repository to your Obsidan vault. Be sure to link the `dist` folder

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

```shell
ln -s <repo-path> <dev-vault-path>/.obsidian/plugins
ln -s <repository-path>/dist <development-vault-path>/.obsidian/plugins/obsidian-dataloom
```

e.g. `ln -s /users/trey/desktop/obsidian-dataloom /users/trey/desktop/test-vault/.obsidian/plugins`
e.g

```shell
ln -s /users/trey/desktop/obsidian-dataloom/dist /users/trey/desktop/test-vault/.obsidian/plugins/obsidian-dataloom
```

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

Expand Down
Binary file modified bun.lockb
Binary file not shown.
134 changes: 72 additions & 62 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -1,70 +1,80 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import * as fs from "fs";
import fs from "fs";
import path from "path";

const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

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

esbuild
.build({
entryPoints: ["src/main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/closebrackets",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/comment",
"@codemirror/fold",
"@codemirror/gutter",
"@codemirror/highlight",
"@codemirror/history",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/matchbrackets",
"@codemirror/panel",
"@codemirror/rangeset",
"@codemirror/rectangular-selection",
"@codemirror/search",
"@codemirror/state",
"@codemirror/stream-parser",
"@codemirror/text",
"@codemirror/tooltip",
"@codemirror/view",
...builtins,
],
format: "cjs",
watch: prod
? false
: {
onRebuild(error) {
if (error) console.error("watch build failed:", error);
else
fs.rename("main.css", "styles.css", (err) => {
if (err) console.error(err);
});
},
},
const rebuildPlugin = {
name: "rebuild-handler",
setup(build) {
build.onEnd(async () => {
await fs.promises.rename("dist/main.css", "dist/styles.css");
await fs.promises.copyFile(
path.join(path.resolve(), "manifest.json"),
path.join(path.resolve(), "dist", "manifest.json")
);
});
},
};

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["src/main.ts"],
bundle: true,
external: [
"obsidian",
"electron",
"@codemirror/autocomplete",
"@codemirror/closebrackets",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/comment",
"@codemirror/fold",
"@codemirror/gutter",
"@codemirror/highlight",
"@codemirror/history",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/matchbrackets",
"@codemirror/panel",
"@codemirror/rangeset",
"@codemirror/rectangular-selection",
"@codemirror/search",
"@codemirror/state",
"@codemirror/stream-parser",
"@codemirror/text",
"@codemirror/tooltip",
"@codemirror/view",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
define: {
"process.env.ENABLE_REACT_DEVTOOLS": tools
? JSON.stringify("true")
: JSON.stringify("false"),
},
treeShaking: true,
outdir: "dist",
plugins: [rebuildPlugin],
});

target: "es2016",
logLevel: "info",
sourcemap: !prod,
define: {
"process.env.ENABLE_REACT_DEVTOOLS": tools
? JSON.stringify("true")
: JSON.stringify("false"),
},
treeShaking: true,
outfile: "main.js",
})
.then(() => {
if (prod) {
fs.rename("main.css", "styles.css", (err) => {
if (err) console.error(err);
});
}
})
.catch(() => process.exit(1));
if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"fundingUrl": {
"Buymeacoffee": "https://www.buymeacoffee.com/treywallis"
},
"version": "8.15.10"
"version": "8.15.11"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-dataloom",
"version": "8.15.10",
"version": "8.15.11",
"description": "Weave together data from diverse sources into different views. Inspired by Excel Spreadsheets and Notion.so.",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -36,7 +36,7 @@
"@typescript-eslint/parser": "^5.59.8",
"babel-jest": "^29.0.2",
"builtin-modules": "^3.2.0",
"esbuild": "^0.15.7",
"esbuild": "^0.19.11",
"eslint": "^8.41.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-react-hooks": "^4.6.0",
Expand All @@ -58,6 +58,7 @@
"dayjs": "^1.11.10",
"fuzzysort": "^2.0.4",
"htmlparser2": "^9.0.0",
"js-logger": "^1.6.1",
"jsondiffpatch": "^0.5.0",
"lucide": "^0.241.0",
"markdown-it": "^13.0.1",
Expand Down
Loading

0 comments on commit 5df0b6f

Please sign in to comment.