From b311ca13ffe01cd39733dcba3727189fae695e1d Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Sat, 23 Nov 2019 13:50:38 +0100 Subject: [PATCH] ci: fix build --- rollup.config.js | 26 +++++++++++--------------- src/index.ts | 46 +++++++++++++++++++++++++++++----------------- src/useStore.ts | 0 3 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 src/useStore.ts diff --git a/rollup.config.js b/rollup.config.js index 58da42fa..db0b321a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -22,21 +22,14 @@ const banner = `/*! const exportName = pascalcase(pkg.name) -function createEntry( - { - format, // Rollup format (iife, umd, cjs, es) - external, // Rollup external option - input = 'src/index.ts', // entry point - env = 'development', // NODE_ENV variable - minify = false, - isBrowser = false, // produce a browser module version or not - } = { - input: 'src/index.ts', - env: 'development', - minify: false, - isBrowser: false, - } -) { +function createEntry({ + format, // Rollup format (iife, umd, cjs, es) + external = ['vue', '@vue/composition-api'], + input = 'src/index.ts', // entry point + env = 'development', // NODE_ENV variable + minify = false, + isBrowser = false, // produce a browser module version or not +}) { // force production mode when minifying if (minify) env = 'production' @@ -72,6 +65,9 @@ function createEntry( config.plugins.push(resolve(), commonjs()) } else { config.external = external + config.globals = { + '@vue/composition-api': 'VueCompositionApi', + } } config.plugins.push( diff --git a/src/index.ts b/src/index.ts index 27babaf1..63844cf3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -109,27 +109,39 @@ export function createStore( return store } -function makeStore( - id: Id, - buildState: () => S -) { - let store: Store | undefined +/** + * The api needs more work we must be able to use the store easily in any + * function by calling `useStore` to get the store Instance and we also need to + * be able to reset the store instance between requests on the server + */ + +/** + * + * @param id id of the store we are creating + * @param buildState function that returns a state + */ - function useStore(): Store { - if (!store) store = createStore(id, buildState) +// function makeStore( +// id: Id, +// buildState: () => S +// ) { +// let store: Store | undefined - return store - } +// function useStore(): Store { +// if (!store) store = createStore(id, buildState) - function clear(): void { - store = undefined - } +// return store +// } - return { - useStore, - clear, - } -} +// function clear(): void { +// store = undefined +// } + +// return { +// useStore, +// clear, +// } +// } // export const store = createStore('main', initialState) // export const cartStore = createStore('cart', { diff --git a/src/useStore.ts b/src/useStore.ts deleted file mode 100644 index e69de29b..00000000 -- 2.47.2