@ramathibodi/nuxt-commons 0.1.73 → 4.0.0
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 +81 -55
- package/dist/module.json +4 -4
- package/dist/module.mjs +5 -4
- package/dist/runtime/bridges/authentication.d.ts +21 -0
- package/dist/runtime/bridges/authentication.js +20 -0
- package/dist/runtime/bridges/graphql.d.ts +17 -0
- package/dist/runtime/bridges/graphql.js +45 -0
- package/dist/runtime/components/Alert.d.vue.ts +3 -0
- package/dist/runtime/components/Alert.vue +17 -22
- package/dist/runtime/components/Alert.vue.d.ts +3 -0
- package/dist/runtime/components/BarcodeReader.d.vue.ts +9 -0
- package/dist/runtime/components/BarcodeReader.vue +56 -73
- package/dist/runtime/components/BarcodeReader.vue.d.ts +9 -0
- package/dist/runtime/components/ExportCSV.d.vue.ts +55 -0
- package/dist/runtime/components/ExportCSV.vue +39 -68
- package/dist/runtime/components/ExportCSV.vue.d.ts +55 -0
- package/dist/runtime/components/FileBtn.d.vue.ts +53 -0
- package/dist/runtime/components/FileBtn.vue +23 -38
- package/dist/runtime/components/FileBtn.vue.d.ts +53 -0
- package/dist/runtime/components/ImportCSV.d.vue.ts +52 -0
- package/dist/runtime/components/ImportCSV.vue +60 -99
- package/dist/runtime/components/ImportCSV.vue.d.ts +52 -0
- package/dist/runtime/components/MrzReader.d.vue.ts +19 -0
- package/dist/runtime/components/MrzReader.vue +128 -0
- package/dist/runtime/components/MrzReader.vue.d.ts +19 -0
- package/dist/runtime/components/SplitterPanel.d.vue.ts +15 -0
- package/dist/runtime/components/SplitterPanel.vue +18 -27
- package/dist/runtime/components/SplitterPanel.vue.d.ts +15 -0
- package/dist/runtime/components/TabsGroup.d.vue.ts +19 -0
- package/dist/runtime/components/TabsGroup.vue +8 -12
- package/dist/runtime/components/TabsGroup.vue.d.ts +19 -0
- package/dist/runtime/components/TextBarcode.d.vue.ts +12 -0
- package/dist/runtime/components/TextBarcode.vue +22 -33
- package/dist/runtime/components/TextBarcode.vue.d.ts +12 -0
- package/dist/runtime/components/device/IdCardButton.d.vue.ts +57 -0
- package/dist/runtime/components/device/IdCardButton.vue +30 -55
- package/dist/runtime/components/device/IdCardButton.vue.d.ts +57 -0
- package/dist/runtime/components/device/IdCardWebSocket.d.vue.ts +55 -0
- package/dist/runtime/components/device/IdCardWebSocket.vue +104 -153
- package/dist/runtime/components/device/IdCardWebSocket.vue.d.ts +55 -0
- package/dist/runtime/components/device/Scanner.d.vue.ts +66 -0
- package/dist/runtime/components/device/Scanner.vue +97 -166
- package/dist/runtime/components/device/Scanner.vue.d.ts +66 -0
- package/dist/runtime/components/dialog/Confirm.d.vue.ts +37 -0
- package/dist/runtime/components/dialog/Confirm.vue +30 -47
- package/dist/runtime/components/dialog/Confirm.vue.d.ts +37 -0
- package/dist/runtime/components/dialog/Host.d.vue.ts +9 -0
- package/dist/runtime/components/dialog/Host.vue +34 -53
- package/dist/runtime/components/dialog/Host.vue.d.ts +9 -0
- package/dist/runtime/components/dialog/Index.d.vue.ts +24 -0
- package/dist/runtime/components/dialog/Index.vue +20 -28
- package/dist/runtime/components/dialog/Index.vue.d.ts +24 -0
- package/dist/runtime/components/dialog/Loading.d.vue.ts +21 -0
- package/dist/runtime/components/dialog/Loading.vue +12 -17
- package/dist/runtime/components/dialog/Loading.vue.d.ts +21 -0
- package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +40 -0
- package/dist/runtime/components/dialog/default/Confirm.vue +29 -50
- package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +40 -0
- package/dist/runtime/components/dialog/default/Loading.d.vue.ts +23 -0
- package/dist/runtime/components/dialog/default/Loading.vue +12 -17
- package/dist/runtime/components/dialog/default/Loading.vue.d.ts +23 -0
- package/dist/runtime/components/dialog/default/Notify.d.vue.ts +23 -0
- package/dist/runtime/components/dialog/default/Notify.vue +19 -36
- package/dist/runtime/components/dialog/default/Notify.vue.d.ts +23 -0
- package/dist/runtime/components/dialog/default/Printing.d.vue.ts +21 -0
- package/dist/runtime/components/dialog/default/Printing.vue +13 -17
- package/dist/runtime/components/dialog/default/Printing.vue.d.ts +21 -0
- package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +29 -0
- package/dist/runtime/components/dialog/default/VerifyUser.vue +44 -70
- package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +29 -0
- package/dist/runtime/components/document/Form.d.vue.ts +9 -0
- package/dist/runtime/components/document/Form.vue +27 -34
- package/dist/runtime/components/document/Form.vue.d.ts +9 -0
- package/dist/runtime/components/document/TemplateBuilder.d.vue.ts +24 -0
- package/dist/runtime/components/document/TemplateBuilder.vue +154 -182
- package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +24 -0
- package/dist/runtime/components/form/ActionPad.d.vue.ts +114 -0
- package/dist/runtime/components/form/ActionPad.vue +48 -73
- package/dist/runtime/components/form/ActionPad.vue.d.ts +114 -0
- package/dist/runtime/components/form/Birthdate.d.vue.ts +38 -0
- package/dist/runtime/components/form/Birthdate.vue +44 -64
- package/dist/runtime/components/form/Birthdate.vue.d.ts +38 -0
- package/dist/runtime/components/form/CheckboxGroup.d.vue.ts +41 -0
- package/dist/runtime/components/form/CheckboxGroup.vue +34 -52
- package/dist/runtime/components/form/CheckboxGroup.vue.d.ts +41 -0
- package/dist/runtime/components/form/CodeEditor.d.vue.ts +25 -0
- package/dist/runtime/components/form/CodeEditor.vue +18 -28
- package/dist/runtime/components/form/CodeEditor.vue.d.ts +25 -0
- package/dist/runtime/components/form/Date.d.vue.ts +86 -0
- package/dist/runtime/components/form/Date.vue +109 -150
- package/dist/runtime/components/form/Date.vue.d.ts +86 -0
- package/dist/runtime/components/form/DateTime.d.vue.ts +36 -0
- package/dist/runtime/components/form/DateTime.vue +94 -131
- package/dist/runtime/components/form/DateTime.vue.d.ts +36 -0
- package/dist/runtime/components/form/Dialog.d.vue.ts +69 -0
- package/dist/runtime/components/form/Dialog.vue +60 -84
- package/dist/runtime/components/form/Dialog.vue.d.ts +69 -0
- package/dist/runtime/components/form/EditPad.d.vue.ts +113 -0
- package/dist/runtime/components/form/EditPad.vue +49 -73
- package/dist/runtime/components/form/EditPad.vue.d.ts +113 -0
- package/dist/runtime/components/form/File.d.vue.ts +65 -0
- package/dist/runtime/components/form/File.vue +112 -174
- package/dist/runtime/components/form/File.vue.d.ts +65 -0
- package/dist/runtime/components/form/Hidden.d.vue.ts +12 -0
- package/dist/runtime/components/form/Hidden.vue +17 -22
- package/dist/runtime/components/form/Hidden.vue.d.ts +12 -0
- package/dist/runtime/components/form/Iterator.d.vue.ts +279 -0
- package/dist/runtime/components/form/Iterator.vue +162 -240
- package/dist/runtime/components/form/Iterator.vue.d.ts +279 -0
- package/dist/runtime/components/form/Login.d.vue.ts +32 -0
- package/dist/runtime/components/form/Login.vue +23 -43
- package/dist/runtime/components/form/Login.vue.d.ts +32 -0
- package/dist/runtime/components/form/Pad.d.vue.ts +674 -0
- package/dist/runtime/components/form/Pad.vue +166 -253
- package/dist/runtime/components/form/Pad.vue.d.ts +674 -0
- package/dist/runtime/components/form/SignPad.d.vue.ts +62 -0
- package/dist/runtime/components/form/SignPad.vue +80 -118
- package/dist/runtime/components/form/SignPad.vue.d.ts +62 -0
- package/dist/runtime/components/form/System.d.vue.ts +34 -0
- package/dist/runtime/components/form/System.vue +18 -24
- package/dist/runtime/components/form/System.vue.d.ts +34 -0
- package/dist/runtime/components/form/Table.d.vue.ts +221 -0
- package/dist/runtime/components/form/Table.vue +123 -170
- package/dist/runtime/components/form/Table.vue.d.ts +221 -0
- package/dist/runtime/components/form/TableData.d.vue.ts +102 -0
- package/dist/runtime/components/form/TableData.vue +109 -127
- package/dist/runtime/components/form/TableData.vue.d.ts +102 -0
- package/dist/runtime/components/form/Time.d.vue.ts +49 -0
- package/dist/runtime/components/form/Time.vue +64 -87
- package/dist/runtime/components/form/Time.vue.d.ts +49 -0
- package/dist/runtime/components/form/images/Capture.d.vue.ts +96 -0
- package/dist/runtime/components/form/images/Capture.vue +104 -139
- package/dist/runtime/components/form/images/Capture.vue.d.ts +96 -0
- package/dist/runtime/components/form/images/Edit.d.vue.ts +29 -0
- package/dist/runtime/components/form/images/Edit.vue +57 -69
- package/dist/runtime/components/form/images/Edit.vue.d.ts +29 -0
- package/dist/runtime/components/form/images/Field.d.vue.ts +27 -0
- package/dist/runtime/components/form/images/Field.vue +136 -194
- package/dist/runtime/components/form/images/Field.vue.d.ts +27 -0
- package/dist/runtime/components/form/images/Pad.d.vue.ts +13 -0
- package/dist/runtime/components/form/images/Pad.vue +23 -28
- package/dist/runtime/components/form/images/Pad.vue.d.ts +13 -0
- package/dist/runtime/components/label/Date.d.vue.ts +13 -0
- package/dist/runtime/components/label/Date.vue +13 -21
- package/dist/runtime/components/label/Date.vue.d.ts +13 -0
- package/dist/runtime/components/label/DateAgo.d.vue.ts +20 -0
- package/dist/runtime/components/label/DateAgo.vue +43 -67
- package/dist/runtime/components/label/DateAgo.vue.d.ts +20 -0
- package/dist/runtime/components/label/DateCount.d.vue.ts +22 -0
- package/dist/runtime/components/label/DateCount.vue +58 -97
- package/dist/runtime/components/label/DateCount.vue.d.ts +22 -0
- package/dist/runtime/components/label/Field.d.vue.ts +38 -0
- package/dist/runtime/components/label/Field.vue +18 -32
- package/dist/runtime/components/label/Field.vue.d.ts +38 -0
- package/dist/runtime/components/label/FormatMoney.d.vue.ts +12 -0
- package/dist/runtime/components/label/FormatMoney.vue +12 -20
- package/dist/runtime/components/label/FormatMoney.vue.d.ts +12 -0
- package/dist/runtime/components/label/Mask.d.vue.ts +10 -0
- package/dist/runtime/components/label/Mask.vue +21 -30
- package/dist/runtime/components/label/Mask.vue.d.ts +10 -0
- package/dist/runtime/components/label/Object.d.vue.ts +8 -0
- package/dist/runtime/components/label/Object.vue +10 -12
- package/dist/runtime/components/label/Object.vue.d.ts +8 -0
- package/dist/runtime/components/master/Autocomplete.d.vue.ts +70 -0
- package/dist/runtime/components/master/Autocomplete.vue +25 -26
- package/dist/runtime/components/master/Autocomplete.vue.d.ts +70 -0
- package/dist/runtime/components/master/Combobox.d.vue.ts +70 -0
- package/dist/runtime/components/master/Combobox.vue +26 -27
- package/dist/runtime/components/master/Combobox.vue.d.ts +70 -0
- package/dist/runtime/components/master/RadioGroup.d.vue.ts +51 -0
- package/dist/runtime/components/master/RadioGroup.vue +44 -47
- package/dist/runtime/components/master/RadioGroup.vue.d.ts +51 -0
- package/dist/runtime/components/master/Select.d.vue.ts +68 -0
- package/dist/runtime/components/master/Select.vue +25 -26
- package/dist/runtime/components/master/Select.vue.d.ts +68 -0
- package/dist/runtime/components/master/label.d.vue.ts +24 -0
- package/dist/runtime/components/master/label.vue +22 -34
- package/dist/runtime/components/master/label.vue.d.ts +24 -0
- package/dist/runtime/components/model/Autocomplete.d.vue.ts +82 -0
- package/dist/runtime/components/model/Autocomplete.vue +50 -37
- package/dist/runtime/components/model/Autocomplete.vue.d.ts +82 -0
- package/dist/runtime/components/model/Combobox.d.vue.ts +82 -0
- package/dist/runtime/components/model/Combobox.vue +51 -37
- package/dist/runtime/components/model/Combobox.vue.d.ts +82 -0
- package/dist/runtime/components/model/Pad.d.vue.ts +72 -0
- package/dist/runtime/components/model/Pad.vue +50 -53
- package/dist/runtime/components/model/Pad.vue.d.ts +72 -0
- package/dist/runtime/components/model/Select.d.vue.ts +72 -0
- package/dist/runtime/components/model/Select.vue +42 -32
- package/dist/runtime/components/model/Select.vue.d.ts +72 -0
- package/dist/runtime/components/model/Table.d.vue.ts +272 -0
- package/dist/runtime/components/model/Table.vue +121 -133
- package/dist/runtime/components/model/Table.vue.d.ts +272 -0
- package/dist/runtime/components/model/iterator.d.vue.ts +321 -0
- package/dist/runtime/components/model/iterator.vue +148 -175
- package/dist/runtime/components/model/iterator.vue.d.ts +321 -0
- package/dist/runtime/components/model/label.d.vue.ts +26 -0
- package/dist/runtime/components/model/label.vue +25 -35
- package/dist/runtime/components/model/label.vue.d.ts +26 -0
- package/dist/runtime/components/pdf/Print.d.vue.ts +17 -0
- package/dist/runtime/components/pdf/Print.vue +27 -38
- package/dist/runtime/components/pdf/Print.vue.d.ts +17 -0
- package/dist/runtime/components/pdf/View.d.vue.ts +52 -0
- package/dist/runtime/components/pdf/View.vue +58 -83
- package/dist/runtime/components/pdf/View.vue.d.ts +52 -0
- package/dist/runtime/composables/alert.d.ts +4 -0
- package/dist/runtime/composables/api.d.ts +4 -0
- package/dist/runtime/composables/api.js +4 -2
- package/dist/runtime/composables/assetFile.js +4 -2
- package/dist/runtime/composables/dialog.d.ts +1 -1
- package/dist/runtime/composables/document/template.js +3 -3
- package/dist/runtime/composables/document/templateFormHidden.d.ts +4 -0
- package/dist/runtime/composables/document/templateFormTable.js +1 -0
- package/dist/runtime/composables/graphql.d.ts +2 -2
- package/dist/runtime/composables/graphql.js +5 -5
- package/dist/runtime/composables/graphqlModel.d.ts +6 -6
- package/dist/runtime/composables/graphqlModelItem.d.ts +4 -4
- package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
- package/dist/runtime/composables/graphqlModelOperation.js +2 -1
- package/dist/runtime/composables/graphqlOperation.js +5 -1
- package/dist/runtime/composables/hostAgentWs.d.ts +1 -1
- package/dist/runtime/composables/localStorageModel.d.ts +4 -0
- package/dist/runtime/composables/lookupList.d.ts +4 -0
- package/dist/runtime/composables/lookupListMaster.js +3 -3
- package/dist/runtime/composables/menu.d.ts +4 -0
- package/dist/runtime/composables/menu.js +2 -2
- package/dist/runtime/composables/useMrzReader.d.ts +48 -0
- package/dist/runtime/composables/useMrzReader.js +423 -0
- package/dist/runtime/composables/useTesseract.d.ts +16 -0
- package/dist/runtime/composables/useTesseract.js +45 -0
- package/dist/runtime/composables/userPermission.d.ts +1 -1
- package/dist/runtime/composables/utils/fuzzy.d.ts +2 -1
- package/dist/runtime/labs/Calendar.d.vue.ts +35 -0
- package/dist/runtime/labs/Calendar.vue +47 -75
- package/dist/runtime/labs/Calendar.vue.d.ts +35 -0
- package/dist/runtime/labs/form/EditMobile.d.vue.ts +12 -0
- package/dist/runtime/labs/form/EditMobile.vue +19 -36
- package/dist/runtime/labs/form/EditMobile.vue.d.ts +12 -0
- package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +21 -0
- package/dist/runtime/labs/form/TextFieldMask.vue +19 -25
- package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +21 -0
- package/dist/runtime/plugins/dialogManager.js +2 -2
- package/dist/runtime/plugins/permission.js +3 -3
- package/dist/runtime/types/bridge.d.ts +14 -0
- package/dist/runtime/utils/asset.d.ts +2 -0
- package/dist/runtime/utils/asset.js +49 -0
- package/dist/runtime/utils/datetime.js +1 -1
- package/dist/types.d.mts +2 -6
- package/package.json +79 -57
- package/scripts/ci-release.mjs +125 -0
- package/scripts/enrich-vue-docs-from-ai.mjs +197 -0
- package/scripts/generate-ai-summary.mjs +321 -0
- package/scripts/generate-composables-md.mjs +129 -0
- package/scripts/release-version.mjs +68 -0
- package/scripts/release.mjs +49 -0
- package/templates/public/tesseract/mrz.traineddata.gz +0 -0
- package/templates/public/tesseract/ocrb.traineddata.gz +0 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -8
- package/dist/types.d.ts +0 -7
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
const rootDir = process.cwd()
|
|
5
|
+
const aiSummaryPath = path.join(rootDir, 'docs/ai-summary.json')
|
|
6
|
+
const outDir = path.join(rootDir, 'docs/composables-md')
|
|
7
|
+
|
|
8
|
+
if (!fs.existsSync(aiSummaryPath)) {
|
|
9
|
+
console.error('docs/ai-summary.json not found. Run: npm run docs:ai:summary')
|
|
10
|
+
process.exit(1)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ai = JSON.parse(fs.readFileSync(aiSummaryPath, 'utf8'))
|
|
14
|
+
const composables = ai.composables || []
|
|
15
|
+
|
|
16
|
+
function safeName(filePath) {
|
|
17
|
+
return filePath
|
|
18
|
+
.replace(/^src\/runtime\/composables\//, '')
|
|
19
|
+
.replace(/\//g, '__')
|
|
20
|
+
.replace(/\.ts$/, '')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function mdEscape(str) {
|
|
24
|
+
return String(str ?? '').replace(/\|/g, '\\|')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fs.mkdirSync(outDir, { recursive: true })
|
|
28
|
+
|
|
29
|
+
const index = []
|
|
30
|
+
index.push('# Composables (Markdown)')
|
|
31
|
+
index.push('')
|
|
32
|
+
index.push(`Generated at: ${ai.generatedAt}`)
|
|
33
|
+
index.push('')
|
|
34
|
+
index.push('| Composable | Source |')
|
|
35
|
+
index.push('| ---------- | ------ |')
|
|
36
|
+
|
|
37
|
+
for (const c of composables) {
|
|
38
|
+
const fileBase = safeName(c.path)
|
|
39
|
+
const outFile = path.join(outDir, `${fileBase}.md`)
|
|
40
|
+
const content = []
|
|
41
|
+
|
|
42
|
+
content.push(`# ${fileBase}`)
|
|
43
|
+
content.push('')
|
|
44
|
+
content.push(`- Source: \`${c.path}\``)
|
|
45
|
+
content.push(`- Summary: ${c.summary || ''}`)
|
|
46
|
+
content.push('')
|
|
47
|
+
|
|
48
|
+
const exp = c.exports || {}
|
|
49
|
+
const functions = exp.functions || []
|
|
50
|
+
const interfaces = exp.interfaces || []
|
|
51
|
+
const types = exp.types || []
|
|
52
|
+
const consts = exp.constants || []
|
|
53
|
+
const enums = exp.enums || []
|
|
54
|
+
|
|
55
|
+
content.push('## Exported Functions')
|
|
56
|
+
content.push('')
|
|
57
|
+
if (functions.length) {
|
|
58
|
+
content.push('| Name | Signature | Returns |')
|
|
59
|
+
content.push('| ---- | --------- | ------- |')
|
|
60
|
+
for (const fn of functions) {
|
|
61
|
+
content.push(`| \`${mdEscape(fn.name)}\` | \`${mdEscape(fn.signature || '')}\` | \`${mdEscape(fn.returns || '')}\` |`)
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
content.push('No exported functions.')
|
|
65
|
+
}
|
|
66
|
+
content.push('')
|
|
67
|
+
|
|
68
|
+
content.push('## Exported Interfaces')
|
|
69
|
+
content.push('')
|
|
70
|
+
if (interfaces.length) {
|
|
71
|
+
for (const i of interfaces) {
|
|
72
|
+
content.push(`### \`${i.name}\``)
|
|
73
|
+
content.push('')
|
|
74
|
+
content.push('```ts')
|
|
75
|
+
content.push(i.shape || '')
|
|
76
|
+
content.push('```')
|
|
77
|
+
content.push('')
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
content.push('No exported interfaces.')
|
|
81
|
+
content.push('')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
content.push('## Exported Types')
|
|
85
|
+
content.push('')
|
|
86
|
+
if (types.length) {
|
|
87
|
+
content.push('| Name | Definition |')
|
|
88
|
+
content.push('| ---- | ---------- |')
|
|
89
|
+
for (const t of types) {
|
|
90
|
+
content.push(`| \`${mdEscape(t.name)}\` | \`${mdEscape(t.definition || '')}\` |`)
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
content.push('No exported types.')
|
|
94
|
+
}
|
|
95
|
+
content.push('')
|
|
96
|
+
|
|
97
|
+
content.push('## Exported Constants')
|
|
98
|
+
content.push('')
|
|
99
|
+
if (consts.length) {
|
|
100
|
+
content.push('| Name | Type |')
|
|
101
|
+
content.push('| ---- | ---- |')
|
|
102
|
+
for (const k of consts) {
|
|
103
|
+
content.push(`| \`${mdEscape(k.name)}\` | \`${mdEscape(k.type || '')}\` |`)
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
content.push('No exported constants.')
|
|
107
|
+
}
|
|
108
|
+
content.push('')
|
|
109
|
+
|
|
110
|
+
content.push('## Exported Enums')
|
|
111
|
+
content.push('')
|
|
112
|
+
if (enums.length) {
|
|
113
|
+
for (const e of enums) {
|
|
114
|
+
content.push(`### \`${e.name}\``)
|
|
115
|
+
content.push('')
|
|
116
|
+
for (const m of e.members || []) content.push(`- \`${m}\``)
|
|
117
|
+
content.push('')
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
content.push('No exported enums.')
|
|
121
|
+
content.push('')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
fs.writeFileSync(outFile, content.join('\n'))
|
|
125
|
+
index.push(`| [\`${fileBase}\`](${fileBase}.md) | \`${c.path}\` |`)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
fs.writeFileSync(path.join(outDir, 'README.md'), index.join('\n'))
|
|
129
|
+
console.log(`Generated markdown docs for ${composables.length} composables at docs/composables-md`)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export function parseSemver(version) {
|
|
2
|
+
const match = /^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(version)
|
|
3
|
+
|
|
4
|
+
if (!match) {
|
|
5
|
+
throw new Error(`Invalid semver version: ${version}`)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
major: Number(match[1]),
|
|
10
|
+
minor: Number(match[2]),
|
|
11
|
+
patch: Number(match[3]),
|
|
12
|
+
version: `${match[1]}.${match[2]}.${match[3]}`,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getReleaseLine(version) {
|
|
17
|
+
const parsed = typeof version === 'string' ? parseSemver(version) : version
|
|
18
|
+
return `${parsed.major}.${parsed.minor}`
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function compareSemver(leftVersion, rightVersion) {
|
|
22
|
+
const left = typeof leftVersion === 'string' ? parseSemver(leftVersion) : leftVersion
|
|
23
|
+
const right = typeof rightVersion === 'string' ? parseSemver(rightVersion) : rightVersion
|
|
24
|
+
|
|
25
|
+
if (left.major !== right.major) {
|
|
26
|
+
return left.major - right.major
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (left.minor !== right.minor) {
|
|
30
|
+
return left.minor - right.minor
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return left.patch - right.patch
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function findLatestVersionInReleaseLine(packageVersion, versions) {
|
|
37
|
+
const desired = typeof packageVersion === 'string' ? parseSemver(packageVersion) : packageVersion
|
|
38
|
+
const desiredLine = getReleaseLine(desired)
|
|
39
|
+
|
|
40
|
+
return versions
|
|
41
|
+
.map(version => parseSemver(version))
|
|
42
|
+
.filter(version => getReleaseLine(version) === desiredLine)
|
|
43
|
+
.sort((left, right) => compareSemver(right, left))[0]?.version ?? null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function resolveReleasePlan(packageVersion, latestTagVersion) {
|
|
47
|
+
const desired = parseSemver(packageVersion)
|
|
48
|
+
const latest = latestTagVersion ? parseSemver(latestTagVersion) : null
|
|
49
|
+
|
|
50
|
+
if (!latest) {
|
|
51
|
+
return {
|
|
52
|
+
releaseVersion: desired.version,
|
|
53
|
+
syncedPackageVersion: desired.version,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (getReleaseLine(desired) !== getReleaseLine(latest)) {
|
|
58
|
+
return {
|
|
59
|
+
releaseVersion: desired.version,
|
|
60
|
+
syncedPackageVersion: desired.version,
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
releaseVersion: null,
|
|
66
|
+
syncedPackageVersion: latest.version,
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process'
|
|
2
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
3
|
+
|
|
4
|
+
import { resolveReleasePlan } from './release-version.mjs'
|
|
5
|
+
|
|
6
|
+
function readPackageJson() {
|
|
7
|
+
return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function writePackageJson(pkg) {
|
|
11
|
+
const packageJsonUrl = new URL('../package.json', import.meta.url)
|
|
12
|
+
writeFileSync(packageJsonUrl, `${JSON.stringify(pkg, null, 2)}\n`)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getLatestTagVersion() {
|
|
16
|
+
const output = execFileSync('git', ['tag', '--sort=-v:refname'], {
|
|
17
|
+
encoding: 'utf8',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
return output
|
|
21
|
+
.split('\n')
|
|
22
|
+
.map(tag => tag.trim())
|
|
23
|
+
.find(tag => /^v?\d+\.\d+\.\d+(?:[-+].*)?$/.test(tag)) ?? null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function run() {
|
|
27
|
+
const pkg = readPackageJson()
|
|
28
|
+
const latestTagVersion = getLatestTagVersion()
|
|
29
|
+
const plan = resolveReleasePlan(pkg.version, latestTagVersion)
|
|
30
|
+
|
|
31
|
+
if (pkg.version !== plan.syncedPackageVersion) {
|
|
32
|
+
pkg.version = plan.syncedPackageVersion
|
|
33
|
+
writePackageJson(pkg)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const changelogenArgs = ['changelogen', '--release']
|
|
37
|
+
|
|
38
|
+
if (plan.releaseVersion) {
|
|
39
|
+
changelogenArgs.push('-r', plan.releaseVersion)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
execFileSync('./node_modules/.bin/changelogen', changelogenArgs.slice(1), {
|
|
43
|
+
stdio: 'inherit',
|
|
44
|
+
})
|
|
45
|
+
execFileSync('npm', ['publish'], { stdio: 'inherit' })
|
|
46
|
+
execFileSync('git', ['push', '--follow-tags'], { stdio: 'inherit' })
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
run()
|
|
Binary file
|
|
Binary file
|
package/dist/module.cjs
DELETED
package/dist/module.d.ts
DELETED
package/dist/types.d.ts
DELETED