diff --git a/fusionfile.mjs b/fusionfile.mjs index bec0c6d8..944dcbb8 100644 --- a/fusionfile.mjs +++ b/fusionfile.mjs @@ -5,8 +5,9 @@ * @license MIT */ -import fusion, { sass, babel, parallel, wait } from '@windwalker-io/fusion'; -import { jsSync, installVendors, findModules } from '@windwalker-io/core'; +import fusion, { sass, babel, parallel, wait, ts } from '@windwalker-io/fusion'; +import { syncModuleScripts, installVendors, findModules } from '@windwalker-io/core'; +import path from 'path'; export async function mainCSS() { // Watch start @@ -78,41 +79,39 @@ export async function css() { } export async function js() { // Watch start - fusion.watch(['resources/assets/src/**/*.{js,mjs}']); + fusion.watch([ + 'resources/assets/src/**/*.{js,mjs,ts}', + 'src/Module/**/assets/**/*.{js,mjs,ts}', + ...findModules('**/assets/*.{js,mjs,ts}') + ]); // Watch end // Compile Start return wait( babel('resources/assets/src/**/*.{js,mjs}', 'www/assets/js/', { module: 'systemjs' }), + ts('resources/assets/src/**/*.ts', 'www/assets/js/', { tsconfig: 'tsconfig.js.json' }), syncJS() ); // Compile end } -export async function images() { - // Watch start - fusion.watch('resources/assets/images/**/*'); - // Watch end - +export async function syncJS() { // Compile Start return wait( - fusion.copy('resources/assets/images/**/*', 'www/assets/images/') + ...syncModuleScripts() ); // Compile end } -export async function syncJS() { +export async function images() { // Watch start - fusion.watch(['src/Module/**/assets/**/*.{js,mjs}', ...findModules('**/assets/*.{js,mjs}')]); + fusion.watch('resources/assets/images/**/*'); // Watch end // Compile Start - const { dest } = await jsSync( - 'src/Module/', - 'www/assets/js/view/' + return wait( + fusion.copy('resources/assets/images/**/*', 'www/assets/images/') ); - - return babel(dest.path + '**/*.{mjs,js}', null, { module: 'systemjs' }); // Compile end } diff --git a/package.json b/package.json index 42d569a1..342bc8cd 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "build": "cross-env node_modules/.bin/gulp", "build:dev": "cross-env NODE_ENV=development node_modules/.bin/gulp", "build:prod": "cross-env NODE_ENV=production node_modules/.bin/gulp", - "watch": "cross-env NODE_ENV=development node_modules/.bin/gulp --watch=1", - "watch:reload": "cross-env NODE_ENV=development node_modules/.bin/gulp --watch=1 --livereload=1", + "watch": "cross-env NODE_ENV=development node_modules/.bin/gulp --watching=1", + "watch:reload": "cross-env NODE_ENV=development node_modules/.bin/gulp --watching=1 --livereload=1", "postinstall": "yarn build install" }, "dependencies": { diff --git a/resources/assets/src/admin/main.js b/resources/assets/src/admin/main.ts similarity index 59% rename from resources/assets/src/admin/main.js rename to resources/assets/src/admin/main.ts index a1cddd33..3c5af277 100644 --- a/resources/assets/src/admin/main.js +++ b/resources/assets/src/admin/main.ts @@ -1,10 +1,3 @@ -/** - * Part of starter project. - * - * @copyright Copyright (C) 2021 LYRASOFT. - * @license __LICENSE__ - */ - import '@regenerator-runtime'; import '@unicorn/unicorn.js'; import { UIBootstrap5 } from '@unicorn/ui/ui-bootstrap5.js'; diff --git a/resources/assets/src/front/main.js b/resources/assets/src/front/main.ts similarity index 59% rename from resources/assets/src/front/main.js rename to resources/assets/src/front/main.ts index a1cddd33..3c5af277 100644 --- a/resources/assets/src/front/main.js +++ b/resources/assets/src/front/main.ts @@ -1,10 +1,3 @@ -/** - * Part of starter project. - * - * @copyright Copyright (C) 2021 LYRASOFT. - * @license __LICENSE__ - */ - import '@regenerator-runtime'; import '@unicorn/unicorn.js'; import { UIBootstrap5 } from '@unicorn/ui/ui-bootstrap5.js'; diff --git a/resources/assets/src/types/index.d.ts b/resources/assets/src/types/index.d.ts new file mode 100644 index 00000000..54abc591 --- /dev/null +++ b/resources/assets/src/types/index.d.ts @@ -0,0 +1 @@ +import '@windwalker-io/core/types'; diff --git a/src/Module/Admin/Dashboard/assets/dashboard.js b/src/Module/Admin/Dashboard/assets/dashboard.js deleted file mode 100644 index 6b9bca07..00000000 --- a/src/Module/Admin/Dashboard/assets/dashboard.js +++ /dev/null @@ -1 +0,0 @@ -// JS file for Dashboard diff --git a/src/Module/Admin/Dashboard/assets/dashboard.ts b/src/Module/Admin/Dashboard/assets/dashboard.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/Module/Front/Home/assets/home.js b/src/Module/Front/Home/assets/home.js deleted file mode 100644 index 8d329764..00000000 --- a/src/Module/Front/Home/assets/home.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Part of starter project. - * - * @copyright Copyright (C) 2021 __ORGANIZATION__. - * @license __LICENSE__ - */ - -export const Home = {}; diff --git a/src/Module/Front/Home/assets/home.ts b/src/Module/Front/Home/assets/home.ts new file mode 100644 index 00000000..e9516eeb --- /dev/null +++ b/src/Module/Front/Home/assets/home.ts @@ -0,0 +1 @@ +export const Home = {}; diff --git a/tsconfig.js.json b/tsconfig.js.json new file mode 100644 index 00000000..fb53f2c4 --- /dev/null +++ b/tsconfig.js.json @@ -0,0 +1,17 @@ +{ + "extends": [ + "@windwalker-io/core/tsconfig.js.json" + ], + "include": [ + "resources/assets/src/**/*.ts", + "src/Module/**/*.ts" + ], + "exclude": [ + "node_modules/**/*" + ], + "compilerOptions": { + "paths": { + "@/*": ["./resources/assets/src/*"] + } + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..ee5c352e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": [ + "@windwalker-io/core/tsconfig.js.json", + "@vue/tsconfig/tsconfig.dom.json" + ], + "include": [ + "vendor/**/src/Module/**/assets/**/*.ts", + "resources/assets/vue/**/*", + "resources/assets/vue/**/*.vue", + "resources/assets/src/**/*.ts", + "src/Module/**/*.ts" + ], + "exclude": [ + "node_modules/**/*" + ], + "types": ["reflect-metadata"], + "compilerOptions": { + "allowJs": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "paths": { + "@/*": ["./resources/assets/vue/*"], + } + } +}