From a0f078db13936800a32c14ade08b670a14b5a886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Fri, 24 Mar 2023 09:56:18 +0100 Subject: [PATCH 1/3] feat: remove @svgr/plugin-jsx from core BREAKING CHANGE: plugin-jsx is no longer included by default in core --- packages/core/README.md | 6 +----- packages/core/package.json | 1 - packages/core/src/plugins.test.ts | 6 +++--- packages/core/src/plugins.ts | 4 +--- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 69fa864a..771e9046 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -34,7 +34,7 @@ Use `svgr.sync(code, config, state)` if you would like to use sync version. ### Plugins -By default `@svgr/core` doesn't include `svgo` and `prettier` plugins, if you want them, you have to install them and include them in config. +By default `@svgr/core` doesn't include any plugin, if you want them, you have to install them and include them in config. ```js svgr(svgCode, { @@ -54,7 +54,3 @@ MIT [package]: https://www.npmjs.com/package/@svgr/core [license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square [license]: https://github.com/smooth-code/svgr/blob/master/LICENSE - -``` - -``` diff --git a/packages/core/package.json b/packages/core/package.json index 218ae184..8acf5dde 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -40,7 +40,6 @@ "dependencies": { "@babel/core": "^7.21.3", "@svgr/babel-preset": "^6.5.1", - "@svgr/plugin-jsx": "^6.5.1", "camelcase": "^6.2.0", "cosmiconfig": "^8.1.3" } diff --git a/packages/core/src/plugins.test.ts b/packages/core/src/plugins.test.ts index 80619abc..2cdd0162 100644 --- a/packages/core/src/plugins.test.ts +++ b/packages/core/src/plugins.test.ts @@ -16,12 +16,12 @@ describe('#getPlugins', () => { expect(getPlugins({}, state)).toEqual(['from-state-plugin']) }) - it('should default to ["@svgr/plugin-jsx"]', () => { - expect(getPlugins({}, {})).toEqual([jsx]) + it('should default to []', () => { + expect(getPlugins({}, {})).toEqual([]) }) it('should support caller with "defaultPlugins" in second choice', () => { - expect(getPlugins({}, { caller: {} })).toEqual([jsx]) + expect(getPlugins({}, { caller: {} })).toEqual([]) }) }) diff --git a/packages/core/src/plugins.ts b/packages/core/src/plugins.ts index 58386265..90b13f14 100644 --- a/packages/core/src/plugins.ts +++ b/packages/core/src/plugins.ts @@ -1,5 +1,3 @@ -// @ts-ignore -import jsx from '@svgr/plugin-jsx' import { Config } from './config' import type { State } from './state' @@ -9,7 +7,7 @@ export interface Plugin { export type ConfigPlugin = string | Plugin -const DEFAULT_PLUGINS: Plugin[] = [jsx as any] +const DEFAULT_PLUGINS: Plugin[] = [] export const getPlugins = ( config: Config, From fb9e57911f12ec83cf15c6f18fd67b55dde257be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Fri, 24 Mar 2023 09:59:27 +0100 Subject: [PATCH 2/3] chore: speed up build --- build/build.sh | 20 -------------------- package.json | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100755 build/build.sh diff --git a/build/build.sh b/build/build.sh deleted file mode 100755 index 4a2fe7c3..00000000 --- a/build/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -e - -npm run build --workspace @svgr/babel-plugin-add-jsx-attribute -npm run build --workspace @svgr/babel-plugin-remove-jsx-attribute -npm run build --workspace @svgr/babel-plugin-remove-jsx-empty-expression -npm run build --workspace @svgr/babel-plugin-replace-jsx-attribute-value -npm run build --workspace @svgr/babel-plugin-svg-dynamic-title -npm run build --workspace @svgr/babel-plugin-svg-em-dimensions -npm run build --workspace @svgr/babel-plugin-transform-react-native-svg -npm run build --workspace @svgr/babel-plugin-transform-svg-component -npm run build --workspace @svgr/babel-preset -npm run build --workspace @svgr/core -npm run build --workspace @svgr/hast-util-to-babel-ast -npm run build --workspace @svgr/plugin-jsx -npm run build --workspace @svgr/plugin-prettier -npm run build --workspace @svgr/plugin-svgo -npm run build --workspace @svgr/cli -npm run build --workspace @svgr/rollup -npm run build --workspace @svgr/webpack \ No newline at end of file diff --git a/package.json b/package.json index 0179cf87..4b5c2dea 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "examples/*" ], "scripts": { - "build": "build/build.sh", + "build": "lerna run build", "dev": "lerna run build --parallel -- --watch", "format": "prettier --write .", "lint": "eslint . && prettier --check .", From b7477c6a0aa1b76e9b001a7607b01097394457c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Berg=C3=A9?= Date: Fri, 24 Mar 2023 10:04:44 +0100 Subject: [PATCH 3/3] chore: add netlify config --- netlify.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 netlify.toml diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..f1bffb9b --- /dev/null +++ b/netlify.toml @@ -0,0 +1,4 @@ +[build] + base = "website/" + publish = "public/" + command = "npm run build" \ No newline at end of file