Moved to src folder

This commit is contained in:
Ryan Bantz 2025-02-09 10:16:03 -06:00
parent 0780e51eba
commit 8bf81c1b27
9 changed files with 41 additions and 21 deletions

9
.editorconfig Normal file
View file

@ -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

2
.eslintignore Normal file
View file

@ -0,0 +1,2 @@
npm node_modules
build

View file

@ -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) {

View file

@ -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
}

View file

@ -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}`,

View file

@ -1,7 +1,7 @@
import {
App,
FuzzySuggestModal,
Notice,
Notice,
Plugin,
PluginSettingTab,
Setting,

View file

@ -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';
/**

View file

@ -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"]
}