Skip to content

Commit

Permalink
chore: get rid of legacy package (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caele committed Jun 13, 2022
1 parent 904aca9 commit 1e1af14
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 139 deletions.
1 change: 0 additions & 1 deletion apis/nucleus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@nebula.js/ui": "^2.11.0",
"@mui/material": "^5.8.3",
"@mui/icons-material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"node-event-emitter": "0.0.1",
Expand Down
11 changes: 11 additions & 0 deletions apis/nucleus/src/components/ClassNameSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ClassNameGenerator } from '@nebula.js/ui/theme';

const NEBULA_VERSION_HASH = process.env.NEBULA_VERSION_HASH || '';
let counter = 0;

ClassNameGenerator.configure((componentName) => {
if (process.env.NODE_ENV !== 'production') {
return `njs-${counter++}-${componentName.replace('Mui', '')}`;
}
return `njs-${NEBULA_VERSION_HASH}-${componentName.replace('Mui', '')}`;
});
16 changes: 4 additions & 12 deletions apis/nucleus/src/components/NebulaApp.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import React, { useState, useMemo, forwardRef, useImperativeHandle } from 'react';
import ReactDOM from 'react-dom';
import './ClassNameSetup';

import { createTheme, ThemeProvider, StyledEngineProvider, createGenerateClassName } from '@nebula.js/ui/theme';
import { createTheme, ThemeProvider, StyledEngineProvider } from '@nebula.js/ui/theme';

import InstanceContext from '../contexts/InstanceContext';
import useAppSelections from '../hooks/useAppSelections';

const NEBULA_VERSION_HASH = process.env.NEBULA_VERSION_HASH || '';

let counter = 0;

