Skip to content

Commit

Permalink
feat: Added reload delay setting
Browse files Browse the repository at this point in the history
  • Loading branch information
hayes committed Mar 20, 2021
1 parent d6ba1ed commit f09af05
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## [1.3.6](https://github.com/hayes0724/shopify-packer/compare/1.3.5...1.3.6) (2021-03-20)


### :memo: Documentation

* changed docusaurus.config.js ([4755789](https://github.com/hayes0724/shopify-packer/commit/4755789c12cd7359fcd832c54a01882d6172ea40))
* changed docusaurus.config.js again ([d6ba1ed](https://github.com/hayes0724/shopify-packer/commit/d6ba1edc116b63d0ceade781c7bcfab0c19c1e4d))
* documentation website ([b5ab20f](https://github.com/hayes0724/shopify-packer/commit/b5ab20fbdc758a42812ad03d216e9c39e87a9014))
* fixed broken links ([f6f4a9e](https://github.com/hayes0724/shopify-packer/commit/f6f4a9e15d81c4561f36310b0045d7bfce23b7d1))


### :sparkles: Features

* Added reload delay setting ([3ef3b40](https://github.com/hayes0724/shopify-packer/commit/3ef3b408c6e24ba244f811443d4a5e97c256b904))



## [1.3.5](https://github.com/hayes0724/shopify-packer/compare/1.3.4...1.3.5) (2021-01-13)


Expand Down
9 changes: 2 additions & 7 deletions cli/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ const figures = require('figures');
const ora = require('ora');
const ip = require('ip');
const consoleControl = require('console-control-strings');
const clearConsole = require('../../src/utilities/clear-console');

const AssetServer = require('../../src/server/asset');
const DevServer = require('../../src/server/dev');
const webpackConfig = require('../../src/webpack/config/dev.config');
const getAvailablePortSeries = require('../../src/utilities/get-available-port-series');
const promptContinueIfPublishedTheme = require('../../src/server/prompts/continue-if-published-theme');
const promptSkipSettingsData = require('../../src/server/prompts/skip-settings-data');

const {
getStoreValue,
getThemeIdValue,
assign,
} = require('../../src/env');
const {getStoreValue, getThemeIdValue, assign} = require('../../src/env');
const PackerConfig = require('../../src/config');
const config = new PackerConfig(require('../../packer.schema'));

Expand Down
4 changes: 4 additions & 0 deletions docs/docs/config/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module.exports = {
'network.ipAddress': '192.168.1.1',
'network.external': '',
'network.interface': '',
// Add a reload delay before refreshing browser in ms, Shopify may need several seconds
'network.reload': 0,
// Add additional entrypoint
'entrypoints': {},
}
Expand Down Expand Up @@ -179,5 +181,7 @@ module.exports = {
'network.ip': '',
'network.external': '',
'network.interface': '',
// Add a reload delay before refreshing browser
'network.reload': '',
};
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hayes0724/shopify-packer",
"version": "1.3.5",
"version": "1.3.6",
"bin": {
"packer": "cli/index.js"
},
Expand Down
1 change: 1 addition & 0 deletions packer.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ module.exports = {
'network.ip': '',
'network.external': '',
'network.interface': '',
'network.reload': 0,
};
11 changes: 7 additions & 4 deletions src/server/asset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ module.exports = class AssetServer {
}

_onAfterSync(files) {
this.app.webpackHotMiddleware.publish({
action: 'shopify_upload_finished',
force: files.length > 0,
});
const _syncHandler = () => {
this.app.webpackHotMiddleware.publish({
action: 'shopify_upload_finished',
force: files.length > 0,
});
};
setTimeout(_syncHandler, parseInt(config.get('network.reload')));
}

_isChunk(key, chunks) {
Expand Down

0 comments on commit f09af05

Please sign in to comment.