mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-17 04:41:51 +08:00
0445c4ec41
* feat(hippy-vue-next): initialize hippy-vue-next package * feat(hippy-vue-next): rollup build config * feat(example): add vue-next demo * docs(hippy-vue-next): update vue version * feat(hippy-vue-next): update branch up to date with Tencent:master * feat(hippy-vue-next): update comment * feat(example): use @vue/runtime-core with package * docs(hippy-vue-next): update comment * fix(hippy-vue-next): fix demo debug problem * feat(hippy-vue-next): modify import type of runtime in demo * feat(hippy-vue-next): generate d.ts file * fix(hippy-vue-next): fix android horizontal problem in demo-list * feat(hippy-vue-next): modify eslint options to check demo's code * feat(hippy-vue-next): add vue-next unit test * feat(hippy-vue-next): fix & commit unit tests * feat(hippy-vue-next): ignore api-extractor warnings * docs(hippy-vue-next): update docs * docs(hippy-vue-next): update comment * docs(hippy-vue-next): update docs * docs(hippy-vue-next): update docs * chore(license): add license header * docs(hippy-vue-next): update docs * feat(hippy-vue-next): add once event demo * refactor(hippy-vue-next): rename tool package * docs(hippy-vue-next): update docs * docs(hippy-vue-next): update comment * docs(hippy-vue-next): update docs * feat(hippy-vue-next): modify regexp * docs(hippy-vue-next): update docs * feat(hippy-vue-next): modify regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): perf regexp * feat(hippy-vue-next): reset old package-lock * feat(hippy-vue-next): update breakStrategy demo * feat(hippy-vue-next): add utils unit test case * feat(hippy-vue-next): add utils & element unit test case * feat(hippy-vue-next): add event & element unit test case * feat(hippy-vue-next): add native unit test case * feat(hippy-vue-next): add built-in & patch unit test case * feat(hippy-vue-next): add patch unit test case * feat(hippy-vue-next): add style unit test case * feat(hippy-vue-next): add style unit test case * feat(hippy-vue-next): add style & util unit test case * fix(hippy-vue-next): fix swiper & animation warn in debug mode * feat(hippy-vue-next): use shallowRef to up perf for component reactive * fix(hippy-vue-next): fix animation warn in debug mode * feat(hippy-vue-next): upgrade debug package * feat(hippy-vue-next): fix CR problem * feat(hippy-vue-next): fix CR problem * feat(hippy-vue-next): app start support both callback & promise * feat(hippy-vue-next): fix turbo proxy value problem * feat(hippy-vue-next): update docs * feat(hippy-vue-next): fix animation demo problem * feat(hippy-vue-next): modify register hippy method to compatible vue2 * feat(hippy-vue-next): update docs * feat(hippy-vue-next): update vue3 docs * feat(hippy-vue-next): add waterfall lose props * fix(vue-next): fix lint issues and logic robust issues * feat(hippy-vue-next): add event bus & unit test case * feat(hippy-vue-next): add webpack vendor options * feat(hippy-vue-next): add webpack vendor options * feat(hippy-vue-next): remove unused demo method * feat(hippy-vue-next): modify event bus to compatible vue2 * feat(hippy-vue-next): modify event bus to compatible vue2 * feat(hippy-vue-next): add event-bus unit test cases * feat(hippy-vue-next): add build vendor directive * feat(hippy-vue-next): remove demo redundant method & add silent option * feat(hippy-vue-next): update debug doc * feat(hippy-vue-next): add console output style * feat(hippy-vue-next): add custom nativeapis and components demo * docs(text): extend custom nativeapis and components docs * feat(hippy-vue-next): remove auto generated declaration files * feat(hippy-vue-next): update demo list & compatible vue3.2.39+ event * feat(hippy-vue-next): support scoped & attribute selector & merge update * feat(hippy-vue-next): support scoped & add unit tests * feat(hippy-vue-next): update vue-next-demo same to vue-demo * feat(hippy-vue-next): add unit tests * feat(hippy-vue-next): use named export instead universal export * feat(hippy-vue-next): update css-loader name to compatible vue-loader * feat(hippy-vue-next): fix style matched issue * refactor(vue-next): update docs & lock * fix(npm,eslint): update npm package & fix lint * feat(hippy-vue-next): add style unit tests * feat(hippy-vue-next): fix eslint issue * feat(hippy-vue-next): add android router inject logic & doc * feat(hippy-vue-next): use hippy history to solve router inject logic * feat(hippy-vue-next): update router history doc * feat(hippy-vue-next): update router history doc * feat(vue): add getElemCss scoped judgement * refactor(vue-demo): remove stop Co-authored-by: anqinli <anqinli@tencent.com> Co-authored-by: birdguo <birdguo@tencent.com> Co-authored-by: Zoom Chan <zoom_chan@163.com> Co-authored-by: birdguo <gguoyu@users.noreply.github.com>
109 lines
3.1 KiB
JavaScript
109 lines
3.1 KiB
JavaScript
/*
|
|
* Tencent is pleased to support the open source community by making
|
|
* Hippy available.
|
|
*
|
|
* Copyright (C) 2017-2022 THL A29 Limited, a Tencent company.
|
|
* All rights reserved.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const { rollup } = require('rollup');
|
|
const reactBuilds = require('./react-configs').getAllBuilds();
|
|
const vueBuilds = require('./vue-configs').getAllBuilds();
|
|
const vueNextBuilds = require('./vue-next-configs').getAllBuilds();
|
|
|
|
let builds = [...reactBuilds, ...vueBuilds, ...vueNextBuilds];
|
|
|
|
// filter builds via command line arg
|
|
if (process.argv[2]) {
|
|
const filters = process.argv[2].split(',');
|
|
builds = builds.filter(b => filters.some(f => b.output.file.indexOf(f) > -1 || b.output.name.indexOf(f) > -1));
|
|
}
|
|
|
|
function blue(str) {
|
|
return `\x1b[1m\x1b[34m${str}\x1b[39m\x1b[22m`;
|
|
}
|
|
|
|
function getSize(code) {
|
|
return `${(code.length / 1024).toFixed(2)}kb`;
|
|
}
|
|
|
|
function logError(e) {
|
|
console.error('build js packages error', e);
|
|
process.exit(1);
|
|
}
|
|
|
|
/**
|
|
* remove typescript declaration files that generated by rollup plugin.
|
|
*
|
|
* 1. auto generate typescript declaration files by rollup-plugin-typescript2
|
|
* 2. declaration files rollup to index.d.ts by api-extractor
|
|
* 3. remove auto generated declaration files
|
|
*
|
|
* @param filePath
|
|
*/
|
|
function cleanTypescriptDeclarationFiles(filePath) {
|
|
if (filePath) {
|
|
let isDir = fs.statSync(filePath);
|
|
const dir = isDir.isDirectory() ? filePath : path.dirname(filePath);
|
|
const subDirs = fs.readdirSync(dir);
|
|
|
|
if (subDirs.length) {
|
|
for (let i = 0; i <= subDirs.length; i++) {
|
|
if (subDirs[i]) {
|
|
const dirPath = `${dir}/${subDirs[i]}`;
|
|
isDir = fs.statSync(dirPath);
|
|
if (isDir?.isDirectory() && subDirs[i].startsWith('hippy-')) {
|
|
fs.rmSync(dirPath, {
|
|
force: true,
|
|
recursive: true,
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
async function buildEntry(config) {
|
|
const { output } = config;
|
|
const { file = '', dir = '' } = output;
|
|
const bundle = await rollup(config);
|
|
await bundle.generate(output);
|
|
const { output: [{ code }] } = await bundle.write(output);
|
|
console.log(`${blue(path.relative(process.cwd(), file ? file : `${dir}/index.js`))} ${getSize(code)}`);
|
|
|
|
cleanTypescriptDeclarationFiles(file || dir);
|
|
}
|
|
|
|
function build(buildSets) {
|
|
let built = 0;
|
|
const total = builds.length;
|
|
const next = () => {
|
|
buildEntry(buildSets[built])
|
|
.then(() => {
|
|
built += 1;
|
|
if (built < total) {
|
|
next();
|
|
}
|
|
})
|
|
.catch(logError);
|
|
};
|
|
next();
|
|
}
|
|
|
|
build(builds);
|