From 23a7113221570884a1d8fcf31a75ea58c837af61 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 8 Jan 2024 16:13:33 +0800 Subject: [PATCH] feat: bin script --- package.json | 6 +- packages/npm/package.json | 2 +- packages/sample/.best-shot/config.mjs | 1 + packages/sample/README.md | 2 +- packages/sample/lib/bin.mjs | 4 + packages/sample/lib/lib/config.mjs | 2 +- packages/sample/lib/lib/picker.mjs | 11 ++- packages/sample/package.json | 5 +- packages/sentry/.best-shot/config.mjs | 14 +-- packages/sentry/lib/bin.mjs | 4 + packages/sentry/package.json | 5 +- packages/sftp/.best-shot/config.mjs | 1 + packages/sftp/lib/bin.mjs | 4 + packages/sftp/package.json | 5 +- pnpm-lock.yaml | 127 ++++++++++++++++++++++++-- 15 files changed, 160 insertions(+), 33 deletions(-) create mode 100644 packages/sample/lib/bin.mjs create mode 100644 packages/sentry/lib/bin.mjs create mode 100644 packages/sftp/lib/bin.mjs diff --git a/package.json b/package.json index 980f945..d2e95c4 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,9 @@ "@nice-move/cli": "^0.11.3", "@nice-move/eslint-config-base": "^0.11.1", "@nice-move/prettier-config": "^0.10.0", - "best-shot": "^0.5.0", + "best-shot": "^0.5.1", "eslint": "^8.56.0", - "garou": "^0.6.22", + "garou": "^0.6.23", "prettier": "^3.1.1" }, "peerDependencies": { @@ -40,7 +40,7 @@ "node": "^18.0.0 || ^20.0.0", "npm": ">=9.4.0" }, - "packageManager": "pnpm@8.12.1", + "packageManager": "pnpm@8.14.0", "pnpm": { "overrides": { "cpu-features": "npm:cheetor@0.0.0" diff --git a/packages/npm/package.json b/packages/npm/package.json index f0ad9e7..75e763e 100644 --- a/packages/npm/package.json +++ b/packages/npm/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/npm", - "version": "0.5.0", + "version": "0.5.1", "description": "Publish npm packages when needed", "license": "MIT", "author": { diff --git a/packages/sample/.best-shot/config.mjs b/packages/sample/.best-shot/config.mjs index 447a26f..aa85a3b 100644 --- a/packages/sample/.best-shot/config.mjs +++ b/packages/sample/.best-shot/config.mjs @@ -4,6 +4,7 @@ export const config = { path: 'dist', module: true, }, + copy: ['./lib/bin.mjs'], entry: { sub: './lib/cmd.mjs', }, diff --git a/packages/sample/README.md b/packages/sample/README.md index dcec694..bc1851c 100644 --- a/packages/sample/README.md +++ b/packages/sample/README.md @@ -45,7 +45,7 @@ Config example: "group": [ { "cwd": ".", - "pattern": ["."], + "pattern": ["**/*"], "extensions": ["js", "ts", "..."], "ignore": ["dist"], "title": "示例软件名称", diff --git a/packages/sample/lib/bin.mjs b/packages/sample/lib/bin.mjs new file mode 100644 index 0000000..21d7ee5 --- /dev/null +++ b/packages/sample/lib/bin.mjs @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +/* eslint-disable n/shebang */ +import '@bring-it/cli/dist/cli.mjs'; diff --git a/packages/sample/lib/lib/config.mjs b/packages/sample/lib/lib/config.mjs index 7aa0d9e..982bdb9 100644 --- a/packages/sample/lib/lib/config.mjs +++ b/packages/sample/lib/lib/config.mjs @@ -27,7 +27,7 @@ export function mergeConfig(group = [{}]) { title = '示例软件名称', version = 'v1.0', cwd = '.', - pattern = ['.'], + pattern = ['**/*'], ignore = ['dist'], extensions = [ ['js', 'cjs', 'mjs', 'jsx'], diff --git a/packages/sample/lib/lib/picker.mjs b/packages/sample/lib/lib/picker.mjs index 965c230..01395aa 100644 --- a/packages/sample/lib/lib/picker.mjs +++ b/packages/sample/lib/lib/picker.mjs @@ -49,8 +49,17 @@ export function scan(config) { gitignore: true, onlyFiles: true, dot: true, + caseSensitiveMatch: false, expandDirectories: { extensions: config.extensions, }, - }).then((list) => list.sort()); + }) + .then((list) => list.sort()) + .then((list) => { + for (const item of list) { + logger.file(item); + } + + return list; + }); } diff --git a/packages/sample/package.json b/packages/sample/package.json index c8bd137..bb830e9 100644 --- a/packages/sample/package.json +++ b/packages/sample/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/sample", - "version": "0.4.0", + "version": "0.4.2", "description": "Generate code sample files", "license": "MIT", "author": { @@ -26,6 +26,9 @@ "bugs": { "url": "https://github.com/airkro/bring-it/issues" }, + "bin": { + "bring-it": "dist/bin.mjs" + }, "main": "dist/sub.mjs", "files": [ "dist" diff --git a/packages/sentry/.best-shot/config.mjs b/packages/sentry/.best-shot/config.mjs index 7032104..9abaefa 100644 --- a/packages/sentry/.best-shot/config.mjs +++ b/packages/sentry/.best-shot/config.mjs @@ -4,23 +4,11 @@ export const config = { path: 'dist', module: true, }, + copy: ['./lib/bin.mjs'], entry: { sub: './lib/cmd.mjs', }, externals: { globby: 'globby', }, - optimization: { - // splitChunks: { - // cacheGroups: { - // vendors: { - // name: 'share', - // chunks: 'all', - // minChunks: 2, - // enforce: true, - // reuseExistingChunk: true, - // }, - // }, - // }, - }, }; diff --git a/packages/sentry/lib/bin.mjs b/packages/sentry/lib/bin.mjs new file mode 100644 index 0000000..21d7ee5 --- /dev/null +++ b/packages/sentry/lib/bin.mjs @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +/* eslint-disable n/shebang */ +import '@bring-it/cli/dist/cli.mjs'; diff --git a/packages/sentry/package.json b/packages/sentry/package.json index 393c5b4..67c1f9c 100644 --- a/packages/sentry/package.json +++ b/packages/sentry/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/sentry", - "version": "0.5.0", + "version": "0.5.1", "description": "Update sentry artifacts", "license": "MIT", "author": { @@ -26,6 +26,9 @@ "bugs": { "url": "https://github.com/airkro/bring-it/issues" }, + "bin": { + "bring-it": "dist/bin.mjs" + }, "main": "dist/sub.mjs", "files": [ "dist" diff --git a/packages/sftp/.best-shot/config.mjs b/packages/sftp/.best-shot/config.mjs index fad0ea8..3eaf0e1 100644 --- a/packages/sftp/.best-shot/config.mjs +++ b/packages/sftp/.best-shot/config.mjs @@ -4,6 +4,7 @@ export const config = { path: 'dist', module: true, }, + copy: ['./lib/bin.mjs'], entry: { sub: './lib/cmd.mjs', }, diff --git a/packages/sftp/lib/bin.mjs b/packages/sftp/lib/bin.mjs new file mode 100644 index 0000000..21d7ee5 --- /dev/null +++ b/packages/sftp/lib/bin.mjs @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +/* eslint-disable n/shebang */ +import '@bring-it/cli/dist/cli.mjs'; diff --git a/packages/sftp/package.json b/packages/sftp/package.json index 4934dca..7d98937 100644 --- a/packages/sftp/package.json +++ b/packages/sftp/package.json @@ -1,6 +1,6 @@ { "name": "@bring-it/sftp", - "version": "0.3.0", + "version": "0.3.1", "description": "SFTP deployment tool for frontend", "license": "MIT", "author": { @@ -27,6 +27,9 @@ "bugs": { "url": "https://github.com/airkro/bring-it/issues" }, + "bin": { + "bring-it": "dist/bin.mjs" + }, "main": "dist/sub.mjs", "files": [ "dist" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aeb305e..cbb1636 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,14 +28,14 @@ importers: specifier: ^0.10.0 version: 0.10.0(prettier@3.1.1) best-shot: - specifier: ^0.5.0 - version: 0.5.0 + specifier: ^0.5.1 + version: 0.5.1(browserslist@4.22.2) eslint: specifier: ^8.56.0 version: 8.56.0 garou: - specifier: ^0.6.22 - version: 0.6.22(eslint@8.56.0)(typescript@5.3.3) + specifier: ^0.6.23 + version: 0.6.23(eslint@8.56.0)(typescript@5.3.3) prettier: specifier: ^3.1.1 version: 3.1.1 @@ -743,6 +743,27 @@ packages: - supports-color dev: true + /@typescript-eslint/parser@6.18.0(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-v6uR68SFvqhNQT41frCMCQpsP+5vySy6IdgjlzUWoo7ALCnpaWYcz/Ij2k4L8cEsL0wkvOviCMpjmtRtHNOKzA==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 6.18.0 + '@typescript-eslint/types': 6.18.0 + '@typescript-eslint/typescript-estree': 6.18.0(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.18.0 + debug: 4.3.4 + eslint: 8.56.0 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/scope-manager@6.15.0: resolution: {integrity: sha512-+BdvxYBltqrmgCNu4Li+fGDIkW9n//NrruzG9X1vBzaNK+ExVXPoGB71kneaVw/Jp+4rH/vaMAGC6JfMbHstVg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -751,6 +772,14 @@ packages: '@typescript-eslint/visitor-keys': 6.15.0 dev: true + /@typescript-eslint/scope-manager@6.18.0: + resolution: {integrity: sha512-o/UoDT2NgOJ2VfHpfr+KBY2ErWvCySNUIX/X7O9g8Zzt/tXdpfEU43qbNk8LVuWUT2E0ptzTWXh79i74PP0twA==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.18.0 + '@typescript-eslint/visitor-keys': 6.18.0 + dev: true + /@typescript-eslint/type-utils@6.15.0(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-CnmHKTfX6450Bo49hPg2OkIm/D/TVYV7jO1MCfPYGwf6x3GO0VU8YMO5AYMn+u3X05lRRxA4fWCz87GFQV6yVQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -776,6 +805,11 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true + /@typescript-eslint/types@6.18.0: + resolution: {integrity: sha512-/RFVIccwkwSdW/1zeMx3hADShWbgBxBnV/qSrex6607isYjj05t36P6LyONgqdUrNLl5TYU8NIKdHUYpFvExkA==} + engines: {node: ^16.0.0 || >=18.0.0} + dev: true + /@typescript-eslint/typescript-estree@6.15.0(typescript@5.3.3): resolution: {integrity: sha512-7mVZJN7Hd15OmGuWrp2T9UvqR2Ecg+1j/Bp1jXUEY2GZKV6FXlOIoqVDmLpBiEiq3katvj/2n2mR0SDwtloCew==} engines: {node: ^16.0.0 || >=18.0.0} @@ -797,6 +831,28 @@ packages: - supports-color dev: true + /@typescript-eslint/typescript-estree@6.18.0(typescript@5.3.3): + resolution: {integrity: sha512-klNvl+Ql4NsBNGB4W9TZ2Od03lm7aGvTbs0wYaFYsplVPhr+oeXjlPZCDI4U9jgJIDK38W1FKhacCFzCC+nbIg==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/types': 6.18.0 + '@typescript-eslint/visitor-keys': 6.18.0 + debug: 4.3.4 + globby: 11.1.0 + is-glob: 4.0.3 + minimatch: 9.0.3 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/utils@6.15.0(eslint@8.56.0)(typescript@5.3.3): resolution: {integrity: sha512-eF82p0Wrrlt8fQSRL0bGXzK5nWPRV2dYQZdajcfzOD9+cQz9O7ugifrJxclB+xVOvWvagXfqS4Es7vpLP4augw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -824,6 +880,14 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@typescript-eslint/visitor-keys@6.18.0: + resolution: {integrity: sha512-1wetAlSZpewRDb2h9p/Q8kRjdGuqdTAQbkJIOUMLug2LBLG+QOjiWoSj6/3B/hA9/tVTFFdtiKvAYoYnSRW/RA==} + engines: {node: ^16.0.0 || >=18.0.0} + dependencies: + '@typescript-eslint/types': 6.18.0 + eslint-visitor-keys: 3.4.3 + dev: true + /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true @@ -1115,10 +1179,12 @@ packages: tweetnacl: 0.14.5 dev: true - /best-shot@0.5.0: - resolution: {integrity: sha512-DW+RvxG+VPqrD6YpMyiK6Lw86HKi3FpNHVmne//aK5vmvra7SyskdLesXo73XXOM83IG1cZvAiITp1XNXjSeYQ==} + /best-shot@0.5.1(browserslist@4.22.2): + resolution: {integrity: sha512-k8ZpBvMpEU3jKCe7IW7NWB3Ktv7plwBXGh0Ycs23KZsYSzudmeYu4jQR6CJsaK4To5EO2LaZ4a3WHFmta2pllg==} engines: {node: ^18.12.0 || ^20.0.0} hasBin: true + peerDependencies: + browserslist: ^4.22.2 dependencies: '@best-shot/no-cache-loader': 0.0.0(webpack@5.89.0) browserslist: 4.22.2 @@ -1148,6 +1214,12 @@ packages: concat-map: 0.0.1 dev: true + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -1652,6 +1724,34 @@ packages: - supports-color dev: true + /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.18.0)(eslint@8.56.0): + resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + dependencies: + '@typescript-eslint/parser': 6.18.0(eslint@8.56.0)(typescript@5.3.3) + debug: 3.2.7 + eslint: 8.56.0 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-es-x@7.5.0(eslint@8.56.0): resolution: {integrity: sha512-ODswlDSO0HJDzXU0XvgZ3lF3lS3XAZEossh15Q2UHjwrJggWeBoKqqEsLTZLXl+dh5eOAozG0zRcYtuE35oTuQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -2018,8 +2118,8 @@ packages: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: true - /garou@0.6.22(eslint@8.56.0)(typescript@5.3.3): - resolution: {integrity: sha512-p/hDC+7HjlAstuAAP5gWwojJyfDrsOPhEoXHqKq74nLu5mnppR9SoV1bDeODu8xbYtZAfR2AJnp47LYk6odUig==} + /garou@0.6.23(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-QlmodAmSvNGolX4BKUqwYwW3YW8nhrM4B9JK+gZqnv1vyGhzFIdCiGwTu727Jk/tHJFqsuXuDsVWNlj2xmD5cQ==} engines: {node: '>=20.0.0 || ^16.15.0 || ^18.12.0'} hasBin: true peerDependencies: @@ -2029,10 +2129,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 6.15.0(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/parser': 6.18.0(eslint@8.56.0)(typescript@5.3.3) '@yarnpkg/lockfile': 1.1.0 eslint: 8.56.0 - eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.15.0)(eslint-import-resolver-node@0.3.9)(eslint@8.56.0) + eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.18.0)(eslint@8.56.0) flat-cache: 3.2.0 typescript: 5.3.3 vue-eslint-parser: 9.3.2(eslint@8.56.0) @@ -2766,6 +2866,13 @@ packages: brace-expansion: 1.1.11 dev: true + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} dev: true