trying vite for storybook... again

main
Yanick Champoux 2022-03-06 17:09:01 -05:00
parent 55a9a17dc1
commit fd72aafec0
4 changed files with 13 additions and 6 deletions

View File

@ -2,6 +2,7 @@ const path = require("path");
const preprocess = require("svelte-preprocess"); const preprocess = require("svelte-preprocess");
module.exports = { module.exports = {
// core: { builder: "storybook-builder-vite" },
staticDirs: ["../static", "../pictures"], staticDirs: ["../static", "../pictures"],
stories: [ stories: [
"../src/**/*.stories.mdx", "../src/**/*.stories.mdx",
@ -9,13 +10,20 @@ module.exports = {
"../src/**/stories.svelte", "../src/**/stories.svelte",
], ],
addons: [ addons: [
"@storybook/addon-links",
"@storybook/addon-essentials", "@storybook/addon-essentials",
"@storybook/addon-svelte-csf", "@storybook/addon-svelte-csf",
], ],
framework: "@storybook/svelte", framework: "@storybook/svelte",
svelteOptions: { svelteOptions: {
preprocess: preprocess(), preprocess: preprocess(),
},
async viteFinal(config, { configType }) {
// customize the Vite config here
config.resolve.alias.$lib = path.resolve(__dirname, "../src/lib/");
config.resolve.alias.$app = path.resolve(__dirname, "../fake/app/");
// return the customized config
return config;
}, },
webpackFinal: async (config) => { webpackFinal: async (config) => {
return { return {

View File

@ -24,14 +24,13 @@
"eslint-plugin-svelte3": "^3.4.1", "eslint-plugin-svelte3": "^3.4.1",
"prettier": "~2.5.1", "prettier": "~2.5.1",
"prettier-plugin-svelte": "^2.6.0", "prettier-plugin-svelte": "^2.6.0",
"storybook-builder-vite": "0.1.17",
"svelte": "^3.46.4", "svelte": "^3.46.4",
"vite": "^2.7.0" "vite": "^2.7.0"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-essentials": "^6.4.19", "@storybook/addon-essentials": "^6.4.19",
"@storybook/addon-links": "6.4.19",
"@storybook/addon-svelte-csf": "^1.1.0", "@storybook/addon-svelte-csf": "^1.1.0",
"@storybook/svelte": "^6.4.19", "@storybook/svelte": "^6.4.19",
"@sveltejs/adapter-node": "^1.0.0-next.0", "@sveltejs/adapter-node": "^1.0.0-next.0",

View File

@ -7,7 +7,7 @@ import { calculateDriveReqs } from './propulsion/drive.js';
import { ftlReqsReaction } from './propulsion/ftl.js'; import { ftlReqsReaction } from './propulsion/ftl.js';
import structure from './structure/index.js'; import structure from './structure/index.js';
import carrier from './carrier.js'; import carrier from './carrier.js';
import { screenReqsReaction, screensReqsReaction } from './structure/screens.js' import { screensReqsReaction } from './structure/screens.js'
const dux = new Updux({ const dux = new Updux({
subduxes: { subduxes: {
@ -26,6 +26,6 @@ dux.setMutation( 'setShipMass', mass => u({reqs: {mass}}) );
dux.addReaction( calculateDriveReqs ); dux.addReaction( calculateDriveReqs );
dux.addReaction( ftlReqsReaction ); dux.addReaction( ftlReqsReaction );
dux.addReaction( screenReqsReaction ); dux.addReaction( screensReqsReaction );
export default dux; export default dux;

View File

@ -21,7 +21,7 @@ export default dux;
dux.setMutation('setScreens', payload => u(payload)); dux.setMutation('setScreens', payload => u(payload));
dux.setMutation('setScreensReqs', reqs => u({reqs})); dux.setMutation('setScreensReqs', reqs => u({reqs}));
export const screenReqsReaction = store => createSelector( export const screensReqsReaction = store => createSelector(
(ship) => ship.reqs.mass, (ship) => ship.reqs.mass,
(ship) => ship.structure.screens.standard, (ship) => ship.structure.screens.standard,
(ship) => ship.structure.screens.advanced, (ship) => ship.structure.screens.advanced,