Skip to content

Commit

Permalink
Merge pull request #311 from bytedance/feat/lynx3
Browse files Browse the repository at this point in the history
支持分类页装修
  • Loading branch information
1198994985 authored Jan 21, 2025
2 parents b39f1f8 + b75fa3e commit e240ac8
Show file tree
Hide file tree
Showing 47 changed files with 883 additions and 765 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [14.18.0]
node-version: [18.17.1]

steps:
# prepare env
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

strategy:
matrix:
node-version: [14.18.0]
node-version: [18.17.1]

steps:
# run identifier
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
uses: azu/action-package-version-to-git-tag@v1
with:
version: ${{ env.cversion }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.7 }}
github_repo: ${{ github.repository }}
git_commit_sha: ${{ github.sha }}
git_tag_prefix: 'v'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ yarn-error.log*

.yarn
.yalc
yalc.lock

tsconfig.tsbuildinfo

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# mona

mona 是抖店开放平台推出的抖店应用跨端开发方案,支持使用**React 框架**来开发应用,以求达到一次开发处处运行
mona 是抖店开放平台推出的抖店应用跨端开发方案,支持使用**React 框架**来开发应用,以求达到一次开发处处运行的目的

详细文档请点击[这里](https://op.jinritemai.com/docs/mona-docs/1169/2708)
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.3.38",
"version": "0.3.39",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
"test": "jest",
"test:coverage": "jest --coverage",
"test:c": "jest --coverage",
"release": "node ./scripts/release.js",
"bnpm:sync": "node ./scripts/bnpmSync.js"
"release": "sh scripts/publish.sh",
"bnpm:sync": "node ./scripts/bnpmSync.js",
"publish:local": "lerna exec -- yalc publish"
},
"repository": {
"type": "git",
Expand All @@ -32,16 +33,16 @@
],
"packageManager": "[email protected]",
"engines": {
"node": ">=14"
"node": ">=18"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@types/enzyme": "^3.10.10",
"@types/jest": "^27.0.2",
"@types/react-test-renderer": "^17.0.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.6",
"canvas": "^2.8.0",
"chalk": "4.1.2",
"concurrently": "^7.6.0",
"enzyme": "^3.11.0",
"execa": "5.1.1",
"identity-obj-proxy": "^3.0.0",
Expand All @@ -54,7 +55,8 @@
"semver": "^7.3.5",
"ts-jest": "^27.1.3",
"ts-node": "^10.4.0",
"concurrently": "^7.6.0",
"typescript": "^4.4.4"
"ts-patch": "^3.2.1",
"typescript": "5.6.3",
"typescript-transform-paths": "^3.5.2"
}
}
}
6 changes: 3 additions & 3 deletions packages/mona-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-cli",
"version": "0.3.38",
"version": "0.3.39",
"displayName": "mona",
"description": "Merchant app's developing and building tools",
"main": "./bin/mona",
Expand All @@ -20,8 +20,8 @@
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"@bytedance/mona-cli-commands": "0.3.38",
"@bytedance/mona-manager": "0.3.38"
"@bytedance/mona-cli-commands": "^0.3.39",
"@bytedance/mona-manager": "^0.3.39"
},
"devDependencies": {
"@types/node": "^16.4.5"
Expand Down
10 changes: 5 additions & 5 deletions packages/mona-clients/mona-client-max/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-client-max",
"version": "0.3.38",
"version": "0.3.39",
"description": "max for mona",
"main": "./dist/index.js",
"files": [
Expand All @@ -19,10 +19,10 @@
"mona"
],
"dependencies": {
"@bytedance/mona": "0.3.38",
"@bytedance/mona-client-web": "0.3.38",
"@bytedance/mona-shared": "0.3.38",
"@bytedance/mona-speedy-components": "0.0.37",
"@bytedance/mona": "^0.3.39",
"@bytedance/mona-client-web": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39",
"@bytedance/mona-speedy-components": "0.0.38",
"axios": "^1.6.5"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/mona-clients/mona-client-max/src/apis/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function _wrapPromise<T extends Callbacks>({
const _erroHandler =
erroHandler ||
function (err) {
return { errMsg: `${name}:fail ` + err?.message ?? '' } as any;
return { errMsg: `${name}:fail ` + (err?.message || '') } as any;
};
const promiseFunc = _global[name];

Expand Down
8 changes: 4 additions & 4 deletions packages/mona-clients/mona-client-mini/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-client-mini",
"version": "0.3.38",
"version": "0.3.39",
"description": "miniapp for mona",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -21,8 +21,8 @@
"license": "MIT",
"sideEffects": false,
"dependencies": {
"@bytedance/mona": "0.3.38",
"@bytedance/mona-shared": "0.3.38",
"@bytedance/mona": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39",
"react-reconciler": "^0.26.2",
"scheduler": "^0.20.2"
},
Expand All @@ -37,7 +37,7 @@
"rollup": "2.53.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-typescript2": "0.36.0",
"tslib": "^2.3.1",
"typescript-json-schema": "^0.43.0",
"typescript-transform-paths": "^2.2.4"
Expand Down
10 changes: 5 additions & 5 deletions packages/mona-clients/mona-client-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-client-plugin",
"version": "0.3.38",
"version": "0.3.39",
"description": "plugin for mona",
"main": "./dist/index.js",
"files": [
Expand All @@ -17,10 +17,10 @@
"mona"
],
"dependencies": {
"@bytedance/mona": "0.3.38",
"@bytedance/mona-client-web": "0.3.38",
"@bytedance/mona-plugin-events": "0.3.38",
"@bytedance/mona-shared": "0.3.38"
"@bytedance/mona": "^0.3.39",
"@bytedance/mona-client-web": "^0.3.39",
"@bytedance/mona-plugin-events": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39"
},
"peerDependencies": {
"react": "^17.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/mona-clients/mona-client-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-client-web",
"version": "0.3.38",
"version": "0.3.39",
"description": "web for mona",
"main": "./dist/index.js",
"files": [
Expand All @@ -19,8 +19,8 @@
"mona"
],
"dependencies": {
"@bytedance/mona": "0.3.38",
"@bytedance/mona-shared": "0.3.38",
"@bytedance/mona": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39",
"ahooks": "^3.7.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/mona-manager-plugins/mona-cli-commands/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-cli-commands",
"version": "0.3.38",
"version": "0.3.39",
"displayName": "mona-cli-commands",
"description": "mona-cli commands plugins for mona-manager",
"main": "./dist/index",
Expand All @@ -16,8 +16,8 @@
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"@bytedance/mona-manager": "0.3.38",
"@bytedance/mona-shared": "0.3.38",
"@bytedance/mona-manager": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39",
"@koa/cors": "^4.0.0",
"@koa/router": "^12.0.0",
"axios": "^1.6.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ const templates = [

const maxTemplateTypes = [
{
name: 'component(店铺装修组件开发)',
name: 'component(普通店铺装修组件开发)',
value: 'max',
},
{
name: 'component-old(旧版h5版本店铺装修组件开发)',
value: 'max-h5',
},
{
name: 'template(店铺装修模板开发)',
value: 'max-template',
},
{
name: 'nav-component(分类页导航组件开发,需特殊处理)',
value: 'max-component-nav',
},
];

type AskKey = keyof Omit<Answer, 'appId'>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import { readUser, saveUser } from '@bytedance/mona-shared';

const WS_DOMAIN = 'opws.jinritemai.com';

function parseHeaders(headers: string) {
const result: Record<string, string> = {};
const lines = headers.split(';');
lines.forEach(line => {
const [key, value] = line.split('=');
result[key.trim()] = value.trim();
});
return result;
}

const login: IPlugin = ctx => {
ctx.registerCommand(
'login',
Expand All @@ -18,7 +28,7 @@ const login: IPlugin = ctx => {
},
args => {
const domain = args.domain || OPEN_DOMAIN;
const header = args.header ? JSON.parse(args.header) : OPEN_DEV_HEADERS;
const header = args.header ? parseHeaders(args.headers) : OPEN_DEV_HEADERS;

const openURL = `https://${domain}/authorization`;
const wsURL = `wss://${args.domain || WS_DOMAIN}/ws/api/terminal`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@bytedance/mona-manager-plugins-shared",
"displayName": "mona-manager-plugins-shared",
"version": "0.3.38",
"version": "0.3.39",
"description": "mona-manager plugins shared utils and plugins",
"main": "./dist/index.js",
"module": "./dist/index.js",
"scripts": {
"build": "yarn clean && ttsc -b",
"start": "ttsc -b -w",
"build": "yarn clean && tspc -b",
"start": "tspc -b -w",
"clean": "rm -rf dist",
"test": "jest"
},
Expand All @@ -17,16 +17,14 @@
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"@bytedance/mona-manager": "0.3.38",
"@bytedance/mona-manager": "^0.3.39",
"copy-webpack-plugin": "^10.2.0",
"webpack": "^5.58.2"
},
"devDependencies": {
"@types/node": "^16.4.5",
"react": "^17.0.2",
"ttypescript": "^1.5.12",
"typescript-json-schema": "^0.43.0",
"typescript-transform-paths": "^2.2.4"
"typescript-json-schema": "^0.43.0"
},
"publishConfig": {
"access": "public",
Expand Down
14 changes: 6 additions & 8 deletions packages/mona-manager-plugins/mona-service-commands/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bytedance/mona-service-commands",
"version": "0.3.38",
"version": "0.3.39",
"displayName": "mona-service-commands",
"description": "mona-service commands plugins for mona-manager",
"main": "./dist/index.js",
Expand All @@ -9,16 +9,16 @@
"dist"
],
"scripts": {
"build": "yarn clean && ttsc -b",
"start": "ttsc -b -w",
"build": "yarn clean && tspc -b",
"start": "tspc -b -w",
"clean": "rm -rf dist",
"test": "jest"
},
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"@bytedance/mona-manager": "0.3.38",
"@bytedance/mona-shared": "0.3.38",
"@bytedance/mona-manager": "^0.3.39",
"@bytedance/mona-shared": "^0.3.39",
"archiver": "^5.3.0",
"assert": "^2.0.0",
"axios": "^1.6.5",
Expand All @@ -39,9 +39,7 @@
"@types/minimist": "^1.2.2",
"@types/node": "^16.4.5",
"@types/qrcode": "^1.4.2",
"ttypescript": "^1.5.12",
"typescript-json-schema": "^0.43.0",
"typescript-transform-paths": "^2.2.4"
"typescript-json-schema": "^0.43.0"
},
"publishConfig": {
"access": "public",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@ export function readUser(): { cookie: string; nickName: string; userId: string }
export function saveUser(data: any) {
fs.writeFileSync(userDataFile, JSON.stringify(data));
}
function parseHeaders(headers: string) {
const result: Record<string, string> = {};
const lines = headers.split(';');
lines.forEach(line => {
const [key, value] = line.split('=');
result[key.trim()] = value.trim();
});
return result;
}

export function generateRequestFromOpen(args: any, cookie: string) {
return function <T = any>(path: string, options?: AxiosRequestConfig<any>): Promise<T> {
const domain = args.domain || OPEN_DOMAIN;
const header = args.header ? JSON.parse(args.header) : OPEN_DEV_HEADERS;
const header = args.headers ? parseHeaders(args.headers) : OPEN_DEV_HEADERS;
const url = `https://${domain}${path}`;

const config = {
Expand All @@ -63,6 +72,9 @@ export function generateRequestFromOpen(args: any, cookie: string) {
return axios.request(config).then(res => {
const data = res.data as any;
if (data.code === 0) {
if (args.debug) {
console.log(` [path: ${path}, logid:${res?.headers?.['x-tt-logid'] || 'unknow'}] `)
}
return data.data;
} else {
throw new Error(
Expand Down
Loading

0 comments on commit e240ac8

Please sign in to comment.