Skip to content

Commit

Permalink
chore: Added a new firefly-configs package (#144)
Browse files Browse the repository at this point in the history
* Created a new firefly-configs package

* Added changeset files

* Updated packages lists
  • Loading branch information
patricklafrance authored Jan 31, 2024
1 parent 88afebf commit 39d0bbe
Show file tree
Hide file tree
Showing 74 changed files with 361 additions and 195 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-penguins-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@squide/core": minor
---

Internal cleanup.
5 changes: 5 additions & 0 deletions .changeset/chilled-comics-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@squide/firefly": major
---

Moved the webpack define functions to the new `@squide/firefly-configs` package.
5 changes: 4 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@basic/*", "@endpoints/*"]
"ignore": ["@basic/*", "@endpoints/*"],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
5 changes: 5 additions & 0 deletions .changeset/mean-hounds-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@squide/firefly-configs": major
---

Initial release of the package.
5 changes: 5 additions & 0 deletions .changeset/smart-suits-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@squide/react-router": patch
---

Internal cleanup.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ A federated web application shell built on top of [Module Federation](https://we
| [@squide/msw](packages/msw/README.md) | [![npm version](https://img.shields.io/npm/v/@squide/msw)](https://www.npmjs.com/package/@squide/msw) |
| [@squide/i18next](packages/i18next/README.md) | [![npm version](https://img.shields.io/npm/v/@squide/i18next)](https://www.npmjs.com/package/@squide/i18next) |
| [@squide/firefly](packages/firefly/README.md) | [![npm version](https://img.shields.io/npm/v/@squide/firefly)](https://www.npmjs.com/package/@squide/firefly) |
| [@squide/firefly-configs](packages/firefly-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@squide/firefly-configs)](https://www.npmjs.com/package/@squide/firefly-configs) |
| [@squide/fakes](packages/fakes/README.md) | [![npm version](https://img.shields.io/npm/v/@squide/fakes)](https://www.npmjs.com/package/@squide/fakes) |

## Have a question or found an issue?
Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started/create-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ Create a new application (we'll refer to ours as `host`), then open a terminal a

+++ pnpm
```bash
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
pnpm add @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++ yarn
```bash
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
yarn add @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++ npm
```bash
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss typescript
npm install @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++
Expand Down Expand Up @@ -337,7 +337,7 @@ Then, open the `webpack.dev.js` file and use the [defineDevHostConfig](/referenc
```js !#6-13 host/webpack.dev.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand Down Expand Up @@ -371,7 +371,7 @@ Then, open the `webpack.build.js` file and use the [defineBuildHostConfig](/refe
```js !#6-13 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started/create-remote-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ Create a new application (we'll refer to ours as `remote-module`), then open a t

+++ pnpm
```bash
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
pnpm add @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++ yarn
```bash
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
yarn add @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++ npm
```bash
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
npm install @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++
Expand Down Expand Up @@ -115,7 +115,7 @@ Then, open the `webpack.dev.js` file and use the [defineDevRemoteModuleConfig](/
```js !#6-12 remote-module/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevRemoteModuleConfig(swcConfig, "remote1", 8081, {
Expand Down Expand Up @@ -148,7 +148,7 @@ Then, open the `webpack.build.js` file and use the [defineBuildRemoteModuleConfi
```js !#6-12 remote-module/webpack.build.js
// @ts-check

import { defineBuildRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildRemoteModuleConfig(swcConfig, "remote1", {
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/add-a-shared-dependency.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Sometimes, a `singleton` shared dependency is paired with the [strictVersion](ht
```js !#10 webpack.config.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand Down Expand Up @@ -67,7 +67,7 @@ An [eager](https://webpack.js.org/plugins/module-federation-plugin/#eager) share
```js !#10 webpack.config.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand Down Expand Up @@ -108,7 +108,7 @@ To configure shared dependencies, use the `sharedDependencies` option of any [de
```js !#7-11 host/webpack.dev.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand All @@ -125,7 +125,7 @@ When a dependency is shared between a host application and a remote module, the
```js !#7-11 remote-module/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevRemoteModuleConfig(swcConfig, "remote1", 8081, {
Expand Down
12 changes: 6 additions & 6 deletions docs/guides/develop-a-module-in-isolation.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ To configure webpack, open the `webpack.dev.js` file and update the configuratio
```js !#8,11 remote-module/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig, defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig, defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

let config;
Expand Down Expand Up @@ -332,19 +332,19 @@ If you are experiencing issues with this section of the guide:

Similarly to remote modules, the same isolated setup can be achieved for local modules. The main difference is that the `webpack.config.js` file of a local module serves the sole purpose of starting a development server for isolated development. Typically, local modules do not rely on webpack and [Module Federation](https://webpack.js.org/concepts/module-federation/).

First, open a terminal at the root of the local module application and install the `@squide/webpack-configs` package and its dependencies:
First, open a terminal at the root of the local module application and install the `@squide/firefly-configs` package and its dependencies:

+++ pnpm
```bash
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
pnpm add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
```
+++ yarn
```bash
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
yarn add -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
```
+++ npm
```bash
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/webpack-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
npm install -D @workleap/webpack-configs @workleap/swc-configs @workleap/browserslist-config @squide/firefly-configs webpack webpack-dev-server webpack-cli @swc/core @swc/helpers browserslist postcss
```
+++

Expand Down Expand Up @@ -439,7 +439,7 @@ Finally, open the `webpack.config.js` file and use the the [defineDevHostConfig]
```js local-module/webpack.config.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.config.js";

export default defineDevHostConfig(swcConfig, "local1", 8080);
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/override-a-react-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ In this scenario, Hopper's components are used throughout the entire federated a
```js !#8-10 host/webpack.dev.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/setup-i18next.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Finally, update the webpack development and build configurations to activate the
```js !#7-9 host/webpack.dev.js
// @ts-check

import { defineDevHostConfig } from "@squide/firefly/defineConfig.js";
import { defineDevHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevHostConfig(swcConfig, "host", 8080, {
Expand All @@ -190,7 +190,7 @@ export default defineDevHostConfig(swcConfig, "host", 8080, {
```js !#7-9 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand Down Expand Up @@ -373,7 +373,7 @@ Finally, update the webpack development and build configurations to activate the
```js !#7-9 remote-module/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevRemoteModuleConfig(swcConfig, "remote1", 8081, {
Expand All @@ -391,7 +391,7 @@ export default defineDevRemoteModuleConfig(swcConfig, "remote1", 8081, {
```js !#7-9 remote-module/webpack.build.js
// @ts-check

import { defineBuildRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildRemoteModuleConfig(swcConfig, "remote1", {
Expand Down
1 change: 1 addition & 0 deletions docs/reference/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ toc:
- [FireflyRuntime class](./runtime/runtime-class.md)
- [RuntimeContext](./runtime/runtime-context.md)
- [useRuntime](./runtime/useRuntime.md)
- [useRuntimeMode](./runtime/useRuntimeMode.md)
- [useRoutes](./runtime/useRoutes.md)
- [useNavigationItems](./runtime/useNavigationItems.md)
- [useLogger](./runtime/useLogger.md)
Expand Down
1 change: 1 addition & 0 deletions docs/reference/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ order: 200
| :icon-mark-github: [@squide/msw](https://github.com/gsoft-inc/wl-squide/tree/main/packages/msw) | Add support for [MSW](https://mswjs.io/). | [![npm version](https://img.shields.io/npm/v/@squide/msw)](https://www.npmjs.com/package/@squide/msw) |
| :icon-mark-github: [@squide/i18next](https://github.com/gsoft-inc/wl-squide/tree/main/packages/i18next) | Add support for [i18next](https://www.i18next.com/). | [![npm version](https://img.shields.io/npm/v/@squide/i18next)](https://www.npmjs.com/package/@squide/i18next) |
| :icon-mark-github: [@squide/firefly](https://github.com/gsoft-inc/wl-squide/tree/main/packages/firefly) | Helpers to facilitate the creation of a shell package with Squide firefly technology stack. | [![npm version](https://img.shields.io/npm/v/@squide/firefly)](https://www.npmjs.com/package/@squide/firefly) |
| :icon-mark-github: [@squide/firefly-configs](https://github.com/gsoft-inc/wl-squide/tree/main/packages/firefly-configs) | Webpack configuration helpers for the Squide firefly technology stack. | [![npm version](https://img.shields.io/npm/v/@squide/firefly-configs)](https://www.npmjs.com/package/@squide/firefly-configs) |
| :icon-mark-github: [@squide/fakes](https://github.com/gsoft-inc/wl-squide/tree/main/packages/fakes) | A collection of fake implementations to facilitate the development of federated modules. | [![npm version](https://img.shields.io/npm/v/@squide/fakes)](https://www.npmjs.com/package/@squide/fakes) |
6 changes: 3 additions & 3 deletions docs/reference/registration/registerRemoteModules.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const Remotes: RemoteDefinition = [
```js !#6 remote-module/src/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevRemoteModuleConfig(swcConfig, "remote1", PORT);
Expand All @@ -217,7 +217,7 @@ In development mode, the `publicPath` is built from the provided `host` and `por
```js !#6-8 remote-module/webpack.dev.js
// @ts-check

import { defineDevRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineDevRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.dev.js";

export default defineDevRemoteModuleConfig(swcConfig, REMOTE_NAME, 8081, {
Expand All @@ -230,7 +230,7 @@ In build mode, the `publicPath` is the third argument of the `defineBuildRemoteM
```js !#6 remote-module/webpack.build.js
// @ts-check

import { defineBuildRemoteModuleConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildRemoteModuleConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildRemoteModuleConfig(swcConfig, REMOTE_NAME, "http://localhost:8081/");
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/runtime/useNavigationItems.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
order: 60
order: 50
toc:
depth: 2-3
---
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/runtime/useRoutes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
order: 70
order: 60
toc:
depth: 2-3
---
Expand Down
31 changes: 31 additions & 0 deletions docs/reference/runtime/useRuntimeMode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
order: 70
toc:
depth: 2-3
---

# useRuntimeMode

Retrieve the runtime mode.

## Reference

```ts
const mode = useRuntimeMode()
```

### Parameters

None

### Returns

Either `"development"` or `"production"`.

## Usage

```ts
import { useRuntimeMode } from "@squide/firefly";

const mode = useRuntimeMode();
```
12 changes: 6 additions & 6 deletions docs/reference/webpack/defineBuildHostConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ For the full shared dependencies configuration, have a look at the [defineConfig
```js !#6 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host");
Expand All @@ -65,7 +65,7 @@ export default defineBuildHostConfig(swcConfig, "host");
```js !#7-9 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand All @@ -85,7 +85,7 @@ Features must be activated on the host application as well as every remote modul
```js !#7-11 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand All @@ -106,7 +106,7 @@ Additional shared dependencies must be configured on the host application as wel
```js !#7-11 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand Down Expand Up @@ -135,7 +135,7 @@ In the previous code sample, the `react` shared dependency will be **augmented**
```js !#7-11 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand Down Expand Up @@ -165,7 +165,7 @@ While you could customize the [ModuleFederationPlugin](https://webpack.js.org/pl
```js !#7-9 host/webpack.build.js
// @ts-check

import { defineBuildHostConfig, defineHostModuleFederationPluginOptions } from "@squide/firefly/defineConfig.js";
import { defineBuildHostConfig, defineHostModuleFederationPluginOptions } from "@squide/firefly-configs";
import { swcConfig } from "./swc.build.js";

export default defineBuildHostConfig(swcConfig, "host", {
Expand Down
Loading

0 comments on commit 39d0bbe

Please sign in to comment.