Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: multiple fixes #161

Merged
merged 5 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ pnpm install

### Setup Retype

[Retype](https://retype.com/) is the documentation platform that `workleap/web-configs` is using for the documentation. As this project is leveraging a few [Pro features](https://retype.com/pro/) of Retype, you must first setup your [Retype wallet](https://retype.com/guides/cli/#retype-wallet).
[Retype](https://retype.com/) is the documentation platform that `workleap/web-configs` is using for its documentation. As this project is leveraging a few [Pro features](https://retype.com/pro/) of Retype.

Everything should work fine as-is but there are a few limitations to use Retype Pro features without a wallet with a licence. If you want to circumvent these limitations, you can optionally, setup your [Retype wallet](https://retype.com/guides/cli/#retype-wallet).

To do so, first make sure that you retrieve the Retype license from your Vault (or ask IT).

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Common configurations for building web apps at [Workleap](https://workleap.com/)
| --- | --- |
| [@workleap/browserslist-config](packages/browserslist-config/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/browserslist-config)](https://www.npmjs.com/package/@workleap/browserslist-config) |
| [@workleap/eslint-plugin](packages/eslint-plugin/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/eslint-plugin)](https://www.npmjs.com/package/@workleap/eslint-plugin) |
| [@workleap/postcss-plugin](packages/postcss-plugin/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/postcss-plugin)](https://www.npmjs.com/package/@workleap/postcss-plugin) |
| [@workleap/postcss-configs](packages/postcss-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/postcss-configs)](https://www.npmjs.com/package/@workleap/postcss-configs) |
| [@workleap/stylelint-plugin](packages/stylelint-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/stylelint-configs)](https://www.npmjs.com/package/@workleap/stylelint-configs) |
| [@workleap/typescript-config](packages/typescript-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/typescript-configs)](https://www.npmjs.com/package/@workleap/typescript-configs) |
| [@workleap/typescript-configs](packages/typescript-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/typescript-configs)](https://www.npmjs.com/package/@workleap/typescript-configs) |
| [@workleap/tsup-configs](packages/tsup-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/tsup-configs)](https://www.npmjs.com/package/@workleap/tsup-configs) |
| [@workleap/swc-configs](packages/swc-configs/README.md) | [![npm version](https://img.shields.io/npm/v/@workleap/swc-configs)](https://www.npmjs.com/package/@workleap/swc-configs) |

Expand Down
17 changes: 6 additions & 11 deletions packages/webpack-configs/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ export function defineMiniCssExtractPluginConfig(options: MiniCssExtractPluginOp
};
}

function preflight(options: DefineBuildConfigOptions) {
if (options.publicPath) {
if (options.publicPath !== "auto" && !options.publicPath.endsWith("/")) {
throw new Error("[webpack-configs] The \"publicPath\" must end with a \"/\".");
}
}
}

export interface DefineBuildConfigOptions {
entry?: string;
outputPath?: string;
Expand All @@ -73,8 +65,6 @@ export interface DefineBuildConfigOptions {
}

export function defineBuildConfig(swcConfig: SwcConfig, options: DefineBuildConfigOptions = {}) {
preflight(options);

const {
entry = path.resolve("./src/index.tsx"),
outputPath = path.resolve("dist"),
Expand Down Expand Up @@ -152,7 +142,12 @@ export function defineBuildConfig(swcConfig: SwcConfig, options: DefineBuildConf
: {
minimize: false,
chunkIds: "named",
moduleIds: "named"
concatenateModules: false,
flagIncludedChunks: false,
mangleExports: false,
mangleWasmImports: false,
moduleIds: "named",
removeAvailableModules: false
},
infrastructureLogging: verbose ? {
appendOnly: true,
Expand Down
6 changes: 0 additions & 6 deletions packages/webpack-configs/tests/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ test("when an output path is provided, use the provided ouput path value", () =>
expect(result.output?.path).toBe("./a-new-output-path");
});

test("when a public path not ending with a trailing slash is provided, throw an error", () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - We know this is invalid, but we still want to test the error.
expect(() => defineBuildConfig(SwcConfig, { publicPath: "an-invalid-public-path" })).toThrow();
});

test("when a public path is set to \"auto\", should not throw an error", () => {
expect(() => defineBuildConfig(SwcConfig, { publicPath: "auto" })).not.toThrow();
});
Expand Down