mirror of
				https://github.com/ionic-team/ionic-framework.git
				synced 2025-11-04 21:30:00 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			732 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			732 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
 | 
						|
// the unpkg link cannot use "latest" in the url
 | 
						|
// so this script is to keep the link updated
 | 
						|
// with the latest
 | 
						|
 | 
						|
const fs = require('fs');
 | 
						|
const path = require('path');
 | 
						|
 | 
						|
let version = process.argv[2];
 | 
						|
 | 
						|
if (version) {
 | 
						|
  version = '@' + version;
 | 
						|
} else {
 | 
						|
  version = '';
 | 
						|
}
 | 
						|
 | 
						|
const srcPath = path.join(__dirname, 'cdn-loader.js');
 | 
						|
let scriptContent = fs.readFileSync(srcPath, 'utf-8');
 | 
						|
 | 
						|
// https://unpkg.com/@ionic/core@latest/dist/ionic.js
 | 
						|
 | 
						|
scriptContent = scriptContent.replace(
 | 
						|
  /__CDN_LOADER_URL__/g,
 | 
						|
  'https://cdn.jsdelivr.net/npm/@ionic/core' + version
 | 
						|
);
 | 
						|
 | 
						|
fs.writeFileSync(path.join(__dirname, '..', 'loader', 'cdn.js'), scriptContent);
 | 
						|
fs.writeFileSync(path.join(__dirname, '..', 'loader', 'index.cjs.js'), scriptContent);
 |