调整locales的build
This commit is contained in:
parent
5c2e00a65f
commit
01d94d0915
|
|
@ -5,7 +5,7 @@ const Path = require('path');
|
||||||
const { merge, get, set, setWith } = require('lodash');
|
const { merge, get, set, setWith } = require('lodash');
|
||||||
|
|
||||||
const oakRegex =
|
const oakRegex =
|
||||||
/(\/*[a-zA-Z0-9_-])*\/app\/(pages|components|locales)+\/|(\\*[a-zA-Z0-9_-])*\\app\\(pages|components|locales)+\\/;
|
/(\/*[a-zA-Z0-9_-])*\/lib\/(pages|components|locales)+\/|(\\*[a-zA-Z0-9_-])*\\lib\\(pages|components|locales)+\\/;
|
||||||
const localRegex =
|
const localRegex =
|
||||||
/(\/*[a-zA-Z0-9_-])*\/src\/(pages|components|locales)+\/|(\\*[a-zA-Z0-9_-])*\\src\/(pages|components|locales)+\\/;
|
/(\/*[a-zA-Z0-9_-])*\/src\/(pages|components|locales)+\/|(\\*[a-zA-Z0-9_-])*\\src\/(pages|components|locales)+\\/;
|
||||||
|
|
||||||
|
|
@ -39,14 +39,12 @@ function getNameAndLng(path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildLocales({
|
function buildLocales({
|
||||||
projectPath,
|
projectPaths,
|
||||||
businessProjectPath,
|
|
||||||
buildPath,
|
buildPath,
|
||||||
nodeEnv,
|
nodeEnv,
|
||||||
platform,
|
platform,
|
||||||
}) {
|
}) {
|
||||||
const dataJson = {};
|
const dataJson = {};
|
||||||
const projectPaths = [projectPath, businessProjectPath];
|
|
||||||
projectPaths.forEach((path) => {
|
projectPaths.forEach((path) => {
|
||||||
readProject(dataJson, path, buildPath, nodeEnv, platform);
|
readProject(dataJson, path, buildPath, nodeEnv, platform);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ function copyLocaleFiles() {
|
||||||
// locales到mp/dist下
|
// locales到mp/dist下
|
||||||
const buildPath = Path.resolve(paths.appSrc, Locales);
|
const buildPath = Path.resolve(paths.appSrc, Locales);
|
||||||
const json = buildLocales({
|
const json = buildLocales({
|
||||||
projectPath: paths.appRootSrc,
|
projectPaths: [paths.appRootSrc, paths.oakGeneralBusinessAppPath],
|
||||||
businessProjectPath: paths.oakGeneralBusinessAppPath,
|
|
||||||
buildPath,
|
buildPath,
|
||||||
nodeEnv: env.raw.NODE_ENV,
|
nodeEnv: env.raw.NODE_ENV,
|
||||||
platform: env.raw.OAK_PLATFORM,
|
platform: env.raw.OAK_PLATFORM,
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,11 @@ function copyLocaleFiles() {
|
||||||
const buildPath = Path.resolve(paths.appPublic, Locales);
|
const buildPath = Path.resolve(paths.appPublic, Locales);
|
||||||
consola.success(`${chalk.greenBright('读取locales,生成json数据')}`);
|
consola.success(`${chalk.greenBright('读取locales,生成json数据')}`);
|
||||||
const json = buildLocales({
|
const json = buildLocales({
|
||||||
projectPath: paths.appRootSrc,
|
projectPaths: [
|
||||||
businessProjectPath: paths.oakGeneralBusinessAppPath,
|
paths.appRootSrc,
|
||||||
|
paths.oakGeneralBusinessAppPath,
|
||||||
|
paths.appSrc,
|
||||||
|
],
|
||||||
buildPath,
|
buildPath,
|
||||||
nodeEnv: env.raw.NODE_ENV,
|
nodeEnv: env.raw.NODE_ENV,
|
||||||
platform: env.raw.OAK_PLATFORM,
|
platform: env.raw.OAK_PLATFORM,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue