-
Notifications
You must be signed in to change notification settings - Fork 970
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes babel configuration from users project (#3719)
* WIP: playing with presets and jest babel config * Only set preset env for jest * Remove all babelconfig from users project, including Load all babel config from rwjs/interal * Whoops deleted the wrong rc * Fix apiSide register * Fix prerendering * Try programatically generating babel config for project * Fixes for linter config * A few tweaks * Config to configFile * Lint the linter config... * Separate out fw and project eslint config * Standarise usage of babel options * Remove reminder for me * Switch ignores array to string array * Update internal package dependency * Add middleware to warn users about custom babel config * Remove scary warning, only leave helpful error if using a babelrc file * Add babelrc check to build command * Add comment to explain presetEnv flag * Consistent test pattern for cell and routes overrides * Undo web jest env changes * Make fast-glob explicit cli dependency * Bump eslint config dep to 0.38.3 too * Option A: remove polyfill plugin, only have transform-runtime Also change framework config to make sure corejs isn't imported * move framework ESlint settings 100% to ./.eslintrc.js Co-authored-by: David Price <thedavid@thedavidprice.com>
- Loading branch information
1 parent
6ea8350
commit 03cb1fc
Showing
28 changed files
with
551 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var sym = Symbol() | ||
|
||
var promise = Promise.resolve() | ||
|
||
var check = arr.includes('yeah!') | ||
|
||
console.log(arr[Symbol.iterator]()) | ||
|
||
Promise.allSettled() | ||
|
||
console.log([].includes('bazinga')) | ||
|
||
Promise.any() | ||
|
||
|
||
Object.hasOwn({ x: 2 }, "x") | ||
|
||
var arr = [1, 2, 3]; | ||
arr.at(0) === 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
// This is added as a test for prebuild; | ||
// check: packages/internal/**/build_api.test.ts | ||
module.exports = { | ||
presets: ['@redwoodjs/core/config/babel-preset'], | ||
plugins: [ | ||
[ | ||
'babel-plugin-auto-import', | ||
{ | ||
declarations: [ | ||
{ | ||
// import kitty from 'kitty-purr' | ||
default: 'kitty', | ||
path: 'kitty-purr', | ||
}, | ||
], | ||
}, | ||
], | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import boxen from 'boxen' | ||
import fg from 'fast-glob' | ||
|
||
import { getPaths } from '@redwoodjs/internal' | ||
|
||
import c from '../lib/colors' | ||
|
||
const isUsingBabelRc = () => { | ||
return ( | ||
fg.sync('**/*/.babelrc(.*)?', { | ||
cwd: getPaths().base, | ||
ignore: 'node_modules', | ||
}).length > 0 | ||
) | ||
} | ||
const BABEL_SETTINGS_LINK = c.warning('https://redwoodjs.com/docs/builds') | ||
|
||
const checkForBabelConfig = () => { | ||
if (isUsingBabelRc()) { | ||
const messages = [ | ||
"Looks like you're trying to configure one of your sides with a .babelrc file.", | ||
'These settings will be ignored, unless you use a babel.config.js file', | ||
'', | ||
'Your plugins and settings will be automatically merged with', | ||
`the Redwood built-in config, more details here: ${BABEL_SETTINGS_LINK}`, | ||
] | ||
|
||
const errTitle = 'Incorrect project configuration' | ||
|
||
console.log( | ||
boxen(messages.join('\n'), { | ||
title: errTitle, | ||
padding: { top: 0, bottom: 0, right: 1, left: 1 }, | ||
margin: 1, | ||
borderColor: 'red', | ||
}) | ||
) | ||
|
||
throw new Error(errTitle) | ||
} | ||
} | ||
|
||
export default checkForBabelConfig |
Oops, something went wrong.