Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: gather utility functions and constants with consistent filenames #40

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,8 @@ jobs:
- name: Install dependencies
run: npm clean-install
env: { HUSKY: 0 }

- name: Build package
run: npm run build
- name: Build docs
run: npm run build:docs

- name: Audit dependencies
run: >
npm audit
npm audit signatures
- name: Audit linting
run: npm run lint
- name: Audit type checks
run: npm run build:typescript
- name: Audit code coverage
run: npm run test:coverage

- name: Run CI tasks
run: npm run build:ci
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- name: Install dependencies
run: npm clean-install
env: { HUSKY: 0 }
- name: Build plugin
run: npm run build
- name: Ensure CI passes
run: npm run build:ci
- name: Release update
env: { GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" }
run: npx semantic-release
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"type": "module",
"main": "dist/main.js",
"scripts": {
"audit": "npm audit && npm audit signatures",
"build": "vite build",
"build:ci": "npm run audit && npm run lint && npm run build:typescript && npm run build && npm run test:coverage && npm run build:docs",
"build:clean": "rm -rf node_modules/ dist/ coverage/ docs/",
"build:docs": "typedoc --validation",
"build:typescript": "tsc --build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";

import { sanitizeFolder } from "../utils";
import { sanitizeFolder } from "../util";

describe(`${sanitizeFolder.name}`, () => {
it("should strip trailing slashes", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/model/collection/periodic-notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { parse } from "path";
import { assertLuxonValidity } from "@/util/luxon-utils";

import { DateBasedCollection } from "./schema";
import { sanitizeFolder } from "./utils";
import { sanitizeFolder } from "./util";

/**
* @see {@link https://github.com/liamcain/obsidian-periodic-notes}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DateTime } from "luxon";
import { describe, expect, it } from "vitest";

import { mergeTaskParts } from "../merge";
import { mergeTaskParts } from "../util";

describe(`${mergeTaskParts.name}`, () => {
it("gives default values when called with nothing", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/model/task/lib/__tests__/obsidian-dataview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { constant } from "lodash";
import { afterEach, describe, expect, it, vi } from "vitest";

import { adaptDataviewMarkdownTask } from "../obsidian-dataview";
import { NULL_DATAVIEW_TASK } from "./obsidian-dataview.const";
import { NULL_DATAVIEW_TASK } from "./obsidian-dataview.test.const";

describe(`${adaptDataviewMarkdownTask.name}`, () => {
afterEach(() => vi.resetAllMocks());
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/util/__tests__/luxon-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DateTime, DateTimeMaybeValid, Duration, DurationMaybeValid, Interval, I
import { describe, expect, it } from "vitest";

import { assertIntervalsDoNotIntersect, assertLuxonValidity } from "../luxon-utils";
import { WITH_OVERLAPPING_INTERVALS, WITHOUT_OVERLAPPING_INTERVALS } from "./luxon-utils.const";
import { WITH_OVERLAPPING_INTERVALS, WITHOUT_OVERLAPPING_INTERVALS } from "./luxon-utils.test.const";

describe(`${assertLuxonValidity.name}`, () => {
const reason = "user-provided reason";
Expand Down