@pushwoosh/frontend-builder-engine 0.0.6 → 0.1.1

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
 
@@ -36,6 +37,24 @@ program
36
37
  }
37
38
  }),
38
39
  );
40
+ program
41
+ .addCommand(
42
+ new Command('lib:playground')
43
+ .description('Check types in the project')
44
+ .action(async () => {
45
+ const wpChildProcess = childProcess.spawn(
46
+ './node_modules/.bin/webpack-dev-server',
47
+ '--config ./node_modules/@pushwoosh/frontend-builder-engine/lib/webpack.playground.config.js --stats-error-details'.split(' '),
48
+ {
49
+ cwd: process.cwd(),
50
+ stdio: 'inherit',
51
+ },
52
+ );
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));
56
+ }),
57
+ );
39
58
 
40
59
  const pushwooshConfig = loadPushwooshConfig();
41
60
  if (pushwooshConfig.program) {
@@ -1,12 +1,15 @@
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 { error, parsed } = dotenv.config();
10
+ if (error) {
11
+ throw error;
12
+ }
10
13
  return {
11
14
  target: 'web',
12
15
  mode: 'development',
@@ -45,7 +48,7 @@ function getConfig() {
45
48
  },
46
49
  plugins: [
47
50
  new HtmlWebpackPlugin({
48
- template: './playground/index.html', // Убедитесь, что этот путь указывает на ваш HTML-шаблон
51
+ template: './playground/index.html',
49
52
  }),
50
53
  ],
51
54
  devServer: {
@@ -53,7 +56,7 @@ function getConfig() {
53
56
  directory: path.join(projectPath, 'dist'),
54
57
  },
55
58
  // compress: true,
56
- port: 9000, // Можете выбрать любой порт
59
+ port: parsed.PLAYGROUND_PORT || 8080,
57
60
  },
58
61
  };
59
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "0.0.6",
3
+ "version": "0.1.1",
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",