const NebulaApp = forwardRef(({ initialContext, app }, ref) => {
const [appSelections] = useAppSelections(app);
const [context, setContext] = useState(initialContext);
const [muiThemeName, setMuiThemeName] = useState();

const { theme, generator } = useMemo(
const { theme } = useMemo(
() => ({
theme: createTheme(muiThemeName),
generator: createGenerateClassName({
productionPrefix: `${NEBULA_VERSION_HASH}`,
disableGlobal: true,
seed: `njs-${counter++}`,
}),
}),
[muiThemeName]
);
Expand All @@ -46,7 +38,7 @@ const NebulaApp = forwardRef(({ initialContext, app }, ref) => {
}));

return (
<StyledEngineProvider generateClassName={generator} injectFirst>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<InstanceContext.Provider value={context}>{components}</InstanceContext.Provider>
</ThemeProvider>
Expand Down
1 change: 0 additions & 1 deletion apis/stardust/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"peerDependencies": {
"@mui/material": "^5.8.3",
"@mui/icons-material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"react": "^17.0.2",
Expand Down
1 change: 0 additions & 1 deletion apis/stardust/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@nebula.js/ui": "^2.11.0",
"@mui/material": "^5.8.3",
"@mui/icons-material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@scriptappy/cli": "0.1.0",
Expand Down
1 change: 0 additions & 1 deletion commands/serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@babel/preset-env": "7.18.2",
"@babel/preset-react": "7.17.12",
"@mui/material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@nebula.js/enigma-mocker": "^2.11.0",
"@nebula.js/nucleus": "^2.11.0",
"@nebula.js/snapshooter": "^2.11.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"peerDependencies": {
"@mui/material": "^5.8.3",
"@mui/icons-material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"react": "^17.0.2",
Expand All @@ -19,7 +18,6 @@
"devDependencies": {
"@mui/material": "^5.8.3",
"@mui/icons-material": "^5.8.3",
"@mui/styles": "^5.8.3",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"react": "17.0.2",
Expand Down
7 changes: 3 additions & 4 deletions packages/ui/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useTheme, createGenerateClassName } from '@mui/styles';
import { ThemeProvider, StyledEngineProvider } from '@mui/material/styles';

import { ThemeProvider, StyledEngineProvider, useTheme } from '@mui/material/styles';
import { unstable_ClassNameGenerator as ClassNameGenerator } from '@mui/material/className';
import createTheme from './create';

export { createTheme, createGenerateClassName, useTheme, ThemeProvider, StyledEngineProvider };
export { createTheme, useTheme, ThemeProvider, ClassNameGenerator, StyledEngineProvider };
118 changes: 1 addition & 117 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@
dependencies:
regenerator-runtime "^0.13.2"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
version "7.18.3"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.3.tgz#c7b654b57f6f63cf7f8b418ac9ca04408c4579f4"
integrity sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==
Expand Down Expand Up @@ -3282,29 +3282,6 @@
"@emotion/cache" "^11.7.1"
prop-types "^15.8.1"

"@mui/styles@^5.8.3":
version "5.8.3"
resolved "https://registry.yarnpkg.com/@mui/styles/-/styles-5.8.3.tgz#2003084a5ad793ab8067efa9b411a6ef4cf3a57e"
integrity sha512-O0FGaKYajtIC2H42bhh6CvqQsH5WVodsYx3joga+heojta2D2TRIOxtPX4v2VG8D3TvhcggrSsERF6S9sAvl3Q==
dependencies:
"@babel/runtime" "^7.17.2"
"@emotion/hash" "^0.8.0"
"@mui/private-theming" "^5.8.0"
"@mui/types" "^7.1.3"
"@mui/utils" "^5.8.0"
clsx "^1.1.1"
csstype "^3.1.0"
hoist-non-react-statics "^3.3.2"
jss "^10.8.2"
jss-plugin-camel-case "^10.8.2"
jss-plugin-default-unit "^10.8.2"
jss-plugin-global "^10.8.2"
jss-plugin-nested "^10.8.2"
jss-plugin-props-sort "^10.8.2"
jss-plugin-rule-value-function "^10.8.2"
jss-plugin-vendor-prefixer "^10.8.2"
prop-types "^15.8.1"

"@mui/system@^5.8.3":
version "5.8.3"
resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.8.3.tgz#66db174f1b5c244eb73dbc48527509782a22ec0a"
Expand Down Expand Up @@ -7879,14 +7856,6 @@ css-tree@^1.1.2, css-tree@^1.1.3:
mdn-data "2.0.14"
source-map "^0.6.1"

css-vendor@^2.0.8:
version "2.0.8"
resolved "https://registry.yarnpkg.com/css-vendor/-/css-vendor-2.0.8.tgz#e47f91d3bd3117d49180a3c935e62e3d9f7f449d"
integrity sha512-x9Aq0XTInxrkuFeHKbYC7zWY8ai7qJ04Kxd9MnvbC1uO5DagxoHQjm4JvG+vCdXOoFtCjbL2XSZfxmoYa9uQVQ==
dependencies:
"@babel/runtime" "^7.8.3"
is-in-browser "^1.0.2"

css-what@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4"
Expand Down Expand Up @@ -10775,11 +10744,6 @@ husky@8.0.1:
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9"
integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==

hyphenate-style-name@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==

iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
Expand Down Expand Up @@ -11327,11 +11291,6 @@ is-hexadecimal@^1.0.0:
resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz#cc35c97588da4bd49a8eedd6bc4082d44dcb23a7"
integrity sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==

is-in-browser@^1.0.2, is-in-browser@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/is-in-browser/-/is-in-browser-1.1.3.tgz#56ff4db683a078c6082eb95dad7dc62e1d04f835"
integrity sha512-FeXIBgG/CPGd/WUxuEyvgGTEfwiG9Z4EKGxjNMRqviiIIfsmgrpnHLffEDdwUHqNva1VEW91o3xBT/m8Elgl9g==

is-interactive@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e"
Expand Down Expand Up @@ -12009,76 +11968,6 @@ jsonparse@^1.2.0, jsonparse@^1.3.1:
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==

jss-plugin-camel-case@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-camel-case/-/jss-plugin-camel-case-10.9.0.tgz#4921b568b38d893f39736ee8c4c5f1c64670aaf7"
integrity sha512-UH6uPpnDk413/r/2Olmw4+y54yEF2lRIV8XIZyuYpgPYTITLlPOsq6XB9qeqv+75SQSg3KLocq5jUBXW8qWWww==
dependencies:
"@babel/runtime" "^7.3.1"
hyphenate-style-name "^1.0.3"
jss "10.9.0"

jss-plugin-default-unit@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-default-unit/-/jss-plugin-default-unit-10.9.0.tgz#bb23a48f075bc0ce852b4b4d3f7582bc002df991"
integrity sha512-7Ju4Q9wJ/MZPsxfu4T84mzdn7pLHWeqoGd/D8O3eDNNJ93Xc8PxnLmV8s8ZPNRYkLdxZqKtm1nPQ0BM4JRlq2w==
dependencies:
"@babel/runtime" "^7.3.1"
jss "10.9.0"

jss-plugin-global@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-global/-/jss-plugin-global-10.9.0.tgz#fc07a0086ac97aca174e37edb480b69277f3931f"
integrity sha512-4G8PHNJ0x6nwAFsEzcuVDiBlyMsj2y3VjmFAx/uHk/R/gzJV+yRHICjT4MKGGu1cJq2hfowFWCyrr/Gg37FbgQ==
dependencies:
"@babel/runtime" "^7.3.1"
jss "10.9.0"

jss-plugin-nested@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-nested/-/jss-plugin-nested-10.9.0.tgz#cc1c7d63ad542c3ccc6e2c66c8328c6b6b00f4b3"
integrity sha512-2UJnDrfCZpMYcpPYR16oZB7VAC6b/1QLsRiAutOt7wJaaqwCBvNsosLEu/fUyKNQNGdvg2PPJFDO5AX7dwxtoA==
dependencies:
"@babel/runtime" "^7.3.1"
jss "10.9.0"
tiny-warning "^1.0.2"

jss-plugin-props-sort@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-props-sort/-/jss-plugin-props-sort-10.9.0.tgz#30e9567ef9479043feb6e5e59db09b4de687c47d"
integrity sha512-7A76HI8bzwqrsMOJTWKx/uD5v+U8piLnp5bvru7g/3ZEQOu1+PjHvv7bFdNO3DwNPC9oM0a//KwIJsIcDCjDzw==
dependencies:
"@babel/runtime" "^7.3.1"
jss "10.9.0"

jss-plugin-rule-value-function@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-rule-value-function/-/jss-plugin-rule-value-function-10.9.0.tgz#379fd2732c0746fe45168011fe25544c1a295d67"
integrity sha512-IHJv6YrEf8pRzkY207cPmdbBstBaE+z8pazhPShfz0tZSDtRdQua5jjg6NMz3IbTasVx9FdnmptxPqSWL5tyJg==
dependencies:
"@babel/runtime" "^7.3.1"
jss "10.9.0"
tiny-warning "^1.0.2"

jss-plugin-vendor-prefixer@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss-plugin-vendor-prefixer/-/jss-plugin-vendor-prefixer-10.9.0.tgz#aa9df98abfb3f75f7ed59a3ec50a5452461a206a"
integrity sha512-MbvsaXP7iiVdYVSEoi+blrW+AYnTDvHTW6I6zqi7JcwXdc6I9Kbm234nEblayhF38EftoenbM+5218pidmC5gA==
dependencies:
"@babel/runtime" "^7.3.1"
css-vendor "^2.0.8"
jss "10.9.0"

jss@10.9.0, jss@^10.8.2:
version "10.9.0"
resolved "https://registry.yarnpkg.com/jss/-/jss-10.9.0.tgz#7583ee2cdc904a83c872ba695d1baab4b59c141b"
integrity sha512-YpzpreB6kUunQBbrlArlsMpXYyndt9JATbt95tajx0t4MTJJcCJdd4hdNpHmOIDiUJrF/oX5wtVFrS3uofWfGw==
dependencies:
"@babel/runtime" "^7.3.1"
csstype "^3.0.2"
is-in-browser "^1.1.3"
tiny-warning "^1.0.2"

"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.2.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.0.tgz#e624f259143b9062c92b6413ff92a164c80d3ccb"
Expand Down Expand Up @@ -17532,11 +17421,6 @@ timm@^1.6.1:
resolved "https://registry.yarnpkg.com/timm/-/timm-1.7.1.tgz#96bab60c7d45b5a10a8a4d0f0117c6b7e5aff76f"
integrity sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==

tiny-warning@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==

tinycolor2@^1.4.1:
version "1.4.2"
resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.2.tgz#3f6a4d1071ad07676d7fa472e1fac40a719d8803"
Expand Down

0 comments on commit 1e1af14

Please sign in to comment.