Skip to content

Commit

Permalink
Revert "feat: ignore prop-types in prod (#255)" (#256)
Browse files Browse the repository at this point in the history
This reverts commit 9e64849.
  • Loading branch information
amir-zahedi authored May 29, 2024
1 parent 9e64849 commit 1c1e73f
Show file tree
Hide file tree
Showing 16 changed files with 343 additions and 498 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@autoguru/eslint-plugin": "*",
"@changesets/cli": "^2.11.1",
"@manypkg/cli": "^0.21.4",
"@manypkg/cli": "^0.17.0",
"@types/node": "^16.4.13",
"browserslist-config-autoguru": "*",
"eslint": "^7.28.0",
Expand Down
13 changes: 0 additions & 13 deletions packages/babel-preset/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# @autoguru/babel-preset

## 2.0.0

### Major Changes

- 51a33af: Add plugin prop-types in babel
- 51a33af: Add react global and standalone flag

## 2.0.0-beta.0

### Major Changes

- Add plugin prop-types in babel

## 1.5.0

### Minor Changes
Expand Down
5 changes: 3 additions & 2 deletions packages/babel-preset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@autoguru/babel-preset",
"version": "2.0.0",
"version": "1.5.0",
"description": "AutoGuru's org-wide Babel preset",
"homepage": "https://github.com/autoguru-au/octane/tree/master/packages/babel-preset#readme",
"repository": "https://github.com/autoguru-au/octane/tree/master/packages/babel-preset",
Expand Down Expand Up @@ -28,7 +28,8 @@
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime-corejs3": "^7.24.5",
"babel-plugin-dev-expression": "^0.2.3",
"babel-plugin-macros": "^3.1.0"
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24"
},
"devDependencies": {
"@autoguru/jest-preset": "*",
Expand Down
10 changes: 7 additions & 3 deletions packages/babel-preset/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ module.exports = function autoGuruReactPreset(api, options = {}) {
],
plugins: [
!dev &&
require.resolve(
'@babel/plugin-transform-react-constant-elements',
),
require.resolve(
'babel-plugin-transform-react-remove-prop-types',
),
!dev &&
require.resolve(
'@babel/plugin-transform-react-constant-elements',
),
dev && experimental && require.resolve('./plugins/named-memo.js'),
].filter(Boolean),
};
Expand Down
85 changes: 0 additions & 85 deletions packages/create-guru/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,5 @@
# create-guru

## 9.0.0

### Major Changes

- 51a33af: Implement react-remove-prop-types
- 51a33af: avoid type-props in prod
- 51a33af: add standalone flag
- 51a33af: remove webpack config prop-types
- 51a33af: Add plugin prop-types in babel
- 51a33af: Add react global and standalone flag

### Patch Changes

- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- [email protected]

## 9.0.0-beta.6

### Major Changes

- Add plugin prop-types in babel

### Patch Changes

- Updated dependencies [undefined]
- [email protected]

## 9.0.0-beta.5

### Major Changes

- remove webpack config prop-types

### Patch Changes

- Updated dependencies [undefined]
- [email protected]

## 9.0.0-beta.4

### Major Changes

- Implement react-remove-prop-types

### Patch Changes

- Updated dependencies [undefined]
- [email protected]

## 9.0.0-beta.3

### Major Changes

- add standalone flag

### Patch Changes

- Updated dependencies [undefined]
- [email protected]

## 9.0.0-beta.2

### Major Changes

- 2e01490: avoid type-props in prod

### Patch Changes

- Updated dependencies [2e01490]
- [email protected]

## 9.0.0-beta.0

### Patch Changes

- Updated dependencies [70ecedc]
- [email protected]

## 8.0.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/create-guru/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "create-guru",
"version": "9.0.0",
"version": "8.0.0",
"description": "Create a GDU project",
"homepage": "https://github.com/autoguru-au/octane/tree/master/packages/create-guru#readme",
"repository": "https://github.com/autoguru-au/octane/tree/master/packages/create-guru",
"license": "MIT",
"bin": "./index.js",
"dependencies": {
"gdu": "^9.0.0",
"gdu": "^8.0.0",
"mri": "^1.1.6"
},
"scripts": {
Expand Down
66 changes: 0 additions & 66 deletions packages/gdu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,5 @@
# gdu

## 9.0.0

### Major Changes

- 51a33af: Implement react-remove-prop-types
- 51a33af: avoid type-props in prod
- 51a33af: add standalone flag
- 51a33af: react external
- 51a33af: remove webpack config prop-types
- 51a33af: Add plugin prop-types in babel
- 51a33af: Add react global and standalone flag

### Patch Changes

- 51a33af: Force release
- Updated dependencies [51a33af]
- Updated dependencies [51a33af]
- @autoguru/babel-preset@2.0.0

## 9.0.0-beta.6

### Major Changes

- Add plugin prop-types in babel

### Patch Changes

- Updated dependencies [undefined]
- @autoguru/babel-preset@2.0.0-beta.0

## 9.0.0-beta.5

### Major Changes

- remove webpack config prop-types

## 9.0.0-beta.4

### Major Changes

- Implement react-remove-prop-types

## 9.0.0-beta.3

### Major Changes

- add standalone flag

## 9.0.0-beta.2

### Major Changes

- 2e01490: avoid type-props in prod

## 9.0.0-beta.1

### Patch Changes

- Force release

## 9.0.0-beta.0

### Major Changes

- 70ecedc: react external

## 8.1.2

### Patch Changes
Expand Down
21 changes: 9 additions & 12 deletions packages/gdu/commands/start/runSPA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const runSPA = async (guruConfig: GuruConfig, isDebug) => {

// eslint-disable-next-line unicorn/prefer-prototype-methods
const webpackConfig: Configuration = hooks.webpackConfig
.call(webpackConfigs(appEnv, isDebug, null, guruConfig.standalone))
.call(webpackConfigs(appEnv, isDebug))
.find(({ name }) => name === appEnv);

const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
Expand Down Expand Up @@ -123,17 +123,14 @@ export const runSPA = async (guruConfig: GuruConfig, isDebug) => {
}
});

