@pushwoosh/frontend-builder-engine 1.0.4 → 1.0.6
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/pushwoosh-engine.js +11 -1
- package/package.json +1 -1
package/lib/pushwoosh-engine.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const childProcess = require('child_process');
|
|
2
2
|
const fs = require('fs').promises;
|
|
3
3
|
const { program, Command } = require('commander');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
|
|
5
6
|
const { buildTs } = require('./build-ts');
|
|
6
7
|
const { buildStyledComponents } = require('./build-babel');
|
|
7
8
|
const { loadTsConfig } = require('./lib-build-tsconfig');
|
|
8
|
-
const { loadPushwooshConfig } = require('./helpers');
|
|
9
|
+
const { loadPushwooshConfig, listFilesInDirectoryRecursively } = require('./helpers');
|
|
9
10
|
|
|
10
11
|
program
|
|
11
12
|
.version('1.0.0')
|
|
@@ -14,6 +15,7 @@ program
|
|
|
14
15
|
.action(async () => {
|
|
15
16
|
const pushwooshConfig = loadPushwooshConfig();
|
|
16
17
|
const curDir = process.cwd();
|
|
18
|
+
const srcDir = `${curDir}/src`;
|
|
17
19
|
const targetDir = pushwooshConfig.libBuildTargetDir ?? `${curDir}/dist`;
|
|
18
20
|
const tsConfig = loadTsConfig({
|
|
19
21
|
compilerOptions: {
|
|
@@ -22,6 +24,14 @@ program
|
|
|
22
24
|
});
|
|
23
25
|
await buildTs(curDir, tsConfig);
|
|
24
26
|
await buildStyledComponents(targetDir, targetDir);
|
|
27
|
+
const svgFiles = await listFilesInDirectoryRecursively(srcDir).then((files) => files.filter((file) => file.endsWith('.svg')));
|
|
28
|
+
await Promise.all(svgFiles.map(async (file) => {
|
|
29
|
+
const sourcePath = `${srcDir}/${file}`;
|
|
30
|
+
const targetPath = `${targetDir}/${file}`;
|
|
31
|
+
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
32
|
+
await fs.copyFile(sourcePath, targetPath);
|
|
33
|
+
console.log(`Copied ${sourcePath} to ${targetPath}`);
|
|
34
|
+
}));
|
|
25
35
|
await fs.copyFile(`${curDir}/package.json`, `${targetDir}/package.json`);
|
|
26
36
|
await fs.copyFile(`${curDir}/.npmrc`, `${targetDir}/.npmrc`);
|
|
27
37
|
});
|