@pushwoosh/frontend-builder-engine 0.1.0 → 0.1.2

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.
@@ -1,3 +1,4 @@
1
+ const childProcess = require('child_process');
1
2
  const fs = require('fs').promises;
2
3
  const { program, Command } = require('commander');
3
4
 
@@ -5,7 +6,6 @@ const { buildTs } = require('./build-ts');
5
6
  const { buildStyledComponents } = require('./build-babel');
6
7
  const { loadTsConfig } = require('./lib-build-tsconfig');
7
8
  const { loadPushwooshConfig } = require('./helpers');
8
- const subProcess = require('child_process');
9
9
 
10
10
  program
11
11
  .version('1.0.0')
@@ -42,8 +42,7 @@ program
42
42
  new Command('lib:playground')
43
43
  .description('Check types in the project')
44
44
  .action(async () => {
45
- console.log('Hello from pushwoosh.config.js', process.cwd());
46
- const lsChildProcess = subProcess.spawn(
45
+ const wpChildProcess = childProcess.spawn(
47
46
  './node_modules/.bin/webpack-dev-server',
48
47
  '--config ./node_modules/@pushwoosh/frontend-builder-engine/lib/webpack.playground.config.js --stats-error-details'.split(' '),
49
48
  {
@@ -51,9 +50,9 @@ program
51
50
  stdio: 'inherit',
52
51
  },
53
52
  );
54
- lsChildProcess.on('exit', () => console.log('webpack finished'));
55
- lsChildProcess.on('error', (aa) => console.error('error', aa));
56
- lsChildProcess.on('message', (aa) => console.info('mess', aa));
53
+ wpChildProcess.on('exit', () => console.log('webpack finished'));
54
+ wpChildProcess.on('error', (aa) => console.error('error', aa));
55
+ wpChildProcess.on('message', (aa) => console.info('mess', aa));
57
56
  }),
58
57
  );
59
58
 
@@ -1,12 +1,12 @@
1
1
  const path = require('path');
2
-
2
+ const dotenv = require('dotenv');
3
3
  const HtmlWebpackPlugin = require('html-webpack-plugin');
4
4
  const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
5
5
  // const { loadTsConfig } = require('./lib-build-tsconfig');
6
6
 
7
7
  function getConfig() {
8
8
  const projectPath = process.cwd();
9
- // console.log(1112, projectPath, __dirname);
9
+ const { parsed = {} } = dotenv.config();
10
10
  return {
11
11
  target: 'web',
12
12
  mode: 'development',
@@ -45,7 +45,7 @@ function getConfig() {
45
45
  },
46
46
  plugins: [
47
47
  new HtmlWebpackPlugin({
48
- template: './playground/index.html', // Убедитесь, что этот путь указывает на ваш HTML-шаблон
48
+ template: './playground/index.html',
49
49
  }),
50
50
  ],
51
51
  devServer: {
@@ -53,7 +53,7 @@ function getConfig() {
53
53
  directory: path.join(projectPath, 'dist'),
54
54
  },
55
55
  // compress: true,
56
- port: 9000, // Можете выбрать любой порт
56
+ port: parsed.PLAYGROUND_PORT || 8080,
57
57
  },
58
58
  };
59
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Pushwoosh frontend builder engine",
5
5
  "main": "./lib/pushwoosh-frontend-builder-engine.js",
6
6
  "scripts": {
@@ -17,6 +17,7 @@
17
17
  "dependencies": {
18
18
  "@babel/core": "^7.24.3",
19
19
  "commander": "^12.0.0",
20
+ "dotenv": "^16.4.5",
20
21
  "html-webpack-plugin": "^5.6.0",
21
22
  "ts-loader": "^9.5.1",
22
23
  "tsconfig-paths-webpack-plugin": "^4.1.0",