diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index a08d9e015c536..1ec707d161d6f 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -94,7 +94,7 @@ const presetOptions: { name: Preset; message: string }[] = [ { name: Preset.ReactNative, message: - 'react-native [a workspace with a single React Native application]', + 'react-native [a monorepo with a single React Native application]', }, ]; diff --git a/packages/expo/package.json b/packages/expo/package.json index 1567a5ae28658..7bf48ddeea3b5 100644 --- a/packages/expo/package.json +++ b/packages/expo/package.json @@ -33,7 +33,6 @@ "@nrwl/react": "file:../react", "@nrwl/webpack": "file:../webpack", "@nrwl/workspace": "file:../workspace", - "@svgr/webpack": "^6.1.2", "chalk": "^4.1.0", "enhanced-resolve": "^5.8.3", "fs-extra": "^10.1.0", diff --git a/packages/expo/plugins/with-nx-webpack.ts b/packages/expo/plugins/with-nx-webpack.ts index 445d01506458e..3d9ca4483f2b8 100644 --- a/packages/expo/plugins/with-nx-webpack.ts +++ b/packages/expo/plugins/with-nx-webpack.ts @@ -25,64 +25,6 @@ export async function withNxWebpack(config) { }, }, }); - // svg rule from https://github.com/kristerkari/react-native-svg-transformer/issues/135#issuecomment-1008310514 - rules.unshift({ - test: /\.svg$/, - exclude: /node_modules/, - use: [ - { - loader: require.resolve('@svgr/webpack'), - options: { - svgoConfig: { - plugins: { - cleanupAttrs: true, - cleanupEnableBackground: true, - cleanupIDs: true, - cleanupListOfValues: true, - cleanupNumericValues: true, - collapseGroups: true, - convertEllipseToCircle: true, - convertPathData: true, - convertShapeToPath: true, - convertStyleToAttrs: true, - convertTransform: true, - inlineStyles: true, - mergePaths: true, - minifyStyles: true, - moveElemsAttrsToGroup: true, - moveGroupAttrsToElems: true, - removeComments: true, - removeDesc: true, - removeDimensions: false, - removeDoctype: true, - removeEditorsNSData: true, - removeEmptyAttrs: true, - removeEmptyContainers: true, - removeEmptyText: true, - removeHiddenElems: true, - removeMetadata: true, - removeNonInheritableGroupAttrs: true, - removeRasterImages: true, - removeScriptElement: false, - removeStyleElement: false, - removeTitle: true, - removeUnknownsAndDefaults: true, - removeUnusedNS: true, - removeUselessDefs: true, - removeUselessStrokeAndFill: true, - removeViewBox: false, - removeXMLNS: true, - removeXMLProcInst: true, - reusePaths: true, - sortAttrs: true, - sortDefsChildren: true, - convertColors: false, - }, - }, - }, - }, - ], - }); } const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx']; diff --git a/packages/expo/src/generators/application/files/assets/logo.png b/packages/expo/src/generators/application/files/assets/logo.png deleted file mode 100644 index e9b9b6eb620ff..0000000000000 Binary files a/packages/expo/src/generators/application/files/assets/logo.png and /dev/null differ diff --git a/packages/expo/src/generators/application/files/assets/star.svg b/packages/expo/src/generators/application/files/assets/star.svg deleted file mode 100644 index 901053d385490..0000000000000 --- a/packages/expo/src/generators/application/files/assets/star.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/packages/expo/src/generators/application/files/src/app/App.tsx.template b/packages/expo/src/generators/application/files/src/app/App.tsx.template index 3d25e16364e22..3d53e8082c113 100644 --- a/packages/expo/src/generators/application/files/src/app/App.tsx.template +++ b/packages/expo/src/generators/application/files/src/app/App.tsx.template @@ -8,23 +8,11 @@ import { Text, StatusBar, TouchableOpacity, - Linking + Linking, } from 'react-native'; +import Svg, { Path } from 'react-native-svg'; -import Checkmark from './icons/checkmark.svg'; -import Book from './icons/book.svg'; -import ChevronRight from './icons/chevron-right.svg'; -import Blog from './icons/blog.svg'; -import Courses from './icons/courses.svg'; -import YouTube from './icons/youtube.svg'; -import Pointer from './icons/pointer.svg'; -import VSCode from './icons/vscode.svg'; -import NxCloud from './icons/nx-cloud.svg'; -import GitHub from './icons/github.svg'; -import Terminal from './icons/terminal.svg'; -import Heart from './icons/heart.svg'; - -const App = () => { +export const App = () => { const [whatsNextYCoord, setWhatsNextYCoord] = useState(0); const scrollViewRef = useRef(null); @@ -48,11 +36,20 @@ const App = () => { - + fill="none" + viewBox="0 0 24 24" + > + + You're up and running @@ -85,31 +82,81 @@ const App = () => { ) } > - + + + Documentation Everything is in there - + + + - Linking.openURL( - 'https://blog.nrwl.io/?utm_source=nx-project' - ) + Linking.openURL('https://blog.nrwl.io/?utm_source=nx-project') } > - + + + Blog Changelog, features & events - + + + { ) } > - + + + Youtube channel Nx Show, talks & tutorials - + + + { ) } > - + + + Interactive tutorials Create an app, step by step - + + + { ) } > - + + + + + Video courses Nx custom courses - + + + @@ -173,7 +289,14 @@ const App = () => { } > - + + + { > - + + + + { } > - + + + { Here are some things you can do with Nx: - + + + Add UI library @@ -293,20 +440,46 @@ const App = () => { - + + + - View interactive dependency graph + View interactive project graph - nx dep-graph + nx graph - + + + Run affected commands @@ -349,7 +522,20 @@ const App = () => { Carefully crafted with - + + + diff --git a/packages/expo/src/generators/application/files/src/app/icons/blog.svg b/packages/expo/src/generators/application/files/src/app/icons/blog.svg deleted file mode 100644 index b7618efb90ad4..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/blog.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/book.svg b/packages/expo/src/generators/application/files/src/app/icons/book.svg deleted file mode 100644 index af2d6df129007..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/book.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/checkmark.svg b/packages/expo/src/generators/application/files/src/app/icons/checkmark.svg deleted file mode 100644 index fe2608c90b1df..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/checkmark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/chevron-right.svg b/packages/expo/src/generators/application/files/src/app/icons/chevron-right.svg deleted file mode 100644 index 332879444aef8..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/chevron-right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/courses.svg b/packages/expo/src/generators/application/files/src/app/icons/courses.svg deleted file mode 100644 index 1a3d480024762..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/courses.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/github.svg b/packages/expo/src/generators/application/files/src/app/icons/github.svg deleted file mode 100644 index 266c1f766d135..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/heart.svg b/packages/expo/src/generators/application/files/src/app/icons/heart.svg deleted file mode 100644 index 74c66cb72894b..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/heart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/logo.png b/packages/expo/src/generators/application/files/src/app/icons/logo.png deleted file mode 100644 index e9b9b6eb620ff..0000000000000 Binary files a/packages/expo/src/generators/application/files/src/app/icons/logo.png and /dev/null differ diff --git a/packages/expo/src/generators/application/files/src/app/icons/nx-cloud.svg b/packages/expo/src/generators/application/files/src/app/icons/nx-cloud.svg deleted file mode 100644 index 0637cbd3dbb87..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/nx-cloud.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/pointer.svg b/packages/expo/src/generators/application/files/src/app/icons/pointer.svg deleted file mode 100644 index 47cb0edce4c5b..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/pointer.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/terminal.svg b/packages/expo/src/generators/application/files/src/app/icons/terminal.svg deleted file mode 100644 index 2041db0dd30e4..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/terminal.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/vscode.svg b/packages/expo/src/generators/application/files/src/app/icons/vscode.svg deleted file mode 100644 index 70ae6e92c912f..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/vscode.svg +++ /dev/null @@ -1 +0,0 @@ -Visual Studio Code \ No newline at end of file diff --git a/packages/expo/src/generators/application/files/src/app/icons/youtube.svg b/packages/expo/src/generators/application/files/src/app/icons/youtube.svg deleted file mode 100644 index b527eaa1c18c9..0000000000000 --- a/packages/expo/src/generators/application/files/src/app/icons/youtube.svg +++ /dev/null @@ -1 +0,0 @@ -YouTube \ No newline at end of file diff --git a/packages/expo/src/generators/init/init.ts b/packages/expo/src/generators/init/init.ts index 24a2e50d279f4..61ccb54bd2a3e 100644 --- a/packages/expo/src/generators/init/init.ts +++ b/packages/expo/src/generators/init/init.ts @@ -21,7 +21,6 @@ import { reactNativeSvgTransformerVersion, reactNativeSvgVersion, expoCliVersion, - svgrWebpackVersion, babelPresetExpoVersion, easCliVersion, deprecatedExpoCliVersion, @@ -89,7 +88,6 @@ export function updateDependencies(host: Tree) { 'expo-cli': deprecatedExpoCliVersion, '@expo/cli': expoCliVersion, 'eas-cli': easCliVersion, - '@svgr/webpack': svgrWebpackVersion, 'babel-preset-expo': babelPresetExpoVersion, } ); diff --git a/packages/expo/src/utils/add-jest.ts b/packages/expo/src/utils/add-jest.ts index e0e7eea3b1575..70314432adf6f 100644 --- a/packages/expo/src/utils/add-jest.ts +++ b/packages/expo/src/utils/add-jest.ts @@ -32,7 +32,7 @@ export async function addJest( moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'], setupFilesAfterEnv: ['/test-setup.${js ? 'js' : 'ts'}'], moduleNameMapper: { - '\\.svg': '@nrwl/expo/plugins/jest/svg-mock' + '\\\\.svg$': '@nrwl/expo/plugins/jest/svg-mock' } };`; host.write(configPath, content); diff --git a/packages/expo/src/utils/versions.ts b/packages/expo/src/utils/versions.ts index 8b5e613192302..377d6aa6d2f5f 100644 --- a/packages/expo/src/utils/versions.ts +++ b/packages/expo/src/utils/versions.ts @@ -15,7 +15,6 @@ export const reactNativeWebVersion = '~0.18.7'; export const reactNativeSvgTransformerVersion = '1.0.0'; export const reactNativeSvgVersion = '13.4.0'; -export const svgrWebpackVersion = '^6.5.1'; export const metroVersion = '0.73.3'; diff --git a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template index e47331995a1b0..667e25d1da24c 100644 --- a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template +++ b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template @@ -10,19 +10,7 @@ import { TouchableOpacity, Linking, } from 'react-native'; - -import Checkmark from './icons/checkmark.svg'; -import Book from './icons/book.svg'; -import ChevronRight from './icons/chevron-right.svg'; -import Blog from './icons/blog.svg'; -import Courses from './icons/courses.svg'; -import YouTube from './icons/youtube.svg'; -import Pointer from './icons/pointer.svg'; -import VSCode from './icons/vscode.svg'; -import NxCloud from './icons/nx-cloud.svg'; -import GitHub from './icons/github.svg'; -import Terminal from './icons/terminal.svg'; -import Heart from './icons/heart.svg'; +import Svg, { Path } from 'react-native-svg'; export const App = () => { const [whatsNextYCoord, setWhatsNextYCoord] = useState(0); @@ -48,11 +36,20 @@ export const App = () => { - + fill="none" + viewBox="0 0 24 24" + > + + You're up and running @@ -85,31 +82,81 @@ export const App = () => { ) } > - + + + Documentation Everything is in there - + + + - Linking.openURL( - 'https://blog.nrwl.io/?utm_source=nx-project' - ) + Linking.openURL('https://blog.nrwl.io/?utm_source=nx-project') } > - + + + Blog Changelog, features & events - + + + { ) } > - + + + Youtube channel Nx Show, talks & tutorials - + + + { ) } > - + + + Interactive tutorials Create an app, step by step - + + + { ) } > - + + + + + Video courses Nx custom courses - + + + @@ -173,7 +289,14 @@ export const App = () => { } > - + + + { > - + + + + { } > - + + + { Here are some things you can do with Nx: - + + + Add UI library @@ -293,7 +440,20 @@ export const App = () => { - + + + View interactive project graph @@ -306,7 +466,20 @@ export const App = () => { - + + + Run affected commands @@ -349,7 +522,20 @@ export const App = () => { Carefully crafted with - + + + @@ -418,7 +604,7 @@ const styles = StyleSheet.create({ color: '#6b7280', }, section: { - marginVertical: 12, + marginVertical: 24, marginHorizontal: 12, }, shadowBox: { diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/blog.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/blog.svg deleted file mode 100644 index b7618efb90ad4..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/blog.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/book.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/book.svg deleted file mode 100644 index af2d6df129007..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/book.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/checkmark.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/checkmark.svg deleted file mode 100644 index fe2608c90b1df..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/checkmark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/chevron-right.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/chevron-right.svg deleted file mode 100644 index 332879444aef8..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/chevron-right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/courses.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/courses.svg deleted file mode 100644 index 1a3d480024762..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/courses.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/github.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/github.svg deleted file mode 100644 index 266c1f766d135..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/github.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/heart.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/heart.svg deleted file mode 100644 index 74c66cb72894b..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/heart.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/logo.png b/packages/react-native/src/generators/application/files/app/src/app/icons/logo.png deleted file mode 100644 index e9b9b6eb620ff..0000000000000 Binary files a/packages/react-native/src/generators/application/files/app/src/app/icons/logo.png and /dev/null differ diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/nx-cloud.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/nx-cloud.svg deleted file mode 100644 index 0637cbd3dbb87..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/nx-cloud.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/pointer.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/pointer.svg deleted file mode 100644 index 47cb0edce4c5b..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/pointer.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/terminal.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/terminal.svg deleted file mode 100644 index 2041db0dd30e4..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/terminal.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/vscode.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/vscode.svg deleted file mode 100644 index 70ae6e92c912f..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/vscode.svg +++ /dev/null @@ -1 +0,0 @@ -Visual Studio Code \ No newline at end of file diff --git a/packages/react-native/src/generators/application/files/app/src/app/icons/youtube.svg b/packages/react-native/src/generators/application/files/app/src/app/icons/youtube.svg deleted file mode 100644 index b527eaa1c18c9..0000000000000 --- a/packages/react-native/src/generators/application/files/app/src/app/icons/youtube.svg +++ /dev/null @@ -1 +0,0 @@ -YouTube \ No newline at end of file diff --git a/packages/react-native/src/utils/add-jest.ts b/packages/react-native/src/utils/add-jest.ts index 42426d29b87c8..f130d43661285 100644 --- a/packages/react-native/src/utils/add-jest.ts +++ b/packages/react-native/src/utils/add-jest.ts @@ -32,7 +32,7 @@ export async function addJest( moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'], setupFilesAfterEnv: ['/test-setup.${js ? 'js' : 'ts'}'], moduleNameMapper: { - '\\.svg': '@nrwl/react-native/plugins/jest/svg-mock' + '\\\\.svg$': '@nrwl/react-native/plugins/jest/svg-mock' } };`; host.write(configPath, content);