index.js
function buildIndexFile(isProd) {
			return new Promise((resolve) => {
				files.readFile(path.resolve(__dirname, ".includes/index.html"), (err, html) => {
					if (err) throw err;
					html = html.replace("$appDesc$", wapitisConfig.appDesc);
					html = html.replace("$themeColor$", wapitisConfig.themeColor);
					html = html.replace("$appName$", wapitisConfig.appName);
					if (isProd) {
						const quantumFile = JSON.parse(files.readFileSync(completeDistPath + "/quantum.json", "utf8"));
						html = html.replace("$bundle$", `<script src="${quantumFile.bundle.relativePath}"></script>`);
						files.remove(completeDistPath + "/quantum.json");
					} else html = html.replace("$bundle$", '<script src="bundle.js"></script>');
					files.appendFile(completeDistPath + "/index.html", html, true).then(() => resolve());
				});
			});
		}
function buildIndexFile(isProd) {
			return new Promise((resolve) => {
				files.readFile(path.resolve(__dirname, ".includes/index.html"), (err, html) => {
					if (err) throw err;
					html = html.replace("$appDesc$", wapitisConfig.appDesc);
					html = html.replace("$themeColor$", wapitisConfig.themeColor);
					html = html.replace("$appName$", wapitisConfig.appName);
					if (isProd) {
						const quantumFile = JSON.parse(files.readFileSync(completeDistPath + "/quantum.json", "utf8"));
						html = html.replace("$bundle$", `<script src="${quantumFile.bundle.relativePath}"></script>`);
						files.remove(completeDistPath + "/quantum.json");
					} else html = html.replace("$bundle$", '<script src="bundle.js"></script>');
					files.appendFile(completeDistPath + "/index.html", html, true).then(() => resolve());
				});
			});
		}
function buildIndexFile ( isProd ) { return new Promise ( ( resolve ) => { files . readFile ( path . resolve ( __dirname , ".includes/index.html" ) , ( err , html ) => { if ( err ) throw err ; html = html . replace ( "$appDesc$" , wapitisConfig . appDesc ) ; html = html . replace ( "$themeColor$" , wapitisConfig . themeColor ) ; html = html . replace ( "$appName$" , wapitisConfig . appName ) ; if ( isProd ) { const quantumFile = JSON . parse ( files . readFileSync ( completeDistPath + "/quantum.json" , "utf8" ) ) ; html = html . replace ( "$bundle$" , ` ${ quantumFile . bundle . relativePath } ` ) ; files . remove ( completeDistPath + "/quantum.json" ) ; } else html = html . replace ( "$bundle$" , '<script src="bundle.js"></script>' ) ; files . appendFile ( completeDistPath + "/index.html" , html , true ) . then ( ( ) => resolve ( ) ) ; } ) ; } ) ; }
Modify index file
Modify index file