create-jwn-js 1.0.21 → 1.0.22

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": "create-jwn-js",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "license": "PRIVATE",
5
5
  "author": "Webigorkiev",
6
6
  "bin": {
@@ -22,5 +22,18 @@
22
22
  "margv": "^1.1.2",
23
23
  "prompts": "^2.4.2"
24
24
  },
25
- "devDependencies": {}
25
+ "devDependencies": {
26
+ "@jwn-js/common": "^2.1.15",
27
+ "@types/memjs": "^1.3.3",
28
+ "@types/node": "18",
29
+ "buildmsql": "^1.6.9",
30
+ "cross-fetch": "3",
31
+ "easy-ash": "^1.1.14",
32
+ "jsdom": "^24.0.0",
33
+ "memjs": "^1.3.2",
34
+ "typescript": "^5.3.3",
35
+ "vite": "4",
36
+ "vitepress": "0.22.4",
37
+ "vitest": "^1.2.2"
38
+ }
26
39
  }
@@ -7,27 +7,29 @@
7
7
  "main": "./index.ts",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
+ "serve": "vite",
10
11
  "build": "vite build",
11
12
  "test": "vitest run",
13
+ "test:production": "vitest run -c vitest.config.production.ts",
12
14
  "docs:dev": "vitepress dev docs",
13
15
  "docs:build": "vitepress build docs",
14
16
  "docs:serve": "vitepress serve docs"
15
17
  },
16
18
  "devDependencies": {
17
- "@types/memjs": "^1.3.0",
18
- "@types/node": "^20.2.5",
19
- "typescript": "^5.1.3",
20
- "vite": "^4.3.9",
21
- "vitepress": "^1.0.0-beta.1",
22
- "vitest": "^0.32.0"
19
+ "@types/memjs": "^1.2.4",
20
+ "@types/node": "18",
21
+ "typescript": "^5.3.3",
22
+ "vite": "4",
23
+ "vitest": "^1.2.2",
24
+ "vitepress": "0.22.4",
25
+ "jsdom": "^24.0.0"
23
26
  },
24
27
  "dependencies": {
25
- "@jwn-js/common": "^2.0.7",
26
- "buildmsql": "^1.3.2",
27
- "cross-fetch": "^3.1.4",
28
- "easy-ash": "^1.1.5",
29
- "margv": "^1.1.2",
30
- "mariadb": "^3.1.2",
31
- "memjs": "^1.3.0"
28
+ "@jwn-js/common": "2.1.15",
29
+ "buildmsql": "1.6.9",
30
+ "cross-fetch": "3",
31
+ "easy-ash": "1.1.14",
32
+ "margv": "1.1.2",
33
+ "memjs": "1.3.2"
32
34
  }
33
35
  }
@@ -5,8 +5,9 @@ const args = margv();
5
5
  * Config for server
6
6
  * @param config
7
7
  */
