-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from EnCiv/civil-updates-1
Civil updates 1
- Loading branch information
Showing
132 changed files
with
70,883 additions
and
13,437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const webpack = require('webpack') | ||
|
||
module.exports = { | ||
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
framework: '@storybook/react', | ||
core: { | ||
builder: 'webpack5', | ||
}, | ||
webpackFinal: async config => { | ||
// config may or may not have these properties so we have to make sure they are there and then modify them to ensure we don't delete anything | ||
if (!config.resolve) config.resolve = {} | ||
if (!config.resolve.fallback) config.resolve.fallback = {} | ||
Object.assign(config.resolve.fallback, { | ||
fs: false, | ||
buffer: require.resolve('buffer'), | ||
path: require.resolve('path-browserify'), | ||
stream: require.resolve('stream-browserify'), | ||
os: require.resolve('os-browserify/browser'), | ||
zlib: require.resolve('browserify-zlib'), | ||
constants: require.resolve('constants-browserify'), | ||
util: require.resolve('util'), | ||
}) | ||
if (!config.plugins) config.plugins = [] | ||
config.plugins.push(new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] })) | ||
config.plugins.push(new webpack.ProvidePlugin({ process: 'process/browser' })) // fix "process is not defined" error: // (do "npm install process" before running the build) | ||
for (const plugin of config.plugins) { | ||
if (plugin.definitions) { | ||
if (plugin.definitions['process.env']) { | ||
console.info( | ||
'.storybook/main.js: deleting process.env from', | ||
{ plugin }, | ||
'see comments in that file' | ||
) | ||
delete plugin.definitions['process.env'] | ||
/* | ||
webpack will try to string replace process.env with what is assigned in the definition. | ||
// But if there is code in the browser side that does something like "if(process.env)" it will get replaced and cause syntax error and break the existing code | ||
definitions{ | ||
... | ||
"process.env": "{\"NODE_ENV\":\"development\",\"NODE_PATH\":[],\"STORYBOOK\":\"true\",\"PUBLIC_URL\":\".\"}", | ||
... | ||
} | ||
causes this: | ||
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'development' | ||
to become | ||
if (!{"NODE_ENV":"development","NODE_PATH":["/usr/lib64/node_modules"],"STORYBOOK":"true","PUBLIC_URL":"."}) {"NODE_ENV":"development","NODE_PATH":["/usr/lib64/node_modules"],"STORYBOOK":"true","PUBLIC_URL":"."} = {}; | ||
*/ | ||
} | ||
} | ||
} | ||
return config | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
import { ThemeProvider } from 'react-jss' | ||
import theme from '../app/theme' | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
} | ||
|
||
export const decorators = [ | ||
Story => { | ||
if (typeof window.logger === 'undefined') window.logger = console | ||
if (typeof socket === 'undefined') window.socket = {} | ||
window.socket.NoSocket = true | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<div style={{ backgroundColor: theme.backgroundColorApp }}> | ||
<Story /> | ||
</div> | ||
</ThemeProvider> | ||
) | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict' | ||
|
||
// clustering is a node thing, dummy it out on the client side | ||
|
||
export function isMaster() { | ||
return true | ||
} | ||
|
||
export function onlyOnMaster(f1, f2) { | ||
return f1() | ||
} | ||
|
||
export function onMessage() { | ||
return | ||
} | ||
export function send() { | ||
return | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict' | ||
|
||
import { clientMain } from 'civil-client' | ||
import App from '../components/app' | ||
|
||
// this is the entry point for the client App running on the browser | ||
// App will be run on both the server side, and the client side, but the stuff in clientMain will only be run to set things up on the browser | ||
clientMain(App) |
Oops, something went wrong.