From 8bf81c1b27f9e8a6bfb60b0e1bf05747dbc32b35 Mon Sep 17 00:00:00 2001 From: Ryan Bantz Date: Sun, 9 Feb 2025 10:16:03 -0600 Subject: [PATCH] Moved to src folder --- .editorconfig | 9 +++++++++ .eslintignore | 2 ++ esbuild.config.mjs | 6 +++--- manifest.json | 13 +++++++------ {api => src/api}/asanaApi.ts | 15 +++++++++------ main.ts => src/main.ts | 2 +- {settings => src/settings}/settings.ts | 2 +- {ui => src/ui}/FuzzySelectModal.ts | 0 tsconfig.json | 13 +++++++++---- 9 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 .editorconfig create mode 100644 .eslintignore rename {api => src/api}/asanaApi.ts (90%) rename main.ts => src/main.ts (99%) rename {settings => src/settings}/settings.ts (97%) rename {ui => src/ui}/FuzzySelectModal.ts (100%) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..30bb192 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# top-most EditorConfig file +root = true + +[*] +charset = utf-8 +insert_final_newline = true +indent_style = tab +indent_size = 4 +tab_width = 4 \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..32909b2 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +npm node_modules +build \ No newline at end of file diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 539e1de..2ed9595 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -15,7 +15,7 @@ const context = await esbuild.context({ banner: { js: banner, }, - entryPoints: ["main.ts"], + entryPoints: ["src/main.ts"], bundle: true, external: [ "obsidian", @@ -35,10 +35,10 @@ const context = await esbuild.context({ format: "cjs", target: "es2018", logLevel: "info", - sourcemap: prod ? false : "inline", + sourcemap: prod ? false : 'inline', treeShaking: true, outfile: "main.js", - minify: prod, + minify: prod ? true : false, }); if (prod) { diff --git a/manifest.json b/manifest.json index 0c3f0d5..55cb71f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,11 @@ { - "id": "asana-task-creator", - "name": "Asana Task Creator", + "id": "asana-for-obsidian", + "name": "Asana for Obsidian", "version": "1.0.0", - "minAppVersion": "0.12.0", - "description": "Create Asana tasks from highlighted text or current line in Obsidian.", - "author": "Your Name", - "authorUrl": "https://yourwebsite.com", + "description": "Create Asana tasks from highlighted text or the current line in Obsidian.", + "author": "Ryan Bantz", + "authorUrl": "https://ryanbantz.com", + "fundingUrl": "https://www.buymeacoffee.com/ryanbantz", + "helpUrl": "https://github.com/mryanb/obsidian-asana", "isDesktopOnly": false } \ No newline at end of file diff --git a/api/asanaApi.ts b/src/api/asanaApi.ts similarity index 90% rename from api/asanaApi.ts rename to src/api/asanaApi.ts index 1410fc7..5cc75f7 100644 --- a/api/asanaApi.ts +++ b/src/api/asanaApi.ts @@ -1,6 +1,9 @@ import { requestUrl } from 'obsidian'; import { AsanaPluginSettings } from '../settings/settings'; +// Asana API Base URL +const ASANA_API_BASE_URL = 'https://app.asana.com/api/1.0'; + /** * Fetches a list of workspaces from Asana. * @param settings - The plugin settings containing the Asana API token. @@ -11,7 +14,7 @@ export async function fetchAsanaWorkspaces(settings: AsanaPluginSettings) { try { const response = await requestUrl({ - url: 'https://app.asana.com/api/1.0/workspaces', + url: `${ASANA_API_BASE_URL}/workspaces`, method: 'GET', headers: { Authorization: `Bearer ${token}`, @@ -43,7 +46,7 @@ export async function fetchAsanaProjects( try { const response = await requestUrl({ - url: `https://app.asana.com/api/1.0/workspaces/${workspaceGid}/projects?is_archived=false`, + url: `${ASANA_API_BASE_URL}/workspaces/${workspaceGid}/projects?is_archived=false`, method: 'GET', headers: { Authorization: `Bearer ${token}`, @@ -75,7 +78,7 @@ export async function fetchAsanaSections( try { const response = await requestUrl({ - url: `https://app.asana.com/api/1.0/projects/${projectGid}/sections`, + url: `${ASANA_API_BASE_URL}/projects/${projectGid}/sections`, method: 'GET', headers: { Authorization: `Bearer ${token}`, @@ -114,7 +117,7 @@ export async function createTaskInAsana( try { // Create task in Asana const response = await requestUrl({ - url: 'https://app.asana.com/api/1.0/tasks', + url: `${ASANA_API_BASE_URL}/tasks`, method: 'POST', headers: { Authorization: `Bearer ${token}`, @@ -135,7 +138,7 @@ export async function createTaskInAsana( // Move task to the selected section (if provided) if (sectionGid) { await requestUrl({ - url: `https://app.asana.com/api/1.0/sections/${sectionGid}/addTask`, + url: `${ASANA_API_BASE_URL}/sections/${sectionGid}/addTask`, method: 'POST', headers: { Authorization: `Bearer ${token}`, @@ -151,7 +154,7 @@ export async function createTaskInAsana( // Fetch task details to get `permalink_url` const taskResponse = await requestUrl({ - url: `https://app.asana.com/api/1.0/tasks/${taskGid}`, + url: `${ASANA_API_BASE_URL}/tasks/${taskGid}`, method: 'GET', headers: { Authorization: `Bearer ${token}`, diff --git a/main.ts b/src/main.ts similarity index 99% rename from main.ts rename to src/main.ts index 2980b52..5afc32f 100644 --- a/main.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ import { App, FuzzySuggestModal, - Notice, + Notice, Plugin, PluginSettingTab, Setting, diff --git a/settings/settings.ts b/src/settings/settings.ts similarity index 97% rename from settings/settings.ts rename to src/settings/settings.ts index b71b409..33bec44 100644 --- a/settings/settings.ts +++ b/src/settings/settings.ts @@ -1,4 +1,4 @@ -import { App, PluginSettingTab, Setting, TextComponent, ToggleComponent } from 'obsidian'; +import { App, Notice, PluginSettingTab, Setting, TextComponent, ToggleComponent } from 'obsidian'; import AsanaPlugin from '../main'; /** diff --git a/ui/FuzzySelectModal.ts b/src/ui/FuzzySelectModal.ts similarity index 100% rename from ui/FuzzySelectModal.ts rename to src/ui/FuzzySelectModal.ts diff --git a/tsconfig.json b/tsconfig.json index d05c28d..72fd62c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,13 +6,18 @@ "module": "ESNext", "target": "ES6", "allowJs": true, - "noImplicitAny": true, + "noImplicitAny": false, "moduleResolution": "node", "importHelpers": true, "isolatedModules": true, - "strictNullChecks": true, - "lib": ["DOM", "ES2016"], - "types": ["obsidian"] + "esModuleInterop": true, + "lib": ["DOM", "ES5", "ES6", "ES7"], + "paths": { + "@settings/*": ["src/settings/*"], + "@ui/*": ["src/ui/*"], + "@api/*": ["src/api/*"], + "@src/*": ["src/*"] + } }, "include": ["**/*.ts"] } \ No newline at end of file