@joystick.js/cli-canary 0.0.0-canary.1000 → 0.0.0-canary.1002

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/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@joystick.js/cli-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.1000",
5
- "canary_version": "0.0.0-canary.999",
4
+ "version": "0.0.0-canary.1002",
5
+ "canary_version": "0.0.0-canary.1001",
6
6
  "description": "The CLI for Joystick.",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
@@ -13,7 +13,7 @@ import Loader from "../loader.js";
13
13
  import path_exists from "../path_exists.js";
14
14
  import encrypt_buffer from '../../lib/encrypt_buffer.js';
15
15
 
16
- const { mkdir, copyFile, readFile, writeFile } = fs.promises;
16
+ const { mkdir, copyFile, readFile, writeFile, readdir } = fs.promises;
17
17
  const exec = util.promisify(child_process.exec);
18
18
 
19
19
  const get_files_to_build_with_operation_and_platform = (files = []) => {
@@ -44,9 +44,26 @@ const build = async (options = {}) => {
44
44
  await exec(`rm -rf .build`);
45
45
  }
46
46
 
47
- const files_to_copy = files_to_build_with_operation_and_platform?.filter((file) => {
48
- return file?.operation === 'copy_file';
49
- })
47
+ const custom_copy_paths = settings?.config?.build?.copy_paths?.length > 0 ? await Promise.all(
48
+ settings?.config?.build?.copy_paths?.filter((custom_copy_path) => {
49
+ return fs.existsSync(custom_copy_path);
50
+ })?.flatMap(async (custom_copy_path = '') => {
51
+ const stat = await fs.lstat(custom_copy_path);
52
+ const paths = stat.isDirectory() ? await readdir(custom_copy_path, { recursive: true }) : [custom_copy_path];
53
+ return paths?.map((path) => {
54
+ return { path };
55
+ });
56
+ })
57
+ ) : [];
58
+
59
+ console.log(custom_copy_paths);
60
+
61
+ const files_to_copy = [
62
+ ...files_to_build_with_operation_and_platform?.filter((file) => {
63
+ return file?.operation === 'copy_file';
64
+ }),
65
+ ...(custom_copy_paths || [])
66
+ ];
50
67
 
51
68
  const files_to_build = files_to_build_with_operation_and_platform?.filter((file) => {
52
69
  return file?.operation === 'build_file';