@akanjs/config 0.0.4
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 +11 -0
- package/index.d.ts +1 -0
- package/index.js +27 -0
- package/package.json +76 -0
- package/src/PageAgent.d.ts +13 -0
- package/src/PageAgent.js +67 -0
- package/src/PageAgent.ts +42 -0
- package/src/jest.config.base.d.ts +2 -0
- package/src/jest.config.base.js +49 -0
- package/src/jest.config.base.ts +25 -0
- package/src/jest.globalSetup.d.ts +4 -0
- package/src/jest.globalSetup.js +38 -0
- package/src/jest.globalSetup.ts +27 -0
- package/src/jest.globalTeardown.d.ts +3 -0
- package/src/jest.globalTeardown.js +30 -0
- package/src/jest.globalTeardown.ts +12 -0
- package/src/jest.preset.js +3 -0
- package/src/jest.setupFilesAfterEnv.d.ts +1 -0
- package/src/jest.setupFilesAfterEnv.js +10 -0
- package/src/jest.setupFilesAfterEnv.ts +17 -0
- package/src/next.base.js +127 -0
- package/src/playwright.config.base.d.ts +9 -0
- package/src/playwright.config.base.js +80 -0
- package/src/playwright.config.base.ts +71 -0
- package/src/tailwind.base.js +351 -0
- package/src/testServer.d.ts +12 -0
- package/src/testServer.js +139 -0
- package/src/testServer.ts +105 -0
- package/src/tsconfig.backend.json +24 -0
- package/src/webpack.backend.base.js +42 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var playwright_config_base_exports = {};
|
|
19
|
+
__export(playwright_config_base_exports, {
|
|
20
|
+
withBase: () => withBase
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(playwright_config_base_exports);
|
|
23
|
+
var import_devkit = require("@nx/devkit");
|
|
24
|
+
var import_preset = require("@nx/playwright/preset");
|
|
25
|
+
var import_test = require("@playwright/test");
|
|
26
|
+
const baseURL = process.env.BASE_URL ?? "http://127.0.0.1:4200";
|
|
27
|
+
const projectName = process.env.NX_TASK_TARGET_PROJECT ?? "unknown";
|
|
28
|
+
const withBase = (filename, config = {}) => (0, import_test.defineConfig)({
|
|
29
|
+
...(0, import_preset.nxE2EPreset)(filename, { testDir: "./app" }),
|
|
30
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
31
|
+
use: {
|
|
32
|
+
baseURL,
|
|
33
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
34
|
+
trace: "on-first-retry"
|
|
35
|
+
},
|
|
36
|
+
/* Run your local dev server before starting the tests */
|
|
37
|
+
webServer: {
|
|
38
|
+
command: `nx serve ${projectName}`,
|
|
39
|
+
url: "http://127.0.0.1:4200",
|
|
40
|
+
reuseExistingServer: !process.env.CI,
|
|
41
|
+
cwd: import_devkit.workspaceRoot
|
|
42
|
+
},
|
|
43
|
+
projects: [
|
|
44
|
+
{
|
|
45
|
+
name: "chromium",
|
|
46
|
+
use: { ...import_test.devices["Desktop Chrome"] }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "firefox",
|
|
50
|
+
use: { ...import_test.devices["Desktop Firefox"] }
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "webkit",
|
|
54
|
+
use: { ...import_test.devices["Desktop Safari"] }
|
|
55
|
+
}
|
|
56
|
+
// Uncomment for mobile browsers support
|
|
57
|
+
/* {
|
|
58
|
+
name: 'Mobile Chrome',
|
|
59
|
+
use: { ...devices['Pixel 5'] },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Mobile Safari',
|
|
63
|
+
use: { ...devices['iPhone 12'] },
|
|
64
|
+
}, */
|
|
65
|
+
// Uncomment for branded browsers
|
|
66
|
+
/* {
|
|
67
|
+
name: 'Microsoft Edge',
|
|
68
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Google Chrome',
|
|
72
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
73
|
+
} */
|
|
74
|
+
],
|
|
75
|
+
...config
|
|
76
|
+
});
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
withBase
|
|
80
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { workspaceRoot } from "@nx/devkit";
|
|
2
|
+
import { nxE2EPreset } from "@nx/playwright/preset";
|
|
3
|
+
import { defineConfig, devices, type PlaywrightTestConfig } from "@playwright/test";
|
|
4
|
+
|
|
5
|
+
// For CI, you may want to set BASE_URL to the deployed application.
|
|
6
|
+
const baseURL = process.env.BASE_URL ?? "http://127.0.0.1:4200";
|
|
7
|
+
const projectName = process.env.NX_TASK_TARGET_PROJECT ?? "unknown";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Read environment variables from file.
|
|
11
|
+
* https://github.com/motdotla/dotenv
|
|
12
|
+
*/
|
|
13
|
+
// require('dotenv').config();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
17
|
+
*/
|
|
18
|
+
export const withBase = (filename: string, config: PlaywrightTestConfig = {}) =>
|
|
19
|
+
defineConfig({
|
|
20
|
+
...nxE2EPreset(filename, { testDir: "./app" }),
|
|
21
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
22
|
+
use: {
|
|
23
|
+
baseURL,
|
|
24
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
25
|
+
trace: "on-first-retry",
|
|
26
|
+
},
|
|
27
|
+
/* Run your local dev server before starting the tests */
|
|
28
|
+
webServer: {
|
|
29
|
+
command: `nx serve ${projectName}`,
|
|
30
|
+
url: "http://127.0.0.1:4200",
|
|
31
|
+
reuseExistingServer: !process.env.CI,
|
|
32
|
+
cwd: workspaceRoot,
|
|
33
|
+
},
|
|
34
|
+
projects: [
|
|
35
|
+
{
|
|
36
|
+
name: "chromium",
|
|
37
|
+
use: { ...devices["Desktop Chrome"] },
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
name: "firefox",
|
|
42
|
+
use: { ...devices["Desktop Firefox"] },
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
name: "webkit",
|
|
47
|
+
use: { ...devices["Desktop Safari"] },
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// Uncomment for mobile browsers support
|
|
51
|
+
/* {
|
|
52
|
+
name: 'Mobile Chrome',
|
|
53
|
+
use: { ...devices['Pixel 5'] },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Mobile Safari',
|
|
57
|
+
use: { ...devices['iPhone 12'] },
|
|
58
|
+
}, */
|
|
59
|
+
|
|
60
|
+
// Uncomment for branded browsers
|
|
61
|
+
/* {
|
|
62
|
+
name: 'Microsoft Edge',
|
|
63
|
+
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Google Chrome',
|
|
67
|
+
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
68
|
+
} */
|
|
69
|
+
],
|
|
70
|
+
...config,
|
|
71
|
+
});
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
const { createGlobPatternsForDependencies } = require("@nx/next/tailwind");
|
|
2
|
+
const { join } = require("path");
|
|
3
|
+
|
|
4
|
+
const directions = ["Right", "Left", "Up", "Down"];
|
|
5
|
+
const percentages = [5, 15, 30, 100];
|
|
6
|
+
const duration = [150, 500, 1000];
|
|
7
|
+
|
|
8
|
+
// fadeInRight5_150ms: "fadeInRight5 0.15s ease-in-out forwards",
|
|
9
|
+
// fadeInRight5_500ms: "fadeInRight5 0.5s ease-in-out forwards",
|
|
10
|
+
// fadeInRight5_1000ms: "fadeInRight5 1s ease-in-out forwards",
|
|
11
|
+
// delay 는 animation-delay-300 을 className에 추가해서 사용
|
|
12
|
+
// 그 외의 duration,timing function, fill mode 적용시, animate-[fadeInRight100_1s_ease-in-out_2s_forwards]
|
|
13
|
+
const animations = directions.reduce((acc, direction) => {
|
|
14
|
+
percentages.forEach((percentage) => {
|
|
15
|
+
duration.forEach((time) => {
|
|
16
|
+
const key = `fadeIn${direction}${percentage}_${time}ms`;
|
|
17
|
+
const value = `fadeIn${direction}${percentage} ${time / 1000}s ease-in-out forwards`;
|
|
18
|
+
acc[key] = value;
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
|
|
24
|
+
const keyframes = directions.reduce((acc, direction) => {
|
|
25
|
+
percentages.forEach((percentage) => {
|
|
26
|
+
const key = `fadeIn${direction}${percentage}`;
|
|
27
|
+
const xPercentage = direction === "Left" ? -percentage : direction === "Right" ? percentage : 0;
|
|
28
|
+
const yPercentage = direction === "Up" ? percentage : direction === "Down" ? -percentage : 0;
|
|
29
|
+
|
|
30
|
+
const value = {
|
|
31
|
+
"0%": {
|
|
32
|
+
opacity: 0,
|
|
33
|
+
// transform: `translate(${xPercentage}%, ${yPercentage}%)`,
|
|
34
|
+
translate: `${xPercentage}% ${yPercentage}%`,
|
|
35
|
+
},
|
|
36
|
+
"100%": {
|
|
37
|
+
opacity: 1,
|
|
38
|
+
// transform: "translate(0, 0)",
|
|
39
|
+
translate: "0 0",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
acc[key] = value;
|
|
44
|
+
});
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
|
|
48
|
+
const defaultPlugin = require("tailwindcss/plugin")(
|
|
49
|
+
({ matchUtilities, theme, addUtilities, addComponents, addBase }) => {
|
|
50
|
+
matchUtilities(
|
|
51
|
+
{
|
|
52
|
+
"animation-delay": (value) => {
|
|
53
|
+
return { "animation-delay": value };
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{ values: theme("transitionDelay") }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
addUtilities({
|
|
60
|
+
".centric": {
|
|
61
|
+
display: "flex",
|
|
62
|
+
"justify-content": "center",
|
|
63
|
+
"align-items": "center",
|
|
64
|
+
},
|
|
65
|
+
".all-initial": { all: "initial" },
|
|
66
|
+
".all-inherit": { all: "inherit" },
|
|
67
|
+
".all-revert": { all: "revert" },
|
|
68
|
+
".all-unset": { all: "unset" },
|
|
69
|
+
});
|
|
70
|
+
addComponents({});
|
|
71
|
+
addBase({});
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
theme: {
|
|
75
|
+
container: { center: true },
|
|
76
|
+
extend: {
|
|
77
|
+
colors: {
|
|
78
|
+
"primary-light": "hsl(var(--primary-light) / <alpha-value>)",
|
|
79
|
+
"primary-dark": "hsl(var(--primary-dark) / <alpha-value>)",
|
|
80
|
+
"secondary-light": "hsl(var(--secondary-light) / <alpha-value>)",
|
|
81
|
+
"secondary-dark": "hsl(var(--secondary-dark) / <alpha-value>)",
|
|
82
|
+
},
|
|
83
|
+
transitionProperty: {
|
|
84
|
+
all: "all",
|
|
85
|
+
},
|
|
86
|
+
keyframes: {
|
|
87
|
+
smaller: {
|
|
88
|
+
"0%": { scale: 1, height: "100%" },
|
|
89
|
+
"100%": { scale: 0, height: 0 },
|
|
90
|
+
},
|
|
91
|
+
bigger: {
|
|
92
|
+
"0%": {
|
|
93
|
+
transform: "scale(0.5)",
|
|
94
|
+
},
|
|
95
|
+
"100%": {
|
|
96
|
+
transform: "scale(1)",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
fadeIn: {
|
|
100
|
+
"0%": { opacity: 0 },
|
|
101
|
+
"100%": { opacity: 1 },
|
|
102
|
+
},
|
|
103
|
+
flyOut: {
|
|
104
|
+
"0%": { opacity: 1, transform: "translate(-50%, -100%)" },
|
|
105
|
+
"100%": { opacity: 0, transform: "translate(-50%, -140%)" },
|
|
106
|
+
},
|
|
107
|
+
drop: {
|
|
108
|
+
"0%": { opacity: 0, transform: "translate(-50%, -140%)" },
|
|
109
|
+
"100%": { opacity: 1, transform: "translate(-50%, -100%)" },
|
|
110
|
+
},
|
|
111
|
+
fadeOut: {
|
|
112
|
+
"0%": { opacity: 1 },
|
|
113
|
+
"100%": { opacity: 0 },
|
|
114
|
+
},
|
|
115
|
+
flash: {
|
|
116
|
+
"0%": { opacity: 1 },
|
|
117
|
+
"50%": { opacity: 0.2 },
|
|
118
|
+
"100%": { opacity: 1 },
|
|
119
|
+
},
|
|
120
|
+
spin: {
|
|
121
|
+
"0%": { transform: "rotate(0deg)" },
|
|
122
|
+
"100%": { transform: "rotate(360deg)" },
|
|
123
|
+
},
|
|
124
|
+
pop: {
|
|
125
|
+
"0%": { transform: "scale(0, 0)" },
|
|
126
|
+
"50%": { transform: "scale(1.5, 1.5)" },
|
|
127
|
+
"100%": { transform: "scale(1, 1)" },
|
|
128
|
+
},
|
|
129
|
+
slideDown: {
|
|
130
|
+
from: { height: 0 },
|
|
131
|
+
to: { height: "var(--radix-accordion-content-height)" },
|
|
132
|
+
},
|
|
133
|
+
slideUp: {
|
|
134
|
+
from: { height: "var(--radix-accordion-content-height)" },
|
|
135
|
+
to: { height: 0 },
|
|
136
|
+
},
|
|
137
|
+
menuOpen: {
|
|
138
|
+
"0%": {
|
|
139
|
+
opacity: 0,
|
|
140
|
+
width: 0,
|
|
141
|
+
},
|
|
142
|
+
"100%": {
|
|
143
|
+
opacity: 1,
|
|
144
|
+
width: 80,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
menuClose: {
|
|
148
|
+
"0%": {
|
|
149
|
+
opacity: 1,
|
|
150
|
+
width: 80,
|
|
151
|
+
},
|
|
152
|
+
"100%": {
|
|
153
|
+
opacity: 0,
|
|
154
|
+
width: 0,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
"backdrop-blur": {
|
|
158
|
+
"0%": { "backdrop-filter": "blur(0)" },
|
|
159
|
+
"100%": { "backdrop-filter": "blur(5px)" },
|
|
160
|
+
},
|
|
161
|
+
zoomIn: {
|
|
162
|
+
"0%": {
|
|
163
|
+
opacity: 0,
|
|
164
|
+
transform: "scale(0.6)",
|
|
165
|
+
},
|
|
166
|
+
"100%": {
|
|
167
|
+
opacity: 1,
|
|
168
|
+
transform: "scale(1)",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
bottomUp: {
|
|
172
|
+
"0%": {
|
|
173
|
+
transform: "translateY(100%)",
|
|
174
|
+
},
|
|
175
|
+
"100%": {
|
|
176
|
+
transform: "translateY(0)",
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
bottomDown: {
|
|
180
|
+
"0%": {
|
|
181
|
+
transform: "translateY(0)",
|
|
182
|
+
},
|
|
183
|
+
"100%": {
|
|
184
|
+
transform: "translateY(100%)",
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
wave: {
|
|
188
|
+
"0%": {
|
|
189
|
+
"box-shadow":
|
|
190
|
+
"0 0 0 0 rgba(219, 39, 119, 0.3), 0 0 0 1em rgba(219, 39, 119, 0.3), 0 0 0 2em rgba(219, 39, 119, 0.3),0 0 0 3em rgba(219, 39, 119, 0.3)",
|
|
191
|
+
},
|
|
192
|
+
"100%": {
|
|
193
|
+
"box-shadow":
|
|
194
|
+
"0 0 0 1em rgba(219, 39, 119, 0.3), 0 0 0 2em rgba(219, 39, 119, 0.3), 0 0 0 3em rgba(219, 39, 119, 0.3), 0 0 0 4em rgba(219, 39, 119, 0)",
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
translateUp: {
|
|
198
|
+
"0%": {
|
|
199
|
+
transform: "translateY(0)",
|
|
200
|
+
},
|
|
201
|
+
"100%": {
|
|
202
|
+
transform: "translateY(-60%)",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
tranlateLeft: {
|
|
206
|
+
"0%": {
|
|
207
|
+
transform: "translateX(100%)",
|
|
208
|
+
},
|
|
209
|
+
"100%": {
|
|
210
|
+
transform: "translateX(0)",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
tranlateRight: {
|
|
214
|
+
"0%": {
|
|
215
|
+
transform: "translateX(-100%)",
|
|
216
|
+
},
|
|
217
|
+
"100%": {
|
|
218
|
+
transform: "translateX(0)",
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
floatUpDown: {
|
|
222
|
+
"0%": {
|
|
223
|
+
transform: "translateY(0%)",
|
|
224
|
+
},
|
|
225
|
+
"50%": {
|
|
226
|
+
transform: "translateY(10%)",
|
|
227
|
+
},
|
|
228
|
+
"100%": {
|
|
229
|
+
transform: "translateY(0%)",
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
floatDownUp: {
|
|
233
|
+
"0%": {
|
|
234
|
+
transform: "translateY(10%)",
|
|
235
|
+
},
|
|
236
|
+
"50%": {
|
|
237
|
+
transform: "translateY(0%)",
|
|
238
|
+
},
|
|
239
|
+
"100%": {
|
|
240
|
+
transform: "translateY(10%)",
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
scanDown: {
|
|
244
|
+
"0%": {
|
|
245
|
+
top: "-100%",
|
|
246
|
+
},
|
|
247
|
+
"100%": {
|
|
248
|
+
top: "200%",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
...keyframes,
|
|
253
|
+
},
|
|
254
|
+
|
|
255
|
+
animation: {
|
|
256
|
+
smaller: "smaller 0.15s ease-in-out forwards",
|
|
257
|
+
bigger: "bigger 1s ease-in-out forwards",
|
|
258
|
+
fadeIn: "fadeIn 0.15s ease-in-out forwards",
|
|
259
|
+
fadeIn_750ms: "fadeIn 0.75s ease-in-out forwards",
|
|
260
|
+
fadeOut: "fadeOut 0.15s ease-in-out forwards",
|
|
261
|
+
flyOut: "flyOut 0.15s ease-in-out forwards",
|
|
262
|
+
drop: "drop 0.15s ease-in-out forwards",
|
|
263
|
+
flash: "flash 1s linear infinite",
|
|
264
|
+
spin: "spin 1s linear infinite",
|
|
265
|
+
spin_15s: "spin 15s linear infinite",
|
|
266
|
+
"backdrop-blur": "backdrop-blur 2s ease-in-out forwards",
|
|
267
|
+
pop: "pop 0.15s ease-in-out forwards",
|
|
268
|
+
menuOpen: "menuOpen 0.3s ease-in-out forwards",
|
|
269
|
+
menuClose: "menuClose 0.3s ease-in-out forwards",
|
|
270
|
+
slideDown: "slideDown 300ms cubic-bezier(0.87, 0, 0.13, 1)",
|
|
271
|
+
slideUp: "slideUp 300ms cubic-bezier(0.87, 0, 0.13, 1)",
|
|
272
|
+
zoomIn: "zoomIn 0.15s ease-in-out forwards",
|
|
273
|
+
zoomIn_1000ms: "zoomIn 1s ease-in-out forwards",
|
|
274
|
+
wave: "wave 1s linear infinite",
|
|
275
|
+
fadeIn_delay_1s: "fadeIn 0.3s ease-in-out 1s forwards",
|
|
276
|
+
translateUp: "translateUp 0.5s ease-in-out 0.5s forwards",
|
|
277
|
+
bottomUp: "bottomUp 0.5s ease-in-out 0.5s forwards",
|
|
278
|
+
translateLeft: "translateLeft 0.15s ease-in-out forwards",
|
|
279
|
+
translateRight: "tranlateRight 0.15s ease-in-out forwards",
|
|
280
|
+
spreadOutFromCenter: "spreadOutFromCenter 1s ease-out forwards",
|
|
281
|
+
floatUpDown: "floatUpDown 3s linear forwards infinite",
|
|
282
|
+
floatDownUp: "floatDownUp 3s linear forwards infinite",
|
|
283
|
+
scanDown: "scanDown 3s ease-in-out infinite",
|
|
284
|
+
...animations,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const withBase = (
|
|
292
|
+
dirname,
|
|
293
|
+
{
|
|
294
|
+
fonts = [],
|
|
295
|
+
themes = [],
|
|
296
|
+
config = {},
|
|
297
|
+
container = "normal",
|
|
298
|
+
colors = {},
|
|
299
|
+
backgroundImage = {},
|
|
300
|
+
extend = {},
|
|
301
|
+
plugins = [],
|
|
302
|
+
} = {}
|
|
303
|
+
) => ({
|
|
304
|
+
content: [
|
|
305
|
+
join(dirname, "./app/**/*.{js,ts,jsx,tsx}"),
|
|
306
|
+
join(dirname, "./lib/**/*.{js,ts,jsx,tsx}"),
|
|
307
|
+
join(dirname, "./ui/**/*.{js,ts,jsx,tsx}"),
|
|
308
|
+
...createGlobPatternsForDependencies(dirname),
|
|
309
|
+
],
|
|
310
|
+
theme: {
|
|
311
|
+
...config,
|
|
312
|
+
...(container === "compact"
|
|
313
|
+
? {
|
|
314
|
+
container: {
|
|
315
|
+
center: true,
|
|
316
|
+
// padding: '1rem',
|
|
317
|
+
screens: {
|
|
318
|
+
sm: "600px",
|
|
319
|
+
md: "768px",
|
|
320
|
+
lg: "1024px",
|
|
321
|
+
xl: "1280px",
|
|
322
|
+
"2xl": "1280px",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
}
|
|
326
|
+
: {}),
|
|
327
|
+
extend: {
|
|
328
|
+
fontFamily: Object.fromEntries(fonts.map((font) => [font, [`var(--font-${font})`]])),
|
|
329
|
+
colors: colors || {},
|
|
330
|
+
backgroundImage: backgroundImage || {},
|
|
331
|
+
...extend,
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
daisyui: {
|
|
335
|
+
themes: Array.isArray(themes) ? (themes.length === 0 ? ["light", "dark"] : themes) : [themes],
|
|
336
|
+
logs: false,
|
|
337
|
+
},
|
|
338
|
+
plugins: [
|
|
339
|
+
defaultPlugin,
|
|
340
|
+
require("@tailwindcss/aspect-ratio"),
|
|
341
|
+
require("@tailwindcss/typography"),
|
|
342
|
+
require("@tailwindcss/container-queries"),
|
|
343
|
+
// require("tailwindcss-animation-delay"),
|
|
344
|
+
require("tailwind-scrollbar"),
|
|
345
|
+
require("daisyui"),
|
|
346
|
+
require("tailwindcss-radix")(),
|
|
347
|
+
...plugins,
|
|
348
|
+
],
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
module.exports = { defaultPlugin, withBase };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BackendEnv } from "@akanjs/base";
|
|
2
|
+
import { DynamicModule } from "@nestjs/common";
|
|
3
|
+
export declare class TestServer {
|
|
4
|
+
#private;
|
|
5
|
+
workerId: number;
|
|
6
|
+
static initClient(env: BackendEnv, workerId?: number): void;
|
|
7
|
+
constructor(registerModules: (options: any) => DynamicModule[], env: BackendEnv, workerId?: number);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
startMongo(): Promise<string>;
|
|
10
|
+
cleanup(): Promise<void>;
|
|
11
|
+
terminate(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var testServer_exports = {};
|
|
29
|
+
__export(testServer_exports, {
|
|
30
|
+
TestServer: () => TestServer
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(testServer_exports);
|
|
33
|
+
var import_common = require("@akanjs/common");
|
|
34
|
+
var import_server = require("@akanjs/server");
|
|
35
|
+
var import_signal = require("@akanjs/signal");
|
|
36
|
+
var import_mongodb_memory_server = require("mongodb-memory-server");
|
|
37
|
+
var import_mongoose = __toESM(require("mongoose"));
|
|
38
|
+
var import_redis_memory_server = require("redis-memory-server");
|
|
39
|
+
const MAX_RETRY = 5;
|
|
40
|
+
const TEST_LISTEN_PORT_BASE = 38080;
|
|
41
|
+
const TEST_MONGODB_PORT_BASE = 38081;
|
|
42
|
+
const TEST_REDIS_PORT_BASE = 38082;
|
|
43
|
+
const MIN_ACTIVATION_TIME = 0;
|
|
44
|
+
const MAX_ACTIVATION_TIME = 3e4;
|
|
45
|
+
class TestServer {
|
|
46
|
+
#logger = new import_common.Logger("TestServer");
|
|
47
|
+
#mongod;
|
|
48
|
+
#redis;
|
|
49
|
+
#registerModules;
|
|
50
|
+
#env;
|
|
51
|
+
workerId;
|
|
52
|
+
#startAt = Date.now();
|
|
53
|
+
#app;
|
|
54
|
+
#portOffset = 0;
|
|
55
|
+
static initClient(env, workerId = parseInt(process.env.JEST_WORKER_ID ?? "0")) {
|
|
56
|
+
if (workerId === 0)
|
|
57
|
+
throw new Error("TestClient should not be used in main thread");
|
|
58
|
+
const portOffset = workerId * 1e3 + env.appCode * 10;
|
|
59
|
+
const port = TEST_LISTEN_PORT_BASE + portOffset;
|
|
60
|
+
const endpoint = `http://localhost:${port}/backend/graphql`;
|
|
61
|
+
import_signal.client.init({ uri: endpoint });
|
|
62
|
+
}
|
|
63
|
+
constructor(registerModules, env, workerId) {
|
|
64
|
+
this.workerId = workerId ?? parseInt(process.env.JEST_WORKER_ID ?? "0");
|
|
65
|
+
if (this.workerId === 0)
|
|
66
|
+
throw new Error("TestServer should not be used in main thread");
|
|
67
|
+
this.#portOffset = this.workerId * 1e3 + env.appCode * 10;
|
|
68
|
+
this.#mongod = new import_mongodb_memory_server.MongoMemoryServer({ instance: { port: TEST_MONGODB_PORT_BASE + this.#portOffset } });
|
|
69
|
+
this.#redis = new import_redis_memory_server.RedisMemoryServer({ instance: { port: TEST_REDIS_PORT_BASE + this.#portOffset } });
|
|
70
|
+
this.#env = { ...env };
|
|
71
|
+
this.#registerModules = registerModules;
|
|
72
|
+
}
|
|
73
|
+
async init() {
|
|
74
|
+
for (let i = 0; i < MAX_RETRY; i++) {
|
|
75
|
+
try {
|
|
76
|
+
const watchdog = setTimeout(() => {
|
|
77
|
+
throw new Error("TestServer Init Timeout");
|
|
78
|
+
}, MAX_ACTIVATION_TIME);
|
|
79
|
+
await this.#init();
|
|
80
|
+
clearTimeout(watchdog);
|
|
81
|
+
return;
|
|
82
|
+
} catch (e) {
|
|
83
|
+
this.#logger.error(e);
|
|
84
|
+
await this.terminate();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async #init() {
|
|
89
|
+
const now = Date.now();
|
|
90
|
+
this.#logger.log(`Test System #${this.workerId} Initializing...`);
|
|
91
|
+
const port = TEST_LISTEN_PORT_BASE + this.#portOffset;
|
|
92
|
+
const [mongoUri, redisHost, redisPort] = await Promise.all([
|
|
93
|
+
this.startMongo(),
|
|
94
|
+
this.#redis.getHost(),
|
|
95
|
+
this.#redis.getPort()
|
|
96
|
+
]);
|
|
97
|
+
this.#env.port = port;
|
|
98
|
+
this.#env.mongoUri = mongoUri;
|
|
99
|
+
this.#env.redisUri = `redis://${redisHost}:${redisPort}`;
|
|
100
|
+
this.#env.meiliUri = "http://localhost:7700/search";
|
|
101
|
+
this.#env.onCleanup = async () => {
|
|
102
|
+
await this.cleanup();
|
|
103
|
+
};
|
|
104
|
+
this.#app = await (0, import_server.createNestApp)({ registerModules: this.#registerModules, env: this.#env });
|
|
105
|
+
this.#logger.log(`Test System #${this.workerId} Initialized, Mongo: ${mongoUri}, Redis: ${redisHost}:${redisPort}`);
|
|
106
|
+
this.#startAt = Date.now();
|
|
107
|
+
this.#logger.log(`Test System #${this.workerId} Activation Time: ${this.#startAt - now}ms`);
|
|
108
|
+
}
|
|
109
|
+
async startMongo() {
|
|
110
|
+
await this.#mongod.start();
|
|
111
|
+
return this.#mongod.getUri();
|
|
112
|
+
}
|
|
113
|
+
async cleanup() {
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
this.#logger.log("Mongo Memory Database Cleaning up...");
|
|
116
|
+
if (this.#mongod.state === "running") {
|
|
117
|
+
await this.#mongod.stop();
|
|
118
|
+
await this.#mongod.start(true);
|
|
119
|
+
}
|
|
120
|
+
this.#logger.log(`Mongo Memory Database Cleaned up in ${Date.now() - now}ms`);
|
|
121
|
+
}
|
|
122
|
+
async terminate() {
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
const elapsed = now - this.#startAt;
|
|
125
|
+
await (0, import_common.sleep)(50);
|
|
126
|
+
import_signal.client.io?.socket.close();
|
|
127
|
+
await this.#app.close();
|
|
128
|
+
if (elapsed < MIN_ACTIVATION_TIME) {
|
|
129
|
+
this.#logger.log(`waiting for ${MIN_ACTIVATION_TIME - elapsed}`);
|
|
130
|
+
await (0, import_common.sleep)(MIN_ACTIVATION_TIME - elapsed);
|
|
131
|
+
}
|
|
132
|
+
await Promise.all([import_mongoose.default.disconnect(), this.#mongod.stop(), this.#redis.stop()]);
|
|
133
|
+
this.#logger.log(`System Terminated in ${Date.now() - now}ms`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
+
0 && (module.exports = {
|
|
138
|
+
TestServer
|
|
139
|
+
});
|