From f527aac695414bd0c219321664cc93f4b6e32bd1 Mon Sep 17 00:00:00 2001 From: Iskren Slavov Date: Sat, 9 Sep 2023 11:28:27 +0300 Subject: [PATCH] Build demo page before deploying --- .github/workflows/build.yml | 9 ++- .gitignore | 1 + README.md | 2 +- demo-web/bundle.js | 107 ------------------------------------ 4 files changed, 8 insertions(+), 111 deletions(-) delete mode 100644 demo-web/bundle.js diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7572e4..a93c91f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,10 +28,13 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Setup pages uses: actions/configure-pages@v3 - - name: Setup pages structure + - name: Build pages run: | - mkdir ./pages - mv ./demo-web/ ./pages/ + cd ./demo-web/ + npm run build + cd .. + mkdir -p ./pages/demo-web/ + cp -f ./demo-web/index.html ./demo-web/bundle.js ./pages/demo-web/ - name: Upload page artifact uses: actions/upload-pages-artifact@v2 with: diff --git a/.gitignore b/.gitignore index f1c636c..b795830 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ dist/ coverage/ .DS_Store types/ +demo-web/bundle.js diff --git a/README.md b/README.md index d973e9b..f649325 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ __Works with any of the following:__ - SessionStorage (web) - Your own custom storage driver that implements `setItem(key, value)` and `getItem(key)` -### [__See demo!__](https://rawgit.com/zewish/redux-remember/master/demo-web/index.html) +### [__See demo!__](https://zewish.github.io/redux-remember/demo-web/) Installation ------------ diff --git a/demo-web/bundle.js b/demo-web/bundle.js deleted file mode 100644 index 59f2757..0000000 --- a/demo-web/bundle.js +++ /dev/null @@ -1,107 +0,0 @@ -(function (require$$0, reactRedux, toolkit, reduxRemember) { - 'use strict'; - - var client = {}; - - var m = require$$0; - { - var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; - client.createRoot = function (c, o) { - i.usingClientEntryPoint = true; - try { - return m.createRoot(c, o); - } finally { - i.usingClientEntryPoint = false; - } - }; - client.hydrateRoot = function (c, h, o) { - i.usingClientEntryPoint = true; - try { - return m.hydrateRoot(c, h, o); - } finally { - i.usingClientEntryPoint = false; - } - }; - } - - var textToBePersisted = toolkit.createSlice({ - name: 'set-persisted-text', - initialState: { - text: '' - }, - reducers: { - setPersistedText: function setPersistedText(state, action) { - state.text = action.payload; - } - } - }); - var textToBeForgotten = toolkit.createSlice({ - name: 'set-forgotten-text', - initialState: { - text: '' - }, - reducers: { - setForgottenText: function setForgottenText(state, action) { - state.text = action.payload; - } - } - }); - var reducers = { - textToBePersisted: textToBePersisted.reducer, - textToBeForgotten: textToBeForgotten.reducer, - someExtraData: function someExtraData(state) { - if (state === void 0) { - state = 'bla'; - } - return state; - } - }; - var actions = Object.assign({}, textToBePersisted.actions, textToBeForgotten.actions); - - var rememberedKeys = ['textToBePersisted']; - var reducer = reduxRemember.rememberReducer(reducers); - var store = toolkit.configureStore({ - reducer: reducer, - enhancers: [reduxRemember.rememberEnhancer(window.localStorage, rememberedKeys, { - prefix: '@@rememebered-', - persistWholeStore: true - })] - }); - var useAppDispatch = reactRedux.useDispatch; - var useAppSelector = reactRedux.useSelector; - - var App = function App() { - var textToBePersisted = useAppSelector(function (store) { - return store.textToBePersisted.text; - }); - var textToBeForgotten = useAppSelector(function (store) { - return store.textToBeForgotten.text; - }); - var dispatch = useAppDispatch(); - return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "redux-remember demo (uses window.localStorage)"), /*#__PURE__*/React.createElement("h2", null, "Type something into the inputs and reload the page"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "I shall be remembered :)")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", { - type: "text", - value: textToBePersisted, - onChange: function onChange(ev) { - return dispatch(actions.setPersistedText(ev.target.value)); - } - })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("label", null, "I shall be forgotten :(")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", { - type: "text", - value: textToBeForgotten, - onChange: function onChange(ev) { - return dispatch(actions.setForgottenText(ev.target.value)); - } - })), /*#__PURE__*/React.createElement("div", { - className: "source-code" - }, /*#__PURE__*/React.createElement("a", { - href: "https://github.com/zewish/redux-remember/tree/master/demo-web/src", - target: "_blank", - rel: "noopener noreferrer nofollow" - }, "[ See demo source ]"))); - }; - - var root = client.createRoot(document.getElementById('root')); - root.render( /*#__PURE__*/React.createElement(reactRedux.Provider, { - store: store - }, /*#__PURE__*/React.createElement(App, null))); - -})(ReactDOM, ReactRedux, RTK, ReduxRemember);