Skip to content

Commit

Permalink
Refactor project file structure
Browse files Browse the repository at this point in the history
- removes most dependencies
- removes build-related tasks and code
- removes lint-related tasks and code
- moves source and test files to `index[.test].js` in root of project
- updates documentation
- adds note about feature completeness

Moving forward, this package will only provide an ESM formatted file. It's 2025
and that style module is supported basically everywhere you'd use this package.
  • Loading branch information
jgarber623 committed Jan 2, 2025
1 parent b916ecb commit 13b48b3
Show file tree
Hide file tree
Showing 11 changed files with 234 additions and 2,817 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,8 @@ on:
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: npm
- run: npm ci
- run: npm run lint
test:
name: Test (Node.js v${{ matrix.version }})
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run build
- run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -46,7 +45,6 @@ jobs:
cache: npm
registry-url: https://npm.pkg.github.com
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/coverage/
/dist/
/node_modules/
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
[![Downloads](https://img.shields.io/npm/dt/@jgarber/cashcash.svg?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/@jgarber/cashcash)
[![Build](https://img.shields.io/github/actions/workflow/status/jgarber623/CashCash/ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/jgarber623/CashCash/actions/workflows/ci.yml)

> [!NOTE]
> CashCash is feature complete and will only be updated to address bugs or security issues.
### Key Features

- Uses JavaScript's native [`querySelectorAll`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) method
- Dependency-free
- JavaScript module (ESM), CommonJS, and browser global (`window.CashCash`) support
- JavaScript module (ESM) support

## Getting CashCash

Expand Down Expand Up @@ -103,22 +106,9 @@ For a full-featured CashCash demonstration, check out [the demo page](https://jg

If you want to cut down on some typing (and potentially confuse your teammates), you can reassign `CashCash` to `$` to mimic jQuery:

```html
<script src="./dist/cashcash.js"></script>
<script>
(function($) {
const paragraphs = $("p");
//
})(CashCash);
</script>
```

…or:

```html
<script type="module">
import $ from "./dist/cashcash.mjs";
import { default as $ } from "@jgarber/cashcash";
const paragraphs = $("p");
Expand Down
15 changes: 0 additions & 15 deletions eslint.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1>CashCash: Example</h1>
</main>

<script type="module">
import { default as $ } from "../src/cashcash.js";
import { default as $ } from "../index.js";

const main = $("main");
const h1 = $("h1", main[0]);
Expand All @@ -40,7 +40,7 @@ <h1>CashCash: Example</h1>
console.log("Primary heading:", h1);
console.log("Paragraphs:", p);

p.forEach(node => console.log(node.getAttribute("id")));
p.forEach(node => console.log(node.id));
</script>

</body>
Expand Down
13 changes: 13 additions & 0 deletions src/cashcash.js → index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/*!
* @name CashCash
* @version 5.0.0
*
* @file A very small DOM library inspired by jQuery.
*
* {@link https://github.com/jgarber623/CashCash}
*
* @copyright 2016 Jason Garber (https://sixtwothree.org)
* @license MIT
*
*/

class Cash {
length = 0;

Expand Down
2 changes: 1 addition & 1 deletion test/cashcash.test.js → index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from "node:test";

import { JSDOM } from "jsdom";

import CashCash from "../src/cashcash.js";
import CashCash from "./index.js";

const html = `\
<!doctype html>
Expand Down
Loading

0 comments on commit 13b48b3

Please sign in to comment.