| 
				
			 | 
			
			
				@@ -36,12 +36,11 @@ function setupGit() { 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				36
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				37
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				38
			 | 
			
				38
			 | 
			
			
				 function calcNewVersion() { 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				
			 | 
			
			
				-  const currentVersion = exec.execSyncRead(`npm view ${process.env.npm_package_name} dist-tags.${VERSION_TAG}`); 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				
			 | 
			
			
				-  console.log(`${VERSION_TAG} version: ${currentVersion}`); 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				
			 | 
			
			
				-  const packageVersion = process.env.npm_package_version; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+  const packageVersion = semver.clean(process.env.npm_package_version); 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				40
			 | 
			
			
				   console.log(`package version: ${packageVersion}`); 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				
			 | 
			
			
				-  const greater = semver.gt(currentVersion, packageVersion) ? currentVersion : packageVersion; 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				
			 | 
			
			
				-  return semver.inc(greater, VERSION_INC); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+  const commitCount = exec.execSyncRead(`git rev-list --count ${ONLY_ON_BRANCH}`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+  console.log(`new patch: ${commitCount}`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+  return `${semver.major(packageVersion)}.${semver.minor(packageVersion)}.${commitCount}`; 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				44
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				45
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				47
			 | 
			
				46
			 | 
			
			
				 function createNpmRc() { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -53,19 +52,20 @@ email=\${NPM_EMAIL} 
			 | 
		
	
		
			
			| 
				53
			 | 
			
				52
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				54
			 | 
			
				53
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				55
			 | 
			
				54
			 | 
			
			
				 function tagAndPublish(newVersion) { 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				
			 | 
			
			
				-  console.log(`new version is: ${newVersion}`); 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				55
			 | 
			
			
				   exec.execSync(`npm version ${newVersion} -f -m "v${newVersion} [ci skip]"`); 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				56
			 | 
			
			
				   exec.execSync(`npm publish --tag ${VERSION_TAG}`); 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				57
			 | 
			
			
				   exec.execSyncSilent(`git push deploy --tags || true`); 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				58
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				61
			 | 
			
				59
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				62
			 | 
			
				60
			 | 
			
			
				 function run() { 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				
			 | 
			
			
				-  if (!validateEnv()) { 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				-    return; 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				
			 | 
			
			
				-  } 
			 | 
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				-  setupGit(); 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				
			 | 
			
			
				-  createNpmRc(); 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				
			 | 
			
			
				-  tagAndPublish(calcNewVersion()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				+  // if (!validateEnv()) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				+  //   return; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				+  // } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				+  // setupGit(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				+  // createNpmRc(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				+  const newVersion = calcNewVersion(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				+  console.log(`new version is: ${newVersion}`); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				+  // tagAndPublish(newVersion); 
			 | 
		
	
		
			
			| 
				69
			 | 
			
				69
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				70
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				71
			 | 
			
				71
			 | 
			
			
				 run(); 
			 |