fix: workflow executions not show and format codes (#1184)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1184
This commit is contained in:
sealday 2024-06-13 15:56:43 +08:00
parent 64741b1726
commit d99bd8f4a5
816 changed files with 2901 additions and 1942 deletions

View File

@ -1,5 +1,6 @@
import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig';
import path from 'path';
import { getUmiConfig, IndexGenerator } from '@tachybase/devtools/umiConfig';
import { defineConfig } from 'umi';
const umiConfig = getUmiConfig();
@ -10,7 +11,8 @@ process.env.DID_YOU_KNOW = 'none';
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '').split(',').filter((item) => !item.includes('preset')); // 因为现在 preset 是直接引入的,所以不能忽略,如果以后 preset 也是动态插件的形式引入,那么这里可以去掉
const pluginDirs = (process.env.PLUGIN_PATH || 'packages/plugins/,packages/samples/,packages/pro-plugins/')
.split(',').map(item => path.join(process.cwd(), item));
.split(',')
.map((item) => path.join(process.cwd(), item));
const outputPluginPath = path.join(__dirname, 'src', '.plugins');
const indexGenerator = new IndexGenerator(outputPluginPath, pluginDirs);
@ -36,7 +38,9 @@ export default defineConfig({
src: `${appPublicPath}browser-checker.js`,
},
{
content: isDevCmd ? '' : `
content: isDevCmd
? ''
: `
window['__webpack_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
window['__tachybase_public_path__'] = '{{env.APP_PUBLIC_PATH}}';
window['__tachybase_api_base_url__'] = '{{env.API_BASE_URL}}';
@ -71,7 +75,7 @@ export default defineConfig({
safari: 12,
},
codeSplitting: {
jsStrategy: 'depPerChunk'
jsStrategy: 'depPerChunk',
},
chainWebpack(config, { env }) {
if (env === 'production') {

View File

@ -39,101 +39,105 @@ function css_browser_selector(u) {
(!/opera|webtv/i.test(ua) && /msie\s(\d+)/.test(ua)) || /trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.test(ua)
? 'ie ie' + (/trident\/4\.0/.test(ua) ? '8' : RegExp.$1 == '11.0' ? '11' : RegExp.$1)
: is('firefox/')
? g +
' ' +
f +
(/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + '_' + RegExp.$4
: '')
: is('gecko/')
? g
: is('opera')
? o +
(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$4
: /opera(\s|\/)(\d+)\.(\d+)/.test(ua)
? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$3
: '')
: is('konqueror')
? 'konqueror'
: is('blackberry')
? bb +
(/Version\/(\d+)(\.(\d+)+)/i.test(ua)
? ' ' + bb + RegExp.$1 + ' ' + bb + RegExp.$1 + RegExp.$2.replace('.', '_')
: /Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua)
? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '')
: '')
: is('android')
? a +
(/Version\/(\d+)(\.(\d+))+/i.test(ua)
? ' ' + a + RegExp.$1 + ' ' + a + RegExp.$1 + RegExp.$2.replace('.', '_')
: '') +
(/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_') : '')
: is('chrome')
? w +
' ' +
c +
(/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + c + RegExp.$2 + (RegExp.$4 > 0 ? ' ' + c + RegExp.$2 + '_' + RegExp.$4 : '')
: '')
: is('iron')
? w + ' iron'
: is('applewebkit/')
? w +
' ' +
s +
(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + s + RegExp.$2 + ' ' + s + RegExp.$2 + RegExp.$3.replace('.', '_')
: / Safari\/(\d+)/i.test(ua)
? RegExp.$1 == '419' || RegExp.$1 == '417' || RegExp.$1 == '416' || RegExp.$1 == '412'
? ' ' + s + '2_0'
: RegExp.$1 == '312'
? ' ' + s + '1_3'
: RegExp.$1 == '125'
? ' ' + s + '1_2'
: RegExp.$1 == '85'
? ' ' + s + '1_0'
: ''
: '')
: is('mozilla/')
? g
: '',
? g +
' ' +
f +
(/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + '_' + RegExp.$4
: '')
: is('gecko/')
? g
: is('opera')
? o +
(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$4
: /opera(\s|\/)(\d+)\.(\d+)/.test(ua)
? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + '_' + RegExp.$3
: '')
: is('konqueror')
? 'konqueror'
: is('blackberry')
? bb +
(/Version\/(\d+)(\.(\d+)+)/i.test(ua)
? ' ' + bb + RegExp.$1 + ' ' + bb + RegExp.$1 + RegExp.$2.replace('.', '_')
: /Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua)
? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '')
: '')
: is('android')
? a +
(/Version\/(\d+)(\.(\d+))+/i.test(ua)
? ' ' + a + RegExp.$1 + ' ' + a + RegExp.$1 + RegExp.$2.replace('.', '_')
: '') +
(/Android (.+); (.+) Build/i.test(ua)
? ' ' + dv + RegExp.$2.replace(/ /g, '_').replace(/-/g, '_')
: '')
: is('chrome')
? w +
' ' +
c +
(/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + c + RegExp.$2 + (RegExp.$4 > 0 ? ' ' + c + RegExp.$2 + '_' + RegExp.$4 : '')
: '')
: is('iron')
? w + ' iron'
: is('applewebkit/')
? w +
' ' +
s +
(/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua)
? ' ' + s + RegExp.$2 + ' ' + s + RegExp.$2 + RegExp.$3.replace('.', '_')
: / Safari\/(\d+)/i.test(ua)
? RegExp.$1 == '419' || RegExp.$1 == '417' || RegExp.$1 == '416' || RegExp.$1 == '412'
? ' ' + s + '2_0'
: RegExp.$1 == '312'
? ' ' + s + '1_3'
: RegExp.$1 == '125'
? ' ' + s + '1_2'
: RegExp.$1 == '85'
? ' ' + s + '1_0'
: ''
: '')
: is('mozilla/')
? g
: '',
is('android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk') ? m : '',
is('j2me')
? 'j2me'
: is('ipad|ipod|iphone')
? (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') +
' ' +
(/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : '')
: is('playbook')
? 'playbook'
: is('kindle|silk')
? 'kindle'
: is('playbook')
? 'playbook'
: is('mac')
? 'mac' +
(/mac os x ((\d+)[.|_](\d+))/.test(ua) ? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_') : '')
: is('win')
? 'win' +
(is('windows nt 6.2')
? ' win8'
: is('windows nt 6.1')
? ' win7'
: is('windows nt 6.0')
? ' vista'
: is('windows nt 5.2') || is('windows nt 5.1')
? ' win_xp'
: is('windows nt 5.0')
? ' win_2k'
: is('windows nt 4.0') || is('WinNT4.0')
? ' win_nt'
: '')
: is('freebsd')
? 'freebsd'
: is('x11|linux')
? 'linux'
: '',
? (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') +
' ' +
(/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : '')
: is('playbook')
? 'playbook'
: is('kindle|silk')
? 'kindle'
: is('playbook')
? 'playbook'
: is('mac')
? 'mac' +
(/mac os x ((\d+)[.|_](\d+))/.test(ua)
? ' mac' + RegExp.$2 + ' mac' + RegExp.$1.replace('.', '_')
: '')
: is('win')
? 'win' +
(is('windows nt 6.2')
? ' win8'
: is('windows nt 6.1')
? ' win7'
: is('windows nt 6.0')
? ' vista'
: is('windows nt 5.2') || is('windows nt 5.1')
? ' win_xp'
: is('windows nt 5.0')
? ' win_2k'
: is('windows nt 4.0') || is('WinNT4.0')
? ' win_nt'
: '')
: is('freebsd')
? 'freebsd'
: is('x11|linux')
? 'linux'
: '',
/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua)
? (lang + RegExp.$2).replace('-', '_') + (RegExp.$3 != '' ? (' ' + lang + RegExp.$1).replace('-', '_') : '')
: '',

View File

@ -1 +1,11 @@
{"name":"","short_name":"","icons":[{"src":"./android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
{
"name": "",
"short_name": "",
"icons": [
{ "src": "./android-chrome-192x192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/android-chrome-512x512.png", "sizes": "512x512", "type": "image/png" }
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@ -1,4 +1,4 @@
import { PluginConfiguration } from '@tachybase/server';
import process from 'process';
import { PluginConfiguration } from '@tachybase/server';
export default [process.env.PRESET_NAME ?? 'tachybase'] as PluginConfiguration[];

View File

@ -1,4 +1,5 @@
import { Gateway } from '@tachybase/server';
import { getConfig } from './config';
getConfig()

View File

@ -1,26 +1,39 @@
import { EventEmitter } from 'events';
import path from 'path';
import type { Project } from '@pnpm/workspace.find-packages';
import chalk from 'chalk';
import execa from 'execa';
import { buildCjs } from './buildCjs';
import { buildClient } from './buildClient';
import { buildDeclaration } from './buildDeclaration';
import { buildEsm } from './buildEsm';
import { buildPlugin } from './buildPlugin';
import { CORE_APP, CORE_CLIENT, ESM_PACKAGES, getCjsPackages, getPluginPackages, getPresetsPackages, PACKAGES_PATH, ROOT_PATH } from './constant';
import {
CORE_APP,
CORE_CLIENT,
ESM_PACKAGES,
getCjsPackages,
getPluginPackages,
getPresetsPackages,
PACKAGES_PATH,
ROOT_PATH,
} from './constant';
import { signals } from './stats';
import { tarPlugin } from './tarPlugin';
import { getPackageJson, getPkgLog, getUserConfig, PkgLog, readFromCache, toUnixPath, UserConfig, writeToCache } from './utils';
import {
getPackageJson,
getPkgLog,
getUserConfig,
PkgLog,
readFromCache,
toUnixPath,
UserConfig,
writeToCache,
} from './utils';
import { getPackages } from './utils/getPackages';
const BUILD_ERROR = 'build-error';
export async function build(pkgs: string[]) {

View File

@ -1,8 +1,10 @@
import { build } from 'tsup';
import fg from 'fast-glob';
import path from 'path';
import chalk from 'chalk';
import { globExcludeFiles, EsbuildSupportExts } from './constant';
import fg from 'fast-glob';
import { build } from 'tsup';
import { EsbuildSupportExts, globExcludeFiles } from './constant';
import { PkgLog, UserConfig } from './utils';
export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
@ -10,26 +12,30 @@ export function buildCjs(cwd: string, userConfig: UserConfig, sourcemap: boolean
const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd, absolute: true });
const outDir = path.join(cwd, 'lib');
const otherExts = Array.from(new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))));
const otherExts = Array.from(
new Set(entry.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))),
);
if (otherExts.length) {
log('%s will not be processed, only be copied to the lib directory.', chalk.yellow(otherExts.join(',')));
}
return build(userConfig.modifyTsupConfig({
entry,
splitting: false,
clean: true,
bundle: false,
silent: true,
sourcemap,
treeshake: false,
target: 'node16',
keepNames: true,
outDir,
loader: {
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}),
'.json': 'copy',
},
format: 'cjs',
skipNodeModulesBundle: true,
}));
return build(
userConfig.modifyTsupConfig({
entry,
splitting: false,
clean: true,
bundle: false,
silent: true,
sourcemap,
treeshake: false,
target: 'node16',
keepNames: true,
outDir,
loader: {
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}),
'.json': 'copy',
},
format: 'cjs',
skipNodeModulesBundle: true,
}),
);
}

