@vixoniccom/module-packager 2.4.2 → 2.4.3-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +3 -3
- package/.eslintrc +2 -2
- package/CHANGELOG.md +90 -83
- package/electron.js +45 -45
- package/index.html +64 -64
- package/main.js +182 -182
- package/package.json +18 -17
- package/tsconfig.json +15 -15
- package/webpack.config.js +162 -162
package/.babelrc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": ["env", "react"]
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"presets": ["env", "react"]
|
|
3
|
+
}
|
package/.eslintrc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["standard", "standard-react"]
|
|
1
|
+
{
|
|
2
|
+
"extends": ["standard", "standard-react"]
|
|
3
3
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,91 +1,98 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.4.3-dev.0](https://gitlab.com/mandomedio/vixonic/module-packager/compare/v2.4.2...v2.4.3-dev.0) (2021-08-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **release:** typescript and electron were upgrated to v4 and also new vixoniccom dependencies versions were applied ([be351e6](https://gitlab.com/mandomedio/vixonic/module-packager/commit/be351e6efd18458180032148c24cd6be4741397f))
|
|
11
|
+
|
|
5
12
|
<a name="2.4.2"></a>
|
|
6
13
|
## 2.4.2 (2019-07-11)
|
|
7
14
|
|
|
8
15
|
|
|
9
16
|
|
|
10
|
-
<a name="2.4.0"></a>
|
|
11
|
-
# [2.4.0](https://bitbucket.org/vixonicmodules/module-packager/compare/v2.3.1...v2.4.0) (2019-06-14)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Features
|
|
15
|
-
|
|
16
|
-
* added transpileOnly and tsOverride options ([a7227de](https://bitbucket.org/vixonicmodules/module-packager/commits/a7227de))
|
|
17
|
-
* update typescript ([95f7b64](https://bitbucket.org/vixonicmodules/module-packager/commits/95f7b64))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<a name="2.3.1"></a>
|
|
22
|
-
## [2.3.1](https://bitbucket.org/vixonicmodules/module-packager/compare/v2.3.0...v2.3.1) (2018-11-07)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<a name="2.3.0"></a>
|
|
27
|
-
# 2.3.0 (2018-09-24)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Bug Fixes
|
|
31
|
-
|
|
32
|
-
* conflicts resolved ([ab8264e](https://bitbucket.org/vixonicmodules/module-packager/commits/ab8264e))
|
|
33
|
-
* escaped downloadsPath in windows. ([11347b8](https://bitbucket.org/vixonicmodules/module-packager/commits/11347b8))
|
|
34
|
-
* externals not working with npm 3. ([6ad554a](https://bitbucket.org/vixonicmodules/module-packager/commits/6ad554a))
|
|
35
|
-
* merge conflict ([2829371](https://bitbucket.org/vixonicmodules/module-packager/commits/2829371))
|
|
36
|
-
* merge duplicated node property ([abc0232](https://bitbucket.org/vixonicmodules/module-packager/commits/abc0232))
|
|
37
|
-
* missing dependencies and default tsconfig modules mode set to es2015 ([12cbc21](https://bitbucket.org/vixonicmodules/module-packager/commits/12cbc21))
|
|
38
|
-
* package-lock error ([8c7f54c](https://bitbucket.org/vixonicmodules/module-packager/commits/8c7f54c))
|
|
39
|
-
* prevent installing externals if target is not electron-renderer ([49aa362](https://bitbucket.org/vixonicmodules/module-packager/commits/49aa362))
|
|
40
|
-
* ts-node configuration chechJs set to false ([648b0a8](https://bitbucket.org/vixonicmodules/module-packager/commits/648b0a8))
|
|
41
|
-
* updated dependencies ([bbc7c20](https://bitbucket.org/vixonicmodules/module-packager/commits/bbc7c20))
|
|
42
|
-
* watch paths not relative to filesystem. ([f91d680](https://bitbucket.org/vixonicmodules/module-packager/commits/f91d680))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### Features
|
|
46
|
-
|
|
47
|
-
* added babel env and polyfill. ([95c8a8a](https://bitbucket.org/vixonicmodules/module-packager/commits/95c8a8a))
|
|
48
|
-
* added default tsconfig. ([64c85a4](https://bitbucket.org/vixonicmodules/module-packager/commits/64c85a4))
|
|
49
|
-
* added target as an option. ([8a0ea52](https://bitbucket.org/vixonicmodules/module-packager/commits/8a0ea52))
|
|
50
|
-
* added typescript loader and changed to webpack 2. ([651d805](https://bitbucket.org/vixonicmodules/module-packager/commits/651d805))
|
|
51
|
-
* added typescript loader. ([5b3eddf](https://bitbucket.org/vixonicmodules/module-packager/commits/5b3eddf))
|
|
52
|
-
* added vixonic modules definition. ([de80168](https://bitbucket.org/vixonicmodules/module-packager/commits/de80168))
|
|
53
|
-
* added web mode to generate Android compatible apps. ([80431a9](https://bitbucket.org/vixonicmodules/module-packager/commits/80431a9))
|
|
54
|
-
* duration calculation ([19175f6](https://bitbucket.org/vixonicmodules/module-packager/commits/19175f6))
|
|
55
|
-
* electron 2.0.2 + vixonic modules 1.1.0 ([dcd6b67](https://bitbucket.org/vixonicmodules/module-packager/commits/dcd6b67))
|
|
56
|
-
* tsx support and hot loading ([dc6c03e](https://bitbucket.org/vixonicmodules/module-packager/commits/dc6c03e))
|
|
57
|
-
* updated [@vixonic](https://bitbucket.org/vixonic)/modules dependency ([dc92913](https://bitbucket.org/vixonicmodules/module-packager/commits/dc92913))
|
|
58
|
-
* upgrade module-controler dependency ([8502347](https://bitbucket.org/vixonicmodules/module-packager/commits/8502347))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<a name="2.2.0"></a>
|
|
63
|
-
# 2.2.0 (2018-08-22)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Bug Fixes
|
|
67
|
-
|
|
68
|
-
* conflicts resolved ([ab8264e](https://bitbucket.org/vixonicmodules/module-packager/commits/ab8264e))
|
|
69
|
-
* escaped downloadsPath in windows. ([11347b8](https://bitbucket.org/vixonicmodules/module-packager/commits/11347b8))
|
|
70
|
-
* externals not working with npm 3. ([6ad554a](https://bitbucket.org/vixonicmodules/module-packager/commits/6ad554a))
|
|
71
|
-
* merge conflict ([2829371](https://bitbucket.org/vixonicmodules/module-packager/commits/2829371))
|
|
72
|
-
* merge duplicated node property ([abc0232](https://bitbucket.org/vixonicmodules/module-packager/commits/abc0232))
|
|
73
|
-
* missing dependencies and default tsconfig modules mode set to es2015 ([12cbc21](https://bitbucket.org/vixonicmodules/module-packager/commits/12cbc21))
|
|
74
|
-
* package-lock error ([8c7f54c](https://bitbucket.org/vixonicmodules/module-packager/commits/8c7f54c))
|
|
75
|
-
* prevent installing externals if target is not electron-renderer ([49aa362](https://bitbucket.org/vixonicmodules/module-packager/commits/49aa362))
|
|
76
|
-
* updated dependencies ([bbc7c20](https://bitbucket.org/vixonicmodules/module-packager/commits/bbc7c20))
|
|
77
|
-
* watch paths not relative to filesystem. ([f91d680](https://bitbucket.org/vixonicmodules/module-packager/commits/f91d680))
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Features
|
|
81
|
-
|
|
82
|
-
* added babel env and polyfill. ([95c8a8a](https://bitbucket.org/vixonicmodules/module-packager/commits/95c8a8a))
|
|
83
|
-
* added default tsconfig. ([64c85a4](https://bitbucket.org/vixonicmodules/module-packager/commits/64c85a4))
|
|
84
|
-
* added target as an option. ([8a0ea52](https://bitbucket.org/vixonicmodules/module-packager/commits/8a0ea52))
|
|
85
|
-
* added typescript loader and changed to webpack 2. ([651d805](https://bitbucket.org/vixonicmodules/module-packager/commits/651d805))
|
|
86
|
-
* added typescript loader. ([5b3eddf](https://bitbucket.org/vixonicmodules/module-packager/commits/5b3eddf))
|
|
87
|
-
* added vixonic modules definition. ([de80168](https://bitbucket.org/vixonicmodules/module-packager/commits/de80168))
|
|
88
|
-
* added web mode to generate Android compatible apps. ([80431a9](https://bitbucket.org/vixonicmodules/module-packager/commits/80431a9))
|
|
89
|
-
* electron 2.0.2 + vixonic modules 1.1.0 ([dcd6b67](https://bitbucket.org/vixonicmodules/module-packager/commits/dcd6b67))
|
|
90
|
-
* tsx support and hot loading ([dc6c03e](https://bitbucket.org/vixonicmodules/module-packager/commits/dc6c03e))
|
|
91
|
-
* upgrade module-controler dependency ([8502347](https://bitbucket.org/vixonicmodules/module-packager/commits/8502347))
|
|
17
|
+
<a name="2.4.0"></a>
|
|
18
|
+
# [2.4.0](https://bitbucket.org/vixonicmodules/module-packager/compare/v2.3.1...v2.4.0) (2019-06-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* added transpileOnly and tsOverride options ([a7227de](https://bitbucket.org/vixonicmodules/module-packager/commits/a7227de))
|
|
24
|
+
* update typescript ([95f7b64](https://bitbucket.org/vixonicmodules/module-packager/commits/95f7b64))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
<a name="2.3.1"></a>
|
|
29
|
+
## [2.3.1](https://bitbucket.org/vixonicmodules/module-packager/compare/v2.3.0...v2.3.1) (2018-11-07)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<a name="2.3.0"></a>
|
|
34
|
+
# 2.3.0 (2018-09-24)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* conflicts resolved ([ab8264e](https://bitbucket.org/vixonicmodules/module-packager/commits/ab8264e))
|
|
40
|
+
* escaped downloadsPath in windows. ([11347b8](https://bitbucket.org/vixonicmodules/module-packager/commits/11347b8))
|
|
41
|
+
* externals not working with npm 3. ([6ad554a](https://bitbucket.org/vixonicmodules/module-packager/commits/6ad554a))
|
|
42
|
+
* merge conflict ([2829371](https://bitbucket.org/vixonicmodules/module-packager/commits/2829371))
|
|
43
|
+
* merge duplicated node property ([abc0232](https://bitbucket.org/vixonicmodules/module-packager/commits/abc0232))
|
|
44
|
+
* missing dependencies and default tsconfig modules mode set to es2015 ([12cbc21](https://bitbucket.org/vixonicmodules/module-packager/commits/12cbc21))
|
|
45
|
+
* package-lock error ([8c7f54c](https://bitbucket.org/vixonicmodules/module-packager/commits/8c7f54c))
|
|
46
|
+
* prevent installing externals if target is not electron-renderer ([49aa362](https://bitbucket.org/vixonicmodules/module-packager/commits/49aa362))
|
|
47
|
+
* ts-node configuration chechJs set to false ([648b0a8](https://bitbucket.org/vixonicmodules/module-packager/commits/648b0a8))
|
|
48
|
+
* updated dependencies ([bbc7c20](https://bitbucket.org/vixonicmodules/module-packager/commits/bbc7c20))
|
|
49
|
+
* watch paths not relative to filesystem. ([f91d680](https://bitbucket.org/vixonicmodules/module-packager/commits/f91d680))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* added babel env and polyfill. ([95c8a8a](https://bitbucket.org/vixonicmodules/module-packager/commits/95c8a8a))
|
|
55
|
+
* added default tsconfig. ([64c85a4](https://bitbucket.org/vixonicmodules/module-packager/commits/64c85a4))
|
|
56
|
+
* added target as an option. ([8a0ea52](https://bitbucket.org/vixonicmodules/module-packager/commits/8a0ea52))
|
|
57
|
+
* added typescript loader and changed to webpack 2. ([651d805](https://bitbucket.org/vixonicmodules/module-packager/commits/651d805))
|
|
58
|
+
* added typescript loader. ([5b3eddf](https://bitbucket.org/vixonicmodules/module-packager/commits/5b3eddf))
|
|
59
|
+
* added vixonic modules definition. ([de80168](https://bitbucket.org/vixonicmodules/module-packager/commits/de80168))
|
|
60
|
+
* added web mode to generate Android compatible apps. ([80431a9](https://bitbucket.org/vixonicmodules/module-packager/commits/80431a9))
|
|
61
|
+
* duration calculation ([19175f6](https://bitbucket.org/vixonicmodules/module-packager/commits/19175f6))
|
|
62
|
+
* electron 2.0.2 + vixonic modules 1.1.0 ([dcd6b67](https://bitbucket.org/vixonicmodules/module-packager/commits/dcd6b67))
|
|
63
|
+
* tsx support and hot loading ([dc6c03e](https://bitbucket.org/vixonicmodules/module-packager/commits/dc6c03e))
|
|
64
|
+
* updated [@vixonic](https://bitbucket.org/vixonic)/modules dependency ([dc92913](https://bitbucket.org/vixonicmodules/module-packager/commits/dc92913))
|
|
65
|
+
* upgrade module-controler dependency ([8502347](https://bitbucket.org/vixonicmodules/module-packager/commits/8502347))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
<a name="2.2.0"></a>
|
|
70
|
+
# 2.2.0 (2018-08-22)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Bug Fixes
|
|
74
|
+
|
|
75
|
+
* conflicts resolved ([ab8264e](https://bitbucket.org/vixonicmodules/module-packager/commits/ab8264e))
|
|
76
|
+
* escaped downloadsPath in windows. ([11347b8](https://bitbucket.org/vixonicmodules/module-packager/commits/11347b8))
|
|
77
|
+
* externals not working with npm 3. ([6ad554a](https://bitbucket.org/vixonicmodules/module-packager/commits/6ad554a))
|
|
78
|
+
* merge conflict ([2829371](https://bitbucket.org/vixonicmodules/module-packager/commits/2829371))
|
|
79
|
+
* merge duplicated node property ([abc0232](https://bitbucket.org/vixonicmodules/module-packager/commits/abc0232))
|
|
80
|
+
* missing dependencies and default tsconfig modules mode set to es2015 ([12cbc21](https://bitbucket.org/vixonicmodules/module-packager/commits/12cbc21))
|
|
81
|
+
* package-lock error ([8c7f54c](https://bitbucket.org/vixonicmodules/module-packager/commits/8c7f54c))
|
|
82
|
+
* prevent installing externals if target is not electron-renderer ([49aa362](https://bitbucket.org/vixonicmodules/module-packager/commits/49aa362))
|
|
83
|
+
* updated dependencies ([bbc7c20](https://bitbucket.org/vixonicmodules/module-packager/commits/bbc7c20))
|
|
84
|
+
* watch paths not relative to filesystem. ([f91d680](https://bitbucket.org/vixonicmodules/module-packager/commits/f91d680))
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### Features
|
|
88
|
+
|
|
89
|
+
* added babel env and polyfill. ([95c8a8a](https://bitbucket.org/vixonicmodules/module-packager/commits/95c8a8a))
|
|
90
|
+
* added default tsconfig. ([64c85a4](https://bitbucket.org/vixonicmodules/module-packager/commits/64c85a4))
|
|
91
|
+
* added target as an option. ([8a0ea52](https://bitbucket.org/vixonicmodules/module-packager/commits/8a0ea52))
|
|
92
|
+
* added typescript loader and changed to webpack 2. ([651d805](https://bitbucket.org/vixonicmodules/module-packager/commits/651d805))
|
|
93
|
+
* added typescript loader. ([5b3eddf](https://bitbucket.org/vixonicmodules/module-packager/commits/5b3eddf))
|
|
94
|
+
* added vixonic modules definition. ([de80168](https://bitbucket.org/vixonicmodules/module-packager/commits/de80168))
|
|
95
|
+
* added web mode to generate Android compatible apps. ([80431a9](https://bitbucket.org/vixonicmodules/module-packager/commits/80431a9))
|
|
96
|
+
* electron 2.0.2 + vixonic modules 1.1.0 ([dcd6b67](https://bitbucket.org/vixonicmodules/module-packager/commits/dcd6b67))
|
|
97
|
+
* tsx support and hot loading ([dc6c03e](https://bitbucket.org/vixonicmodules/module-packager/commits/dc6c03e))
|
|
98
|
+
* upgrade module-controler dependency ([8502347](https://bitbucket.org/vixonicmodules/module-packager/commits/8502347))
|
package/electron.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const { app, BrowserWindow } = require('electron')
|
|
3
|
-
|
|
4
|
-
let mainWindow = null
|
|
5
|
-
|
|
6
|
-
const path = require('path')
|
|
7
|
-
const commandLineArgs = require('command-line-args')
|
|
8
|
-
const optionDefinitions = [
|
|
9
|
-
{ name: 'externals', type: String, defaultValue: [], multiple: true },
|
|
10
|
-
{ name: 'src', type: String, defaultValue: '../../src' },
|
|
11
|
-
{ name: 'build', type: String, defaultValue: '../../build' },
|
|
12
|
-
{ name: 'config', type: String, defaultValue: './webpack.config.js' },
|
|
13
|
-
{ name: 'port', type: Number, defaultValue: 8080 },
|
|
14
|
-
{ name: 'mode', type: String, defaultValue: 'build' }
|
|
15
|
-
]
|
|
16
|
-
const options = commandLineArgs(optionDefinitions)
|
|
17
|
-
|
|
18
|
-
if (options.mode === 'watch') {
|
|
19
|
-
require('electron-debug')()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
app.on('window-all-closed', () => {
|
|
23
|
-
app.quit()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
app.on('ready', () => {
|
|
27
|
-
mainWindow = new BrowserWindow({
|
|
28
|
-
show: false,
|
|
29
|
-
width: 600,
|
|
30
|
-
height: 400,
|
|
31
|
-
webPreferences: {
|
|
32
|
-
webSecurity: false
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
mainWindow.loadURL(`file://${path.join(__dirname, 'index.html')}`)
|
|
37
|
-
|
|
38
|
-
mainWindow.webContents.on('did-finish-load', () => {
|
|
39
|
-
mainWindow.webContents.send('init', options)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
mainWindow.on('closed', () => {
|
|
43
|
-
mainWindow = null
|
|
44
|
-
})
|
|
45
|
-
})
|
|
1
|
+
'use strict'
|
|
2
|
+
const { app, BrowserWindow } = require('electron')
|
|
3
|
+
|
|
4
|
+
let mainWindow = null
|
|
5
|
+
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const commandLineArgs = require('command-line-args')
|
|
8
|
+
const optionDefinitions = [
|
|
9
|
+
{ name: 'externals', type: String, defaultValue: [], multiple: true },
|
|
10
|
+
{ name: 'src', type: String, defaultValue: '../../src' },
|
|
11
|
+
{ name: 'build', type: String, defaultValue: '../../build' },
|
|
12
|
+
{ name: 'config', type: String, defaultValue: './webpack.config.js' },
|
|
13
|
+
{ name: 'port', type: Number, defaultValue: 8080 },
|
|
14
|
+
{ name: 'mode', type: String, defaultValue: 'build' }
|
|
15
|
+
]
|
|
16
|
+
const options = commandLineArgs(optionDefinitions)
|
|
17
|
+
|
|
18
|
+
if (options.mode === 'watch') {
|
|
19
|
+
require('electron-debug')()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
app.on('window-all-closed', () => {
|
|
23
|
+
app.quit()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
app.on('ready', () => {
|
|
27
|
+
mainWindow = new BrowserWindow({
|
|
28
|
+
show: false,
|
|
29
|
+
width: 600,
|
|
30
|
+
height: 400,
|
|
31
|
+
webPreferences: {
|
|
32
|
+
webSecurity: false
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
mainWindow.loadURL(`file://${path.join(__dirname, 'index.html')}`)
|
|
37
|
+
|
|
38
|
+
mainWindow.webContents.on('did-finish-load', () => {
|
|
39
|
+
mainWindow.webContents.send('init', options)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
mainWindow.on('closed', () => {
|
|
43
|
+
mainWindow = null
|
|
44
|
+
})
|
|
45
|
+
})
|
package/index.html
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
|
3
|
-
<head>
|
|
4
|
-
<title></title>
|
|
5
|
-
</head>
|
|
6
|
-
<body style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
|
7
|
-
<webview style="width: 100%; height: 100%; margin: 0; padding: 0;" id="webview" autosize nodeintegration plugins disablewebsecurity></webview>
|
|
8
|
-
<script type="text/javascript">
|
|
9
|
-
const path = require('path')
|
|
10
|
-
const ModuleController = require('@vixoniccom/module-controller')
|
|
11
|
-
const { ipcRenderer, remote } = require('electron')
|
|
12
|
-
|
|
13
|
-
ipcRenderer.on('init', (event, options) => {
|
|
14
|
-
let webview = document.getElementById('webview')
|
|
15
|
-
let win = remote.getCurrentWindow()
|
|
16
|
-
|
|
17
|
-
webview.addEventListener('did-finish-load', () => {
|
|
18
|
-
win.show()
|
|
19
|
-
win.focus()
|
|
20
|
-
})
|
|
21
|
-
webview.src = options.mode === 'watch' ? `http://localhost:${options.port}/index.html` : `file://${path.join(options.build, 'index.html')}`
|
|
22
|
-
|
|
23
|
-
function getData () {
|
|
24
|
-
let data = {}
|
|
25
|
-
try {
|
|
26
|
-
data.parameters = require(path.join(options.src, '/test/parameters.json')).parameters
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.log('No parameters.')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
|
|
32
|
-
|
|
33
|
-
// Add file:// to watch because in this mode the app will be in a localhost hosted environment.
|
|
34
|
-
if (options.mode === 'watch') escaped = `file://${escaped}`
|
|
35
|
-
escaped = escaped.replace(/\\/g, '/')
|
|
36
|
-
|
|
37
|
-
data.downloadsPath = escaped
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
data.services = require(path.join(options.src, '/test/services.json')).services
|
|
41
|
-
console.log(data.services)
|
|
42
|
-
} catch (err) {
|
|
43
|
-
console.log('No services.')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return data
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getSchema () {
|
|
50
|
-
let data = {}
|
|
51
|
-
try {
|
|
52
|
-
data = require(path.join(options.src, '../configuration.json')).schema
|
|
53
|
-
} catch (err) {
|
|
54
|
-
console.log('No schema.')
|
|
55
|
-
}
|
|
56
|
-
return data
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
ModuleController.init(win, webview, getData(), getSchema(), options.mode === 'watch')
|
|
60
|
-
})
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
</body>
|
|
64
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
|
3
|
+
<head>
|
|
4
|
+
<title></title>
|
|
5
|
+
</head>
|
|
6
|
+
<body style="width: 100%; height: 100%; margin: 0; padding: 0;">
|
|
7
|
+
<webview style="width: 100%; height: 100%; margin: 0; padding: 0;" id="webview" autosize nodeintegration plugins disablewebsecurity></webview>
|
|
8
|
+
<script type="text/javascript">
|
|
9
|
+
const path = require('path')
|
|
10
|
+
const ModuleController = require('@vixoniccom/module-controller')
|
|
11
|
+
const { ipcRenderer, remote } = require('electron')
|
|
12
|
+
|
|
13
|
+
ipcRenderer.on('init', (event, options) => {
|
|
14
|
+
let webview = document.getElementById('webview')
|
|
15
|
+
let win = remote.getCurrentWindow()
|
|
16
|
+
|
|
17
|
+
webview.addEventListener('did-finish-load', () => {
|
|
18
|
+
win.show()
|
|
19
|
+
win.focus()
|
|
20
|
+
})
|
|
21
|
+
webview.src = options.mode === 'watch' ? `http://localhost:${options.port}/index.html` : `file://${path.join(options.build, 'index.html')}`
|
|
22
|
+
|
|
23
|
+
function getData () {
|
|
24
|
+
let data = {}
|
|
25
|
+
try {
|
|
26
|
+
data.parameters = require(path.join(options.src, '/test/parameters.json')).parameters
|
|
27
|
+
} catch (err) {
|
|
28
|
+
console.log('No parameters.')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
|
|
32
|
+
|
|
33
|
+
// Add file:// to watch because in this mode the app will be in a localhost hosted environment.
|
|
34
|
+
if (options.mode === 'watch') escaped = `file://${escaped}`
|
|
35
|
+
escaped = escaped.replace(/\\/g, '/')
|
|
36
|
+
|
|
37
|
+
data.downloadsPath = escaped
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
data.services = require(path.join(options.src, '/test/services.json')).services
|
|
41
|
+
console.log(data.services)
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.log('No services.')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return data
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getSchema () {
|
|
50
|
+
let data = {}
|
|
51
|
+
try {
|
|
52
|
+
data = require(path.join(options.src, '../configuration.json')).schema
|
|
53
|
+
} catch (err) {
|
|
54
|
+
console.log('No schema.')
|
|
55
|
+
}
|
|
56
|
+
return data
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ModuleController.init(win, webview, getData(), getSchema(), options.mode === 'watch')
|
|
60
|
+
})
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
</body>
|
|
64
|
+
</html>
|
package/main.js
CHANGED
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
'use strict'
|
|
4
|
-
const commandLineArgs = require('command-line-args')
|
|
5
|
-
const optionDefinitions = [
|
|
6
|
-
{ name: 'externals', type: String, defaultValue: [], multiple: true },
|
|
7
|
-
{ name: 'target', type: String, defaultValue: 'web' },
|
|
8
|
-
{ name: 'src', type: String, defaultValue: './src' },
|
|
9
|
-
{ name: 'build', type: String, defaultValue: './build' },
|
|
10
|
-
{ name: 'confDefinition', type: String, defaultValue: './configuration' },
|
|
11
|
-
{ name: 'config', type: String, defaultValue: './webpack.config.js' },
|
|
12
|
-
{ name: 'port', type: Number, defaultValue: 8080 },
|
|
13
|
-
{ name: 'mode', type: String, defaultValue: 'build' },
|
|
14
|
-
{ name: 'transpileOnly', type: Boolean },
|
|
15
|
-
{ name: 'tsOverride', type: Boolean }
|
|
16
|
-
]
|
|
17
|
-
const options = commandLineArgs(optionDefinitions)
|
|
18
|
-
const path = require('path')
|
|
19
|
-
const webpack = require('webpack')
|
|
20
|
-
const WebpackDevServer = require('webpack-dev-server')
|
|
21
|
-
const { exec } = require('child_process')
|
|
22
|
-
const fs = require('fs')
|
|
23
|
-
const archiver = require('archiver')
|
|
24
|
-
const clc = require('cli-color')
|
|
25
|
-
|
|
26
|
-
var pjson = require('./package.json')
|
|
27
|
-
console.log(`VIXONIC PACKAGER: Version ${pjson.version}`)
|
|
28
|
-
|
|
29
|
-
if (options.target !== 'electron-renderer' && options.externals.length > 0) {
|
|
30
|
-
throw new Error(`Can't use external dependencies if target is not electron-renderer.`)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (options.mode === 'build') {
|
|
34
|
-
pack(() => {
|
|
35
|
-
// Install externals only if not web.
|
|
36
|
-
if (options.target === 'electron-renderer') {
|
|
37
|
-
installExternals(() => {
|
|
38
|
-
zip()
|
|
39
|
-
})
|
|
40
|
-
} else {
|
|
41
|
-
zip()
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
} else if (options.mode === 'watch') {
|
|
45
|
-
watch()
|
|
46
|
-
} else if (options.mode === 'run') {
|
|
47
|
-
run()
|
|
48
|
-
} else if (options.mode === 'generate-configuration') {
|
|
49
|
-
generateConfiguration()
|
|
50
|
-
} else if (options.mode === 'validate-configuration') {
|
|
51
|
-
validateConfiguration()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function pack (callback) {
|
|
55
|
-
console.log(clc.blue('Building module...'))
|
|
56
|
-
validateConfiguration()
|
|
57
|
-
webpack(require(options.config)(options), function (err, stats) {
|
|
58
|
-
if (err) {
|
|
59
|
-
console.log(err)
|
|
60
|
-
throw err
|
|
61
|
-
} else {
|
|
62
|
-
if (stats.hasErrors()) {
|
|
63
|
-
console.log(clc.red(stats.toJson('errors-only')))
|
|
64
|
-
callback && callback(stats)
|
|
65
|
-
} else {
|
|
66
|
-
console.log(clc.green('Build OK.'))
|
|
67
|
-
callback && callback(null)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function installExternals (callback) {
|
|
74
|
-
// Get external versions.
|
|
75
|
-
let externals = options.externals.map(x => {
|
|
76
|
-
return `${x}@${JSON.parse(fs.readFileSync(path.resolve(options.src, '..', 'node_modules', x, 'package.json'))).version}`
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
// Install external versions.
|
|
80
|
-
if (externals.length) {
|
|
81
|
-
externals = externals.join(' ')
|
|
82
|
-
console.log(clc.blue(`Installing externals ${externals}...`))
|
|
83
|
-
exec(`npm install --prefix ./ --production ${externals}`, {
|
|
84
|
-
cwd: options.build
|
|
85
|
-
},
|
|
86
|
-
(err, stdout) => {
|
|
87
|
-
if (err) throw err
|
|
88
|
-
console.log(clc.green('Externals installed.'))
|
|
89
|
-
callback && callback(null)
|
|
90
|
-
})
|
|
91
|
-
} else {
|
|
92
|
-
callback && callback(null)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function zip (callback) {
|
|
97
|
-
console.log(clc.blue('Archiving...'))
|
|
98
|
-
let output = fs.createWriteStream(path.resolve(options.build, '../', 'build.zip'))
|
|
99
|
-
let archive = archiver('zip')
|
|
100
|
-
archive.pipe(output)
|
|
101
|
-
archive.directory(path.resolve(options.build), './')
|
|
102
|
-
archive.finalize()
|
|
103
|
-
|
|
104
|
-
output.on('close', function () {
|
|
105
|
-
console.log(clc.green('Generated build.zip.'))
|
|
106
|
-
callback && callback(null)
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
archive.on('error', function (err) {
|
|
110
|
-
throw err
|
|
111
|
-
})
|
|
112
|
-
clc.move(-2, 0)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function watch () {
|
|
116
|
-
var server = new WebpackDevServer(webpack(require(options.config)(options)), {
|
|
117
|
-
contentBase: path.join(__dirname, options.src, '..')
|
|
118
|
-
})
|
|
119
|
-
server.listen(options.port)
|
|
120
|
-
|
|
121
|
-
var environment = process.env
|
|
122
|
-
environment.NODE_ENV = 'development'
|
|
123
|
-
|
|
124
|
-
exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(options.src)} --build ${path.resolve(options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
|
|
125
|
-
{
|
|
126
|
-
cwd: __dirname,
|
|
127
|
-
env: environment
|
|
128
|
-
},
|
|
129
|
-
(err) => {
|
|
130
|
-
if (err) throw err
|
|
131
|
-
process.exit()
|
|
132
|
-
})
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function run () {
|
|
136
|
-
pack((err) => {
|
|
137
|
-
if (err) {
|
|
138
|
-
throw err
|
|
139
|
-
} else {
|
|
140
|
-
exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(options.src)} --build ${path.resolve(options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
|
|
141
|
-
{
|
|
142
|
-
cwd: __dirname
|
|
143
|
-
})
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function loadConfiguration () {
|
|
149
|
-
require('@vixoniccom/modules')
|
|
150
|
-
require('ts-node').register({compilerOptions: { moduleResolution: 'node', module: 'commonjs', target: 'es2015', checkJs: false }})
|
|
151
|
-
return require(path.resolve(options.confDefinition, 'index.ts')).configuration
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function generateConfiguration () {
|
|
155
|
-
try {
|
|
156
|
-
let configuration = loadConfiguration()
|
|
157
|
-
fs.writeFileSync(path.resolve(options.src, 'parameters.d.ts'), configuration.declarationFileString)
|
|
158
|
-
fs.writeFileSync(path.resolve(options.src, '..', 'configuration.json'), JSON.stringify(configuration, undefined, 2))
|
|
159
|
-
console.log(clc.green(`Configuration generated`))
|
|
160
|
-
} catch (e) {
|
|
161
|
-
console.log(clc.red('Configuration generation failed'))
|
|
162
|
-
throw e
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function validateConfiguration () {
|
|
167
|
-
try {
|
|
168
|
-
const { Configuration } = require('@vixoniccom/modules')
|
|
169
|
-
const json = require(path.resolve(options.src, '../', 'configuration.json'))
|
|
170
|
-
const conf = Configuration.fromJSON(json)
|
|
171
|
-
if (conf.durationFormula) {
|
|
172
|
-
const values = require(path.resolve(options.src, 'test', 'parameters.json'))
|
|
173
|
-
console.log('Validate duration')
|
|
174
|
-
console.log('Duration on undefined:', conf.getDuration({}), 'seconds')
|
|
175
|
-
console.log('Duration:', conf.getDuration(values.parameters), 'seconds')
|
|
176
|
-
}
|
|
177
|
-
console.log(clc.green('Valid configuration'))
|
|
178
|
-
} catch (e) {
|
|
179
|
-
console.log(clc.red('Invalid configuration'))
|
|
180
|
-
throw e
|
|
181
|
-
}
|
|
182
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict'
|
|
4
|
+
const commandLineArgs = require('command-line-args')
|
|
5
|
+
const optionDefinitions = [
|
|
6
|
+
{ name: 'externals', type: String, defaultValue: [], multiple: true },
|
|
7
|
+
{ name: 'target', type: String, defaultValue: 'web' },
|
|
8
|
+
{ name: 'src', type: String, defaultValue: './src' },
|
|
9
|
+
{ name: 'build', type: String, defaultValue: './build' },
|
|
10
|
+
{ name: 'confDefinition', type: String, defaultValue: './configuration' },
|
|
11
|
+
{ name: 'config', type: String, defaultValue: './webpack.config.js' },
|
|
12
|
+
{ name: 'port', type: Number, defaultValue: 8080 },
|
|
13
|
+
{ name: 'mode', type: String, defaultValue: 'build' },
|
|
14
|
+
{ name: 'transpileOnly', type: Boolean },
|
|
15
|
+
{ name: 'tsOverride', type: Boolean }
|
|
16
|
+
]
|
|
17
|
+
const options = commandLineArgs(optionDefinitions)
|
|
18
|
+
const path = require('path')
|
|
19
|
+
const webpack = require('webpack')
|
|
20
|
+
const WebpackDevServer = require('webpack-dev-server')
|
|
21
|
+
const { exec } = require('child_process')
|
|
22
|
+
const fs = require('fs')
|
|
23
|
+
const archiver = require('archiver')
|
|
24
|
+
const clc = require('cli-color')
|
|
25
|
+
|
|
26
|
+
var pjson = require('./package.json')
|
|
27
|
+
console.log(`VIXONIC PACKAGER: Version ${pjson.version}`)
|
|
28
|
+
|
|
29
|
+
if (options.target !== 'electron-renderer' && options.externals.length > 0) {
|
|
30
|
+
throw new Error(`Can't use external dependencies if target is not electron-renderer.`)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (options.mode === 'build') {
|
|
34
|
+
pack(() => {
|
|
35
|
+
// Install externals only if not web.
|
|
36
|
+
if (options.target === 'electron-renderer') {
|
|
37
|
+
installExternals(() => {
|
|
38
|
+
zip()
|
|
39
|
+
})
|
|
40
|
+
} else {
|
|
41
|
+
zip()
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
} else if (options.mode === 'watch') {
|
|
45
|
+
watch()
|
|
46
|
+
} else if (options.mode === 'run') {
|
|
47
|
+
run()
|
|
48
|
+
} else if (options.mode === 'generate-configuration') {
|
|
49
|
+
generateConfiguration()
|
|
50
|
+
} else if (options.mode === 'validate-configuration') {
|
|
51
|
+
validateConfiguration()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function pack (callback) {
|
|
55
|
+
console.log(clc.blue('Building module...'))
|
|
56
|
+
validateConfiguration()
|
|
57
|
+
webpack(require(options.config)(options), function (err, stats) {
|
|
58
|
+
if (err) {
|
|
59
|
+
console.log(err)
|
|
60
|
+
throw err
|
|
61
|
+
} else {
|
|
62
|
+
if (stats.hasErrors()) {
|
|
63
|
+
console.log(clc.red(stats.toJson('errors-only')))
|
|
64
|
+
callback && callback(stats)
|
|
65
|
+
} else {
|
|
66
|
+
console.log(clc.green('Build OK.'))
|
|
67
|
+
callback && callback(null)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function installExternals (callback) {
|
|
74
|
+
// Get external versions.
|
|
75
|
+
let externals = options.externals.map(x => {
|
|
76
|
+
return `${x}@${JSON.parse(fs.readFileSync(path.resolve(options.src, '..', 'node_modules', x, 'package.json'))).version}`
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
// Install external versions.
|
|
80
|
+
if (externals.length) {
|
|
81
|
+
externals = externals.join(' ')
|
|
82
|
+
console.log(clc.blue(`Installing externals ${externals}...`))
|
|
83
|
+
exec(`npm install --prefix ./ --production ${externals}`, {
|
|
84
|
+
cwd: options.build
|
|
85
|
+
},
|
|
86
|
+
(err, stdout) => {
|
|
87
|
+
if (err) throw err
|
|
88
|
+
console.log(clc.green('Externals installed.'))
|
|
89
|
+
callback && callback(null)
|
|
90
|
+
})
|
|
91
|
+
} else {
|
|
92
|
+
callback && callback(null)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function zip (callback) {
|
|
97
|
+
console.log(clc.blue('Archiving...'))
|
|
98
|
+
let output = fs.createWriteStream(path.resolve(options.build, '../', 'build.zip'))
|
|
99
|
+
let archive = archiver('zip')
|
|
100
|
+
archive.pipe(output)
|
|
101
|
+
archive.directory(path.resolve(options.build), './')
|
|
102
|
+
archive.finalize()
|
|
103
|
+
|
|
104
|
+
output.on('close', function () {
|
|
105
|
+
console.log(clc.green('Generated build.zip.'))
|
|
106
|
+
callback && callback(null)
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
archive.on('error', function (err) {
|
|
110
|
+
throw err
|
|
111
|
+
})
|
|
112
|
+
clc.move(-2, 0)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function watch () {
|
|
116
|
+
var server = new WebpackDevServer(webpack(require(options.config)(options)), {
|
|
117
|
+
contentBase: path.join(__dirname, options.src, '..')
|
|
118
|
+
})
|
|
119
|
+
server.listen(options.port)
|
|
120
|
+
|
|
121
|
+
var environment = process.env
|
|
122
|
+
environment.NODE_ENV = 'development'
|
|
123
|
+
|
|
124
|
+
exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(options.src)} --build ${path.resolve(options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
|
|
125
|
+
{
|
|
126
|
+
cwd: __dirname,
|
|
127
|
+
env: environment
|
|
128
|
+
},
|
|
129
|
+
(err) => {
|
|
130
|
+
if (err) throw err
|
|
131
|
+
process.exit()
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function run () {
|
|
136
|
+
pack((err) => {
|
|
137
|
+
if (err) {
|
|
138
|
+
throw err
|
|
139
|
+
} else {
|
|
140
|
+
exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(options.src)} --build ${path.resolve(options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
|
|
141
|
+
{
|
|
142
|
+
cwd: __dirname
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function loadConfiguration () {
|
|
149
|
+
require('@vixoniccom/modules')
|
|
150
|
+
require('ts-node').register({compilerOptions: { moduleResolution: 'node', module: 'commonjs', target: 'es2015', checkJs: false }})
|
|
151
|
+
return require(path.resolve(options.confDefinition, 'index.ts')).configuration
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function generateConfiguration () {
|
|
155
|
+
try {
|
|
156
|
+
let configuration = loadConfiguration()
|
|
157
|
+
fs.writeFileSync(path.resolve(options.src, 'parameters.d.ts'), configuration.declarationFileString)
|
|
158
|
+
fs.writeFileSync(path.resolve(options.src, '..', 'configuration.json'), JSON.stringify(configuration, undefined, 2))
|
|
159
|
+
console.log(clc.green(`Configuration generated`))
|
|
160
|
+
} catch (e) {
|
|
161
|
+
console.log(clc.red('Configuration generation failed'))
|
|
162
|
+
throw e
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function validateConfiguration () {
|
|
167
|
+
try {
|
|
168
|
+
const { Configuration } = require('@vixoniccom/modules')
|
|
169
|
+
const json = require(path.resolve(options.src, '../', 'configuration.json'))
|
|
170
|
+
const conf = Configuration.fromJSON(json)
|
|
171
|
+
if (conf.durationFormula) {
|
|
172
|
+
const values = require(path.resolve(options.src, 'test', 'parameters.json'))
|
|
173
|
+
console.log('Validate duration')
|
|
174
|
+
console.log('Duration on undefined:', conf.getDuration({}), 'seconds')
|
|
175
|
+
console.log('Duration:', conf.getDuration(values.parameters), 'seconds')
|
|
176
|
+
}
|
|
177
|
+
console.log(clc.green('Valid configuration'))
|
|
178
|
+
} catch (e) {
|
|
179
|
+
console.log(clc.red('Invalid configuration'))
|
|
180
|
+
throw e
|
|
181
|
+
}
|
|
182
|
+
}
|
package/package.json
CHANGED
|
@@ -51,33 +51,33 @@
|
|
|
51
51
|
"vixonic-module-packager": "main.js"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vixoniccom/module-controller": "^1.2.
|
|
55
|
-
"@vixoniccom/modules": "^2.
|
|
56
|
-
"archiver": "^1.
|
|
57
|
-
"awesome-typescript-loader": "^3.
|
|
58
|
-
"babel-core": "^6.
|
|
54
|
+
"@vixoniccom/module-controller": "^1.2.2-dev.0",
|
|
55
|
+
"@vixoniccom/modules": "^2.12.0-dev.1",
|
|
56
|
+
"archiver": "^3.1.1",
|
|
57
|
+
"awesome-typescript-loader": "^3.5.0",
|
|
58
|
+
"babel-core": "^6.26.3",
|
|
59
59
|
"babel-loader": "^6.2.5",
|
|
60
60
|
"babel-polyfill": "^6.26.0",
|
|
61
61
|
"babel-preset-env": "^1.7.0",
|
|
62
62
|
"babel-preset-react": "^6.24.1",
|
|
63
|
-
"clean-webpack-plugin": "^0.
|
|
64
|
-
"cli-color": "^
|
|
65
|
-
"command-line-args": "^
|
|
63
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
64
|
+
"cli-color": "^2.0.0",
|
|
65
|
+
"command-line-args": "^5.2.0",
|
|
66
66
|
"copy-webpack-plugin": "^3.0.1",
|
|
67
67
|
"css-loader": "^0.24.0",
|
|
68
|
-
"electron": "^2.
|
|
69
|
-
"electron-debug": "^
|
|
68
|
+
"electron": "^4.2.12",
|
|
69
|
+
"electron-debug": "^3.2.0",
|
|
70
70
|
"file-loader": "^0.9.0",
|
|
71
71
|
"html-loader": "^0.4.3",
|
|
72
72
|
"html-webpack-plugin": "^2.22.0",
|
|
73
73
|
"json-loader": "^0.5.4",
|
|
74
|
-
"lodash": "^4.17.
|
|
75
|
-
"node-sass": "^
|
|
74
|
+
"lodash": "^4.17.21",
|
|
75
|
+
"node-sass": "^4.14.1",
|
|
76
76
|
"raw-loader": "^0.5.1",
|
|
77
77
|
"sass-loader": "^4.0.2",
|
|
78
78
|
"style-loader": "^0.13.1",
|
|
79
|
-
"ts-node": "^
|
|
80
|
-
"typescript": "^
|
|
79
|
+
"ts-node": "^10.2.1",
|
|
80
|
+
"typescript": "^4.3.5",
|
|
81
81
|
"webpack": "^2.6.1",
|
|
82
82
|
"webpack-dev-server": "^1.15.1"
|
|
83
83
|
},
|
|
@@ -98,10 +98,11 @@
|
|
|
98
98
|
"readme": "ERROR: No README data found!",
|
|
99
99
|
"scripts": {
|
|
100
100
|
"start": "electron",
|
|
101
|
-
"release": "standard-version"
|
|
101
|
+
"release": "standard-version",
|
|
102
|
+
"prerelease-dev": "standard-version --prerelease dev"
|
|
102
103
|
},
|
|
103
|
-
"version": "2.4.
|
|
104
|
+
"version": "2.4.3-dev.0",
|
|
104
105
|
"devDependencies": {
|
|
105
|
-
"standard-version": "^
|
|
106
|
+
"standard-version": "^9.3.1"
|
|
106
107
|
}
|
|
107
108
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"module": "es2015",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"jsx": "preserve",
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"allowJs": true,
|
|
9
|
-
"checkJs": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"sourceMap": true
|
|
12
|
-
},
|
|
13
|
-
"include": [
|
|
14
|
-
"./src/**/*"
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"module": "es2015",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"jsx": "preserve",
|
|
7
|
+
"outDir": "dist",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"checkJs": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"sourceMap": true
|
|
12
|
+
},
|
|
13
|
+
"include": [
|
|
14
|
+
"./src/**/*"
|
|
15
|
+
]
|
|
16
16
|
}
|
package/webpack.config.js
CHANGED
|
@@ -1,162 +1,162 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
|
4
|
-
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
5
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
6
|
-
const webpack = require('webpack')
|
|
7
|
-
const path = require('path')
|
|
8
|
-
const _ = require('lodash')
|
|
9
|
-
const fs = require('fs')
|
|
10
|
-
|
|
11
|
-
module.exports = (options) => {
|
|
12
|
-
if (options.target === 'web') {
|
|
13
|
-
options.externals = [...(options.externals || []), 'electron']
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let tsconfigPath = fs.existsSync(path.join(options.src, '..', 'tsconfig.json')) ? path.join(options.src, '..', 'tsconfig.json') : path.join(__dirname, 'tsconfig.json')
|
|
17
|
-
const typescriptPath = path.join(options.src, '..', 'node_modules', 'typescript', '/')
|
|
18
|
-
const typescript = fs.existsSync(typescriptPath) ? path.join(__dirname, path.relative(__dirname, typescriptPath), '/') : 'typescript'
|
|
19
|
-
|
|
20
|
-
let exclude = options.mode === 'watch'
|
|
21
|
-
? [path.join(options.src, 'static'), path.join(options.src, 'test')]
|
|
22
|
-
: [path.resolve(options.src, 'static'), path.resolve(options.src, 'test')]
|
|
23
|
-
|
|
24
|
-
let config = {
|
|
25
|
-
context: __dirname,
|
|
26
|
-
entry: ['babel-polyfill', path.resolve(options.src, 'main')],
|
|
27
|
-
output: {
|
|
28
|
-
path: path.resolve(options.build),
|
|
29
|
-
filename: 'main.js'
|
|
30
|
-
},
|
|
31
|
-
node: {
|
|
32
|
-
__dirname: options.mode === 'watch',
|
|
33
|
-
fs: 'empty',
|
|
34
|
-
net: 'empty',
|
|
35
|
-
tls: 'empty'
|
|
36
|
-
},
|
|
37
|
-
resolve: {
|
|
38
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
39
|
-
modules: [
|
|
40
|
-
'node_modules',
|
|
41
|
-
'src',
|
|
42
|
-
'static'
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
module: {
|
|
46
|
-
loaders: [
|
|
47
|
-
{
|
|
48
|
-
test: /\.json$/,
|
|
49
|
-
exclude: exclude,
|
|
50
|
-
loader: 'json-loader'
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
test: /\.(j|t)sx?$/,
|
|
54
|
-
include: [path.resolve(options.src)],
|
|
55
|
-
exclude: exclude,
|
|
56
|
-
loaders: [
|
|
57
|
-
{
|
|
58
|
-
loader: 'babel-loader?babelrc=false&extends=' + path.join(__dirname, '/.babelrc')
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
loader: 'awesome-typescript-loader',
|
|
62
|
-
options: {
|
|
63
|
-
configFileName: tsconfigPath,
|
|
64
|
-
transpileOnly: options.transpileOnly,
|
|
65
|
-
compiler: typescript
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
test: /\.scss$/,
|
|
72
|
-
exclude: exclude,
|
|
73
|
-
loaders: ['style', 'css', 'sass']
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
test: /\.css$/,
|
|
77
|
-
exclude: exclude,
|
|
78
|
-
loader: 'style-loader!css-loader'
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|mp4)$/,
|
|
82
|
-
exclude: exclude,
|
|
83
|
-
loader: 'file-loader'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
test: /\.html$/,
|
|
87
|
-
loader: 'raw-loader'
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
externals: (context, request, callback) => {
|
|
92
|
-
if (_.indexOf(options.externals, request) !== -1) {
|
|
93
|
-
if (options.mode !== 'watch' || request === 'electron') {
|
|
94
|
-
return callback(null, "require('" + request + "')")
|
|
95
|
-
} else {
|
|
96
|
-
return callback(null, "require('" + path.resolve(options.src, '..', 'node_modules', request).replace(/\\/g, '\\\\') + "')")
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
callback()
|
|
100
|
-
},
|
|
101
|
-
plugins: [
|
|
102
|
-
new CopyWebpackPlugin([{ from: path.resolve(options.src, 'static'), to: 'static/' }], { copyUnmodified: true }),
|
|
103
|
-
new HtmlWebpackPlugin({
|
|
104
|
-
inject: 'head',
|
|
105
|
-
template: path.resolve(options.src, 'index.html')
|
|
106
|
-
}),
|
|
107
|
-
new webpack.LoaderOptionsPlugin({
|
|
108
|
-
options: {
|
|
109
|
-
test: /\.tsx?$/,
|
|
110
|
-
ts: {
|
|
111
|
-
compiler: 'typescript',
|
|
112
|
-
configFileName: 'tsconfig.json'
|
|
113
|
-
},
|
|
114
|
-
tslint: {
|
|
115
|
-
emitErrors: true,
|
|
116
|
-
failOnHint: true
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
],
|
|
121
|
-
target: options.target
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (options.mode === 'watch') {
|
|
125
|
-
config.entry.unshift(`webpack-dev-server/client?http://localhost:${options.port}/`, 'webpack/hot/dev-server', path.resolve(options.src, 'index.html'))
|
|
126
|
-
config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
|
|
127
|
-
config.plugins.unshift(new webpack.HotModuleReplacementPlugin())
|
|
128
|
-
config.output.publicPath = `http://localhost:${options.port}/`
|
|
129
|
-
config.devtool = 'source-map'
|
|
130
|
-
config.devServer = {
|
|
131
|
-
contentBase: path.resolve(options.src),
|
|
132
|
-
publicPath: `http://localhost:${options.port}/`,
|
|
133
|
-
inline: true
|
|
134
|
-
}
|
|
135
|
-
} else {
|
|
136
|
-
config.plugins.unshift(
|
|
137
|
-
new CleanWebpackPlugin([path.basename(options.build), path.basename(options.build) + '.zip'], {
|
|
138
|
-
root: path.resolve(options.build, '..'),
|
|
139
|
-
verbose: false
|
|
140
|
-
}),
|
|
141
|
-
new webpack.DefinePlugin({
|
|
142
|
-
'process.env': {
|
|
143
|
-
NODE_ENV: JSON.stringify('production')
|
|
144
|
-
}
|
|
145
|
-
}),
|
|
146
|
-
new webpack.optimize.UglifyJsPlugin({
|
|
147
|
-
compress: {
|
|
148
|
-
warnings: false
|
|
149
|
-
},
|
|
150
|
-
mangle: true,
|
|
151
|
-
minimize: true,
|
|
152
|
-
comments: false
|
|
153
|
-
})
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
if (options.mode === 'run') {
|
|
157
|
-
config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return config
|
|
162
|
-
}
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
|
4
|
+
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
5
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
6
|
+
const webpack = require('webpack')
|
|
7
|
+
const path = require('path')
|
|
8
|
+
const _ = require('lodash')
|
|
9
|
+
const fs = require('fs')
|
|
10
|
+
|
|
11
|
+
module.exports = (options) => {
|
|
12
|
+
if (options.target === 'web') {
|
|
13
|
+
options.externals = [...(options.externals || []), 'electron']
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let tsconfigPath = fs.existsSync(path.join(options.src, '..', 'tsconfig.json')) ? path.join(options.src, '..', 'tsconfig.json') : path.join(__dirname, 'tsconfig.json')
|
|
17
|
+
const typescriptPath = path.join(options.src, '..', 'node_modules', 'typescript', '/')
|
|
18
|
+
const typescript = fs.existsSync(typescriptPath) ? path.join(__dirname, path.relative(__dirname, typescriptPath), '/') : 'typescript'
|
|
19
|
+
|
|
20
|
+
let exclude = options.mode === 'watch'
|
|
21
|
+
? [path.join(options.src, 'static'), path.join(options.src, 'test')]
|
|
22
|
+
: [path.resolve(options.src, 'static'), path.resolve(options.src, 'test')]
|
|
23
|
+
|
|
24
|
+
let config = {
|
|
25
|
+
context: __dirname,
|
|
26
|
+
entry: ['babel-polyfill', path.resolve(options.src, 'main')],
|
|
27
|
+
output: {
|
|
28
|
+
path: path.resolve(options.build),
|
|
29
|
+
filename: 'main.js'
|
|
30
|
+
},
|
|
31
|
+
node: {
|
|
32
|
+
__dirname: options.mode === 'watch',
|
|
33
|
+
fs: 'empty',
|
|
34
|
+
net: 'empty',
|
|
35
|
+
tls: 'empty'
|
|
36
|
+
},
|
|
37
|
+
resolve: {
|
|
38
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
|
39
|
+
modules: [
|
|
40
|
+
'node_modules',
|
|
41
|
+
'src',
|
|
42
|
+
'static'
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
module: {
|
|
46
|
+
loaders: [
|
|
47
|
+
{
|
|
48
|
+
test: /\.json$/,
|
|
49
|
+
exclude: exclude,
|
|
50
|
+
loader: 'json-loader'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
test: /\.(j|t)sx?$/,
|
|
54
|
+
include: [path.resolve(options.src)],
|
|
55
|
+
exclude: exclude,
|
|
56
|
+
loaders: [
|
|
57
|
+
{
|
|
58
|
+
loader: 'babel-loader?babelrc=false&extends=' + path.join(__dirname, '/.babelrc')
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
loader: 'awesome-typescript-loader',
|
|
62
|
+
options: {
|
|
63
|
+
configFileName: tsconfigPath,
|
|
64
|
+
transpileOnly: options.transpileOnly,
|
|
65
|
+
compiler: typescript
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
test: /\.scss$/,
|
|
72
|
+
exclude: exclude,
|
|
73
|
+
loaders: ['style', 'css', 'sass']
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
test: /\.css$/,
|
|
77
|
+
exclude: exclude,
|
|
78
|
+
loader: 'style-loader!css-loader'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|mp4)$/,
|
|
82
|
+
exclude: exclude,
|
|
83
|
+
loader: 'file-loader'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
test: /\.html$/,
|
|
87
|
+
loader: 'raw-loader'
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
externals: (context, request, callback) => {
|
|
92
|
+
if (_.indexOf(options.externals, request) !== -1) {
|
|
93
|
+
if (options.mode !== 'watch' || request === 'electron') {
|
|
94
|
+
return callback(null, "require('" + request + "')")
|
|
95
|
+
} else {
|
|
96
|
+
return callback(null, "require('" + path.resolve(options.src, '..', 'node_modules', request).replace(/\\/g, '\\\\') + "')")
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
callback()
|
|
100
|
+
},
|
|
101
|
+
plugins: [
|
|
102
|
+
new CopyWebpackPlugin([{ from: path.resolve(options.src, 'static'), to: 'static/' }], { copyUnmodified: true }),
|
|
103
|
+
new HtmlWebpackPlugin({
|
|
104
|
+
inject: 'head',
|
|
105
|
+
template: path.resolve(options.src, 'index.html')
|
|
106
|
+
}),
|
|
107
|
+
new webpack.LoaderOptionsPlugin({
|
|
108
|
+
options: {
|
|
109
|
+
test: /\.tsx?$/,
|
|
110
|
+
ts: {
|
|
111
|
+
compiler: 'typescript',
|
|
112
|
+
configFileName: 'tsconfig.json'
|
|
113
|
+
},
|
|
114
|
+
tslint: {
|
|
115
|
+
emitErrors: true,
|
|
116
|
+
failOnHint: true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
],
|
|
121
|
+
target: options.target
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (options.mode === 'watch') {
|
|
125
|
+
config.entry.unshift(`webpack-dev-server/client?http://localhost:${options.port}/`, 'webpack/hot/dev-server', path.resolve(options.src, 'index.html'))
|
|
126
|
+
config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
|
|
127
|
+
config.plugins.unshift(new webpack.HotModuleReplacementPlugin())
|
|
128
|
+
config.output.publicPath = `http://localhost:${options.port}/`
|
|
129
|
+
config.devtool = 'source-map'
|
|
130
|
+
config.devServer = {
|
|
131
|
+
contentBase: path.resolve(options.src),
|
|
132
|
+
publicPath: `http://localhost:${options.port}/`,
|
|
133
|
+
inline: true
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
config.plugins.unshift(
|
|
137
|
+
new CleanWebpackPlugin([path.basename(options.build), path.basename(options.build) + '.zip'], {
|
|
138
|
+
root: path.resolve(options.build, '..'),
|
|
139
|
+
verbose: false
|
|
140
|
+
}),
|
|
141
|
+
new webpack.DefinePlugin({
|
|
142
|
+
'process.env': {
|
|
143
|
+
NODE_ENV: JSON.stringify('production')
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
new webpack.optimize.UglifyJsPlugin({
|
|
147
|
+
compress: {
|
|
148
|
+
warnings: false
|
|
149
|
+
},
|
|
150
|
+
mangle: true,
|
|
151
|
+
minimize: true,
|
|
152
|
+
comments: false
|
|
153
|
+
})
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if (options.mode === 'run') {
|
|
157
|
+
config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return config
|
|
162
|
+
}
|