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 for storybook to resolve alias #589

Merged
merged 4 commits into from
Aug 20, 2021
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We are currently in early development and hope to release an alpha version by la
- [Contributing](#contributing)
- [Local Development](#local-development)
- [Configuration Options](#configuration-options)
- [Frontend](#frontend)
- [Linting](#linting)
- [Running tests](#running-tests)
- [Opening a shell in the container](#opening-a-shell-in-the-container)
Expand Down Expand Up @@ -52,6 +53,9 @@ If you want to use Mathesar with a preexisting Postgres DB, modify the `DATABASE

**Please don't do this unless you have full confidence in what you're doing since Mathesar is not stable yet and may make unexpected changes to the database that you connect to it.**

### Frontend
For more detailed information on Mathesar's frontend development, please refer the [readme file within mathesar_ui directory](https://github.com/centerofci/mathesar/blob/master/mathesar_ui/README.md).

### Linting

To lint the project, run the `lint.sh` script from the root of the repository. The script requires that the Python virtual environment with `flake8` be activated and that Node modules be installed in `mathesar_ui/`. Alternatively, ESLint and Flake8 should be installed globally on the system.
Expand Down
20 changes: 20 additions & 0 deletions mathesar_ui/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
const sveltePreprocess = require('svelte-preprocess');
const data = require('../tsconfig.json');
const path = require("path");

function getAlias() {
const { paths } = data.compilerOptions;
Object.keys(paths).forEach((alias) => {
paths[alias] = path.resolve(__dirname, `../${paths[alias][0]}`);
});
return paths;
}

module.exports = {
"core": { builder: "webpack5" },
"webpackFinal": (config) => {
config.resolve.alias = {
...config.resolve.alias,
...getAlias(),
svelte: path.resolve('node_modules', 'svelte')
}
config.resolve.extensions.push(".ts", ".tsx", ".mjs", ".js", ".svelte");
return config;
},
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx|svelte)"
Expand Down
Loading