@pushwoosh/frontend-builder-engine 0.0.3 → 0.0.5

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/lib/helpers.js CHANGED
@@ -71,7 +71,20 @@ class PromiseQueue {
71
71
  }
72
72
  }
73
73
 
74
+ function loadPushwooshConfig() {
75
+ const configPath = path.resolve(process.cwd(), 'pushwoosh.config.js');
76
+ try {
77
+ return require(configPath);
78
+ } catch (err) {
79
+ if (err.code === 'MODULE_NOT_FOUND') {
80
+ return {};
81
+ }
82
+ throw err;
83
+ }
84
+ }
85
+
74
86
  module.exports = {
75
87
  listFilesInDirectoryRecursively,
76
88
  PromiseQueue,
89
+ loadPushwooshConfig,
77
90
  };
@@ -1,8 +1,10 @@
1
+ const fs = require('fs').promises;
1
2
  const { program, Command } = require('commander');
2
3
 
3
4
  const { buildTs } = require('./build-ts');
4
5
  const { buildStyledComponents } = require('./build-babel');
5
6
  const { loadTsConfig } = require('./lib-build-tsconfig');
7
+ const { loadPushwooshConfig } = require('./helpers');
6
8
 
7
9
  program
8
10
  .version('1.0.0')
@@ -16,6 +18,8 @@ program
16
18
  const tsConfig = loadTsConfig({});
17
19
  await buildTs(curDir, tsConfig);
18
20
  await buildStyledComponents(targetDir, targetDir);
21
+ await fs.copyFile(`${curDir}/package.json`, `${targetDir}/package.json`);
22
+ await fs.copyFile(`${curDir}/.npmrc`, `${targetDir}/.npmrc`);
19
23
  })
20
24
  .option('-s, --ss <type>', 'output extra debugging');
21
25
 
@@ -33,6 +37,11 @@ program
33
37
  }),
34
38
  );
35
39
 
40
+ const pushwooshConfig = loadPushwooshConfig();
41
+ if (pushwooshConfig.program) {
42
+ pushwooshConfig.program(program);
43
+ }
44
+
36
45
  program.parse(process.argv);
37
46
  /*
38
47
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pushwoosh/frontend-builder-engine",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Pushwoosh frontend builder engine",
5
5
  "main": "./lib/pushwoosh-frontend-builder-engine.js",
6
6
  "scripts": {
7
7
  "test": "echo test"
8
8
  },
9
9
  "bin": {
10
- "pushwoosh-build": "./bin/cli.js"
10
+ "pushwoosh-engine": "./bin/cli.js"
11
11
  },
12
12
  "files": [
13
13
  "bin",