Forráskód Böngészése

chore: Remove Gulp dependency

Replaced with simplified script
Michael Bromley 1 éve
szülő
commit
e9ab0355ab

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 32 - 711
package-lock.json


+ 1 - 1
packages/admin-ui-plugin/package.json

@@ -30,6 +30,6 @@
     },
     "dependencies": {
         "date-fns": "^2.30.0",
-        "fs-extra": "^11.1.1"
+        "fs-extra": "^11.2.0"
     }
 }

+ 1 - 1
packages/admin-ui/package.json

@@ -100,7 +100,7 @@
     "eslint-plugin-import": "^2.27.5",
     "eslint-plugin-jsdoc": "^45.0.0",
     "eslint-plugin-prefer-arrow": "^1.2.3",
-    "fs-extra": "^11.1.1",
+    "fs-extra": "^11.2.0",
     "jasmine-core": "~3.99.1",
     "jasmine-spec-reporter": "~7.0.0",
     "karma": "~6.3.4",

+ 1 - 1
packages/cli/package.json

@@ -38,7 +38,7 @@
         "@vendure/common": "2.2.0-next.5",
         "change-case": "^4.1.2",
         "commander": "^11.0.0",
-        "fs-extra": "^11.1.1",
+        "fs-extra": "^11.2.0",
         "picocolors": "^1.0.0",
         "ts-morph": "^21.0.1"
     },

+ 74 - 0
packages/core/build/copy-static.ts

@@ -0,0 +1,74 @@
+/* eslint-disable no-console */
+import chokidar from 'chokidar';
+import fs from 'fs-extra';
+import { globSync } from 'glob';
+import path from 'path';
+
+const SCHEMAS_GLOB = '**/*.graphql';
+const MESSAGES_GLOB = 'i18n/messages/**/*';
+const DEST_DIR = path.join(__dirname, '../dist');
+const MESSAGES_DEST_DIR = path.join(__dirname, '../dist/i18n/messages');
+
+function copyFiles(sourceGlob: string, destinationDir: string) {
+    const srcDir = path.join(__dirname, '../src');
+    const files = globSync(sourceGlob, {
+        cwd: srcDir,
+    });
+    for (const file of files) {
+        const destFile = path.join(destinationDir, file);
+        try {
+            fs.ensureDirSync(path.dirname(destFile));
+            fs.copySync(path.join(srcDir, file), destFile);
+        } catch (error: any) {
+            console.error(`Error copying file ${file}:`, error);
+        }
+    }
+}
+
+function copySchemas() {
+    try {
+        copyFiles(SCHEMAS_GLOB, DEST_DIR);
+        console.log('Schemas copied successfully!');
+    } catch (error) {
+        console.error('Error copying schemas:', error);
+    }
+}
+
+function copyI18nMessages() {
+    try {
+        copyFiles(MESSAGES_GLOB, MESSAGES_DEST_DIR);
+        console.log('I18n messages copied successfully!');
+    } catch (error) {
+        console.error('Error copying i18n messages:', error);
+    }
+}
+
+function build() {
+    copySchemas();
+    copyI18nMessages();
+}
+
+function watch() {
+    const watcher1 = chokidar.watch(SCHEMAS_GLOB, { cwd: path.join(__dirname, '../src') });
+    const watcher2 = chokidar.watch(MESSAGES_GLOB, { cwd: path.join(__dirname, '../src') });
+
+    watcher1.on('change', copySchemas);
+    watcher2.on('change', copyI18nMessages);
+
+    console.log('Watching for changes...');
+}
+
+function runCommand() {
+    const command = process.argv[2];
+
+    if (command === 'build') {
+        build();
+    } else if (command === 'watch') {
+        watch();
+    } else {
+        console.error('Invalid command. Please use "build" or "watch".');
+    }
+}
+
+// Run command specified in the command line argument
+runCommand();

+ 6 - 4
packages/core/package.json

@@ -20,9 +20,9 @@
     "type": "commonjs",
     "scripts": {
         "tsc:watch": "tsc -p ./build/tsconfig.build.json --watch",
-        "gulp:watch": "gulp -f ./build/gulpfile.ts watch",
-        "build": "rimraf dist && tsc -p ./build/tsconfig.build.json && tsc -p ./build/tsconfig.cli.json && gulp -f ./build/gulpfile.ts build",
-        "watch": "concurrently npm:tsc:watch npm:gulp:watch",
+        "copy:watch": "ts-node build/copy-static.ts watch",
+        "build": "rimraf dist && tsc -p ./build/tsconfig.build.json && tsc -p ./build/tsconfig.cli.json && ts-node build/copy-static.ts build",
+        "watch": "concurrently npm:tsc:watch npm:copy:watch",
         "lint": "eslint --fix .",
         "test": "vitest --config vitest.config.mts --run",
         "e2e": "cross-env PACKAGE=core vitest --config ../../e2e-common/vitest.config.mts --run",
@@ -93,7 +93,9 @@
         "@types/prompts": "^2.4.9",
         "@types/semver": "^7.5.8",
         "better-sqlite3": "^9.4.3",
-        "gulp": "^4.0.2",
+        "chokidar": "^3.6.0",
+        "fs-extra": "^11.2.0",
+        "glob": "^10.3.10",
         "mysql": "^2.18.1",
         "pg": "^8.11.3",
         "rimraf": "^5.0.5",

+ 1 - 1
packages/create/package.json

@@ -39,7 +39,7 @@
         "commander": "^11.0.0",
         "cross-spawn": "^7.0.3",
         "detect-port": "^1.5.1",
-        "fs-extra": "^11.1.1",
+        "fs-extra": "^11.2.0",
         "handlebars": "^4.7.8",
         "picocolors": "^1.0.0",
         "semver": "^7.5.4",

+ 1 - 1
packages/email-plugin/package.json

@@ -24,7 +24,7 @@
         "@types/nodemailer": "^6.4.9",
         "dateformat": "^3.0.3",
         "express": "^4.18.2",
-        "fs-extra": "^11.1.1",
+        "fs-extra": "^11.2.0",
         "handlebars": "^4.7.8",
         "mjml": "^4.14.1",
         "nodemailer": "^6.9.4"

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott