@vixoniccom/module-packager 2.7.0-test.6 → 2.7.0-test.8

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
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.7.0-test.8](https://gitlab.com/mandomedio/vixonic/module-packager/compare/v2.7.0-test.7...v2.7.0-test.8) (2022-07-15)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **release:** exclude variable was updated ([6eca779](https://gitlab.com/mandomedio/vixonic/module-packager/commit/6eca7795b42e32e84afeffe74a98bb7e4b970dd1))
11
+
12
+ ## [2.7.0-test.7](https://gitlab.com/mandomedio/vixonic/module-packager/compare/v2.7.0-test.6...v2.7.0-test.7) (2022-07-15)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **Release:** revert __dirname changes ([bb25fe1](https://gitlab.com/mandomedio/vixonic/module-packager/commit/bb25fe10ed9a9368c145530aecdc91f539877a26))
18
+
5
19
  ## [2.7.0-test.6](https://gitlab.com/mandomedio/vixonic/module-packager/compare/v2.7.0-test.5...v2.7.0-test.6) (2022-07-15)
6
20
 
7
21
 
package/index.html CHANGED
@@ -18,17 +18,17 @@
18
18
  win.show()
19
19
  win.focus()
20
20
  })
21
- webview.src = options.mode === 'watch' ? `http://localhost:${options.port}/index.html` : `file://${path.join(__dirname, options.build, 'index.html')}`
21
+ webview.src = options.mode === 'watch' ? `http://localhost:${options.port}/index.html` : `file://${path.join(options.build, 'index.html')}`
22
22
 
