Skip to content

Commit

Permalink
Feature/make react global (#257)
Browse files Browse the repository at this point in the history
* feat: externals

* feat: changeset pre

* chore: Fixes release build

* chore: Fixes release build

* feat: ignore type-props in prod

* feat: beta version

* feat: beta version

* chore: Mumps versions

* feat: add standalone

* feat: add standalone

* feat: add standalone

* feat: add standalone

* feat: prop-types remove

* feat: prop-types remove

* feat: prop-types remove

* feat: add plugin

* feat: add plugin

* feat: remove babel prop-types plugin

* feat: run format

* fix: build error

* fix: build error

* fix: build error

* fix: build error

* feat: remove beta

* feat: remove beta

* feat: revert beta

* feat: revert beta

* feat: revert beta

* feat: final version

* feat: final version

* feat: source map in prod

* feat: changelog

* feat: changeset

---------

Co-authored-by: Amir Zahedi <[email protected]>
  • Loading branch information
sgimama and amir-zahedi authored May 30, 2024
1 parent 1c1e73f commit 51b8d2e
Show file tree
Hide file tree
Showing 17 changed files with 513 additions and 344 deletions.
8 changes: 8 additions & 0 deletions .changeset/slow-oranges-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@autoguru/babel-preset': major
'create-guru': major
'gdu': major
'@autoguru/jest-preset': major
---

Standalone flag, React global, enable sourcemaps in prod
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.17.0",
"@manypkg/cli": "^0.21.4",
"@types/node": "^16.4.13",
"browserslist-config-autoguru": "*",
"eslint": "^7.28.0",
Expand Down
13 changes: 13 additions & 0 deletions packages/babel-preset/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @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: 2 additions & 3 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": "1.5.0",
"version": "2.0.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,8 +28,7 @@
"@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-transform-react-remove-prop-types": "^0.4.24"
"babel-plugin-macros": "^3.1.0"
},
"devDependencies": {
"@autoguru/jest-preset": "*",
Expand Down
10 changes: 3 additions & 7 deletions packages/babel-preset/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ module.exports = function autoGuruReactPreset(api, options = {}) {
],
plugins: [
!dev &&
require.resolve(
'babel-plugin-transform-react-remove-prop-types',
),
!dev &&
require.resolve(
'@babel/plugin-transform-react-constant-elements',
),
require.resolve(
'@babel/plugin-transform-react-constant-elements',
),
dev && experimental && require.resolve('./plugins/named-memo.js'),
].filter(Boolean),
};
Expand Down
85 changes: 85 additions & 0 deletions packages/create-guru/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,90 @@
# 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": "8.0.0",
"version": "9.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": "^8.0.0",
"gdu": "^9.0.0",
"mri": "^1.1.6"
},
"scripts": {
Expand Down
72 changes: 72 additions & 0 deletions packages/gdu/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
# gdu

## 9.1.0

### Minor Changes

- enable sourcemaps in prod

## 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: 12 additions & 9 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))
.call(webpackConfigs(appEnv, isDebug, null, guruConfig.standalone))
.find(({ name }) => name === appEnv);

const consumerHtmlTemplate = getConsumerHtmlTemplate(guruConfig);
Expand Down Expand Up @@ -123,14 +123,17 @@ 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: 8 additions & 2 deletions packages/gdu/config/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ 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),
...makeWebpackConfig(buildEnv, buildEnvs.length > 1, tenant),
...baseOptions(buildEnv, buildEnvs.length > 1, isDebug, standalone),
...makeWebpackConfig(
buildEnv,
buildEnvs.length > 1,
tenant,
standalone,
),
}));
};

Expand Down
Loading

0 comments on commit 51b8d2e

Please sign in to comment.