@cybertale/form 2.0.1 → 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.
package/README.md CHANGED
@@ -3,22 +3,11 @@
3
3
  ##### UI collections for inserting and editing devices along with administration management and creation of custom device forms/groups.
4
4
  ## Compatible version
5
5
  ```
6
- node: v14.21
7
- npm: 6.14
6
+ node: v22.3.0
7
+ npm: 10.8.1
8
8
  ```
9
9
  ## Project setup
10
10
  ```
11
11
  npm install
12
12
  ```
13
- ### Import folder to Vue CLI!
14
13
 
15
- ### Customize configuration (.env.development example)
16
-
17
- ```
18
- VUE_APP_BASE_URL=http://blog.test/api/
19
- VUE_APP_URL=http://blog.test/
20
- VUE_APP_CLIENT_ID=99062c75-d480-4659-82b7-7e0037d7fc52
21
-
22
- PS:get VUE_APP_CLIENT_ID from oauth database, table oauth_clients.
23
- Be sure that you choose the row with front_redirect to localhost:8080
24
- ```
@@ -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.1",
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",
@@ -29,29 +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"
37
41
  },
38
- "eslintConfig": {
39
- "env": {
40
- "node": true
41
- },
42
- "extends": [
43
- "plugin:vue/vue3-essential",
44
- "@vue/standard",
45
- "@vue/typescript/recommended"
46
- ],
47
- "parserOptions": {
48
- "ecmaVersion": 2020,
49
- "sourceType": "module"
50
- }
51
- },
52
- "browserslist": [
53
- "> 1%",
54
- "last 2 versions",
55
- "not dead"
56
- ]
42
+ "scripts": {
43
+ "copy-package": "node copy-package.mjs",
44
+ "postinstall": "npm run copy-package"
45
+ }
57
46
  }
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
- }