23
23
  function getData () {
24
24
  let data = {}
25
25
  try {
26
- data.parameters = require(path.join(__dirname, options.src, '/test/parameters.json')).parameters
26
+ data.parameters = require(path.join(options.src, '/test/parameters.json')).parameters
27
27
  } catch (err) {
28
28
  console.log('No parameters.')
29
29
  }
30
30
 
31
- let escaped = path.join(__dirname, options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
31
+ let escaped = path.join(options.mode === 'watch' ? options.src : options.build, 'test', 'downloads')
32
32
 
33
33
  // Add file:// to watch because in this mode the app will be in a localhost hosted environment.
34
34
  if (options.mode === 'watch') escaped = `file://${escaped}`
@@ -37,7 +37,7 @@
37
37
  data.downloadsPath = escaped
38
38
 
39
39
  try {
40
- data.services = require(path.join(__dirname, options.src, '/test/services.json')).services
40
+ data.services = require(path.join(options.src, '/test/services.json')).services
41
41
  console.log(data.services)
42
42
  } catch (err) {
43
43
  console.log('No services.')
@@ -49,7 +49,7 @@
49
49
  function getSchema () {
50
50
  let data = {}
51
51
  try {
52
- data = require(path.join(__dirname, options.src, '../configuration.json')).schema
52
+ data = require(path.join(options.src, '../configuration.json')).schema
53
53
  } catch (err) {
54
54
  console.log('No schema.')
55
55
  }
package/main.js CHANGED
@@ -5,9 +5,9 @@ const commandLineArgs = require('command-line-args')
5
5
  const optionDefinitions = [
6
6
  { name: 'externals', type: String, defaultValue: [], multiple: true },
7
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' },
8
+ { name: 'src', type: String, defaultValue: './src' },
9
+ { name: 'build', type: String, defaultValue: './build' },
10
+ { name: 'confDefinition', type: String, defaultValue: './configuration' },
11
11
  { name: 'config', type: String, defaultValue: './webpack.config.js' },
12
12
  { name: 'port', type: Number, defaultValue: 8080 },
13
13
  { name: 'mode', type: String, defaultValue: 'build' },
@@ -73,7 +73,7 @@ function pack (callback) {
73
73
  function installExternals (callback) {
74
74
  // Get external versions.
75
75
  let externals = options.externals.map(x => {
76
- return `${x}@${JSON.parse(fs.readFileSync(path.resolve(__dirname, options.src, '..', 'node_modules', x, 'package.json'))).version}`
76
+ return `${x}@${JSON.parse(fs.readFileSync(path.resolve(options.src, '..', 'node_modules', x, 'package.json'))).version}`
77
77
  })
78
78
 
79
79
  // Install external versions.
@@ -95,10 +95,10 @@ function installExternals (callback) {
95
95
 
96
96
  function zip (callback) {
97
97
  console.log(clc.blue('Archiving...'))
98
- let output = fs.createWriteStream(path.resolve(__dirname, options.build, '../', 'build.zip'))
98
+ let output = fs.createWriteStream(path.resolve(options.build, '../', 'build.zip'))
99
99
  let archive = archiver('zip')
100
100
  archive.pipe(output)
101
- archive.directory(path.resolve(__dirname, options.build), './')
101
+ archive.directory(path.resolve(options.build), './')
102
102
  archive.finalize()
103
103
 
104
104
  output.on('close', function () {
@@ -121,7 +121,7 @@ function watch () {
121
121
  var environment = process.env
122
122
  environment.NODE_ENV = 'development'
123
123
 
124
- exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(__dirname, options.src)} --build ${path.resolve(__dirname, options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
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
125
  {
126
126
  cwd: __dirname,
127
127
  env: environment
@@ -137,7 +137,7 @@ function run () {
137
137
  if (err) {
138
138
  throw err
139
139
  } else {
140
- exec(`npm start -- ${path.join(__dirname, 'electron.js')} --src ${path.resolve(__dirname, options.src)} --build ${path.resolve(__dirname, options.build)} --port ${options.port} --mode ${options.mode} --config ${options.config} --externals ${options.externals}`,
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
141
  {
142
142
  cwd: __dirname
143
143
  })
@@ -148,14 +148,14 @@ function run () {
148
148
  function loadConfiguration () {
149
149
  require('@vixoniccom/modules')
150
150
  require('ts-node').register({compilerOptions: { moduleResolution: 'node', module: 'commonjs', target: 'es2015', checkJs: false }})
151
- return require(path.resolve(__dirname, options.confDefinition, 'index.ts')).configuration
151
+ return require(path.resolve(options.confDefinition, 'index.ts')).configuration
152
152
  }
153
153
 
154
154
  function generateConfiguration () {
155
155
  try {
156
156
  let configuration = loadConfiguration()
157
- fs.writeFileSync(path.resolve(__dirname, options.src, 'parameters.d.ts'), configuration.declarationFileString)
158
- fs.writeFileSync(path.resolve(__dirname, options.src, '..', 'configuration.json'), JSON.stringify(configuration, undefined, 2))
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
159
  console.log(clc.green(`Configuration generated`))
160
160
  } catch (e) {
161
161
  console.log(clc.red('Configuration generation failed'))
@@ -166,10 +166,10 @@ function generateConfiguration () {
166
166
  function validateConfiguration () {
167
167
  try {
168
168
  const { Configuration } = require('@vixoniccom/modules')
169
- const json = require(path.resolve(__dirname, options.src, '../', 'configuration.json'))
169
+ const json = require(path.resolve(options.src, '../', 'configuration.json'))
170
170
  const conf = Configuration.fromJSON(json)
171
171
  if (conf.durationFormula) {
172
- const values = require(path.resolve(__dirname, options.src, 'test', 'parameters.json'))
172
+ const values = require(path.resolve(options.src, 'test', 'parameters.json'))
173
173
  console.log('Validate duration')
174
174
  console.log('Duration on undefined:', conf.getDuration({}), 'seconds')
175
175
  console.log('Duration:', conf.getDuration(values.parameters), 'seconds')
package/package.json CHANGED
@@ -104,7 +104,7 @@
104
104
  "prerelease-test": "standard-version --prerelease test",
105
105
  "release": "standard-version"
106
106
  },
107
- "version": "2.7.0-test.6",
107
+ "version": "2.7.0-test.8",
108
108
  "devDependencies": {
109
109
  "standard-version": "^9.3.1"
110
110
  }
package/webpack.config.js CHANGED
@@ -22,12 +22,13 @@ module.exports = (options) => {
22
22
  ? [path.join(__dirname, options.src, 'static'), path.join(__dirname, options.src, 'test')]
23
23
  : [path.resolve(__dirname, options.src, 'static'), path.resolve(__dirname, options.src, 'test')]
24
24
 
25
+ console.log('exclude ', exclude)
25
26
  console.log('Options: ', options, options.src)
26
27
  let config = {
27
28
  context: __dirname,
28
- entry: ['babel-polyfill', path.resolve(__dirname, options.src, 'main')],
29
+ entry: ['babel-polyfill', path.resolve(options.src, 'main')],
29
30
  output: {
30
- path: path.resolve(__dirname, options.build),
31
+ path: path.resolve(options.build),
31
32
  filename: 'main.js'
32
33
  },
33
34
  node: {
@@ -53,7 +54,7 @@ module.exports = (options) => {
53
54
  },
54
55
  {
55
56
  test: /\.(j|t)sx?$/,
56
- include: [path.resolve(__dirname, options.src)],
57
+ include: [path.resolve(options.src)],
57
58
  exclude: exclude,
58
59
  rules: [
59
60
  {
@@ -93,16 +94,16 @@ module.exports = (options) => {
93
94
  if (options.mode !== 'watch' || request === 'electron') {
94
95
  return callback(null, "require('" + request + "')")
95
96
  } else {
96
- return callback(null, "require('" + path.resolve(__dirname, options.src, '..', 'node_modules', request).replace(/\\/g, '\\\\') + "')")
97
+ return callback(null, "require('" + path.resolve(options.src, '..', 'node_modules', request).replace(/\\/g, '\\\\') + "')")
97
98
  }
98
99
  }
99
100
  callback()
100
101
  },
101
102
  plugins: [
102
- new CopyWebpackPlugin([{ from: path.resolve(__dirname, options.src, 'static'), to: 'static/' }], { copyUnmodified: true }),
103
+ new CopyWebpackPlugin([{ from: path.resolve(options.src, 'static'), to: 'static/' }], { copyUnmodified: true }),
103
104
  new HtmlWebpackPlugin({
104
105
  inject: 'head',
105
- template: path.resolve(__dirname, options.src, 'index.html')
106
+ template: path.resolve(options.src, 'index.html')
106
107
  }),
107
108
  new webpack.LoaderOptionsPlugin({
108
109
  options: {
@@ -122,20 +123,20 @@ module.exports = (options) => {
122
123
  }
123
124
 
124
125
  if (options.mode === 'watch') {
125
- config.entry.unshift(`webpack-dev-server/client?http://localhost:${options.port}/`, 'webpack/hot/dev-server', path.resolve(__dirname, options.src, 'index.html'))
126
- config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(__dirname, options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
126
+ config.entry.unshift(`webpack-dev-server/client?http://localhost:${options.port}/`, 'webpack/hot/dev-server', path.resolve(options.src, 'index.html'))
127
+ config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
127
128
  config.plugins.unshift(new webpack.HotModuleReplacementPlugin())
128
129
  config.output.publicPath = `http://localhost:${options.port}/`
129
130
  config.devtool = 'source-map'
130
131
  config.devServer = {
131
- static: path.resolve(__dirname, options.src),
132
+ static: path.resolve(options.src),
132
133
  publicPath: `http://localhost:${options.port}/`,
133
134
  inline: true
134
135
  }
135
136
  } else {
136
137
  config.plugins.unshift(
137
138
  new CleanWebpackPlugin([path.basename(options.build), path.basename(options.build) + '.zip'], {
138
- root: path.resolve(__dirname, options.build, '..'),
139
+ root: path.resolve(options.build, '..'),
139
140
  verbose: false
140
141
  }),
141
142
  new webpack.DefinePlugin({
@@ -153,7 +154,7 @@ module.exports = (options) => {
153
154
  )
154
155
 
155
156
  if (options.mode === 'run') {
156
- config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(__dirname, options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
157
+ config.plugins.unshift(new CopyWebpackPlugin([{ from: path.resolve(options.src, 'test'), to: 'test/' }], { copyUnmodified: true }))
157
158
  }
158
159
  }
159
160