Skip to content

Commit

Permalink
release 7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Apr 15, 2024
1 parent f8d176f commit 5189ba4
Show file tree
Hide file tree
Showing 41 changed files with 5,536 additions and 137 deletions.
42 changes: 29 additions & 13 deletions build/packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,22 @@ export const packages: PackageManifest[] = [
iife: false,
browser: false,
display: 'gitmars文档库'
},
{
name: 'monorepo',
pkgName: '@gitmars/monorepo',
build: false,
display: 'gitmars monorepo'
}
]

export const names = packages.map(({ name }) => name)
export const packageNames = packages.map(({ pkgName }) => pkgName)
export const buildTasks = packages.reduce((acc, cur) => {
for (const item of ([] as Task[]).concat(cur.buildTask)) {
!acc.includes(item) && acc.push(item)
}
if (cur.buildTask)
for (const item of ([] as Task[]).concat(cur.buildTask)) {
!acc.includes(item) && acc.push(item)
}
return acc
}, [] as Task[])

Expand All @@ -107,12 +114,15 @@ export function getPackages(name?: string | string[]) {
const list = packages.filter(item => {
if (intersect(buildTasks, name).length) {
// 传入task
return intersect(
typeof item.buildTask === 'string'
? ([] as Task[]).concat(item.buildTask)
: item.buildTask,
name
).length
return (
item.buildTask &&
intersect(
typeof item.buildTask === 'string'
? ([] as Task[]).concat(item.buildTask)
: item.buildTask,
name
).length
)
}
// 传入name
return name.includes(item.name)
Expand All @@ -126,9 +136,12 @@ export function getPackages(name?: string | string[]) {
}

export function getLibPackages(name?: string | string[]) {
const _names = typeof name === 'string' ? ([] as string[]).concat(name) : name
const list = packages.filter(item => {
const _names = typeof name === 'string' ? ([] as string[]).concat(name) : name
const _buildTask = typeof item.buildTask === 'string' ? [item.buildTask] : item.buildTask
const _buildTask =
item.buildTask && typeof item.buildTask === 'string'
? [item.buildTask]
: item.buildTask || []

if (!_names) return _buildTask.includes('lib')
return _buildTask.includes('lib') && _names.includes(item.name)
Expand All @@ -142,9 +155,12 @@ export function getLibPackages(name?: string | string[]) {
}

export function getBundlePackages(name?: string | string[]) {
const _names = typeof name === 'string' ? ([] as string[]).concat(name) : name
const list = packages.filter(item => {
const _names = typeof name === 'string' ? ([] as string[]).concat(name) : name
const _buildTask = typeof item.buildTask === 'string' ? [item.buildTask] : item.buildTask
const _buildTask =
item.buildTask && typeof item.buildTask === 'string'
? [item.buildTask]
: item.buildTask || []

if (!_names) return _buildTask.includes('bundle')
return _buildTask.includes('bundle') && _names.includes(item.name)
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/buildApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { packages } from '../packages'

export async function buildApp() {
const builds = packages
.filter(({ buildTask }) => buildTask.includes('app'))
.filter(({ buildTask }) => buildTask && buildTask.includes('app'))
.map(async ({ name }) => {
await runSpawnSync(`pnpm build`, resolve(PACKAGE, name))
})
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/buildDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { runExec, runExecSync, runSpawnSync } from '../utils/exec'
import { PACKAGE, ROOT } from '../utils/paths'
import { packages } from '../packages'

const pkgs = packages.filter(({ buildTask }) => buildTask.includes('docs'))
const pkgs = packages.filter(({ buildTask }) => buildTask && buildTask.includes('docs'))
const os = platform()

export async function buildDocs() {
Expand Down
2 changes: 1 addition & 1 deletion build/tasks/buildType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { wrapDisplayName } from '../utils/gulp'
import { PACKAGE } from '../utils/paths'
import { packages } from '../packages'

const pkgs = packages.filter(({ buildTask }) => buildTask.includes('type'))
const pkgs = packages.filter(({ buildTask }) => buildTask && buildTask.includes('type'))

export async function buildType() {
const builds = pkgs.map(async ({ name, build }) => {
Expand Down
2 changes: 1 addition & 1 deletion build/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface PackageManifest {
name: Name
pkgName: PkgName
display: string
buildTask: BuildTask
buildTask?: BuildTask
addon?: boolean
author?: string
description?: string
Expand Down
2 changes: 1 addition & 1 deletion build/utils/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function pathRewriter(bundlePath: string) {

export const reporter = (opt: any, outputOptions: any, info: any) =>
`${chalk.cyan(
chalk.bold((info.fileName && `${outputOptions.file?.split('packages/').pop()}`) || '')
chalk.bold(info.fileName)
)}: bundle size ${chalk.yellow(info.bundleSize)} -> minified ${chalk.green(
(info.minSize && `${info.minSize}`) || ''
)}`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@gitmars/monorepo",
"description": "这是一个git工作流工具",
"version": "6.4.0",
"version": "7.0.0-beta.1",
"packageManager": "[email protected]",
"main": "index.js",
"files": [
Expand Down
Loading

0 comments on commit 5189ba4

Please sign in to comment.