Skip to content

Commit

Permalink
Tweak deepmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieTheWagner committed Mar 8, 2024
1 parent 910f21d commit ff66f76
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shepherd.js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@floating-ui/dom": "^1.5.3",
"deepmerge": "^4.3.1"
"deepmerge-ts": "^5.1.0"
},
"devDependencies": {
"@babel/core": "^7.23.5",
Expand Down
2 changes: 0 additions & 2 deletions shepherd.js/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import cssnanoPlugin from 'cssnano';
import { babel } from '@rollup/plugin-babel';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
import commonjs from '@rollup/plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
import license from 'rollup-plugin-license';
import postcss from 'rollup-plugin-postcss';
Expand All @@ -28,7 +27,6 @@ const plugins = [
preprocess: sveltePreprocess({ typescript: true }),
emitCss: true
}),
commonjs(),
nodeResolve({
extensions: ['.js', '.json', '.svelte', '.ts'],
modulesOnly: true
Expand Down
4 changes: 2 additions & 2 deletions shepherd.js/src/step.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import merge from 'deepmerge';
import { deepmerge } from 'deepmerge-ts';
import { Evented } from './evented';
import autoBind from './utils/auto-bind';
import {
Expand Down Expand Up @@ -514,7 +514,7 @@ export class Step extends Evented {
let tourOptions =
this.tour && this.tour.options && this.tour.options.defaultStepOptions;

tourOptions = merge({}, tourOptions || {}) as StepOptions;
tourOptions = deepmerge({}, tourOptions || {});

this.options = Object.assign(
{
Expand Down
6 changes: 3 additions & 3 deletions shepherd.js/src/utils/floating-ui.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import merge from 'deepmerge';
import { deepmerge } from 'deepmerge-ts';
import { shouldCenterStep } from './general';
import {
autoUpdate,
Expand Down Expand Up @@ -65,7 +65,7 @@ export function mergeTooltipConfig(
options: StepOptions
) {
return {
floatingUIOptions: merge(
floatingUIOptions: deepmerge(
tourOptions.floatingUIOptions || {},
options.floatingUIOptions || {}
)
Expand Down Expand Up @@ -197,7 +197,7 @@ export function getFloatingUIOptions(
options.placement = attachToOptions.on;
}

return merge(step.options.floatingUIOptions || {}, options);
return deepmerge(step.options.floatingUIOptions || {}, options);
}

function addArrow(step: Step) {
Expand Down
8 changes: 4 additions & 4 deletions test/cypress/dummy/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ <h3>Example</h3>
</div>

<!-- Shepherd -->
<script
type="module"
src="../node_modules/shepherd.js/dist/shepherd.js"
></script>
<script type="module">
import Shepherd from '../node_modules/shepherd.js/dist/shepherd.js';
window.Shepherd = Shepherd;
</script>

<!-- Welcome page -->
<script src="js/prism.js"></script>
Expand Down
8 changes: 4 additions & 4 deletions test/cypress/examples/destroying-elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
rel="stylesheet"
href="../node_modules/shepherd.js/dist/css/shepherd.css"
/>
<script
type="module"
src="../node_modules/shepherd.js/dist/shepherd.js"
></script>
<script type="module">
import Shepherd from '../node_modules/shepherd.js/dist/shepherd.js';
window.Shepherd = Shepherd;
</script>
</head>

<body>
Expand Down

0 comments on commit ff66f76

Please sign in to comment.