diff --git a/packages/cli/src/argv.ts b/packages/cli/src/argv.ts index cc75234..747a08f 100644 --- a/packages/cli/src/argv.ts +++ b/packages/cli/src/argv.ts @@ -8,9 +8,18 @@ export interface CliConfig { progress?: boolean; } -const GOJI_TARGETS: Array = ['wechat', 'baidu', 'alipay', 'toutiao', 'qq', 'toutiao']; +const GOJI_TARGETS: Array = [ + 'wechat', + 'baidu', + 'alipay', + 'toutiao', + 'qq', + 'toutiao', + 'red', +]; -export const parseArgv = (arg: Array) => new Promise((resolve, reject) => { +export const parseArgv = (arg: Array) => + new Promise((resolve, reject) => { const yargsConfig = yargs .command({ command: 'start [target]', diff --git a/packages/cli/src/config/webpack.config.ts b/packages/cli/src/config/webpack.config.ts index 8153059..9598559 100644 --- a/packages/cli/src/config/webpack.config.ts +++ b/packages/cli/src/config/webpack.config.ts @@ -61,6 +61,7 @@ export const getWebpackConfig = ({ baidu: 'css', alipay: 'acss', toutiao: 'ttss', + red: 'css', }; return { diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index e9aa3cc..b07ee07 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -2,7 +2,7 @@ export const GOJI_VIRTUAL_ROOT = 'GOJI_VIRTUAL_ROOT'; export const TYPE_TEXT = 'GOJI_TYPE_TEXT'; export const TYPE_SUBTREE = 'GOJI_TYPE_SUBTREE'; -export type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao' | 'qq' | 'toutiao'; +export type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao' | 'qq' | 'red'; export interface SimplifyComponent { name: string; diff --git a/packages/create-goji-app/templates/src/project.red.json b/packages/create-goji-app/templates/src/project.red.json new file mode 100644 index 0000000..b73ee25 --- /dev/null +++ b/packages/create-goji-app/templates/src/project.red.json @@ -0,0 +1,69 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false + }, + "compileType": "miniprogram", + "libVersion": "3.67.2", + "projectname": "demo", + "debugOptions": { + "hidedInDevtools": [] + }, + "appid": "testappid", + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + }, + "miniprogramRoot": "." +} diff --git a/packages/demo-todomvc-linaria/src/project.red.json b/packages/demo-todomvc-linaria/src/project.red.json new file mode 100644 index 0000000..b73ee25 --- /dev/null +++ b/packages/demo-todomvc-linaria/src/project.red.json @@ -0,0 +1,69 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false + }, + "compileType": "miniprogram", + "libVersion": "3.67.2", + "projectname": "demo", + "debugOptions": { + "hidedInDevtools": [] + }, + "appid": "testappid", + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + }, + "miniprogramRoot": "." +} diff --git a/packages/demo-todomvc/src/project.red.json b/packages/demo-todomvc/src/project.red.json new file mode 100644 index 0000000..b73ee25 --- /dev/null +++ b/packages/demo-todomvc/src/project.red.json @@ -0,0 +1,69 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false + }, + "compileType": "miniprogram", + "libVersion": "3.67.2", + "projectname": "demo", + "debugOptions": { + "hidedInDevtools": [] + }, + "appid": "testappid", + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + }, + "miniprogramRoot": "." +} diff --git a/packages/webpack-plugin/src/constants/features.ts b/packages/webpack-plugin/src/constants/features.ts index d79bf18..b116b3f 100644 --- a/packages/webpack-plugin/src/constants/features.ts +++ b/packages/webpack-plugin/src/constants/features.ts @@ -1,7 +1,7 @@ import { GojiTarget } from '@goji/core'; export const getFeatures = (target: GojiTarget) => ({ - useSubtree: target === 'wechat' || target === 'qq', + useSubtree: target === 'wechat' || target === 'qq' || target === 'red', useInlineChildrenInComponent: // Alipay only support circular dependency self to self so we have to inline the children.wxml @@ -11,12 +11,13 @@ export const getFeatures = (target: GojiTarget) => ({ // Baidu changes the behavior of circular dependency on dev tool >= v4.22 with new compiler // so we have to inline the children.wxml // https://smartprogram.baidu.com/docs/develop/devtools/beta-notify#_5-%E6%A8%A1%E6%9D%BF-import-%E8%AF%AD%E6%B3%95%E4%B8%8D%E5%85%81%E8%AE%B8%E5%BE%AA%E7%8E%AF%E5%BC%95%E7%94%A8%E3%80%82 - target === 'baidu', + target === 'baidu' || + target === 'red', // Alipay doesn't support in