@flatjs/evolve 1.8.1-next.45 → 1.8.1-next.46
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/CHANGELOG.md +14 -0
- package/dist/default-options.js +1 -1
- package/dist/main/start-build-dynamic.d.ts +4 -9
- package/dist/main/start-build-dynamic.js +1 -1
- package/dist/types/types-ci.d.ts +18 -0
- package/dist/types/types-ci.js +1 -0
- package/dist/types/types-loader-options.d.ts +1 -1
- package/dist/types/types-options.d.ts +5 -0
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @flatjs/evolve
|
|
2
2
|
|
|
3
|
+
## 1.8.1-next.46
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a2e8c72: bump version
|
|
8
|
+
- 8875949: imporved evolve build logics
|
|
9
|
+
- Updated dependencies [a2e8c72]
|
|
10
|
+
- Updated dependencies [8875949]
|
|
11
|
+
- @flatjs/forge-postcss-plugin-pixel@1.8.1-next.21
|
|
12
|
+
- @flatjs/evolve-preset-babel@1.8.1-next.10
|
|
13
|
+
- @flatjs/common@1.8.1-next.21
|
|
14
|
+
- @flatjs/graph@1.8.1-next.24
|
|
15
|
+
- @flatjs/mock@1.8.1-next.40
|
|
16
|
+
|
|
3
17
|
## 1.8.1-next.45
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/default-options.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},cssnanoOptions:{},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:"50%"};
|
|
1
|
+
export const defaultEvolveOptions={projectCwd:process.cwd(),projectVirtualPath:"flatjs/evolve",rejectWarnings:!1,devServer:{autoOpen:!0,mockOptions:{mockBaseDir:"mocks"},clientOverlay:{errors:!0,warnings:!1},middlewares:[],watchOptions:{poll:1e3,ignored:/node_modules/,aggregateTimeout:500},defaultServeGlobalData:()=>Promise.resolve({})},webpack:{target:["web","es5"],plugins:[],ruleSets:[],publicPath:"auto",externals:{vue:"Vue",react:"React","react-dom":"ReactDOM"},outputDir:"public",enableBundleHashName:!0},pluginOptions:{},loaderOptions:{assetDataUrlMaxSize:4096,babelOptions:{usePreset:"react",plugins:[],presets:[]},runTsChecker:!0,lessOptions:{},cssnanoOptions:{},pixelOptions:{rootValue:{px:100,rpx:1},outputUnit:"rem"},modularImports:[]},entryMap:{},multiHtmlCdn:{},multiHtmlCdnEnvResolver:function cdnResolver(){},needVerifyPackages:{},packageInstallChecker:{enabled:!1,detectModules:["@dimjs/*"],throwError:!1,showAllInstalledGraph:!0},maxProcesses:"50%",ci:{basedBranch:"master"}};
|
|
@@ -4,21 +4,16 @@ import { type FlatEvolveOptions } from '../types/types-options.js';
|
|
|
4
4
|
export declare function getBuildEntryFiles(projectCwd: string, diffFiles: string[], allEntryInputs: string[]): Promise<string[]>;
|
|
5
5
|
/**
|
|
6
6
|
* Dynamic check which entry modules need to build.
|
|
7
|
-
* @param projectCwd
|
|
8
|
-
* @param basedCommitHash
|
|
9
|
-
* @param newCommitHash
|
|
10
|
-
* @param overrideEvolveOptions
|
|
11
|
-
* @param configLoaderOptions
|
|
12
7
|
* @returns
|
|
13
8
|
*/
|
|
14
|
-
export declare function dynamicCheckBuildEntryMap(projectCwd: string,
|
|
9
|
+
export declare function dynamicCheckBuildEntryMap(projectCwd: string, earlyCommit?: string | null, lastCommit?: string, overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions): Promise<{
|
|
15
10
|
buildEntries: import("../index.js").EvolveEntryMap;
|
|
16
11
|
newEvolveOptions: FlatEvolveOptions;
|
|
17
12
|
}>;
|
|
18
13
|
/**
|
|
19
14
|
* The main entry to start an evolve `build` with automatically detect modules which have been changed between two commits.
|
|
20
15
|
* @param projectCwd The Root directory (workspace) of this project.
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
16
|
+
* @param earlyCommit The diff based earlier commit hash
|
|
17
|
+
* @param lastCommit If is omitted, it will have the same effect as using HEAD instead.
|
|
23
18
|
*/
|
|
24
|
-
export declare const startDynamicBuild: (projectCwd: string,
|
|
19
|
+
export declare const startDynamicBuild: (projectCwd: string, earlyCommit?: string, lastCommit?: string, overrideEvolveOptions?: PartialDeep<FlatEvolveOptions>, configLoaderOptions?: ConfigLoaderOptions) => Promise<import("./prepare-build.js").EvolveBuildResult[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAbsolute,join}from"node:path";import{getDiffFiles}from"@armit/git";import{arraysIntersect,logger}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import{filterActivedEntriesByEntryInputs}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export async function getBuildEntryFiles(t,r
|
|
1
|
+
import{isAbsolute,join}from"node:path";import{getDiffFiles,getCommitIdOfBranch}from"@armit/git";import{arraysIntersect,logger}from"@flatjs/common";import{traverseGraph}from"@flatjs/graph";import{filterActivedEntriesByEntryInputs,filterActivedEntriesByModule}from"../helpers/filter-actived-entries.js";import{getGitRoot}from"../helpers/get-git-root.js";import{normalizeEvolveEntryMap}from"../helpers/normalize-entry-map.js";import{resolveEntryMapInputFiles}from"../helpers/resolve-entry-map-input-files.js";import{loadEvolveConfig}from"../load-config/load-evolve-config.js";import{prepareBuild}from"./prepare-build.js";export async function getBuildEntryFiles(e,t,r){const i=[],o=[];for(const e of r)t.includes(e)?i.push(e):o.push(e);if(o.length){const r=await traverseGraph({input:o,projectCwd:e,treeNodeFilter:()=>!0});if(!r)return i;logger.debug(r,"DependencyGraph");for(const e of o){const o=r[e]||[];arraysIntersect(o,t)&&i.push(e)}}return i}export async function dynamicCheckBuildEntryMap(e,t,r,i,o){const n=await loadEvolveConfig({command:"build"},e,i,o);if(n.ci?.fixedBuildModules&&n.ci?.fixedBuildModules.length){logger.info("Use `fixedBuildModules` configuration to build...");return{buildEntries:filterActivedEntriesByModule(n.entryMap,n.ci?.fixedBuildModules),newEvolveOptions:n}}if(logger.info("Dynamicly checking code changed modules ..."),!t){const e=n.ci?.basedBranch||"master";logger.info(`Resolving base branch "${e}" commit hash ...`),t=await getCommitIdOfBranch(e)}let l=t?await getDiffFiles(t,r):[];const s=getGitRoot(e);if(!s)throw new Error(`No .git root (${e}) found`);if(l=l.map((e=>isAbsolute(e)?e:join(s,e))),logger.debug(l,"DiffFiles"),!l.length)return logger.warn("It seems that there are no code files changed."),{buildEntries:{},newEvolveOptions:n};const a=await resolveEntryMapInputFiles(e,n.entryMap),d=await getBuildEntryFiles(e,l,a);logger.debug(d,"ToBuildEntryFiles");return{buildEntries:await filterActivedEntriesByEntryInputs(e,n.entryMap,d),newEvolveOptions:n}}export const startDynamicBuild=async(e,t,r,i={},o)=>{const{buildEntries:n,newEvolveOptions:l}=await dynamicCheckBuildEntryMap(e,t,r,i,o),s=Object.keys(n);if(!s.length)return logger.warn("No build entries providered!"),[];logger.info({buildEntries:s});const a=normalizeEvolveEntryMap(n,l.entryMap);return prepareBuild(e,a,l)};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CI pipeline execute `priority` as below
|
|
3
|
+
* 1. Fixed module build depends on config : `fixedBuildModules` of `flatjs-evolve.config.mts`
|
|
4
|
+
* 2. Dynamic build depends on commits (`flat build evolve --commits=""`)
|
|
5
|
+
* 3. Normally build manually using (`flat build evolve -m "a;b"`)
|
|
6
|
+
*/
|
|
7
|
+
export type FlatEvolveCI = {
|
|
8
|
+
/**
|
|
9
|
+
* The build module patterns, `Highest Priority First`
|
|
10
|
+
* Support "a;b;c" RegExp pattern; `new RegExp(`${pattern}`).test(entryKey)`
|
|
11
|
+
*/
|
|
12
|
+
fixedBuildModules?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Dynamic build depends on persistent `branch`, e.g. `main`,`master`,`release`
|
|
15
|
+
* @default `master`
|
|
16
|
+
*/
|
|
17
|
+
basedBranch: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -43,7 +43,7 @@ export interface RuleSetLoaderOptions {
|
|
|
43
43
|
* The overrided configurations of `cssnano-preset-default`
|
|
44
44
|
* sometimes we need to disabled some rules for `default cssnano preset`
|
|
45
45
|
* @example
|
|
46
|
-
*
|
|
46
|
+
* disable `postcss-minify-font-values` rule to avoid transitions from `font-weight:bold` to `font-weight:700`
|
|
47
47
|
* ```json
|
|
48
48
|
* cssnanoOptions: { minifyFontValues: false }
|
|
49
49
|
* ```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type VerifyPackagePattern } from '@armit/package';
|
|
2
|
+
import { type FlatEvolveCI } from './types-ci.js';
|
|
2
3
|
import { type FlatEvolveDevServerOptions } from './types-dev-server.js';
|
|
3
4
|
import { type EvolveEntryMap } from './types-entry-map.js';
|
|
4
5
|
import { type RuleSetLoaderOptions } from './types-loader-options.js';
|
|
@@ -109,4 +110,8 @@ export interface FlatEvolveOptions {
|
|
|
109
110
|
* @default false
|
|
110
111
|
*/
|
|
111
112
|
rejectWarnings?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The faster builds, simplified ci pipeline configurations
|
|
115
|
+
*/
|
|
116
|
+
ci?: FlatEvolveCI;
|
|
112
117
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flatjs/evolve",
|
|
3
|
-
"version": "1.8.1-next.
|
|
3
|
+
"version": "1.8.1-next.46",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"typecheck": "tsc --project ./tsconfig.json --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@armit/file-utility": "^0.0.
|
|
41
|
-
"@armit/git": "^0.0.
|
|
42
|
-
"@armit/package": "^0.0.
|
|
40
|
+
"@armit/file-utility": "^0.0.22",
|
|
41
|
+
"@armit/git": "^0.0.26",
|
|
42
|
+
"@armit/package": "^0.0.35",
|
|
43
43
|
"@babel/core": "7.22.1",
|
|
44
|
-
"@flatjs/common": "1.8.1-next.
|
|
45
|
-
"@flatjs/evolve-preset-babel": "1.8.1-next.
|
|
46
|
-
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.
|
|
47
|
-
"@flatjs/graph": "1.8.1-next.
|
|
48
|
-
"@flatjs/mock": "1.8.1-next.
|
|
44
|
+
"@flatjs/common": "1.8.1-next.21",
|
|
45
|
+
"@flatjs/evolve-preset-babel": "1.8.1-next.10",
|
|
46
|
+
"@flatjs/forge-postcss-plugin-pixel": "1.8.1-next.21",
|
|
47
|
+
"@flatjs/graph": "1.8.1-next.24",
|
|
48
|
+
"@flatjs/mock": "1.8.1-next.40",
|
|
49
49
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
50
50
|
"@types/babel__core": "7.20.1",
|
|
51
51
|
"babel-loader": "9.1.2",
|
|
@@ -70,20 +70,20 @@
|
|
|
70
70
|
"svgo": "3.0.2",
|
|
71
71
|
"terser-webpack-plugin": "5.3.9",
|
|
72
72
|
"tsconfig-paths-webpack-plugin": "4.0.1",
|
|
73
|
-
"type-fest": "^3.11.
|
|
73
|
+
"type-fest": "^3.11.1",
|
|
74
74
|
"webpack": "5.84.1",
|
|
75
75
|
"webpack-bundle-analyzer": "4.8.0",
|
|
76
76
|
"webpack-dev-server": "4.15.0",
|
|
77
77
|
"webpack-sources": "3.2.3"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@armit/eslint-config-bases": "^0.0.
|
|
81
|
-
"@flatjs/testing": "1.8.1-next.
|
|
80
|
+
"@armit/eslint-config-bases": "^0.0.18",
|
|
81
|
+
"@flatjs/testing": "1.8.1-next.20",
|
|
82
82
|
"@swc/core": "1.3.61",
|
|
83
83
|
"@types/express": "4.17.17",
|
|
84
84
|
"@types/node": "20.2.5",
|
|
85
|
-
"@vitest/coverage-istanbul": "0.31.
|
|
86
|
-
"@vitest/ui": "0.31.
|
|
85
|
+
"@vitest/coverage-istanbul": "0.31.2",
|
|
86
|
+
"@vitest/ui": "0.31.2",
|
|
87
87
|
"eslint": "8.41.0",
|
|
88
88
|
"imagemin-gifsicle": "7.0.0",
|
|
89
89
|
"imagemin-jpegtran": "7.0.0",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"swc-unplugin-ts": "1.0.2",
|
|
97
97
|
"ts-node": "10.9.1",
|
|
98
98
|
"vite-tsconfig-paths": "4.2.0",
|
|
99
|
-
"vitest": "0.31.
|
|
99
|
+
"vitest": "0.31.2",
|
|
100
100
|
"vue-loader": "17.1.2"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|