@windwalker-io/core 4.0.4 → 4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windwalker-io/core",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "type": "module",
5
5
  "description": "Windwalker Core JS package",
6
6
  "scripts": {
package/src/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- /**
2
- * Part of funclass project.
3
- *
4
- * @copyright Copyright (C) 2021 LYRASOFT.
5
- * @license __LICENSE__
6
- */
7
-
8
- export * from './asset-sync.mjs';
9
- export * from './install-vendors.mjs';
1
+ /**
2
+ * Part of funclass project.
3
+ *
4
+ * @copyright Copyright (C) 2021 LYRASOFT.
5
+ * @license __LICENSE__
6
+ */
7
+
8
+ export * from './asset-sync.mjs';
9
+ export * from './install-vendors.mjs';
@@ -11,8 +11,9 @@ import { loadJson } from './utils.mjs';
11
11
  import path from 'path';
12
12
  import fs from 'fs';
13
13
 
14
- export async function installVendors(vendors) {
15
- const root = 'www/assets/vendor';
14
+ export async function installVendors(npmVendors, composerVendors = [], to = 'www/assets/vendor') {
15
+ const root = to;
16
+ let vendors = npmVendors;
16
17
 
17
18
  if (!fs.existsSync(root)) {
18
19
  fs.mkdirSync(root);
@@ -33,12 +34,19 @@ export async function installVendors(vendors) {
33
34
 
34
35
  vendors.forEach((vendor) => {
35
36
  if (fs.existsSync(`node_modules/${vendor}/`)) {
36
- console.log(`[Link] node_modules/${vendor}/ => www/assets/vendor/${vendor}/`);
37
+ console.log(`[Link NPM] node_modules/${vendor}/ => www/assets/vendor/${vendor}/`);
37
38
  src(`node_modules/${vendor}/`).pipe(symlink(`www/assets/vendor/${vendor}`));
38
39
  }
39
40
  });
40
41
 
41
- console.log('[Link] resources/assets/vendor/**/* => www/assets/vendor/');
42
+ composerVendors.forEach((vendor) => {
43
+ if (fs.existsSync(`vendor/${vendor}/assets`)) {
44
+ console.log(`[Link Composer] vendor/${vendor}/assets => www/assets/vendor/${vendor}/`);
45
+ src(`vendor/${vendor}/assets/`).pipe(symlink(`www/assets/vendor/${vendor}/`));
46
+ }
47
+ });
48
+
49
+ console.log('[Link Local] resources/assets/vendor/**/* => www/assets/vendor/');
42
50
  src('resources/assets/vendor/*').pipe(symlink('www/assets/vendor/'));
43
51
  }
44
52