components-helper
Advanced tools
Comparing version 1.0.4 to 1.0.5
# Changelog | ||
### 1.0.5 | ||
feat | ||
- export all types | ||
fix | ||
- support windows path | ||
### 1.0.4 | ||
@@ -4,0 +14,0 @@ |
import type { InstallOptions } from './type'; | ||
declare const main: (options?: InstallOptions) => void; | ||
export * from './type'; | ||
export default main; |
@@ -1,5 +0,2 @@ | ||
import { readFileSync, mkdir, writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
var config = { | ||
import fg from'fast-glob';import {readFileSync,mkdir,writeFileSync}from'fs';import {resolve}from'path';var config = { | ||
tags: 'tags.json', | ||
@@ -29,9 +26,5 @@ attributes: 'attributes.json', | ||
directivesDescription: 'Description', | ||
}; | ||
function read(path) { | ||
};function read(path) { | ||
return readFileSync(path, 'utf-8'); | ||
} | ||
function hyphenate(str) { | ||
}function hyphenate(str) { | ||
return str.replace(/\B([A-Z])/g, '-$1').toLowerCase(); | ||
@@ -42,2 +35,3 @@ } | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function isFunction(val) { | ||
@@ -65,6 +59,6 @@ return typeof val === 'function'; | ||
if (defaultVal) { | ||
str += (str ? ', ' : '') + "default: " + defaultVal + "."; | ||
str += "".concat(str ? ', ' : '', "default: ").concat(defaultVal, "."); | ||
} | ||
if (docUrl) { | ||
str += (str ? '\n\n' : '') + "[Docs](" + docUrl + ")"; | ||
str += "".concat(str ? '\n\n' : '', "[Docs](").concat(docUrl, ")"); | ||
} | ||
@@ -80,5 +74,3 @@ return str ? str : undefined; | ||
: { module: name, symbol: title }; | ||
} | ||
function parse(options, file) { | ||
}function parse(options, file) { | ||
var titleRegExp = options.titleRegExp, tableRegExp = options.tableRegExp; | ||
@@ -163,5 +155,3 @@ var _file = normalizeFile(file); | ||
return file.replace(/\r\n/g, '\n'); | ||
} | ||
function normalize(options, data, path) { | ||
}function normalize(options, data, path) { | ||
var fileNameRegExp = options.fileNameRegExp, props = options.props, events = options.events, slots = options.slots, directives = options.directives; | ||
@@ -260,5 +250,3 @@ var _path = path.match(new RegExp(fileNameRegExp)); | ||
} | ||
} | ||
function vetur(options, list) { | ||
}function vetur(options, list) { | ||
var propsName = options.propsName, propsType = options.propsType, propsDescription = options.propsDescription, propsOptions = options.propsOptions, propsDefault = options.propsDefault, separator = options.separator, eventsName = options.eventsName, eventsDescription = options.eventsDescription, slotsSubtags = options.slotsSubtags; | ||
@@ -280,2 +268,3 @@ var tagsList = {}; | ||
} | ||
// Abandon the current data when missing the name or content | ||
if (!name || (!props && !events && !slots)) | ||
@@ -336,5 +325,3 @@ return "continue"; | ||
return { tags: tagsList, attributes: propsList }; | ||
} | ||
function webTypes(options, list) { | ||
}function webTypes(options, list) { | ||
var name = options.name, version = options.version; | ||
@@ -397,2 +384,3 @@ var _a = getWebTypes(options, list), tags = _a.tags, attributes = _a.attributes; | ||
} | ||
// Abandon the current data when missing the name or content | ||
if (!name || (!props && !events && !slots)) | ||
@@ -454,6 +442,4 @@ return "continue"; | ||
}; | ||
} | ||
function write(options, type, data) { | ||
var path = join(options.outDir, options[type]).replace(/\\/, '/'); | ||
}function write(options, type, data) { | ||
var path = resolve(options.outDir, options[type]); | ||
var buffer = JSON.stringify(data, null, options.space); | ||
@@ -467,6 +453,3 @@ writeFileRecursive(path, buffer); | ||
}); | ||
} | ||
var fg = require('fast-glob'); | ||
var main = function (options) { | ||
}var main = function (options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -495,4 +478,2 @@ if (!options.entry) | ||
}; | ||
module.exports = main; | ||
export default main; | ||
module.exports = main;export{main as default}; |
@@ -1,2 +0,2 @@ | ||
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('fs'),require('path')):typeof define==='function'&&define.amd?define(['exports','fs','path'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ComponentsHelper={},g.fs,g.path));}(this,(function(exports, fs, path){'use strict';var config = { | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var fg=require('fast-glob'),fs=require('fs'),path=require('path');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var fg__default=/*#__PURE__*/_interopDefaultLegacy(fg);var config = { | ||
tags: 'tags.json', | ||
@@ -34,2 +34,3 @@ attributes: 'attributes.json', | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function isFunction(val) { | ||
@@ -57,6 +58,6 @@ return typeof val === 'function'; | ||
if (defaultVal) { | ||
str += (str ? ', ' : '') + "default: " + defaultVal + "."; | ||
str += "".concat(str ? ', ' : '', "default: ").concat(defaultVal, "."); | ||
} | ||
if (docUrl) { | ||
str += (str ? '\n\n' : '') + "[Docs](" + docUrl + ")"; | ||
str += "".concat(str ? '\n\n' : '', "[Docs](").concat(docUrl, ")"); | ||
} | ||
@@ -263,2 +264,3 @@ return str ? str : undefined; | ||
} | ||
// Abandon the current data when missing the name or content | ||
if (!name || (!props && !events && !slots)) | ||
@@ -377,2 +379,3 @@ return "continue"; | ||
} | ||
// Abandon the current data when missing the name or content | ||
if (!name || (!props && !events && !slots)) | ||
@@ -435,3 +438,3 @@ return "continue"; | ||
}function write(options, type, data) { | ||
var path$1 = path.join(options.outDir, options[type]).replace(/\\/, '/'); | ||
var path$1 = path.resolve(options.outDir, options[type]); | ||
var buffer = JSON.stringify(data, null, options.space); | ||
@@ -445,4 +448,3 @@ writeFileRecursive(path$1, buffer); | ||
}); | ||
}var fg = require('fast-glob'); | ||
var main = function (options) { | ||
}var main = function (options) { | ||
if (options === void 0) { options = {}; } | ||
@@ -458,3 +460,3 @@ if (!options.entry) | ||
var _options = Object.assign(config, options); | ||
var files = fg.sync(_options.entry); | ||
var files = fg__default["default"].sync(_options.entry); | ||
var data = files.map(function (path) { | ||
@@ -472,2 +474,2 @@ var fileContent = read(path); | ||
}; | ||
module.exports = main;exports.default=main;Object.defineProperty(exports,'__esModule',{value:true});}))); | ||
module.exports = main;exports["default"]=main; |
@@ -1,7 +0,7 @@ | ||
declare type ReComponentName = (title: string, fileName: string, path: string) => string; | ||
declare type ReDocUrl = (fileName: string, header?: string, path?: string) => string | undefined; | ||
declare type ReAttribute = (value: string, key: string, columns: string[], title: string) => string | undefined; | ||
declare type ReVeturDescription = (description?: string, defaultValue?: string, docUrl?: string) => string | undefined; | ||
declare type ReWebTypesSource = (title: string, fileName: string, path: string) => Source; | ||
interface OptionsConfig { | ||
export declare type ReComponentName = (title: string, fileName: string, path: string) => string; | ||
export declare type ReDocUrl = (fileName: string, header?: string, path?: string) => string | undefined; | ||
export declare type ReAttribute = (value: string, key: string, columns: string[], title: string) => string | undefined; | ||
export declare type ReVeturDescription = (description?: string, defaultValue?: string, docUrl?: string) => string | undefined; | ||
export declare type ReWebTypesSource = (title: string, fileName: string, path: string) => Source; | ||
export interface OptionsConfig { | ||
entry: string; | ||
@@ -144,2 +144,1 @@ outDir: string; | ||
} | ||
export {}; |
{ | ||
"name": "components-helper", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Based on the docs to provide code prompt files for vue component library", | ||
@@ -19,3 +19,4 @@ "main": "lib/index.js", | ||
"lint": "eslint . --fix --ext .ts,.js --ignore-pattern \"/lib/\"", | ||
"prettier": "prettier --write \"src/*.ts\" --ignore-unknown" | ||
"prettier": "prettier --write \"src/*.ts\" --ignore-unknown", | ||
"prepare": "husky install" | ||
}, | ||
@@ -50,22 +51,20 @@ "files": [ | ||
"dependencies": { | ||
"fast-glob": "^3.2.5" | ||
"fast-glob": "^3.2.7" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^14.14.35", | ||
"@typescript-eslint/eslint-plugin": "^4.19.0", | ||
"@typescript-eslint/parser": "^4.19.0", | ||
"eslint": "^7.22.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^4.3.6", | ||
"lint-staged": "^10.5.4", | ||
"prettier": "^2.2.1", | ||
"rollup": "^2.42.3", | ||
"@types/node": "^16.11.12", | ||
"@typescript-eslint/eslint-plugin": "^5.6.0", | ||
"@typescript-eslint/parser": "^5.6.0", | ||
"eslint": "^8.4.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.1.2", | ||
"prettier": "^2.5.1", | ||
"rollup": "^2.61.0", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"typescript": "^4.2.3" | ||
"typescript": "^4.5.2" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
"lint-staged": { | ||
"*.{ts,js}": ["eslint --fix", "prettier --write"] | ||
} | ||
} |
@@ -46,2 +46,6 @@ # components-helper | ||
<details> | ||
<summary>TOC</summary> | ||
<br> | ||
- [entry (required)](#entry) | ||
@@ -82,2 +86,5 @@ - [outDir (required)](#outdir) | ||
<br> | ||
</details> | ||
### entry | ||
@@ -84,0 +91,0 @@ |
420
55973
16
1115
Updatedfast-glob@^3.2.7