View File

@ -1,7 +1,8 @@
import path from 'path';
import react from '@vitejs/plugin-react';
import fg from 'fast-glob';
import fs from 'fs-extra';
import path from 'path';
import { build as tsupBuild } from 'tsup';
import { build as viteBuild } from 'vite';
import { libInjectCss } from 'vite-plugin-lib-inject-css';

View File

@ -1,8 +1,9 @@
import path from 'path';
import { PkgLog, UserConfig } from './utils';
import { build as viteBuild } from 'vite';
import fg from 'fast-glob';
import { build as viteBuild } from 'vite';
import { PkgLog, UserConfig } from './utils';
export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
log('build esm');
@ -12,7 +13,9 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b
await build(cwd, indexEntry, outDir, userConfig, sourcemap, log);
const clientEntry = fg.sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0]?.replaceAll(/\\/g, '/');
const clientEntry = fg
.sync(['src/client/index.ts', 'src/client.ts'], { cwd, absolute: true, onlyFiles: true })?.[0]
?.replaceAll(/\\/g, '/');
const clientOutDir = path.resolve(cwd, 'es/client');
if (clientEntry) {
await build(cwd, clientEntry, clientOutDir, userConfig, sourcemap, log);
@ -26,7 +29,14 @@ export async function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: b
}
}
function build(cwd: string, entry: string, outDir: string, userConfig: UserConfig, sourcemap: boolean = false, log: PkgLog) {
function build(
cwd: string,
entry: string,
outDir: string,
userConfig: UserConfig,
sourcemap: boolean = false,
log: PkgLog,
) {
const cwdWin = cwd.replaceAll(/\\/g, '/');
const cwdUnix = cwd.replaceAll(/\//g, '\\');
const external = function (id: string) {

View File

@ -1,15 +1,16 @@
import path from 'path';
import ncc from '@vercel/ncc';
import react from '@vitejs/plugin-react';
import chalk from 'chalk';
import fg from 'fast-glob';
import fs from 'fs-extra';
import path from 'path';
import { build as tsupBuild } from 'tsup';
import { build as viteBuild } from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import { EsbuildSupportExts, globExcludeFiles } from './constant';
import { PkgLog, UserConfig, getPackageJson } from './utils';
import { getPackageJson, PkgLog, UserConfig } from './utils';
import {
buildCheck,
checkFileSize,
@ -123,9 +124,9 @@ const external = [
'lodash',
'china-division',
];
const pluginPrefix = (
process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-'
).split(',');
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || '@tachybase/plugin-,@tachybase/preset-,@hera/plugin-').split(
',',
);
const target_dir = 'dist';
@ -150,7 +151,9 @@ export function deleteServerFiles(cwd: string, log: PkgLog) {
export function writeExternalPackageVersion(cwd: string, log: PkgLog) {
log('write external version');
const sourceFiles = fg.globSync(sourceGlobalFiles, { cwd, absolute: true }).map((item) => fs.readFileSync(item, 'utf-8'));
const sourceFiles = fg
.globSync(sourceGlobalFiles, { cwd, absolute: true })
.map((item) => fs.readFileSync(item, 'utf-8'));
const sourcePackages = getSourcePackages(sourceFiles);
const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix);
const data = excludePackages.reduce<Record<string, string>>((prev, packageName) => {
@ -171,7 +174,9 @@ export function writeExternalPackageVersion(cwd: string, log: PkgLog) {
export async function buildServerDeps(cwd: string, serverFiles: string[], log: PkgLog) {
log('build plugin server dependencies');
const outDir = path.join(cwd, target_dir, 'node_modules');
const serverFileSource = serverFiles.filter(item => validExts.includes(path.extname(item))).map((item) => fs.readFileSync(item, 'utf-8'));
const serverFileSource = serverFiles
.filter((item) => validExts.includes(path.extname(item)))
.map((item) => fs.readFileSync(item, 'utf-8'));
const sourcePackages = getSourcePackages(serverFileSource);
const includePackages = getIncludePackages(sourcePackages, external, pluginPrefix);
const excludePackages = getExcludePackages(sourcePackages, external, pluginPrefix);
@ -265,30 +270,34 @@ export async function buildPluginServer(cwd: string, userConfig: UserConfig, sou
const packageJson = getPackageJson(cwd);
const serverFiles = fg.globSync(serverGlobalFiles, { cwd, absolute: true });
buildCheck({ cwd, packageJson, entry: 'server', files: serverFiles, log });
const otherExts = Array.from(new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))));
const otherExts = Array.from(
new Set(serverFiles.map((item) => path.extname(item)).filter((item) => !EsbuildSupportExts.includes(item))),
);
if (otherExts.length) {
log('%s will not be processed, only be copied to the dist directory.', chalk.yellow(otherExts.join(',')));
}
deleteServerFiles(cwd, log);
await tsupBuild(userConfig.modifyTsupConfig({
entry: serverFiles,
splitting: false,
clean: false,
bundle: false,
silent: true,
treeshake: false,
target: 'node16',
sourcemap,
outDir: path.join(cwd, target_dir),
format: 'cjs',
skipNodeModulesBundle: true,
loader: {
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}),
'.json': 'copy',
},
}));
await tsupBuild(
userConfig.modifyTsupConfig({
entry: serverFiles,
splitting: false,
clean: false,
bundle: false,
silent: true,
treeshake: false,
target: 'node16',
sourcemap,
outDir: path.join(cwd, target_dir),
format: 'cjs',
skipNodeModulesBundle: true,
loader: {
...otherExts.reduce((prev, cur) => ({ ...prev, [cur]: 'copy' }), {}),
'.json': 'copy',
},
}),
);
await buildServerDeps(cwd, serverFiles, log);
}
@ -316,45 +325,44 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou
const entry = fg.globSync('src/client/index.{ts,tsx,js,jsx}', { absolute: true, cwd });
const outputFileName = 'index.js';
await viteBuild(userConfig.modifyViteConfig({
mode: process.env.NODE_ENV || 'production',
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.__TEST__': false,
'process.env.__E2E__': process.env.__E2E__ ? true : false,
},
logLevel: 'warn',
build: {
minify: process.env.NODE_ENV === 'production',
outDir,
cssCodeSplit: false,
emptyOutDir: true,
sourcemap,
lib: {
entry,
formats: ['umd'],
name: packageJson.name,
fileName: () => outputFileName,
await viteBuild(
userConfig.modifyViteConfig({
mode: process.env.NODE_ENV || 'production',
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.__TEST__': false,
'process.env.__E2E__': process.env.__E2E__ ? true : false,
},
target: ['es2015', 'edge88', 'firefox78', 'chrome87', 'safari14'],
rollupOptions: {
cache: true,
external: [...Object.keys(globals), 'react', 'react/jsx-runtime'],
output: {
exports: 'named',
globals: {
react: 'React',
'react/jsx-runtime': 'jsxRuntime',
...globals,
logLevel: 'warn',
build: {
minify: process.env.NODE_ENV === 'production',
outDir,
cssCodeSplit: false,
emptyOutDir: true,
sourcemap,
lib: {
entry,
formats: ['umd'],
name: packageJson.name,
fileName: () => outputFileName,
},
target: ['es2015', 'edge88', 'firefox78', 'chrome87', 'safari14'],
rollupOptions: {
cache: true,
external: [...Object.keys(globals), 'react', 'react/jsx-runtime'],
output: {
exports: 'named',
globals: {
react: 'React',
'react/jsx-runtime': 'jsxRuntime',
...globals,
},
},
},
},
},
plugins: [
react(),
cssInjectedByJsPlugin({ styleId: packageJson.name }),
],
}));
plugins: [react(), cssInjectedByJsPlugin({ styleId: packageJson.name })],
}),
);
checkFileSize(outDir, log);
}

View File

@ -1,6 +1,7 @@
import type { Project } from '@pnpm/workspace.find-packages';
import path from 'path';
import type { Project } from '@pnpm/workspace.find-packages';
export const globExcludeFiles = [
'!src/**/__tests__',
'!src/**/__test__',

View File

@ -1,6 +1,5 @@
import { Options as TsupConfig } from 'tsup'
import { InlineConfig as ViteConfig } from 'vite'
import { Options as TsupConfig } from 'tsup';
import { InlineConfig as ViteConfig } from 'vite';
export type PkgLog = (msg: string, ...args: any[]) => void;

View File

@ -1,2 +1,2 @@
export * from './build';
export * from './utils'
export * from './utils';

View File

@ -1,10 +1,11 @@
import path from 'path';
import tar from 'tar';
import fg from 'fast-glob';
import fs from 'fs-extra';
import tar from 'tar';
import { PkgLog } from "./utils";
import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant'
import { TAR_OUTPUT_DIR, tarIncludesFiles } from './constant';
import { PkgLog } from './utils';
export function tarPlugin(cwd: string, log: PkgLog) {
log('tar package');
@ -12,14 +13,24 @@ export function tarPlugin(cwd: string, log: PkgLog) {
const npmIgnore = path.join(cwd, '.npmignore');
let files = pkg.files || [];
if (fs.existsSync(npmIgnore)) {
files = fs.readFileSync(npmIgnore, 'utf-8').split('\n').filter((item) => item.trim()).map(item => `!${item}`);
files = fs
.readFileSync(npmIgnore, 'utf-8')
.split('\n')
.filter((item) => item.trim())
.map((item) => `!${item}`);
files.push('**/*');
}
// 必须包含的文件
files.push(...tarIncludesFiles);
files = files.map((item: string) => item !== '**/*' && fs.existsSync(path.join(cwd, item.replace('!', ''))) && fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory() ? `${item}/**/*` : item);
files = files.map((item: string) =>
item !== '**/*' &&
fs.existsSync(path.join(cwd, item.replace('!', ''))) &&
fs.statSync(path.join(cwd, item.replace('!', ''))).isDirectory()
? `${item}/**/*`
: item,
);
const tarball = path.join(TAR_OUTPUT_DIR, `${pkg.name}-${pkg.version}.tgz`);
const tarFiles = fg.sync(files, { cwd });

View File

@ -1,8 +1,9 @@
import fs from 'fs';
import chalk from 'chalk';
import { builtinModules } from 'module';
import path from 'path';
import chalk from 'chalk';
const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
@ -156,10 +157,14 @@ export function checkRequire(sourceFiles: string[], log: Log) {
export function checkFileSize(outDir: string, log: Log) {
const files = fs.readdirSync(outDir);
files.forEach(file => {
files.forEach((file) => {
const fileSize = getFileSize(path.join(outDir, file));
if (fileSize > 1024 * 1024) {
log(`The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`, chalk.red(file), chalk.red(formatFileSize(fileSize)));
log(
`The %s size %s exceeds 1MB. You can use dynamic import \`import()\` for lazy loading content.`,
chalk.red(file),
chalk.red(formatFileSize(fileSize)),
);
}
});
}

View File

@ -1,4 +1,5 @@
import path from 'path';
import fs from 'fs-extra';
export function winPath(path: string) {
@ -17,20 +18,15 @@ export function getRltExternalsFromDeps(
depExternals: Record<string, string>,
current: { name: string; outputDir: string },
) {
return Object.entries(depExternals).reduce<Record<string, string>>(
(r, [dep, target]) => {
// skip self
if (dep !== current.name) {
// transform dep externals path to relative path
r[dep] = winPath(
path.relative(current.outputDir, path.dirname(target)),
);
}
return Object.entries(depExternals).reduce<Record<string, string>>((r, [dep, target]) => {
// skip self
if (dep !== current.name) {
// transform dep externals path to relative path
r[dep] = winPath(path.relative(current.outputDir, path.dirname(target)));
}
return r;
},
{},
);
return r;
}, {});
}
function findPackageJson(filePath) {
@ -44,7 +40,7 @@ function findPackageJson(filePath) {
// 递归寻找直到根目录
return findPackageJson(directory);
} else {
throw new Error('package.json not found.')
throw new Error('package.json not found.');
}
}
@ -100,10 +96,10 @@ export function getDepsConfig(cwd: string, outDir: string, depsName: string[], e
pkg: depPkg,
outputDir,
mainFile,
}
};
return acc;
}, {})
}, {});
// process externals for deps
Object.values(deps).forEach((depConfig) => {

View File

@ -1,10 +1,11 @@
import Topo from '@hapi/topo';
import fg from 'fast-glob';
import path from 'path';
import Topo from '@hapi/topo';
import { findWorkspacePackages, type Project } from '@pnpm/workspace.find-packages';
import fg from 'fast-glob';
import { PACKAGES_PATH, ROOT_PATH } from '../constant';
import { toUnixPath } from './utils';
import { findWorkspacePackages } from '@pnpm/workspace.find-packages';
import type { Project } from '@pnpm/workspace.find-packages';
/**
* npm

View File

@ -1,10 +1,12 @@
import chalk from 'chalk';
import path from 'path';
import chalk from 'chalk';
import { register } from 'esbuild-register/dist/node';
import fg from 'fast-glob';
import fs from 'fs-extra';
import { Options as TsupConfig } from 'tsup'
import { InlineConfig as ViteConfig } from 'vite'
import { register } from 'esbuild-register/dist/node';
import { Options as TsupConfig } from 'tsup';
import { InlineConfig as ViteConfig } from 'vite';
import { NODE_MODULES } from '../constant';
let previousColor = '';
@ -73,9 +75,9 @@ export function getUserConfig(cwd: string) {
throw new Error(`Multiple build configs found: ${buildConfigs.join(', ')}`);
}
if (buildConfigs.length === 1) {
const { unregister } = register({})
const { unregister } = register({});
const userConfig = require(path.join(cwd, buildConfigs[0]));
unregister()
unregister();
Object.assign(config, userConfig.default || userConfig);
}
return config;

View File

@ -1,6 +1,8 @@
import { defineConfig } from 'tsup';
import fg from 'fast-glob';
import path from 'path';
import fg from 'fast-glob';
import { defineConfig } from 'tsup';
import { globExcludeFiles } from './src/constant';
const entry = fg.globSync(['src/**', ...globExcludeFiles], { cwd: __dirname, absolute: true });

View File

@ -1,11 +1,12 @@
import { builtinModules, createRequire } from 'node:module';
import esbuild from 'rollup-plugin-esbuild';
import process from 'node:process';
import dts from 'rollup-plugin-dts';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import resolve from '@rollup/plugin-node-resolve';
import { defineConfig } from 'rollup';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
const require = createRequire(import.meta.url);
const pkg = require('./package.json');

View File

@ -1,11 +1,11 @@
#!/usr/bin/env node
import chalk from 'chalk';
import { initEnv, genTsConfigPaths } from './util';
import { Command } from 'commander';
import commands from './commands';
import semver from 'semver';
import commands from './commands';
import { genTsConfigPaths, initEnv } from './util';
const cli = new Command();
cli.version((await import('../package.json')).version);

View File

@ -1,6 +1,8 @@
import { resolve } from 'path';
import { type Command } from 'commander';
import { run, nodeCheck, isPackageValid, buildIndexHtml } from '../util';
import { buildIndexHtml, isPackageValid, nodeCheck, run } from '../util';
/**
*

View File

@ -1,5 +1,6 @@
import { Command } from 'commander';
import { run, isDev } from '../util';
import { isDev, run } from '../util';
/**
*

View File

@ -1,8 +1,9 @@
import { resolve } from 'path';
import { Command } from 'commander';
import { readFileSync, writeFileSync } from 'fs';
import { resolve } from 'path';
import { URL } from 'url';
import { Command } from 'commander';
const __dirname = new URL('.', import.meta.url).pathname;
export default (cli: Command) => {

View File

@ -1,5 +1,7 @@
import { resolve } from 'path';
import { Command } from 'commander';
import { PluginGenerator } from '../plugin-generator';
export default (cli: Command) => {

View File

@ -1,7 +1,8 @@
import { Command } from 'commander';
import { run, postCheck, nodeCheck, promptForTs } from '../util';
import { getPortPromise } from 'portfinder';
import { nodeCheck, postCheck, promptForTs, run } from '../util';
export default (cli: Command) => {
const { APP_PACKAGE_ROOT } = process.env;
cli

View File

@ -1,11 +1,13 @@
import { Command } from 'commander';
import { run, isPortReachable } from '../util';
import { execSync } from 'node:child_process';
import axios from 'axios';
import { pTest } from './p-test';
import { cpus } from 'os';
import treeKill from 'tree-kill';
import axios from 'axios';
import chalk from 'chalk';
import { Command } from 'commander';
import treeKill from 'tree-kill';
import { isPortReachable, run } from '../util';
import { pTest } from './p-test';
/**
*

View File

@ -1,5 +1,6 @@
import { Command } from 'commander';
import { run, isDev, isProd, promptForTs } from '../util';
import { isDev, isProd, promptForTs, run } from '../util';
export default (cli: Command) => {
const { APP_PACKAGE_ROOT, SERVER_TSCONFIG_PATH } = process.env;

View File

@ -1,19 +1,20 @@
import { Command } from 'commander';
import { generateAppDir } from '../util';
import global from './global';
import createNginxConf from './create-nginx-conf';
import build from './build';
import tar from './tar';
import dev from './dev';
import start from './start';
import e2e from './e2e';
import clean from './clean';
import createNginxConf from './create-nginx-conf';
import createPlugin from './create-plugin';
import dev from './dev';
import e2e from './e2e';
import global from './global';
import pm2 from './pm2';
import postinstall from './postinstall';
import start from './start';
import tar from './tar';
import test from './test';
import umi from './umi';
import upgrade from './upgrade';
import postinstall from './postinstall';
import createPlugin from './create-plugin';
export default async (cli: Command) => {
generateAppDir();

View File

@ -1,10 +1,11 @@
import { execa } from 'execa';
import { existsSync, mkdirSync, readFileSync } from 'fs';
import { resolve } from 'path';
import pAll from 'p-all';
import { parse } from 'dotenv';
import { existsSync, readFileSync, mkdirSync } from 'fs';
import { execa } from 'execa';
import fastGlob from 'fast-glob';
import lodash from 'lodash';
import pAll from 'p-all';
let ENV_FILE = resolve(process.cwd(), '.env.e2e');

View File

@ -1,4 +1,5 @@
import { Command } from 'commander';
import { run } from '../util';
export default (cli: Command) => {

View File

@ -1,9 +1,11 @@
import { Command } from 'commander';
import { run, isDev, isPackageValid, generatePlaywrightPath } from '../util';
import { resolve } from 'path';
import { existsSync } from 'fs';
import { readFile, writeFile } from 'fs/promises';
import { createStoragePluginsSymlink, createDevPluginsSymlink } from '@tachybase/utils/plugin-symlink';
import { resolve } from 'path';
import { createDevPluginsSymlink, createStoragePluginsSymlink } from '@tachybase/utils/plugin-symlink';
import { Command } from 'commander';
import { generatePlaywrightPath, isDev, isPackageValid, run } from '../util';
export default (cli: Command) => {
const { APP_PACKAGE_ROOT } = process.env;

View File

@ -1,10 +1,12 @@
import { Command } from 'commander';
import { run, postCheck, promptForTs } from '../util';
import { existsSync } from 'fs';
import { resolve } from 'path';
import chalk from 'chalk';
import { Command } from 'commander';
import _ from 'lodash';
import { postCheck, promptForTs, run } from '../util';
export default (cli: Command) => {
const { APP_PACKAGE_ROOT, NODE_ARGS } = process.env;
cli

View File

@ -1,6 +1,8 @@
import { resolve } from 'path';
import { Command } from 'commander';
import { run, nodeCheck, isPackageValid } from '../util';
import { isPackageValid, nodeCheck, run } from '../util';
export default (cli: Command) => {
cli

View File

@ -1,7 +1,9 @@
import { Command } from 'commander';
import { run } from '../util';
import { sep } from 'path';
import { Command } from 'commander';
import { run } from '../util';
function addTestCommand(name: string, cli: Command) {
return cli
.command(name)

View File

@ -1,5 +1,6 @@
import { Command } from 'commander';
import { run, isDev } from '../util';
import { isDev, run } from '../util';
export default (cli: Command) => {
const { APP_PACKAGE_ROOT } = process.env;

View File

@ -1,7 +1,9 @@
import { Command } from 'commander';
import { resolve } from 'path';
import { run, promptForTs, runAppCommand, hasCorePackages, hasTsNode } from '../util';
import { existsSync, rmSync } from 'fs';
import { resolve } from 'path';
import { Command } from 'commander';
import { hasCorePackages, hasTsNode, promptForTs, run, runAppCommand } from '../util';
export default (cli: Command) => {
cli

View File

@ -1,12 +1,14 @@
import chalk from 'chalk';
import { existsSync } from 'fs';
import { join, resolve } from 'path';
import { Generator } from '@umijs/utils';
import { readFile } from 'fs/promises';
import { genTsConfigPaths } from './util';
import { execa } from 'execa';
import { join, resolve } from 'path';
import { URL } from 'url';
import { Generator } from '@umijs/utils';
import chalk from 'chalk';
import { execa } from 'execa';
import { genTsConfigPaths } from './util';
const __dirname = new URL('.', import.meta.url).pathname;
function camelize(str: string) {
@ -40,7 +42,7 @@ export class PluginGenerator extends Generator {
...this.context,
packageName: name,
packageVersion,
tachybaseVersion: "0.0.1",
tachybaseVersion: '0.0.1',
pascalCaseName: capitalize(camelize(name.split('/').pop())),
};
}

View File

@ -1,27 +1,32 @@
import {
cpSync as _cpSync,
existsSync as _existsSync,
writeFileSync as _writeFileSync,
copyFileSync,
cpSync,
existsSync,
mkdirSync,
readFileSync,
rmSync,
symlinkSync,
unlinkSync,
writeFileSync,
} from 'fs';
import { readFile, writeFile } from 'fs/promises';
import { createRequire } from 'module';
import { Socket } from 'net';
import { dirname, join, resolve, sep } from 'path';
import chalk from 'chalk';
import { config } from 'dotenv';
import { execa, Options } from 'execa';
import fastGlob from 'fast-glob';
import { dirname, join, resolve, sep } from 'path';
import { readFile, writeFile } from 'fs/promises';
import { existsSync, mkdirSync, cpSync, writeFileSync } from 'fs';
import { config } from 'dotenv';
import {
unlinkSync,
symlinkSync,
existsSync as _existsSync,
rmSync,
cpSync as _cpSync,
copyFileSync,
readFileSync,
writeFileSync as _writeFileSync,
} from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
export function isPackageValid(pkg: string) {
try {
require(pkg)
require(pkg);
return true;
} catch (error) {
return false;

View File

@ -1,4 +1,5 @@
import axios from 'axios';
import { APIClient } from '../APIClient';
describe('APIClient', () => {

View File

@ -1,6 +1,7 @@
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
import MockAdapter from 'axios-mock-adapter';
import React from 'react';
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
import MockAdapter from 'axios-mock-adapter';
const apiClient = new APIClient();

View File

@ -1,6 +1,7 @@
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
import MockAdapter from 'axios-mock-adapter';
import React from 'react';
import { APIClient, APIClientProvider, compose, useRequest } from '@tachybase/client';
import MockAdapter from 'axios-mock-adapter';
const apiClient = new APIClient();

View File

@ -1,8 +1,9 @@
import { uid } from '@tachybase/schema';
import React from 'react';
import { APIClient, APIClientProvider, useAPIClient, useRequest } from '@tachybase/client';
import { uid } from '@tachybase/schema';
import { Button, Input, Space, Table } from 'antd';
import MockAdapter from 'axios-mock-adapter';
import React from 'react';
const apiClient = new APIClient();

View File

@ -1,9 +1,11 @@
import React, { Component } from 'react';
import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import React, { Component } from 'react';
import { Link, Outlet } from 'react-router-dom';
import { describe } from 'vitest';
import { Application } from '../Application';
import { Plugin } from '../Plugin';

View File

@ -1,7 +1,8 @@
import { Application } from '../Application';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { Application } from '../Application';
describe('PluginSettingsManager', () => {
let app: Application;

View File

@ -1,11 +1,13 @@
import { render, screen, userEvent, sleep, waitFor } from '@tachybase/test/client';
import React, { FC } from 'react';
import { render, screen, sleep, userEvent, waitFor } from '@tachybase/test/client';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import React, { FC } from 'react';
import { Link, Outlet } from 'react-router-dom';
import { beforeAll } from 'vitest';
import { Application } from '../Application';
import { RouteType, RouterManager, createRouterManager } from '../RouterManager';
import { createRouterManager, RouterManager, RouteType } from '../RouterManager';
describe('Router', () => {
let app: Application;

View File

@ -1,9 +1,10 @@
import React from 'react';
import { fireEvent, render, screen, waitFor } from '@tachybase/test/client';
import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar';
import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component';
import { useFieldSchema } from '@tachybase/schema';
import { Application, ApplicationContext } from '@tachybase/client';
import { useFieldSchema } from '@tachybase/schema';
import { fireEvent, render, screen, waitFor } from '@tachybase/test/client';
import { SchemaComponent, SchemaComponentProvider, SortableContext, SortableProvider } from '../../schema-component';
import { SchemaToolbarProvider, useSchemaToolbar, useSchemaToolbarRender } from '../schema-toolbar';
describe('SchemaToolbar', () => {
test('SchemaToolbarProvider & useSchemaToolbar', () => {

View File

@ -1,6 +1,7 @@
import React from 'react';
import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component';
import { render } from '@tachybase/test/client';
import { SchemaComponent, SchemaComponentProvider } from '../../../schema-component';
import { withDynamicSchemaProps } from '../../hoc';
const HelloComponent = withDynamicSchemaProps((props: any) => (

View File

@ -1,6 +1,8 @@
import { render, screen } from '@tachybase/test/client';
import React from 'react';
import { render, screen } from '@tachybase/test/client';
import { describe } from 'vitest';
import { compose, normalizeContainer } from '../utils';
describe('utils', () => {

View File

@ -1,4 +1,5 @@
import { createContext } from 'react';
import { Application } from './Application';
export const ApplicationContext = createContext<Application>(null);

View File

@ -1,4 +1,5 @@
import type { ButtonProps } from 'antd';
import { SchemaInitializerItemType, SchemaInitializerItemTypeWithoutName, SchemaInitializerOptions } from './types';
export class SchemaInitializer<P1 = ButtonProps, P2 = {}> {

View File

@ -1,4 +1,5 @@
import { ButtonProps } from 'antd';
import { Application } from '../Application';
import { SchemaInitializer } from './SchemaInitializer';
import { SchemaInitializerItemTypeWithoutName } from './types';

View File

@ -1,6 +1,7 @@
import { useForm } from '@tachybase/schema';
import React, { FC, useCallback, useMemo } from 'react';
import { useActionContext, SchemaComponent } from '../../../schema-component';
import { useForm } from '@tachybase/schema';
import { SchemaComponent, useActionContext } from '../../../schema-component';
import { useSchemaInitializerItem } from '../context';
export interface SchemaInitializerActionModalProps {

View File

@ -1,5 +1,7 @@
import { Button, ButtonProps } from 'antd';
import React, { FC } from 'react';
import { Button, ButtonProps } from 'antd';
import { Icon } from '../../../icon';
import { useCompile } from '../../../schema-component';
import { useGetAriaLabelOfSchemaInitializer } from '../../../schema-initializer/hooks/useGetAriaLabelOfSchemaInitializer';

View File

@ -3,6 +3,7 @@ import React, { FC, memo, useMemo } from 'react';
import { useFindComponent } from '../../../schema-component';
import { SchemaInitializerItemContext } from '../context';
import { SchemaInitializerItemType } from '../types';
export const SchemaInitializerChildren: FC<{ children: SchemaInitializerItemType[] }> = (props) => {
const { children } = props;
if (!children) return null;

View File

@ -1,6 +1,7 @@
import { Divider, theme } from 'antd';
import React from 'react';
import { Divider, theme } from 'antd';
export const SchemaInitializerDivider = () => {
const { token } = theme.useToken();
return <Divider style={{ marginTop: token.marginXXS, marginBottom: token.marginXXS }} />;

View File

@ -1,6 +1,8 @@
import React, { memo, ReactNode, useMemo } from 'react';
import { uid } from '@tachybase/schema';
import classNames from 'classnames';
import React, { ReactNode, memo, useMemo } from 'react';
import { Icon } from '../../../icon';
import { useCompile } from '../../../schema-component';
import { useSchemaInitializerItem } from '../context';

View File

@ -1,5 +1,7 @@
import { theme } from 'antd';
import React, { FC } from 'react';
import { theme } from 'antd';
import { useCompile } from '../../../schema-component';
import { useSchemaInitializerItem } from '../context';
import { SchemaInitializerOptions } from '../types';

View File

@ -1,7 +1,9 @@
import { ButtonProps } from 'antd';
import React, { FC } from 'react';
import { SchemaInitializerChildren } from './SchemaInitializerChildren';
import { ButtonProps } from 'antd';
import { SchemaInitializerOptions } from '../types';
import { SchemaInitializerChildren } from './SchemaInitializerChildren';
export type SchemaInitializerItemsProps<P1 = ButtonProps, P2 = {}> = P2 & {
options?: SchemaInitializerOptions<P1, P2>;

View File

@ -1,7 +1,9 @@
import { Select, SelectProps } from 'antd';
import React, { FC, useCallback, useMemo, useState } from 'react';
import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem';
import { Select, SelectProps } from 'antd';
import { useSchemaInitializerItem } from '../context';
import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem';
export interface SchemaInitializerSelectItemProps extends SchemaInitializerItemProps {
options?: SelectProps['options'];

View File

@ -1,8 +1,10 @@
import { Switch } from 'antd';
import React, { FC } from 'react';
import { SchemaInitializerItemProps, SchemaInitializerItem } from './SchemaInitializerItem';
import { Switch } from 'antd';
import { useCompile } from '../../../schema-component';
import { useSchemaInitializerItem } from '../context';
import { SchemaInitializerItem, SchemaInitializerItemProps } from './SchemaInitializerItem';
export interface SchemaInitializerSwitchItemProps extends SchemaInitializerItemProps {
checked?: boolean;

View File

@ -1,4 +1,5 @@
import React, { createContext } from 'react';
import { InsertType, SchemaInitializerItemType, SchemaInitializerOptions } from '../types';
export const SchemaInitializerContext = createContext<{

View File

@ -1,4 +1,5 @@
import { useMemo } from 'react';
import { useSchemaInitializerSubMenuContext } from '../components/SchemaInitializerSubMenu';
/**

View File

@ -1,6 +1,8 @@
import { ISchema } from '@tachybase/schema';
import { ButtonProps, PopoverProps } from 'antd';
import { ComponentType, ReactNode } from 'react';
import { ISchema } from '@tachybase/schema';
import { ButtonProps, PopoverProps } from 'antd';
import type {
SchemaInitializerActionModalProps,
SchemaInitializerItemGroupProps,

View File

@ -1,10 +1,12 @@
import { ISchema, useFieldSchema } from '@tachybase/schema';
import { SchemaSettingsItemType } from './types';
import { useTranslation } from 'react-i18next';
import { createDesignable, useDesignable } from '../../schema-component';
import { saveAs } from 'file-saver';
import { useAPIClient } from '../../api-client';
import { useMemo } from 'react';
import { ISchema, useFieldSchema } from '@tachybase/schema';
import { saveAs } from 'file-saver';
import { useTranslation } from 'react-i18next';
import { useAPIClient } from '../../api-client';
import { createDesignable, useDesignable } from '../../schema-component';
import { SchemaSettingsItemType } from './types';
export const defaultSettingItems = [
{

View File

@ -1,5 +1,7 @@
import { MenuOutlined } from '@ant-design/icons';
import React, { FC, useMemo } from 'react';
import { MenuOutlined } from '@ant-design/icons';
import { useGetAriaLabelOfDesigner } from '../../../schema-settings/hooks/useGetAriaLabelOfDesigner';
import { SchemaSettingOptions } from '../types';

View File

@ -1,11 +1,11 @@
import { FC, useMemo } from 'react';
import React, { FC, useMemo } from 'react';
import { useField, useFieldSchema } from '@tachybase/schema';
import { useDesignable } from '../../../schema-component';
import { SchemaSettingsDropdown } from '../../../schema-settings';
import { SchemaSettingOptions } from '../types';
import { SchemaSettingsChildren } from './SchemaSettingsChildren';
import { SchemaSettingsIcon } from './SchemaSettingsIcon';
import React from 'react';
import { useDesignable } from '../../../schema-component';
import { useField, useFieldSchema } from '@tachybase/schema';
/**
* @internal

View File

@ -1,4 +1,5 @@
import { createContext, useContext } from 'react';
import { SchemaSettingsItemType } from '../types';
export const SchemaSettingItemContext = createContext<SchemaSettingsItemType>({} as any);

View File

@ -1,4 +1,5 @@
import { ComponentType } from 'react';
import {
SchemaSettingsCascaderItemProps,
SchemaSettingsItemProps,

View File

@ -1,5 +1,4 @@
import React from 'react';
import { createContext, useContext } from 'react';
import React, { createContext, useContext } from 'react';
export const SchemaToolbarContext = createContext<any>({});
SchemaToolbarContext.displayName = 'SchemaToolbarContext';

View File

@ -1,5 +1,6 @@
import React, { useMemo } from 'react';
import { ISchema } from '@tachybase/schema';
import { useComponent, useDesignable } from '../../../schema-component';
import { SchemaToolbar, SchemaToolbarProps } from '../../../schema-settings/GeneralSchemaDesigner';

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
import { FC, ReactNode } from 'react';
import { CollectionProvider } from '../data-source/collection/CollectionProvider';
import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider';
import React, { FC, ReactNode } from 'react';
import { CollectionOptions } from '../data-source/collection/Collection';
import React from 'react';
import { CollectionManagerProvider } from '../data-source/collection/CollectionManagerProvider';
import { CollectionProvider } from '../data-source/collection/CollectionProvider';
/**
* @deprecated use `CollectionProvider` instead

View File

@ -1,17 +1,18 @@
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
import React, { useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema, useField, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid, useField, useForm } from '@tachybase/schema';
import { DownOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps } from 'antd';
import { cloneDeep } from 'lodash';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useRequest } from '../../api-client';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components';
import { TemplateSummary } from './components/TemplateSummary';

View File

@ -1,19 +1,20 @@
import { PlusOutlined } from '@ant-design/icons';
import React, { useCallback, useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { useField, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { uid, useField, useForm } from '@tachybase/schema';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps } from 'antd';
import { cloneDeep } from 'lodash';
import React, { useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useRequest } from '../../api-client';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import useDialect from '../hooks/useDialect';
import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components';
import { useFieldInterfaceOptions } from './interfaces';

View File

@ -1,11 +1,12 @@
import { PlusOutlined } from '@ant-design/icons';
import React, { useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid } from '@tachybase/schema';
import { PlusOutlined } from '@ant-design/icons';
import { Button, Dropdown, MenuProps } from 'antd';
import { cloneDeep } from 'lodash';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useRequest } from '../../api-client';
import { useCollectionRecordData } from '../../data-source';
import { RecordProvider } from '../../record-provider';

View File

@ -1,17 +1,18 @@
import React, { useEffect, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid, useForm } from '@tachybase/schema';
import cloneDeep from 'lodash/cloneDeep';
import omit from 'lodash/omit';
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components';
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {

View File

@ -1,20 +1,21 @@
import React, { useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid, useForm } from '@tachybase/schema';
import cloneDeep from 'lodash/cloneDeep';
import omit from 'lodash/omit';
import set from 'lodash/set';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import useDialect from '../hooks/useDialect';
import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components';
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {

View File

@ -1,9 +1,10 @@
import { ArrayTable } from '@tachybase/components';
import { ISchema, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import cloneDeep from 'lodash/cloneDeep';
import React, { useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema, uid, useForm } from '@tachybase/schema';
import cloneDeep from 'lodash/cloneDeep';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent } from '../../schema-component';

View File

@ -1,18 +1,19 @@
import React, { useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid, useForm } from '@tachybase/schema';
import { omit, set } from 'lodash';
import cloneDeep from 'lodash/cloneDeep';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { useCollectionParentRecordData } from '../../data-source';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import * as components from './components';
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {

View File

@ -1,18 +1,19 @@
import { PlusOutlined } from '@ant-design/icons';
import React, { useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { useField, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { uid, useField, useForm } from '@tachybase/schema';
import { PlusOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import { cloneDeep } from 'lodash';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks';
import { IField } from '../interfaces/types';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { PreviewFields } from '../templates/components/PreviewFields';
import { PreviewTable } from '../templates/components/PreviewTable';
import * as components from './components';

View File

@ -1,18 +1,18 @@
import { SyncOutlined } from '@ant-design/icons';
import { FormLayout } from '@tachybase/components';
import { createForm } from '@tachybase/schema';
import { useField, useForm } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { Button } from 'antd';
import React, { useMemo, useState } from 'react';
import { FormLayout } from '@tachybase/components';
import { createForm, uid, useField, useForm } from '@tachybase/schema';
import { SyncOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import { useTranslation } from 'react-i18next';
import { useAPIClient } from '../../api-client';
import { useCollectionParentRecordData } from '../../data-source/collection-record/CollectionRecordProvider';
import { RecordProvider, useRecord } from '../../record-provider';
import { ActionContextProvider, FormProvider, SchemaComponent, useActionContext } from '../../schema-component';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { useCancelAction } from '../action-hooks';
import { useCollectionManager_deprecated } from '../hooks/useCollectionManager_deprecated';
import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
import { FieldsConfigure, PreviewTable, SQLRequestProvider } from '../templates/components/sql-collection';
const schema = {

View File

@ -1,10 +1,11 @@
import React, { useMemo, useState } from 'react';
import { ArrayTable } from '@tachybase/components';
import { ISchema } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import { ISchema, uid } from '@tachybase/schema';
import cloneDeep from 'lodash/cloneDeep';
import set from 'lodash/set';
import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAPIClient, useRequest } from '../../api-client';
import { useCollectionParentRecordData } from '../../data-source';
import { RecordProvider, useRecord } from '../../record-provider';

View File

@ -1,6 +1,8 @@
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import React from 'react';
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import { useCompile } from '../../../schema-component';
export const CollectionCategory = observer(

View File

@ -1,6 +1,8 @@
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import React from 'react';
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import { useCompile } from '../../../schema-component';
import { useCollectionManager_deprecated } from '../../hooks';

View File

@ -1,6 +1,8 @@
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import React from 'react';
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import { useCompile } from '../../../schema-component';
import { useCollectionManager_deprecated } from '../../hooks';

View File

@ -1,5 +1,7 @@
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useCollectionManager_deprecated } from '../../hooks';
import Summary from './Summary';

View File

@ -1,7 +1,9 @@
import React, { useMemo } from 'react';
import { observer } from '@tachybase/schema';
import { Tag } from 'antd';
import { useAntdToken } from 'antd-style';
import React, { useMemo } from 'react';
import { useCompile } from '../../../schema-component';
const Summary = observer(

View File

@ -1,5 +1,7 @@
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useCollectionManager_deprecated } from '../../hooks';
import Summary from './Summary';

View File

@ -1,7 +1,8 @@
import { Field } from '@tachybase/schema';
import { observer, useField, useForm } from '@tachybase/schema';
import { Select, AutoComplete } from 'antd';
import React, { useState, useEffect } from 'react';
import React, { useEffect, useState } from 'react';
import { Field, observer, useField, useForm } from '@tachybase/schema';
import { AutoComplete, Select } from 'antd';
import { useRecord } from '../../../record-provider';
import { useCompile } from '../../../schema-component';
import { useCollectionManager_deprecated } from '../../hooks';

View File

@ -1,5 +1,6 @@
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
import { useMemo } from 'react';
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';
import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider';
export const getOptions = (

View File

@ -1,6 +1,8 @@
import { useField } from '@tachybase/schema';
import { Result } from 'ahooks/es/useRequest/src/types';
import React, { createContext, useContext, useEffect } from 'react';
import { useField } from '@tachybase/schema';
import { Result } from 'ahooks/es/useRequest/src/types';
import { useCollectionManager_deprecated } from '.';
import { CollectionProvider_deprecated, useRecord } from '..';
import { useAPIClient, useRequest } from '../api-client';

View File

@ -1,5 +1,4 @@
import { FormItem, Input } from '@tachybase/components';
import { ISchema, observer, useForm } from '@tachybase/schema';
import React from 'react';
import {
Action,
CollectionField,
@ -8,7 +7,8 @@ import {
SchemaComponent,
SchemaComponentProvider,
} from '@tachybase/client';
import React from 'react';
import { FormItem, Input } from '@tachybase/components';
import { ISchema, observer, useForm } from '@tachybase/schema';
export default observer(() => {
const collection = {

View File

@ -8,6 +8,7 @@ import {
RecordProvider,
useCollectionField_deprecated,
} from '@tachybase/client';
import MockAdapter from 'axios-mock-adapter';
const apiClient = new APIClient();

View File

@ -1,11 +1,11 @@
import { ISchema } from '@tachybase/schema';
import React from 'react';
import {
AntdSchemaComponentProvider,
ExtendCollectionsProvider,
SchemaComponent,
SchemaComponentProvider,
} from '@tachybase/client';
import React from 'react';
import { ISchema } from '@tachybase/schema';
const schema: ISchema = {
type: 'object',

View File

@ -1,14 +1,10 @@
import { FormDrawer, FormLayout } from '@tachybase/components';
import { createForm } from '@tachybase/schema';
import { ISchema } from '@tachybase/schema';
import { FormContext, SchemaOptionsContext } from '@tachybase/schema';
import { uid } from '@tachybase/schema';
import React, { useContext } from 'react';
import {
AntdSchemaComponentProvider,
Application,
CardItem,
CollectionManagerProvider_deprecated,
CollectionManagerProvider,
CollectionManagerProvider_deprecated,
CollectionProvider_deprecated,
FormItem,
Grid,
@ -20,13 +16,15 @@ import {
SchemaComponentOptions,
SchemaInitializer,
SchemaInitializerItem,
useCollectionManager_deprecated,
useCollectionManager,
useCollectionManager_deprecated,
useSchemaInitializer,
useSchemaInitializerItem,
} from '@tachybase/client';
import { FormDrawer, FormLayout } from '@tachybase/components';
import { createForm, FormContext, ISchema, SchemaOptionsContext, uid } from '@tachybase/schema';
import { cloneDeep } from 'lodash';
import React, { useContext } from 'react';
const collection: any = {
name: 'posts',

View File

@ -1,14 +1,16 @@
import { useCallback, useMemo, useState } from 'react';
import { uid } from '@tachybase/schema';
import { CascaderProps } from 'antd';
import _ from 'lodash';
import { useCallback, useMemo, useState } from 'react';
import { useCompile, useSchemaComponentContext } from '../../schema-component';
import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types';
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
import { uid } from '@tachybase/schema';
import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider';
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
import { useDataSourceManager } from '../../data-source/data-source/DataSourceManagerProvider';
import { useDataSource } from '../../data-source/data-source/DataSourceProvider';
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
import { useCollectionManager } from '../../data-source/collection/CollectionManagerProvider';
import { useCompile, useSchemaComponentContext } from '../../schema-component';
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
import { CollectionFieldOptions_deprecated, CollectionOptions } from '../types';
/**
* @deprecated use `useCollectionManager` instead

View File

@ -1,8 +1,9 @@
import { SchemaKey } from '@tachybase/schema';
import { useAPIClient } from '../../api-client';
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
import { useCallback, useMemo } from 'react';
import { SchemaKey } from '@tachybase/schema';
import { useAPIClient } from '../../api-client';
import { useCollection } from '../../data-source/collection/CollectionProvider';
import { InheritanceCollectionMixin } from '../mixins/InheritanceCollectionMixin';
export type Collection_deprecated = ReturnType<typeof useCollection_deprecated>;

View File

@ -1,5 +1,6 @@
import { render, screen, waitFor } from '@tachybase/test/client';
import React from 'react';
import { render, screen, waitFor } from '@tachybase/test/client';
import { CurrentAppInfoContext } from '../../../appInfo';
import { Checkbox } from '../../../schema-component/antd/checkbox';
import { Input } from '../../../schema-component/antd/input';

View File

@ -1,4 +1,5 @@
import { ISchema } from '@tachybase/schema';
import { defaultProps, operators } from '../';
import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface';

Some files were not shown because too many files have changed in this diff Show More