File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,17 @@ const findResolution = (result: InstallResult, value: string): string => {
7878 return out . version ;
7979} ;
8080
81+ const hashCode = ( str : string ) : string => {
82+ let res = 0 ;
83+ const len = str . length ;
84+ for ( let i = 0 ; i < len ; i ++ ) {
85+ res = res * 31 + str . charCodeAt ( i ) ;
86+ // tslint:disable-next-line:no-bitwise
87+ res = res & res ;
88+ }
89+ return res . toString ( ) ;
90+ } ;
91+
8192export default class Install {
8293 constructor ( private rootDir : string , private config : RawConfig ) { }
8394
@@ -109,10 +120,21 @@ export default class Install {
109120 } ;
110121 } ) ;
111122
123+ const infoString = info
124+ . map ( i => `${ i . pie } @${ i . version . resolved } ` )
125+ . join ( ',' ) ;
126+
127+ const manifest = {
128+ hash : hashCode ( infoString ) ,
129+ hashString : infoString ,
130+ info
131+ } ;
132+
112133 writeFileSync (
113134 join ( this . rootDir , 'pie.manifest.json' ) ,
114- JSON . stringify ( info , null , ' ' )
135+ JSON . stringify ( manifest , null , ' ' )
115136 ) ;
137+
116138 resolve ( null ) ;
117139 } ) ;
118140 }
You can’t perform that action at this time.
0 commit comments