cli 小程序引入模版前缀改

This commit is contained in:
Wang Kejun 2022-04-22 17:11:02 +08:00
parent 7435b20e3c
commit d490a4596c
3 changed files with 14 additions and 11 deletions

View File

@ -196,9 +196,9 @@ exports.projectConfigContentWithWeChatMp = projectConfigContentWithWeChatMp;
function appJsonContentWithWeChatMp(isDev) {
const pages = [];
if (isDev) {
pages.push('oak#pages/address/list/index');
pages.push('oak#pages/address/upsert/index');
pages.push('oak#pages/pickers/area/index');
pages.push('@oak-general-business/address/list/index');
pages.push('@oak-general-business/address/upsert/index');
pages.push('@oak-general-business/pickers/area/index');
}
else {
pages.push('pages/index/index');

View File

@ -16,7 +16,7 @@ const ensurePosix = require('ensure-posix-path');
const requiredPath = require('required-path');
const pluginName = 'OakWeChatMpPlugin';
const oakPagePrefix = 'oak#';
const oakPagePrefix = '@oak-general-business';
const oakPagePath = 'node_modules/oak-general-business/src/platforms/wechatMp/';
// const oakPagePathRegExp = /node_modules\/oak-general-business\/src\/platforms\/wechatMp\//;
@ -197,9 +197,9 @@ class OakWeChatMpPlugin {
let instance;
let isOak = getIsOak(page);
if (isOak) {
const oakPage = page.replace(
const oakPage = oakPagePath + page.replace(
new RegExp(oakPagePrefix),
oakPagePath
'pages'
);
instance = path.resolve(process.cwd(), oakPage);
if (!this.oakPages.has(oakPage)) {
@ -270,7 +270,7 @@ class OakWeChatMpPlugin {
.resolve(instanceDir, c)
.replace(/\\/g, '/');
const component2 = component.replace(
process.cwd() + '/',
process.cwd().replace(/\\/g, '/') + '/',
''
);
if (!this.oakComponents.has(component2)) {
@ -519,7 +519,10 @@ class OakWeChatMpPlugin {
let isOak = getIsOak(page);
if (isOak) {
page = page.replace(new RegExp(oakPagePrefix), '');
page = page.replace(
new RegExp(oakPagePrefix),
'pages'
);
}
pages.push(page);
}

View File

@ -207,9 +207,9 @@ export function projectConfigContentWithWeChatMp(
export function appJsonContentWithWeChatMp(isDev: boolean) {
const pages = [];
if (isDev) {
pages.push('oak#pages/address/list/index');
pages.push('oak#pages/address/upsert/index');
pages.push('oak#pages/pickers/area/index');
pages.push('@oak-general-business/address/list/index');
pages.push('@oak-general-business/address/upsert/index');
pages.push('@oak-general-business/pickers/area/index');
}
else {
pages.push('pages/index/index');