const devServer = new WebpackDevServer(
{
static: join(PROJECT_ROOT, 'public'),
host: hosts[0],
allowedHosts: hosts,
historyApiFallback: true,
hot: true,
port: guruConfig.port,
},
compiler,
);
const devServer = new WebpackDevServer( {
static: join(PROJECT_ROOT, 'public'),
host: hosts[0],
allowedHosts: hosts,
historyApiFallback: true,
hot: true,
port: guruConfig.port,
}, compiler);

devServer.start().catch((error) => {
if (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gdu/config/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const createNextJSConfig = (
defaultConfig.plugins.push(
new IgnorePlugin({
resourceRegExp: /^@newrelic\/browser-agent$/,
}),
})
);
defaultConfig.plugins.push(
new DefinePlugin({
Expand Down
10 changes: 2 additions & 8 deletions packages/gdu/config/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ const buildConfigs = (
env = process.env.APP_ENV,
isDebug: boolean,
tenant?: string,
standalone?: boolean,
): Configuration[] => {
const buildEnvs = getBuildEnvs(env);
return buildEnvs.map((buildEnv) => ({
...baseOptions(buildEnv, buildEnvs.length > 1, isDebug, standalone),
...makeWebpackConfig(
buildEnv,
buildEnvs.length > 1,
tenant,
standalone,
),
...baseOptions(buildEnv, buildEnvs.length > 1, isDebug),
...makeWebpackConfig(buildEnv, buildEnvs.length > 1, tenant),
}));
};

Expand Down
33 changes: 8 additions & 25 deletions packages/gdu/config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const vendorRegex =
/(?<!node_modules.*)[/\\]node_modules[/\\](scheduler|prop-types|use-subscription)[/\\]/;
const relayRegex =
/(?<!node_modules.*)[/\\]node_modules[/\\](relay-runtime|react-relay)[/\\]/;
const frameworkRegex =
/(?<!node_modules.*)[/\\]node_modules[/\\](react|react-dom)[/\\]/;

const hooks = getHooks();
const isDev = !isProductionBuild();
Expand All @@ -82,14 +80,15 @@ export const baseOptions = (
buildEnv,
isMultiEnv: boolean,
isDebug = false,
standalone: boolean,
): Configuration => {
const guruConfig = getGuruConfig();
return {
context: PROJECT_ROOT,
mode: isDev ? 'development' : 'production',
entry: {
main: [join(gduEntryPath, 'spa', 'client.js')].filter(Boolean),
main: [
join(gduEntryPath, 'spa', 'client.js'),
].filter(Boolean),
},
experiments: {
layers: true,
Expand Down Expand Up @@ -164,16 +163,6 @@ export const baseOptions = (
reuseExistingChunk: true,
enforce: true,
},
framework: standalone
? {
chunks: 'all',
name: 'framework',
test: frameworkRegex,
priority: 60,
reuseExistingChunk: true,
enforce: true,
}
: {},
// AutoGuru related assets here
guru: {
test: /@autoguru[/\\]/,
Expand Down Expand Up @@ -380,10 +369,7 @@ export const baseOptions = (
includeChunks: true,
}),
new SourceMapDevToolPlugin({
exclude: standalone
? [/.css.ts$/, frameworkRegex]
: [/.css.ts$/],
test: [/.ts$/, /.tsx$/],
test: [/.ts$/, /.tsx$/]
}),
].filter(Boolean),
};
Expand Down Expand Up @@ -428,7 +414,6 @@ export const makeWebpackConfig = (
buildEnv: BuildEnv,
isMultiEnv: boolean,
tenant?: string,
standalone?: boolean,
): Configuration => {
const { outputPath, isTenanted } = getGuruConfig();
return {
Expand All @@ -452,11 +437,9 @@ export const makeWebpackConfig = (
sourceMapFilename: 'sourceMaps/[file].map',
pathinfo: false,
},
externals: standalone
? {}
: {
react: 'React',
'react-dom': 'ReactDOM',
},
externals: {
react: 'React',
'react-dom': 'ReactDOM'
},
};
};
1 change: 0 additions & 1 deletion packages/gdu/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface GuruConfig {
srcPaths?: string[];
__configPath: string;
__legacy_mode?: boolean;
standalone?: boolean;

tap?(hooks: Record<string, any>): void;
}
Expand Down
Loading

0 comments on commit 1c1e73f

Please sign in to comment.