Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #355 from gluestack/patch
Browse files Browse the repository at this point in the history
Patch
  • Loading branch information
ankit-tailor authored Aug 28, 2023
2 parents d65baa4 + 6dda3fb commit 601c1d8
Show file tree
Hide file tree
Showing 50 changed files with 3,581 additions and 2,092 deletions.
50 changes: 25 additions & 25 deletions example/babel-plugin-styled-resolver-expo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
const path = require('path');
const myBabel = require('../../packages/babel-plugin-styled-resolver/src/index.js');
// const path = require('path');
// const myBabel = require('../../packages/babel-plugin-styled-resolver/src/index.js');
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
// process.env.NODE_ENV === "production" ? myBabel : {},
[
myBabel,
{
web: true,
configPath: path.join(__dirname, './src/styled.config.ts'),
configThemePath: ['config', 'theme'],
outputLibrary: 'test',
// libraryName: '../../styled',
// filename: path.join(__dirname, './core/styled'),
},
],
[
'module-resolver',
{
alias: {
// For development, we want to alias the library to the source
// ['@gluestack-style/react']: path.join(
// __dirname,
// '../../../styled/src/index'
// ),
},
},
],
// [
// myBabel,
// {
// web: true,
// configPath: path.join(__dirname, './src/styled.config.ts'),
// configThemePath: ['config', 'theme'],
// outputLibrary: 'test',
// // libraryName: '../../styled',
// // filename: path.join(__dirname, './core/styled'),
// },
// ],
// [
// 'module-resolver',
// {
// alias: {
// // For development, we want to alias the library to the source
// // ['@gluestack-style/react']: path.join(
// // __dirname,
// // '../../../styled/src/index'
// // ),
// },
// },
// ],
// 'transform-remove-console',
],
};
Expand Down
18 changes: 12 additions & 6 deletions example/babel-plugin-styled-resolver-expo/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,28 @@ const { resolver } = require('./metro.config');
const findWorkspaceRoot = require('find-yarn-workspace-root');

// Find the workspace root, this can be replaced with `find-yarn-workspace-root`
// const workspaceRoot = path.resolve(__dirname, "../../");
// const workspaceRoot = path.resolve(__dirname, "../../..");

const workspaceRoot = findWorkspaceRoot(__dirname);

const root = path.resolve(__dirname, '../..');
const node_modules = path.join(workspaceRoot, 'node_modules');
const styledRoot = path.resolve(__dirname, '../../packages/react/src');

const animationPluginRoot = path.resolve(
__dirname,
'../../packages/animation-plugin/src'
);
const node_modules = path.join(workspaceRoot, 'node_modules');
// const designSystem = path.resolve(__dirname, "../../../glustack-design-system");
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);

config.module.rules.push({
test: /\.(js|ts|tsx)$/,
include: [
path.resolve(root, 'src'),
path.resolve(workspaceRoot, 'node_modules/@gluestack-style/react'),
path.resolve(styledRoot),
path.resolve(animationPluginRoot),
// path.resolve(designSystem, "src"),
],

use: 'babel-loader',
});

Expand All @@ -29,6 +34,7 @@ module.exports = async function (env, argv) {
Object.assign(config.resolve.alias, {
...resolver.extraNodeModules,
'react-native-web': path.join(node_modules, 'react-native-web'),
// '@dank-style/react': path.join(node_modules, '@gluestack-style/react'),
});

// Maybe you want to turn off compression in dev mode.
Expand Down
64 changes: 32 additions & 32 deletions example/storybook/.ondevice/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ import {
addParameters,
addArgsEnhancer,
clearDecorators,
} from "@storybook/react-native";
} from '@storybook/react-native';

global.STORIES = [
{
titlePrefix: "",
directory: "./src",
files: "**/*.stories.?(ts|tsx|js|jsx)",
titlePrefix: '',
directory: './src',
files: '**/*.stories.?(ts|tsx|js|jsx)',
importPathMatcher:
"^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$",
'^\\.[\\\\/](?:src(?:\\/(?!\\.)(?:(?:(?!(?:^|\\/)\\.).)*?)\\/|\\/|$)(?!\\.)(?=.)[^/]*?\\.stories\\.(?:ts|tsx|js|jsx)?)$',
},
];

import "@storybook/addon-ondevice-notes/register";
import "@storybook/addon-ondevice-controls/register";
import "@storybook/addon-ondevice-backgrounds/register";
import "@storybook/addon-ondevice-actions/register";
import '@storybook/addon-ondevice-notes/register';
import '@storybook/addon-ondevice-controls/register';
import '@storybook/addon-ondevice-backgrounds/register';
import '@storybook/addon-ondevice-actions/register';

