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

fix: replace __VERSION__ #300

Merged
merged 3 commits into from
Apr 9, 2023
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
12 changes: 6 additions & 6 deletions packages/hover-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
"@rollup/plugin-node-resolve": "latest",
"@rollup/plugin-replace": "latest",
"@rollup/plugin-terser": "latest",
"@storybook/addon-storyshots": "latest",
"@storybook/addons": "latest",
"@storybook/builder-webpack5": "latest",
"@storybook/manager-webpack5": "latest",
"@storybook/react": "latest",
"@storybook/theming": "latest",
"@storybook/addon-storyshots": "~6.5.16",
"@storybook/addons": "~6.5.16",
"@storybook/builder-webpack5": "~6.5.16",
"@storybook/manager-webpack5": "~6.5.16",
"@storybook/react": "~6.5.16",
"@storybook/theming": "~6.5.16",
"babel-eslint": "latest",
"babel-loader": "latest",
"babel-plugin-transform-react-pure-class-to-function": "latest",
Expand Down
10 changes: 4 additions & 6 deletions packages/hover-vanilla/preact.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,13 @@ <h1 class="f4 black tc">custom</h1>
<script src="https://cdn.jsdelivr.net/npm/react-is@latest/umd/react-is.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/styled-components@latest/dist/styled-components.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@microlink/mql@latest/dist/mql.min.js"></script>
<script src="./dist/microlink.umd.min.js"></script>


<script src="./dist/microlink.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
codecopy('pre')
microlink('.link')
microlink(document.querySelector('.link-query-selector'))
microlink('pacopepe')
microlinkHover('.link')
microlinkHover(document.querySelector('.link-query-selector'))
microlinkHover('pacopepe')
})
</script>

Expand Down
3 changes: 2 additions & 1 deletion packages/hover-vanilla/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const plugins = ({ compress }) =>
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production')
'process.env.NODE_ENV': JSON.stringify('production'),
__VERSION__: require('./package').version
}
}),
!isProduction &&
Expand Down
12 changes: 6 additions & 6 deletions packages/hover-vanilla/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import styled from 'styled-components'
import ReactDOM from 'react-dom'
import React from 'react'

function toArray (selector) {
const collection = Array.from(
typeof selector === 'string'
? document.querySelectorAll(selector)
: selector
)
function toArray (input) {
const collection = (
typeof input === 'string'
? Array.from(document.querySelectorAll(input))
: [].concat(input)
).filter(Boolean)

return collection
.map(el => {
Expand Down
12 changes: 6 additions & 6 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
"@rollup/plugin-node-resolve": "latest",
"@rollup/plugin-replace": "latest",
"@rollup/plugin-terser": "latest",
"@storybook/addon-storyshots": "latest",
"@storybook/addons": "latest",
"@storybook/builder-webpack5": "latest",
"@storybook/manager-webpack5": "latest",
"@storybook/react": "latest",
"@storybook/theming": "latest",
"@storybook/addon-storyshots": "~6.5.16",
"@storybook/addons": "~6.5.16",
"@storybook/builder-webpack5": "~6.5.16",
"@storybook/manager-webpack5": "~6.5.16",
"@storybook/react": "~6.5.16",
"@storybook/theming": "~6.5.16",
"babel-plugin-transform-react-pure-class-to-function": "latest",
"babel-plugin-transform-react-remove-prop-types": "latest",
"enzyme": "latest",
Expand Down
4 changes: 1 addition & 3 deletions packages/vanilla/preact.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ <h1 class="f4 black tc">custom</h1>
<script src="https://cdn.jsdelivr.net/npm/react-is@latest/umd/react-is.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/styled-components@latest/dist/styled-components.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@microlink/mql@latest/dist/mql.min.js"></script>
<script src="./dist/microlink.umd.min.js"></script>


<script src="./dist/microlink.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function (event) {
codecopy('pre')
Expand Down
3 changes: 2 additions & 1 deletion packages/vanilla/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const plugins = ({ compress }) => [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production')
'process.env.NODE_ENV': JSON.stringify('production'),
__VERSION__: require('./package').version
}
})
]
Expand Down
13 changes: 6 additions & 7 deletions packages/vanilla/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ function parseObject (obj) {
}, {})
}

function toArray (selector) {
const elements =
typeof selector === 'string'
? document.querySelectorAll(selector)
: selector

return elements ? Array.from(elements) : []
function toArray (input) {
return (
typeof input === 'string'
? Array.from(document.querySelectorAll(input))
: [].concat(input)
).filter(Boolean)
}

function microlink (selector, opts, rootNode) {
Expand Down