oak-cli build 命令改
This commit is contained in:
parent
fe1ce346ea
commit
4d6c25aeca
|
|
@ -15,7 +15,10 @@ function traverse(doc, callback) {
|
|||
}
|
||||
|
||||
module.exports = function (content) {
|
||||
//console.log(content);
|
||||
const options = this.getOptions() || {}; //获取配置参数
|
||||
// const callback = this.async();
|
||||
|
||||
// console.log(content, options);
|
||||
const doc = new DOMParser().parseFromString(content, 'text/xml');
|
||||
traverse(doc, (node) => {
|
||||
if (node.nodeType === node.ELEMENT_NODE) {
|
||||
|
|
@ -28,8 +31,7 @@ module.exports = function (content) {
|
|||
|
||||
if (node.hasAttribute('oak:forbidFocus')) {
|
||||
node.removeAttribute('oak:forbidFocus');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
node.setAttribute('focus', `{{!!oakFocused.${oakValue}}}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
include: /oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
include:
|
||||
/oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
// include: [
|
||||
// path.resolve(
|
||||
// process.cwd(),
|
||||
|
|
@ -158,17 +159,12 @@ module.exports = {
|
|||
{
|
||||
test: /\.(xml|wxml)$/,
|
||||
include: /oak-general-business\/wechatMp|oak-general-business\\wechatMp/,
|
||||
// include: [
|
||||
// path.resolve(
|
||||
// process.cwd(),
|
||||
// 'node_modules/oak-general-business/wechatMp'
|
||||
// ),
|
||||
// ],
|
||||
type: 'javascript/auto',
|
||||
use: [
|
||||
oakFileLoader('wxml'),
|
||||
{
|
||||
loader: 'wxml-loader',
|
||||
options: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
export default function build(env: string): Promise<void>;
|
||||
export default function build(cmd: any): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tip_style_1 = require("./tip-style");
|
||||
const cross_spawn_1 = __importDefault(require("cross-spawn"));
|
||||
async function build(env) {
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`build环境:${env}`)}`);
|
||||
const result = cross_spawn_1.default.sync(`cross-env NODE_ENV=${env} "${process.execPath}"`, [require.resolve('../scripts/' + 'webpack.js')], {
|
||||
async function build(cmd) {
|
||||
(0, tip_style_1.Success)(`${(0, tip_style_1.success)(`build ${cmd.target} environment: ${cmd.mode}`)}`);
|
||||
const result = cross_spawn_1.default.sync(`cross-env NODE_ENV=${cmd.mode} "${process.execPath}"`, [require.resolve('../scripts/' + 'webpack.js')], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
|
|
|
|||
14
lib/index.js
14
lib/index.js
|
|
@ -46,14 +46,16 @@ commander_1.default
|
|||
.description('build oak app domain of make on demand')
|
||||
.action(make_1.default);
|
||||
commander_1.default
|
||||
.command('start <env>')
|
||||
.usage('<env>')
|
||||
.description('build we chat mp of start on demand')
|
||||
.command('start')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
.description('build project of start on demand')
|
||||
.action(build_1.default);
|
||||
commander_1.default
|
||||
.command('build <env>')
|
||||
.usage('<env>')
|
||||
.description('build we chat mp of build on demand')
|
||||
.command('build')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
.description('build project of build on demand')
|
||||
.action(build_1.default);
|
||||
commander_1.default
|
||||
.command('create <name>')
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ function packageJsonContent({ name, version, description, cliversion, cliname, i
|
|||
"description": "${description}",
|
||||
"scripts": {
|
||||
"make:domain": "${cliname} make",
|
||||
"start:mp": "${cliname} start development",
|
||||
"build:mp": "${cliname} build production"
|
||||
"start:mp": "${cliname} start --target mp --mode development",
|
||||
"build:mp": "${cliname} build --target mp --mode production"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@
|
|||
"fs-extra": "^10.0.0",
|
||||
"globby": "^11.1.0",
|
||||
"inquirer": "^7.3.3",
|
||||
"loader-utils": "^3.2.0",
|
||||
"mini-css-extract-plugin": "^2.5.3",
|
||||
"postcss-less": "^6.0.0",
|
||||
"progress-bar-webpack-plugin": "^2.1.0",
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ class OakWeChatMpPlugin {
|
|||
const emitAssets = [];
|
||||
for (let entry of this.assetsEntry) {
|
||||
const assets = path.resolve(this.basePath, entry);
|
||||
if (/\.(sass|scss|css|less|styl|xml)$/.test(assets)) {
|
||||
if (/\.(sass|scss|css|less|styl|xml|wxml)$/.test(assets)) {
|
||||
continue;
|
||||
}
|
||||
const toTmit = async () => {
|
||||
|
|
@ -539,7 +539,7 @@ class OakWeChatMpPlugin {
|
|||
}
|
||||
for (let entry of this.oakAssetsEntry) {
|
||||
const assets = path.resolve(process.cwd(), entry);
|
||||
if (/\.(sass|scss|css|less|styl|xml)$/.test(assets)) {
|
||||
if (/\.(sass|scss|css|less|styl|xml|wxml)$/.test(assets)) {
|
||||
continue;
|
||||
}
|
||||
const toTmit = async () => {
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ import {
|
|||
} from './tip-style';
|
||||
import spawn from 'cross-spawn';
|
||||
|
||||
export default async function build(env: string) {
|
||||
Success(`${success(`build环境:${env}`)}`);
|
||||
export default async function build(cmd: any) {
|
||||
Success(`${success(`build ${cmd.target} environment: ${cmd.mode}`)}`);
|
||||
const result = spawn.sync(
|
||||
`cross-env NODE_ENV=${env} "${process.execPath}"`,
|
||||
`cross-env NODE_ENV=${cmd.mode} "${process.execPath}"`,
|
||||
[require.resolve('../scripts/' + 'webpack.js')],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
|
|
|
|||
14
src/index.ts
14
src/index.ts
|
|
@ -48,14 +48,16 @@ program
|
|||
.description('build oak app domain of make on demand')
|
||||
.action(make);
|
||||
program
|
||||
.command('start <env>')
|
||||
.usage('<env>')
|
||||
.description('build we chat mp of start on demand')
|
||||
.command('start')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
.description('build project of start on demand')
|
||||
.action(build);
|
||||
program
|
||||
.command('build <env>')
|
||||
.usage('<env>')
|
||||
.description('build we chat mp of build on demand')
|
||||
.command('build')
|
||||
.option('-t, --target <target>', 'target')
|
||||
.option('-m, --mode <mode>', 'mode')
|
||||
.description('build project of build on demand')
|
||||
.action(build);
|
||||
program
|
||||
.command('create <name>')
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ export function packageJsonContent({
|
|||
"description": "${description}",
|
||||
"scripts": {
|
||||
"make:domain": "${cliname} make",
|
||||
"start:mp": "${cliname} start development",
|
||||
"build:mp": "${cliname} build production"
|
||||
"start:mp": "${cliname} start --target mp --mode development",
|
||||
"build:mp": "${cliname} build --target mp --mode production"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
|
|
|||
Loading…
Reference in New Issue