8
- export const createConfigServer = (config: Record<string, any>) => {
9
- const configServer = process.env.NODE_ENV === "production" ? config.server.production : config.server.development;
8
+ export const createConfigServer = (config: Record<string, any>, nodeEnv?: "development"|"production"|"test") => {
9
+ const env = (nodeEnv || process.env.NODE_ENV || "development") as "development"|"production"|"test";
10
+ const configServer = config.server[env];
10
11
 
11
12
  configServer.https = args.https ?? configServer.https;
12
13
  configServer.protocol = configServer.https ? "https" : "http";
@@ -1,8 +1,14 @@
1
1
  import crossFetch from "cross-fetch";
2
+ // @ts-ignore
2
3
  import config from "../../connect.json";
4
+ <<<<<<< HEAD:template-vite-node-ts/src/scripts/test.setup.ts
5
+ import {createConfigServer} from "../../src/backend/server/helpers/createConfigServer";
6
+ const cnf = createConfigServer(config, process.env.TEST_MODE_APP as "test");
7
+ =======
3
8
  import {createConfigServer} from "@/backend/server/helpers/createConfigServer";
4
9
  const cnf = createConfigServer(config);
5
10
 
11
+ >>>>>>> ad324504e6d98d4d9229b45f1d428d8a9ce37811:template-vite-node-ts/src/scripts/test.config.ts
6
12
  const apiUrl = `${cnf.protocol}://${cnf.host}:${cnf.port}`;
7
13
  const defaultHeaders = {
8
14
  headers: {
@@ -0,0 +1,24 @@
1
+ import crossFetch from "cross-fetch";
2
+ // @ts-ignore
3
+ import config from "../../connect.json";
4
+ <<<<<<< HEAD:template-vite-node-ts/src/scripts/test.setup.ts
5
+ import {createConfigServer} from "../../src/backend/server/helpers/createConfigServer";
6
+ const cnf = createConfigServer(config, process.env.TEST_MODE_APP as "test");
7
+ =======
8
+ import {createConfigServer} from "@/backend/server/helpers/createConfigServer";
9
+ const cnf = createConfigServer(config);
10
+
11
+ >>>>>>> ad324504e6d98d4d9229b45f1d428d8a9ce37811:template-vite-node-ts/src/scripts/test.config.ts
12
+ const apiUrl = `${cnf.protocol}://${cnf.host}:${cnf.port}`;
13
+ const defaultHeaders = {
14
+ headers: {
15
+ "user-agent": "fetch-tests",
16
+ "content-type": "application/json"
17
+ }
18
+ }
19
+ const fetch = async(
20
+ input: RequestInfo,
21
+ init: RequestInit = {}
22
+ ) => crossFetch(input, Object.assign({}, defaultHeaders, init));
23
+
24
+ export {fetch, apiUrl};
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "types": [
25
25
  "vite/client",
26
- "node"
26
+ "node",
27
27
  ],
28
28
  "baseUrl": ".",
29
29
  "paths": {
@@ -33,9 +33,11 @@
33
33
  }
34
34
  },
35
35
  "include": [
36
- "./node_modules/vitest/globals.d.ts",
37
- "./src/**/*.ts",
38
- "./src/**/*.d.ts",
36
+ "src/**/*.ts",
37
+ "src/**/*.d.ts",
38
+ "src/**/*.tsx",
39
+ "src/**/*.vue",
40
+ "node_modules/vitest/globals.d.ts"
39
41
  ],
40
42
  "exclude": [
41
43
  "dist"
@@ -1,8 +1,7 @@
1
1
  import * as path from "path";
2
2
  import {build, defineConfig, mergeConfig, Plugin, ResolvedConfig} from "vite";
3
3
  import fetch from "cross-fetch";
4
-
5
- //@ts-ignore
4
+ // @ts-ignore
6
5
  import config from "./connect.json";
7
6
  import {createConfigServer} from "./src/backend/server/helpers/createConfigServer";
8
7
  import {createMemcached} from "./src/backend/server/helpers/createMemcached";
@@ -0,0 +1,41 @@
1
+ /// <reference types="vitest" />
2
+ import path from 'node:path';
3
+ import {defineConfig} from 'vitest/config';
4
+ import vue from '@vitejs/plugin-vue';
5
+
6
+ process.env.TEST_MODE_APP = "production";
7
+
8
+ export default defineConfig({
9
+ resolve: {
10
+ alias: [
11
+ {
12
+ find: /^~(.+)/,
13
+ replacement: path.resolve('./node_modules') + '/$1',
14
+ },
15
+ {
16
+ find: /@\/(.*)/,
17
+ replacement: path.resolve('./src') + '/$1',
18
+ },
19
+ ],
20
+ },
21
+ plugins: [
22
+ //@ts-ignore
23
+ vue(),
24
+ ],
25
+ test: {
26
+ root: "./",
27
+ include: ["**/__its__/**/*.[jt]s?(x)"],
28
+ exclude: ["**/node_modules/**", "./src/certs/**", "./src/scripts/**", "./src/sql/**", "./src/estimation-client/**"],
29
+ environment: "jsdom",
30
+ globals: true,
31
+ testTimeout: 15000,
32
+ hookTimeout: 15000,
33
+ // @ts-ignore
34
+ singleThread: true,
35
+ poolOptions: {
36
+ threads: {
37
+ singleThread: true
38
+ }
39
+ }
40
+ }
41
+ });
@@ -1,19 +1,43 @@
1
- import {defineConfig} from "vitest/config";
2
- import * as path from "path";
1
+ /// <reference types="vitest" />
2
+ import path from 'node:path';
3
+ import { defineConfig } from 'vitest/config';
4
+ import vue from '@vitejs/plugin-vue';
5
+
6
+ process.env.TEST_MODE_APP = "test";
3
7
 
4
8
  export default defineConfig({
5
- resolve: {
6
- alias: [
7
- {
8
- find: /^~(.+)/,
9
- replacement: path.resolve("./node_modules") + "/$1"
10
- },
11
- {
12
- find: /@\/(.*)/,
13
- replacement: path.resolve("./src") + "/$1"
14
- }
15
- ],
16
- },
17
- plugins: [
18
- ]
19
- });
9
+ resolve: {
10
+ alias: [
11
+ {
12
+ find: /^~(.+)/,
13
+ replacement: path.resolve('./node_modules') + '/$1',
14
+ },
15
+ {
16
+ find: /@\/(.*)/,
17
+ replacement: path.resolve('./src') + '/$1',
18
+ },
19
+ ],
20
+ },
21
+ plugins: [
22
+ //@ts-ignore
23
+ vue(),
24
+ ],
25
+ test: {
26
+ root: "./",
27
+ include: ["**/__its__/**/*.[jt]s?(x)", "**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
28
+ exclude: ["**/node_modules/**", "./src/certs/**", "./src/scripts/**", "./src/sql/**", "./src/estimation-client/**"],
29
+ environment: "jsdom",
30
+ globals: true,
31
+ globalSetup: ["./src/scripts/vitest.global.setup.ts"],
32
+ testTimeout: 15000,
33
+ hookTimeout: 15000,
34
+ // threads: false
35
+ // @ts-ignore
36
+ singleThread: true,
37
+ poolOptions: {
38
+ threads: {
39
+ singleThread: true
40
+ }
41
+ }
42
+ },
43
+ });
@@ -1,34 +0,0 @@
1
- {
2
- "server": {
3
- "development": {
4
- "mode": "development",
5
- "https": false,
6
- "port": 3000,
7
- "host": "localhost"
8
- },
9
- "production": {
10
- "mode": "production",
11
- "port": 3000,
12
- "host": "127.0.0.1",
13
- "url": "http://127.0.0.1"
14
- }
15
- },
16
- "db": {
17
- "home": {
18
- "engine": "mysql",
19
- "host": "localhost",
20
- "user": "",
21
- "password": "",
22
- "database": "",
23
- "connectTimeout": 10000,
24
- "acquireTimeout": 10000,
25
- "connectionLimit": 2,
26
- "charset": "utf8",
27
- "compress": true,
28
- "port": 3306,
29
- "multipleStatements": true,
30
- "namedPlaceholders": true,
31
- "dateStrings": true
32
- }
33
- }
34
- }
@@ -1,37 +0,0 @@
1
- export default {
2
- moduleFileExtensions: [
3
- "js",
4
- "ts",
5
- "json",
6
- "vue",
7
- "node"
8
- ],
9
- transform: {
10
- "^.+\\.ts$": "ts-jest"
11
- },
12
- moduleNameMapper: {
13
- "@/(.*)$": "<rootDir>/src/$1"
14
- },
15
- setupFiles: ["./src/scripts/jest.setup.ts"],
16
- globalSetup: "./src/scripts/jest.global.setup.ts",
17
- globalTeardown: "./src/scripts/jest.global.teardown.ts",
18
- testTimeout: 35000,
19
- globals: {
20
- 'ts-jest': {
21
- tsconfig: './tsconfig.json',
22
- diagnostics: false
23
- }
24
- },
25
- testEnvironment: "jsdom",
26
- maxWorkers: 2,
27
- testMatch: [ "**/__its__/**/*.[jt]s?(x)", "**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)" ],
28
- testPathIgnorePatterns: ["<rootDir>/src/scripts",],
29
- collectCoverageFrom: [
30
- "**/src/**/*.{ts}",
31
- "!**/src/**/*.d.ts",
32
- "!**/src/**/index.ts",
33
- "!**/src/scripts/**",
34
- "!**/src/sql/**",
35
- "!**/src/backend/server/web-routes/**",
36
- ]
37
- };