itube-specs 0.0.212 → 0.0.213
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 +9 -117
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,121 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
extends: [
|
|
9
|
-
process.env.LAYER_PATH || '@test/test'
|
|
10
|
-
],
|
|
11
|
-
```
|
|
12
|
-
6) Если не первый раз то обновляем пакет `npm install @test/test@latest`, если пакет уже установлен можно в ручную поменять версию и `npm install` (если пакет недавно обновился, сразу npm install может не подхватить последнюю версию);
|
|
13
|
-
7) `npx nuxi prepare`
|
|
14
|
-
8) если есть проблемы с runtime запустить в пакете npm run dev он перегенерирует tsconfig и eslint.config.mjs
|
|
15
|
-
9) и запускаем либо `npm run dev`
|
|
16
|
-
|
|
17
|
-
`nuxt.config.ts`
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
import { fileURLToPath } from 'node:url'
|
|
21
|
-
import { defineNuxtConfig } from 'nuxt/config'
|
|
22
|
-
|
|
23
|
-
export default defineNuxtConfig({
|
|
24
|
-
modules: ['@nuxt/eslint'],
|
|
25
|
-
eslint: {
|
|
26
|
-
config: {
|
|
27
|
-
// Use the generated ESLint config for lint root project as well
|
|
28
|
-
rootDir: fileURLToPath(new URL('..', import.meta.url))
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
components: {
|
|
32
|
-
dirs: [
|
|
33
|
-
{
|
|
34
|
-
path: './components',
|
|
35
|
-
pathPrefix: false
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
`package.json` - версии nuxt && vue должны быть идентичны проекту
|
|
43
|
-
```bash
|
|
44
|
-
{
|
|
45
|
-
"name": "@test/test", // свое
|
|
46
|
-
"type": "module",
|
|
47
|
-
"version": "0.0.1",
|
|
48
|
-
"main": "./nuxt.config.ts",
|
|
49
|
-
"types": "./types/index.d.ts",
|
|
50
|
-
"exports": {
|
|
51
|
-
".": {
|
|
52
|
-
"types": "./types/index.d.ts",
|
|
53
|
-
"import": "./nuxt.config.ts",
|
|
54
|
-
"default": "./nuxt.config.ts"
|
|
55
|
-
},
|
|
56
|
-
"./types": {
|
|
57
|
-
"types": "./types/index.d.ts",
|
|
58
|
-
"default": "./types/index.d.ts"
|
|
59
|
-
},
|
|
60
|
-
"./runtime": {
|
|
61
|
-
"import": "./runtime/index.ts",
|
|
62
|
-
"default": "./runtime/index.ts"
|
|
63
|
-
},
|
|
64
|
-
"./*": "./*"
|
|
65
|
-
},
|
|
66
|
-
"files": [
|
|
67
|
-
"components/",
|
|
68
|
-
"composables/",
|
|
69
|
-
"types/",
|
|
70
|
-
"nuxt.config.ts"
|
|
71
|
-
],
|
|
72
|
-
"devDependencies": {
|
|
73
|
-
"@nuxt/eslint": "latest",
|
|
74
|
-
"@types/node": "^20.19.19",
|
|
75
|
-
"eslint": "^9.37.0",
|
|
76
|
-
"nuxt": "3.17.6",
|
|
77
|
-
"typescript": "^5.9.3",
|
|
78
|
-
"vue": "3.5.17"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
Импорт typescript типов осуществляется за счет этих опций
|
|
83
|
-
```
|
|
84
|
-
"types": "./types/index.d.ts",
|
|
85
|
-
"exports": {
|
|
86
|
-
".": {
|
|
87
|
-
"types": "./types/index.d.ts",
|
|
88
|
-
"import": "./nuxt.config.ts",
|
|
89
|
-
"default": "./nuxt.config.ts"
|
|
90
|
-
},
|
|
91
|
-
"./types": {
|
|
92
|
-
"types": "./types/index.d.ts",
|
|
93
|
-
"default": "./types/index.d.ts"
|
|
94
|
-
},
|
|
95
|
-
"./runtime": {
|
|
96
|
-
"import": "./runtime/index.ts",
|
|
97
|
-
"default": "./runtime/index.ts"
|
|
98
|
-
},
|
|
99
|
-
"./*": "./*"
|
|
100
|
-
},
|
|
101
|
-
```
|
|
102
|
-
Где:
|
|
103
|
-
- "types" указывает TypeScript, где лежит корневой файл с типами;
|
|
104
|
-
- "exports" сообщает Node и TS, какие модули доступны для импорта;
|
|
105
|
-
- "./types" позволяет писать коротко:
|
|
1
|
+
Пакет является nuxt layer проектов itube;
|
|
2
|
+
Как работать:
|
|
3
|
+
1) коммитим, потом `npm run patch` - патчит версию;
|
|
4
|
+
2) `npm i itube-specs` ставим пакет в проекте;
|
|
5
|
+
3) Если не первый раз то обновляем пакет `npm install @test/test@latest` или `npm run spec`;
|
|
6
|
+
4) npx nuxi prepare` при необходимости (могут не подсасаться композиблы или компоненты в автоимпорте);
|
|
7
|
+
5) если есть проблемы с runtime запустить в пакете npm run dev он перегенерирует tsconfig и eslint.config.mjs;
|
|
106
8
|
|
|
107
9
|
```
|
|
108
10
|
import type { IUser } from '@test/test/types'
|
|
109
11
|
```
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
`tsconfig.json`
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
{
|
|
116
|
-
"extends": "./.nuxt/tsconfig.json",
|
|
117
|
-
"compilerOptions": {
|
|
118
|
-
"types": ["node"]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
```
|
|
12
|
+
Types не импортируются автоматически, каждый тип в свою очередь экспортируется в index.d.ts (обязательно указывать расширение при эскпорте d.ts) общий файл откуда уже и берутся все типы в проект.
|
|
13
|
+
Все что кроме nuxt сущностей (composables, components) устанавливается прописывается вручную.
|