Skip to content

Commit 1a73561

Browse files
authored
dev (#5)
* chore: bump dependencies to latest version * feat: add plugins support & organize files * npm: prepare new version * test: improve storage tests coverage & add helpers function to reduce duplication * demo: add plugins script to index.html * demo: update plugins config * fix: update types * feat: change default key && add jsdocs * feat: add kbd indicator & add jsdocs * feat: add eventListenerManager * ci: run tests on tag push * build: add prepublishOnly script * ci: prepare new release
1 parent 4735334 commit 1a73561

18 files changed

Lines changed: 1078 additions & 655 deletions

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
release_name: Release ${{ github.ref }}
2222
body: |
2323
New Release :tada:
24-
- Code optimization
25-
- Set all `Options` properties as optional
26-
- Prevent duplication of `<meta>` and `<style>` tags
27-
- Exported `Options` types
24+
- Unify storage options in `useStorage`
25+
- Add plugins support via `usePlugins` option
26+
- Add ThemeWidget and KeyboardShortcut plugins
27+
- Add new public method `destroy()`
2828
draft: false
29-
prerelease: false
29+
prerelease: true

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Run tests
22

33
on:
44
push:
5-
paths:
6-
- "src/**"
5+
tags:
6+
- "v*"
77
pull_request:
88
paths:
99
- "src/**"

demo.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ mkdir demo && cat > ./demo/index.html << EOF
77
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
88
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
99
<script type="text/javascript" src="../dist/darkify.umd.js"></script>
10+
<script type="text/javascript" src="../dist/plugins/index.umd.js"></script>
1011
<title>Darkify &#x2014; Demo</title>
1112
</head>
1213
<style>
@@ -25,7 +26,13 @@ mkdir demo && cat > ./demo/index.html << EOF
2526
</main>
2627
</div>
2728
<script type="text/javascript">
28-
var dMode = new Darkify('#element');
29+
const { ThemeWidget, KeyboardShortcut } = DarkifyPlugins;
30+
var dMode = new Darkify('#element', {
31+
usePlugins: [
32+
[ThemeWidget, { shortcut: 'd' }],
33+
[KeyboardShortcut]
34+
]
35+
});
2936
console.info(dMode);
3037
</script>
3138
</body>

jest.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ export default {
66
useESM: true
77
}],
88
},
9+
moduleNameMapper: {
10+
'^@/(.*)$': '<rootDir>/src/$1',
11+
},
912
};

0 commit comments

Comments
 (0)