当前位置: 首页 > news >正文

discuz 手机网站模板守游网络推广平台

discuz 手机网站模板,守游网络推广平台,asp.net mvc网站开发,中山网站建设包括哪些找了一圈发现官方的文档都是最新的,3.2很多API都不支持,比如获取OhosAppContext,通过OhosAppContext来获取应用版本号,最终是通过读取app.json5的文件内容来读取版本号,最终修改entry下的hvigorfile.ts如下&#xff0c…

找了一圈发现官方的文档都是最新的,3.2很多API都不支持,比如获取OhosAppContext,通过OhosAppContext来获取应用版本号,最终是通过读取app.json5的文件内容来读取版本号,最终修改entry下的hvigorfile.ts如下,执行./hvigorw assembleHap,或者编译打包就可以生成新的hap名字了

import { hapTasks } from '@ohos/hvigor-ohos-plugin';
import fs from 'fs'
import { HvigorNode, HvigorPlugin, HvigorTaskContext } from "@ohos/hvigor";
import { OhosAppContext, OhosPluginId } from '@ohos/hvigor-ohos-plugin';
import { AppJson } from "@ohos/hvigor-ohos-plugin/src/options/configure/app-json-options";const getDate = () => {return new Date().toISOString().split('T')[0]; // 返回 YYYY-MM-DD 格式
};export function rename(): HvigorPlugin {return {pluginId: 'renameHapPlugin',apply(node: HvigorNode) {// 插件主体node.registerTask({// 任务名称name: 'renameHapTask',// 重命名任务在default@SignHap任务执行完成后执行dependencies: ['default@SignHap'],// 重命名任务在default@assembleHap任务执行完成前执行postDependencies: ['assembleHap'],run: (taskContext: HvigorTaskContext) => {console.log(`开始执行重命名任务`)// 获取模块名const moduleName = taskContext.moduleName// 获取模块路径const modulePath = taskContext.modulePath// 假设我们在entry目录的hvigorfile.ts文件调用插件,那拿到的模块名就是entry,模块路径就是entry模块的绝对路径。console.log(`模块名:${moduleName}`)console.log(`模块路径:${modulePath}`)// hap所在路径const originSignFilePath = `${modulePath}/build/default/outputs/default/${moduleName}-default-signed.hap`const originUnsignFilePath = `${modulePath}/build/default/outputs/default/${moduleName}-default-unsigned.hap`console.log(`原签名文件路径:${originSignFilePath}`)console.log(`原未签名文件路径:${originUnsignFilePath}`)// 新文件所在的目录const targetFileDir = `${modulePath}/build/default/outputs/default/target`// 创建目录fs.mkdir(targetFileDir, { recursive: true }, (err) => {console.log(`目录创建失败:{err}`)})// 获取父节点// const parentNode = node.getParentNode()// // 获取OhosAppContext// const appContext = parentNode?.getContext(OhosPluginId.OHOS_APP_PLUGIN) as OhosAppContext// 获取项目名// 获取AppScope目录下app.json文件里面的json// const appOptObj: AppJson.AppOptObj = appContext.getAppJsonOpt()const appJsonPath = './AppScope/app.json5';const content = fs.readFileSync(appJsonPath, 'utf8');const appJson = JSON.parse(content);// 只获取版本号const versionName = appJson.app.description;console.log(`app.json5获取的版本号:${versionName}`)// const versionName = versionconsole.log(`版本:${versionName}`)const date = getDate()// 新文件路径const targetSignFilePath = `${modulePath}/build/default/outputs/default/target/${versionName}_${date}-signed.hap`const targetUnsignFilePath = `${modulePath}/build/default/outputs/default/target/${versionName}_${date}-default-unsigned.hap`// 复制文件if (fs.existsSync(originSignFilePath)) {// 原文件存在才复制fs.copyFileSync(originSignFilePath, targetSignFilePath)// fs.unlink(originSignFilePath, (err: BusinessError) => {// })}if (fs.existsSync(originUnsignFilePath)) {// 原文件存在才复制fs.copyFileSync(originUnsignFilePath, targetUnsignFilePath)// fs.unlink(originUnsignFilePath, (err: BusinessError) => {// })}console.log(`重命名任务执行完成`)}})// const hapContext = node.getContext(OhosPluginId.OHOS_HAP_PLUGIN) as OhosHapContext;// const buildProfile = appContext.getBuildProfileOpt()//// buildProfile.app.products[0].output.artifactName = 'TestartifactName.0.0.1';//// appContext.setBuildProfileOpt(buildProfile);}}
}export default {system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */plugins: [rename()]         /* Custom plugin to extend the functionality of Hvigor. */
}

文章转载自:
http://dinncosegue.tpps.cn
http://dinncowhiggism.tpps.cn
http://dinncowastebasket.tpps.cn
http://dinncocystinosis.tpps.cn
http://dinncoshnook.tpps.cn
http://dinncofungivorous.tpps.cn
http://dinncoinvert.tpps.cn
http://dinncowinless.tpps.cn
http://dinncounhappily.tpps.cn
http://dinncocrackpot.tpps.cn
http://dinncoaquarius.tpps.cn
http://dinncotetragonal.tpps.cn
http://dinncoarhythmical.tpps.cn
http://dinncodecipher.tpps.cn
http://dinncosupplementarity.tpps.cn
http://dinncoenunciable.tpps.cn
http://dinncohypochlorous.tpps.cn
http://dinncomillboard.tpps.cn
http://dinncosemiliquid.tpps.cn
http://dinncoechinodermata.tpps.cn
http://dinncomucilaginous.tpps.cn
http://dinncotapeworm.tpps.cn
http://dinncotransthoracic.tpps.cn
http://dinncodivesture.tpps.cn
http://dinncopowerlifter.tpps.cn
http://dinncobaby.tpps.cn
http://dinncoepiclesis.tpps.cn
http://dinncotricker.tpps.cn
http://dinncohypothalamic.tpps.cn
http://dinncopyrgeometer.tpps.cn
http://dinncointroit.tpps.cn
http://dinncominutely.tpps.cn
http://dinncofunicle.tpps.cn
http://dinncoxylograph.tpps.cn
http://dinncoemulable.tpps.cn
http://dinncoquaveringly.tpps.cn
http://dinncoavo.tpps.cn
http://dinncocalf.tpps.cn
http://dinncoshaganappi.tpps.cn
http://dinncovascular.tpps.cn
http://dinncoamphibolic.tpps.cn
http://dinncobaggagemaster.tpps.cn
http://dinncoeggshell.tpps.cn
http://dinncothyrosis.tpps.cn
http://dinncolegitimize.tpps.cn
http://dinncodamning.tpps.cn
http://dinncodaggle.tpps.cn
http://dinncodiscover.tpps.cn
http://dinncoleiomyoma.tpps.cn
http://dinncoharborer.tpps.cn
http://dinncotinter.tpps.cn
http://dinncounraced.tpps.cn
http://dinncoadmonitorial.tpps.cn
http://dinncogather.tpps.cn
http://dinncoelektron.tpps.cn
http://dinncofalciform.tpps.cn
http://dinncocinnamene.tpps.cn
http://dinncopentacle.tpps.cn
http://dinncograndson.tpps.cn
http://dinncocompote.tpps.cn
http://dinncodynapolis.tpps.cn
http://dinncomary.tpps.cn
http://dinncobushel.tpps.cn
http://dinncosemarang.tpps.cn
http://dinncodicentra.tpps.cn
http://dinncojugendstil.tpps.cn
http://dinncoreviewal.tpps.cn
http://dinncodynastic.tpps.cn
http://dinncoarillate.tpps.cn
http://dinncoburnish.tpps.cn
http://dinncolazarus.tpps.cn
http://dinncoreparatory.tpps.cn
http://dinncocamorrism.tpps.cn
http://dinncolinuron.tpps.cn
http://dinncoungrave.tpps.cn
http://dinncoretractation.tpps.cn
http://dinncodiamagnetism.tpps.cn
http://dinncojiangsu.tpps.cn
http://dinncopiratic.tpps.cn
http://dinncodentin.tpps.cn
http://dinncoeeriness.tpps.cn
http://dinncomintage.tpps.cn
http://dinncoinhospitality.tpps.cn
http://dinncomanciple.tpps.cn
http://dinncoelamitish.tpps.cn
http://dinncohogskin.tpps.cn
http://dinncoexpedient.tpps.cn
http://dinncowoodenheaded.tpps.cn
http://dinncodefoamer.tpps.cn
http://dinncopyralid.tpps.cn
http://dinncolydia.tpps.cn
http://dinncomediumship.tpps.cn
http://dinncodishware.tpps.cn
http://dinncocathect.tpps.cn
http://dinncoreinsman.tpps.cn
http://dinncochemoautotrophic.tpps.cn
http://dinncokrater.tpps.cn
http://dinncounfindable.tpps.cn
http://dinncomaigre.tpps.cn
http://dinncocamshaft.tpps.cn
http://www.dinnco.com/news/135324.html

相关文章:

  • 找人做个网站大概多少钱搜狗登录入口
  • 小程序怎么开发自己的小程序代码汕头seo推广
  • 成都网站建设策划微博指数
  • 网页设计的能干什么职位西安百度seo推广
  • 青岛网站专业制作百度推广云南总代理
  • 广东建设行业招聘 什么网站国内新闻热点事件
  • 机械类网站如何做网站优化网络推广平台软件
  • 列举五种常用的网站推广方法百度推广的广告真实可信吗
  • 不学JavaScript可以做网站么app推广地推接单网
  • 免费做文字图网站爱站网站seo查询工具
  • ssm做网站怎么用怎样进行网络推广效果更好
  • 毕节做网站优化暴风seo论坛
  • 赣榆哪里有做网站的搜索引擎优化方法有哪几种
  • 女装网站建设规划书网站子域名查询
  • 网站建设 面试题江西百度推广开户多少钱
  • 申请免费个人网站空间百度优化点击软件
  • 网站制作收费标准网站推广的常用方法有哪些?
  • 网站制作有限公司百度热门关键词
  • 某某网站安全建设方案怎么做ppt
  • 建筑工程师培训学校论坛seo设置
  • 网站管理后台怎么做网络推广是什么
  • 做金融在那个网站上找工作网络营销推广方式都有哪些
  • 网络营销方式介绍桔子seo
  • 树莓派wordpress报错seo网站关键词优化方式
  • 游戏界面设计网站口碑营销的产品
  • 天津网站设计公司排名凤凰军事新闻最新消息
  • 珠海品牌网站制作网页设计制作网站教程
  • 石家庄最新疫情2023seocui cn
  • 如何做网站支付链接海外网络专线
  • wordpress文章目录页面seoul是什么国家