import { argsEnhancers } from "@storybook/addon-actions/dist/modern/preset/addArgs";
import { argsEnhancers } from '@storybook/addon-actions/dist/modern/preset/addArgs';

import { decorators, parameters } from "./preview";
import { decorators, parameters } from './preview';

if (decorators) {
if (__DEV__) {
// stops the warning from showing on every HMR
require("react-native").LogBox.ignoreLogs([
"`clearDecorators` is deprecated and will be removed in Storybook 7.0",
require('react-native').LogBox.ignoreLogs([
'`clearDecorators` is deprecated and will be removed in Storybook 7.0',
]);
}
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
Expand All @@ -49,25 +49,25 @@ try {

const getStories = () => {
return {
"./src/api/AsForwarder/AsForwarder.stories.tsx": require("../src/api/AsForwarder/AsForwarder.stories.tsx"),
"./src/api/ColorModeBasedStyles/ColorMode.stories.tsx": require("../src/api/ColorModeBasedStyles/ColorMode.stories.tsx"),
"./src/api/CompoundVariants/CompoundVarinats.stories.tsx": require("../src/api/CompoundVariants/CompoundVarinats.stories.tsx"),
"./src/api/createStyled/createStyled.stories.tsx": require("../src/api/createStyled/createStyled.stories.tsx"),
"./src/api/DescendantsStyles/ContextBasedStyles.stories.tsx": require("../src/api/DescendantsStyles/ContextBasedStyles.stories.tsx"),
"./src/api/MultipleProvder/MultipleProvider.stories.tsx": require("../src/api/MultipleProvder/MultipleProvider.stories.tsx"),
"./src/api/PlatformBasedStyles/PlatformBasedStyles.stories.tsx": require("../src/api/PlatformBasedStyles/PlatformBasedStyles.stories.tsx"),
"./src/api/PropertyResolver/PropertyResolver.stories.tsx": require("../src/api/PropertyResolver/PropertyResolver.stories.tsx"),
"./src/api/PropsPassing/PropsPassing.stories.tsx": require("../src/api/PropsPassing/PropsPassing.stories.tsx"),
"./src/api/ResponsiveStyles/ResponsiveStyles.stories.tsx": require("../src/api/ResponsiveStyles/ResponsiveStyles.stories.tsx"),
"./src/api/Specificity/Specificity.stories.tsx": require("../src/api/Specificity/Specificity.stories.tsx"),
"./src/api/StateBasesStyles/ButtonStateProps.stories.tsx": require("../src/api/StateBasesStyles/ButtonStateProps.stories.tsx"),
"./src/api/SxStyleResolution/SxStyleResolution.stories.tsx": require("../src/api/SxStyleResolution/SxStyleResolution.stories.tsx"),
"./src/api/Typescript/Typescript.stories.tsx": require("../src/api/Typescript/Typescript.stories.tsx"),
"./src/api/UtilityFunctions/UtilityFunctions.stories.tsx": require("../src/api/UtilityFunctions/UtilityFunctions.stories.tsx"),
"./src/api/Variants/BaseStyleVariantSizes.stories.tsx": require("../src/api/Variants/BaseStyleVariantSizes.stories.tsx"),
"./src/plugins/AnimationPlugin/Animation.stories.tsx": require("../src/plugins/AnimationPlugin/Animation.stories.tsx"),
"./src/plugins/CSSVariables/CSSVariables.stories.tsx": require("../src/plugins/CSSVariables/CSSVariables.stories.tsx"),
"./src/plugins/FontsPlugin/FontsPlugin.stories.tsx": require("../src/plugins/FontsPlugin/FontsPlugin.stories.tsx"),
// "./src/api/AsForwarder/AsForwarder.stories.tsx": require("../src/api/AsForwarder/AsForwarder.stories.tsx"),
// "./src/api/ColorModeBasedStyles/ColorMode.stories.tsx": require("../src/api/ColorModeBasedStyles/ColorMode.stories.tsx"),
// "./src/api/CompoundVariants/CompoundVarinats.stories.tsx": require("../src/api/CompoundVariants/CompoundVarinats.stories.tsx"),
// "./src/api/createStyled/createStyled.stories.tsx": require("../src/api/createStyled/createStyled.stories.tsx"),
'./src/api/DescendantsStyles/ContextBasedStyles.stories.tsx': require('../src/api/DescendantsStyles/ContextBasedStyles.stories.tsx'),
// "./src/api/MultipleProvder/MultipleProvider.stories.tsx": require("../src/api/MultipleProvder/MultipleProvider.stories.tsx"),
// "./src/api/PlatformBasedStyles/PlatformBasedStyles.stories.tsx": require("../src/api/PlatformBasedStyles/PlatformBasedStyles.stories.tsx"),
// "./src/api/PropertyResolver/PropertyResolver.stories.tsx": require("../src/api/PropertyResolver/PropertyResolver.stories.tsx"),
// "./src/api/PropsPassing/PropsPassing.stories.tsx": require("../src/api/PropsPassing/PropsPassing.stories.tsx"),
// "./src/api/ResponsiveStyles/ResponsiveStyles.stories.tsx": require("../src/api/ResponsiveStyles/ResponsiveStyles.stories.tsx"),
// "./src/api/Specificity/Specificity.stories.tsx": require("../src/api/Specificity/Specificity.stories.tsx"),
// "./src/api/StateBasesStyles/ButtonStateProps.stories.tsx": require("../src/api/StateBasesStyles/ButtonStateProps.stories.tsx"),
// "./src/api/SxStyleResolution/SxStyleResolution.stories.tsx": require("../src/api/SxStyleResolution/SxStyleResolution.stories.tsx"),
// "./src/api/Typescript/Typescript.stories.tsx": require("../src/api/Typescript/Typescript.stories.tsx"),
// "./src/api/UtilityFunctions/UtilityFunctions.stories.tsx": require("../src/api/UtilityFunctions/UtilityFunctions.stories.tsx"),
// "./src/api/Variants/BaseStyleVariantSizes.stories.tsx": require("../src/api/Variants/BaseStyleVariantSizes.stories.tsx"),
// "./src/plugins/AnimationPlugin/Animation.stories.tsx": require("../src/plugins/AnimationPlugin/Animation.stories.tsx"),
// "./src/plugins/CSSVariables/CSSVariables.stories.tsx": require("../src/plugins/CSSVariables/CSSVariables.stories.tsx"),
// "./src/plugins/FontsPlugin/FontsPlugin.stories.tsx": require("../src/plugins/FontsPlugin/FontsPlugin.stories.tsx"),
};
};

Expand Down
125 changes: 3 additions & 122 deletions example/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ module.exports = {
'@storybook/addon-react-native-web',
'@storybook/addon-docs',
],
staticDirs: ['../public'],
framework: '@storybook/react',
typescript: {
reactDocgen: 'none',
},
staticDirs: ['../public'],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
Expand All @@ -28,22 +28,7 @@ module.exports = {

config.module.rules.push({
test: /\.(js|ts|tsx)$/,
include: [
// path.resolve('../../', 'node_modules/@universa11y'),
path.resolve('../../', 'node_modules/@gluestack-ui'),
path.resolve('./', 'node_modules/@gluestack-ui'),

path.resolve('../../', 'node_modules/@gluestack/design-system'),
path.resolve(
'../../',
'node_modules/@gluestack-style/animation-plugin'
),
path.resolve('./', 'node_modules/@gluestack-style/animation-plugin'),
path.resolve('./', 'node_modules/@gluestack/design-system'),
path.resolve('../../', 'node_modules/@gluestack-style/react'),
path.resolve('./', 'node_modules/@gluestack-style/react'),
// path.resolve('./', 'node_modules/@gluestack-ui'),
],
// include: [path.resolve('../../', 'node_modules/@gluestack-style/react')],
use: 'babel-loader',
});

Expand All @@ -52,112 +37,8 @@ module.exports = {
include: /node_modules/,
type: 'javascript/auto',
});

// Return the altered config
return config;
},
// webpackFinal: async (config, { configType }) => {
// // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// // You can change the configuration based on that.
// // 'PRODUCTION' is used when building the static version of storybook.

// // Make whatever fine-grained changes you need
// // config.module.rules.push({
// // test: /\.scss$/,
// // use: ['style-loader', 'css-loader', 'sass-loader'],
// // include: path.resolve(__dirname, '../'),
// // });

// config.module.rules.push({
// test: /\.(js|ts|tsx)$/,
// include: [
// path.resolve('../', 'node_modules/@gluestack-style/react'),
// path.resolve('../', 'node_modules/@gluestack/design-system'),
// path.resolve('../', 'node_modules/@universa11y/actionsheet'),
// path.resolve('../', 'node_modules/@universa11y/form-control'),
// path.resolve('../', 'node_modules/@universa11y/avatar'),
// path.resolve('../', 'node_modules/@universa11y/button'),
// path.resolve('../', 'node_modules/@universa11y/checkbox'),
// path.resolve('../', 'node_modules/@universa11y/divider'),
// path.resolve('../', 'node_modules/@universa11y/fab'),
// path.resolve('../', 'node_modules/@universa11y/hooks'),
// path.resolve('../', 'node_modules/@universa11y/hstack'),
// path.resolve('../', 'node_modules/@universa11y/icon'),
// path.resolve('../', 'node_modules/@universa11y/input'),
// path.resolve('../', 'node_modules/@universa11y/link'),
// path.resolve('../', 'node_modules/@universa11y/menu'),
// path.resolve('../', 'node_modules/@universa11y/modal'),
// path.resolve('../', 'node_modules/@universa11y/overlay'),
// path.resolve('../', 'node_modules/@universa11y/popover'),
// path.resolve('../', 'node_modules/@universa11y/popper'),
// path.resolve('../', 'node_modules/@universa11y/progress'),
// path.resolve('../', 'node_modules/@universa11y/provider'),
// path.resolve('../', 'node_modules/@universa11y/radio'),
// path.resolve('../', 'node_modules/@universa11y/select'),
// path.resolve('../', 'node_modules/@universa11y/slider'),
// path.resolve('../', 'node_modules/@universa11y/spinner'),
// path.resolve('../', 'node_modules/@universa11y/stack'),
// path.resolve('../', 'node_modules/@universa11y/switch'),
// path.resolve('../', 'node_modules/@universa11y/textarea'),
// path.resolve('../', 'node_modules/@universa11y/toast'),
// path.resolve('../', 'node_modules/@universa11y/tooltip'),
// path.resolve('../', 'node_modules/@universa11y/ui-provider'),
// path.resolve('../', 'node_modules/@universa11y/vstack'),
// path.resolve('../', 'node_modules/@universa11y/transitions'),
// path.resolve('../', 'node_modules/@universa11y/utils'),
// path.resolve('../', 'node_modules/@universa11y/tabs'),
// path.resolve('../', 'node_modules/@universa11y/react-native-aria'),
// path.resolve('../', 'node_modules/@universa11y/alert-dialog'),
// path.resolve('../', 'node_modules/@universa11y/pressable'),
// ],
// use: 'babel-loader',
// });

// // Return the altered config
// return config;
// },
};

// const path = require('path');

// module.exports = {
// stories: [
// '../components/**/*.stories.mdx',
// '../components/**/*.stories.@(js|jsx|ts|tsx)',
// ],
// addons: [
// 'storybook-dark-mode',
// '@storybook/addon-links',
// '@storybook/addon-essentials',
// '@storybook/addon-react-native-web',
// '@storybook/addon-docs',
// ],
// framework: '@storybook/react',
// typescript: {
// reactDocgen: 'none',
// },
// webpackFinal: async (config, { configType }) => {
// // `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// // You can change the configuration based on that.
// // 'PRODUCTION' is used when building the static version of storybook.

// // Make whatever fine-grained changes you need
// // config.module.rules.push({
// // test: /\.scss$/,
// // use: ['style-loader', 'css-loader', 'sass-loader'],
// // include: path.resolve(__dirname, '../'),
// // });

// config.module.rules.push({
// test: /\.(js|ts|tsx)$/,
// include: [
// path.resolve('../../', 'node_modules/@gluestack-style/react'),
// path.resolve('../../', 'node_modules/@gluestack/ui'),
// path.resolve('../../', 'node_modules/@universa11y'),
// ],
// use: 'babel-loader',
// });

// // Return the altered config
// return config;
// },
// };
17 changes: 8 additions & 9 deletions example/storybook/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ module.exports = function (api) {
{
alias: {
// For development, we want to alias the library to the source
['@gluestack-style/react']: path.join(
__dirname,
'../../packages/react/src'
),
['@gluestack-style/animation-plugin']: path.join(
__dirname,
'../../packages/animation-plugin/src'
),

// ['@gluestack-style/react']: path.join(
// __dirname,
// '../../packages/react/src'
// ),
// ['@gluestack-style/animation-plugin']: path.join(
// __dirname,
// '../../packages/animation-plugin/src'
// ),
// ['@dank-style/react']: path.join(
// __dirname,
// '../../packages/react/src'
Expand Down
Loading

0 comments on commit 601c1d8

Please sign in to comment.