Skip to content

Commit

Permalink
Merge pull request #20 from tolking/dev
Browse files Browse the repository at this point in the history
releases: v1.0.5
  • Loading branch information
tolking authored Dec 10, 2021
2 parents cab3260 + 9918c2b commit 1d2fd17
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 36 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: publish to npm

on:
release:
types: [ created ]

jobs:
build-and-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn build
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ yarn-debug.log*
yarn-error.log*
yarn.lock
package-lock.json
pnpm-lock.yaml

# Editor directories and files
.idea
Expand Down
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 0 additions & 3 deletions .lintstagedrc

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

### 1.0.5

feat

- export all types

fix

- support windows path

### 1.0.4

feat
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ then in package.json

## Options

<details>
<summary>TOC</summary>
<br>

- [entry (required)](#entry)
- [outDir (required)](#outdir)
- [name (required)](#name)
Expand Down Expand Up @@ -78,6 +82,9 @@ then in package.json
- [tableRegExp](#tableregexp)
- [fileNameRegExp](#filenameregexp)

<br>
</details>

### entry

- Required: `true`
Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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",
"main": "lib/index.js",
"module": "lib/index.es.js",
Expand All @@ -16,7 +16,8 @@
"build": "rollup -c rollup.config.js",
"test": "node test/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"
},
"files": [
"lib"
Expand Down Expand Up @@ -46,24 +47,22 @@
"node": ">10.0.0"
},
"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"]
}
}
14 changes: 7 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@ import ts from 'rollup-plugin-typescript2'

const commonConf = {
input: './src/index.ts',
external: ['fast-glob'],
plugins:[
external: ['fast-glob', 'fs', 'path'],
plugins: [
ts({
extensions: ['.ts'],
tsconfig: './tsconfig.json',
}),
]
],
}

const list = [
{
file: 'lib/index.es.js',
format: 'es',
exports: 'named',
compact: true,
},
{
file: 'lib/index.js',
format: 'umd',
format: 'cjs',
exports: 'named',
name: 'ComponentsHelper',
compact: true,
},
]

const buildConf = options => Object.assign({}, commonConf, options)
const buildConf = (options) => Object.assign({}, commonConf, options)

export default list.map(output => buildConf({ output }))
export default list.map((output) => buildConf({ output }))
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fg = require('fast-glob')
import fg from 'fast-glob'
import config from './config'
import read from './read'
import parse from './parse'
Expand Down Expand Up @@ -32,5 +31,6 @@ const main = (options = {} as InstallOptions): void => {
write(_options, 'webTypes', webTypesData)
}

export * from './type'
export default main
module.exports = main
16 changes: 10 additions & 6 deletions src/type.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
type ReComponentName = (title: string, fileName: string, path: string) => string
export type ReComponentName = (
title: string,
fileName: string,
path: string,
) => string

type ReDocUrl = (
export type ReDocUrl = (
fileName: string,
header?: string,
path?: string,
) => string | undefined

type ReAttribute = (
export type ReAttribute = (
value: string,
key: string,
columns: string[],
title: string,
) => string | undefined

type ReVeturDescription = (
export type ReVeturDescription = (
description?: string,
defaultValue?: string,
docUrl?: string,
) => string | undefined

type ReWebTypesSource = (
export type ReWebTypesSource = (
title: string,
fileName: string,
path: string,
) => Source

interface OptionsConfig {
export interface OptionsConfig {
entry: string
outDir: string
name: string
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"module":"esnext",
"lib": ["ESNext"],
"outDir": "lib",
"moduleResolution": "Node",
"strict": true,
"declaration": true,
"removeComments": true
"allowSyntheticDefaultImports": true
}
}

0 comments on commit 1d2fd17

Please sign in to comment.