@cybertale/form 2.0.2 → 2.0.3

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.
@@ -0,0 +1,81 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import promptSync from 'prompt-sync';
5
+
6
+ const prompt = promptSync();
7
+
8
+ // Get the directory name of the current module
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+
11
+ // Correct the source and destination directory paths
12
+ const sourceDir = path.resolve(__dirname, 'src');
13
+ const destDir = path.resolve(process.cwd(), 'src', '@cybertale', 'form');
14
+
15
+ // Create the destination directory if it doesn't exist
16
+ const ensureDir = async (dir) => {
17
+ try {
18
+ await fs.mkdir(dir, { recursive: true });
19
+ } catch (err) {
20
+ if (err.code !== 'EEXIST') {
21
+ throw err;
22
+ }
23
+ }
24
+ };
25
+
26
+ // Function to copy files and directories
27
+ const copyFiles = async (source, destination) => {
28
+ try {
29
+ const files = await fs.readdir(source, { withFileTypes: true });
30
+
31
+ await ensureDir(destination);
32
+
33
+ for (const file of files) {
34
+ const sourceFile = path.join(source, file.name);
35
+ const destFile = path.join(destination, file.name);
36
+
37
+ if (file.isFile()) {
38
+ await fs.copyFile(sourceFile, destFile);
39
+ console.log(`Copied: ${sourceFile} -> ${destFile}`);
40
+ } else if (file.isDirectory()) {
41
+ // Recursively copy directories
42
+ await copyFiles(sourceFile, destFile);
43
+ }
44
+ }
45
+ } catch (err) {
46
+ console.error('Error copying files:', err);
47
+ throw err;
48
+ }
49
+ };
50
+
51
+ // Check if the destination directory already exists
52
+ const checkAndCopy = async () => {
53
+ try {
54
+ // Ensure destination directory exists or create it
55
+ await ensureDir(destDir);
56
+
57
+ const destExists = (await fs.readdir(destDir)).length > 0;
58
+
59
+ if (destExists) {
60
+ const response = prompt('The destination directory already exists. Do you want to overwrite it? (yes/no): ').toLowerCase();
61
+ if (response !== 'yes') {
62
+ console.log('Operation cancelled.');
63
+ return;
64
+ }
65
+
66
+ // Empty the destination directory before copying
67
+ await fs.rm(destDir, { recursive: true, force: true });
68
+ await ensureDir(destDir);
69
+ }
70
+
71
+ // Start copying files
72
+ await copyFiles(sourceDir, destDir);
73
+ console.log('Files copied successfully.');
74
+
75
+ } catch (err) {
76
+ console.error('Error during the copy process:', err);
77
+ }
78
+ };
79
+
80
+ // Start the process
81
+ checkAndCopy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cybertale/form",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "ECS interface for Web Development, CyberTale edition.",
5
5
  "author": "Joso Marich <jspmari@proton.me>",
6
6
  "license": "GPL-3.0-only",
@@ -19,7 +19,7 @@
19
19
  "directories": {
20
20
  "lib": "src"
21
21
  },
22
- "types": "src/index.d.ts",
22
+ "types": "src/index.ts",
23
23
  "module": "src/index.ts",
24
24
  "exports": {
25
25
  ".": {
@@ -29,10 +29,18 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@cybertale/interface": "^2.0.6",
32
- "vue": "^3.4.30"
32
+ "typescript": "^5.5.3",
33
+ "vue": "^3.4.33",
34
+ "vue-facing-decorator": "^3.0.4",
35
+ "prompt-sync": "^4.2.0"
33
36
  },
34
37
  "devDependencies": {
35
- "typescript": "~5.4.0",
36
- "vue-facing-decorator": "^3.0.4"
38
+ "@vitejs/plugin-vue": "^5.0.5",
39
+ "@vue/compiler-sfc": "^3.4.33",
40
+ "vite": "^5.3.4"
41
+ },
42
+ "scripts": {
43
+ "copy-package": "node copy-package.mjs",
44
+ "postinstall": "npm run copy-package"
37
45
  }
38
46
  }
package/src/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- // index.d.ts
2
- import { DefineComponent } from 'vue';
3
-
4
- declare module 'vue' {
5
- export interface AlertComponent extends DefineComponent {}
6
- export interface ButtonComponent extends DefineComponent {}
7
- export interface CheckBoxComponent extends DefineComponent {}
8
- export interface DataListComponent extends DefineComponent {}
9
- export interface FieldComponent extends DefineComponent {}
10
- export interface LabelComponent extends DefineComponent {}
11
- export interface RadioComponent extends DefineComponent {}
12
- export interface SelectListComponent extends DefineComponent {}
13
- }
14
-
15
- export { AlertComponent, ButtonComponent, CheckBoxComponent, DataListComponent, FieldComponent, LabelComponent, RadioComponent, SelectListComponent };
package/tsconfig.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "strict": true,
6
- "jsx": "preserve",
7
- "importHelpers": true,
8
- "moduleResolution": "node",
9
- "experimentalDecorators": true,
10
- "skipLibCheck": true,
11
- "esModuleInterop": true,
12
- "allowSyntheticDefaultImports": true,
13
- "sourceMap": true,
14
- "baseUrl": ".",
15
- "types": [
16
- "webpack-env"
17
- ],
18
- "paths": {
19
- "@/*": [
20
- "src/*"
21
- ]
22
- },
23
- "lib": [
24
- "esnext",
25
- "dom",
26
- "dom.iterable",
27
- "scripthost"
28
- ]
29
- },
30
- "include": [
31
- "src/**/*.ts",
32
- "src/**/*.tsx",
33
- "src/**/*.vue",
34
- "tests/**/*.ts",
35
- "tests/**/*.tsx",
36
- "src/**/*",
37
- "typings/**/*"
38
- ],
39
- "exclude": [
40
- "node_modules"
41
- ]
42
- }