# HG changeset patch # User Ludovic Chabant # Date 1647656358 25200 # Node ID 2a9e941c96ee685371f46a690bc87dd7c7714439 # Parent 131ae934ea071b9975b885af9297b6ea38f05298 Bring new build tools from the sample plugin project diff -r 131ae934ea07 -r 2a9e941c96ee .eslintignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.eslintignore Fri Mar 18 19:19:18 2022 -0700 @@ -0,0 +1,2 @@ +npm node_modules +build diff -r 131ae934ea07 -r 2a9e941c96ee .eslintrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.eslintrc Fri Mar 18 19:19:18 2022 -0700 @@ -0,0 +1,23 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "env": { "node": true }, + "plugins": [ + "@typescript-eslint" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], + "@typescript-eslint/ban-ts-comment": "off", + "no-prototype-builtins": "off", + "@typescript-eslint/no-empty-function": "off" + } +} diff -r 131ae934ea07 -r 2a9e941c96ee .gitignore --- a/.gitignore Sat Mar 12 12:07:02 2022 -0800 +++ b/.gitignore Fri Mar 18 19:19:18 2022 -0700 @@ -1,3 +1,23 @@ -main.js +# vscode +.vscode + +# Intellij +*.iml +.idea + +# npm node_modules package-lock.json + +# Don't include the compiled main.js file in the repo. +# They should be uploaded to GitHub releases instead. +main.js + +# Exclude sourcemaps +*.map + +# obsidian +data.json + +# Exclude macOS Finder (System Explorer) View States +.DS_Store diff -r 131ae934ea07 -r 2a9e941c96ee .hgignore --- a/.hgignore Sat Mar 12 12:07:02 2022 -0800 +++ b/.hgignore Fri Mar 18 19:19:18 2022 -0700 @@ -1,3 +1,25 @@ -main.js +syntax: glob + +# vscode +.vscode + +# Intellij +*.iml +.idea + +# npm node_modules package-lock.json + +# Don't include the compiled main.js file in the repo. +# They should be uploaded to GitHub releases instead. +main.js + +# Exclude sourcemaps +*.map + +# obsidian +data.json + +# Exclude macOS Finder (System Explorer) View States +.DS_Store diff -r 131ae934ea07 -r 2a9e941c96ee .npmrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.npmrc Fri Mar 18 19:19:18 2022 -0700 @@ -0,0 +1,1 @@ +tag-version-prefix="" diff -r 131ae934ea07 -r 2a9e941c96ee esbuild.config.mjs --- a/esbuild.config.mjs Sat Mar 12 12:07:02 2022 -0800 +++ b/esbuild.config.mjs Fri Mar 18 19:19:18 2022 -0700 @@ -10,6 +10,10 @@ `; const prod = (process.argv[2] === 'production'); +const outdir = (process.argv[2] === 'dogfood' ? process.argv[3] : ''); + +const dirsep = (outdir.slice(-1) == '/' || outdir.slice(-1) == "\\") ? '' : '/'; +const outfile = outdir + dirsep + 'main.js'; esbuild.build({ banner: { @@ -18,18 +22,35 @@ entryPoints: ['src/main.ts'], bundle: true, external: [ - 'obsidian', - 'electron', - '@codemirror', - '@codemirror/state', - '@codemirror/view', - ...builtins - ], + '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, target: 'es2016', logLevel: "info", sourcemap: prod ? false : 'inline', treeShaking: true, - outfile: 'main.js', + outfile: outfile, }).catch(() => process.exit(1)); diff -r 131ae934ea07 -r 2a9e941c96ee package.json --- a/package.json Sat Mar 12 12:07:02 2022 -0800 +++ b/package.json Fri Mar 18 19:19:18 2022 -0700 @@ -5,10 +5,12 @@ "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", - "build": "node esbuild.config.mjs production" + "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", + "dogfood": "node esbuild.config.mjs dogfood", + "version": "node version-bump.mjs && git add manifest.json versions.json" }, "keywords": [], - "author": "", + "author": "Ludovic Chabant", "license": "MIT", "devDependencies": { "@codemirror/history": "^0.19.0", @@ -20,7 +22,7 @@ "builtin-modules": "^3.2.0", "esbuild": "0.13.12", "monkey-around": "^2.2.0", - "obsidian": "^0.12.17", + "obsidian": "latest", "tslib": "2.3.1", "typescript": "4.4.4" }, diff -r 131ae934ea07 -r 2a9e941c96ee tsconfig.json --- a/tsconfig.json Sat Mar 12 12:07:02 2022 -0800 +++ b/tsconfig.json Fri Mar 18 19:19:18 2022 -0700 @@ -9,6 +9,7 @@ "noImplicitAny": true, "moduleResolution": "node", "importHelpers": true, + "isolatedModules": true, "lib": [ "DOM", "ES5", diff -r 131ae934ea07 -r 2a9e941c96ee version-bump.mjs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/version-bump.mjs Fri Mar 18 19:19:18 2022 -0700 @@ -0,0 +1,15 @@ +import { readFileSync, writeFileSync } from "fs"; + +const targetVersion = process.env.npm_package_version; + +// read minAppVersion from manifest.json and bump version to target version +let manifest = JSON.parse(readFileSync("manifest.json", "utf8")); +const { minAppVersion } = manifest; +manifest.version = targetVersion; +writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t")); + +// update versions.json with target version and minAppVersion from manifest.json +let versions = JSON.parse(readFileSync("versions.json", "utf8")); +versions[targetVersion] = minAppVersion; +writeFileSync("versions.json", JSON.stringify(versions, null, "\t")); +