Skip to content

Commit

Permalink
Implemented configurable --hmr-port #523
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Jun 6, 2022
1 parent eca73d2 commit a727ace
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 0.14.27 (tbd)

- Fixed issue with `piral-cli-webpack` and `piral-cli-webpack5` not resolving *.jsx*
- Added `--hm-port` option in `piral-cli-webpack` to configure HMR port (#523)
- Added `--hm-port` option in `piral-cli-webpack5` to configure HMR port (#523)

## 0.14.26 (June 5, 2022)

Expand Down
6 changes: 6 additions & 0 deletions src/tooling/piral-cli-webpack/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
} from 'piral-cli';

export const debugPiral: DebugPiralBundlerDefinition = {
flags(argv) {
return argv
.number('hmr-port')
.describe('hmr-port', 'Sets the port to be used for HMR for reloading the application.')
.default('hmr-port', 62123);
},
path: resolve(__dirname, 'webpack', 'piral.js'),
};

Expand Down
3 changes: 2 additions & 1 deletion src/tooling/piral-cli-webpack/src/webpack/piral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ async function getConfig(

const handler: PiralBuildHandler = {
async create(options) {
const hmrPort = options.hmr ? await getFreePort(62123) : 0;
const { 'hmr-port': defaultHmrPort = 62123 } = options.args._;
const hmrPort = options.hmr ? await getFreePort(defaultHmrPort) : 0;
const otherConfigPath = resolve(options.root, defaultWebpackConfig);
const baseConfig = await getConfig(
options.entryFiles,
Expand Down
6 changes: 6 additions & 0 deletions src/tooling/piral-cli-webpack5/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
} from 'piral-cli';

export const debugPiral: DebugPiralBundlerDefinition = {
flags(argv) {
return argv
.number('hmr-port')
.describe('hmr-port', 'Sets the port to be used for HMR for reloading the application.')
.default('hmr-port', 62123);
},
path: resolve(__dirname, 'webpack', 'piral.js'),
};

Expand Down
3 changes: 2 additions & 1 deletion src/tooling/piral-cli-webpack5/src/webpack/piral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ async function getConfig(

const handler: PiralBuildHandler = {
async create(options) {
const { 'hmr-port': defaultHmrPort = 62123 } = options.args._;
const hmrPort = options.hmr ? await getFreePort(defaultHmrPort) : 0;
const otherConfigPath = resolve(options.root, defaultWebpackConfig);
const hmrPort = options.hmr ? await getFreePort(62123) : 0;
const baseConfig = await getConfig(
options.entryFiles,
options.outDir,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10702,10 +10702,10 @@ kras-management-portal@^0.13.0:
resolved "https://registry.yarnpkg.com/kras-management-portal/-/kras-management-portal-0.13.0.tgz#550f2797fce399529897aaa871030644d96812c1"
integrity sha512-NjjXTHKcJ/ECkz03L/HQSUVnkuzZkEV2mwcex36lxJNNwiUrYM5Ju0toAjhLnf8Zpc3nLEPnWKmoTwpSgGim2A==

kras@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/kras/-/kras-0.14.0.tgz#13e356cb0018dc2501a79e4d1c9124a29b03a1fb"
integrity sha512-tETQOwFEkeLF9v5iYHTYyfL7j/npAU6C6epG7/4pc0ZBEtmyIZ6M/WKSwO5sM05gLm0PoigjlMcOCtainmsAxQ==
kras@^0.14.1:
version "0.14.1"
resolved "https://registry.yarnpkg.com/kras/-/kras-0.14.1.tgz#9ab5ac9984096a2bd33cd999cb745606d06fb28f"
integrity sha512-KvutZGH2DdghNvUFoqwfzWrUmnu3//7gt45Kbh+JbSiWS15iffNvp4L6kucKY9bH01TcxQhSSfEnGI78XqXn/A==
dependencies:
kras-management-portal "^0.13.0"
yargs "^15.4.1"
Expand Down

0 comments on commit a727ace

Please sign in to comment.