diff --git a/docs/.vitepress/components/CliGenerator.vue b/docs/.vitepress/components/CliGenerator.vue index 3a44ecdde..ca44f189b 100644 --- a/docs/.vitepress/components/CliGenerator.vue +++ b/docs/.vitepress/components/CliGenerator.vue @@ -2,17 +2,29 @@

{{ I18N[lang].selectedSystem }}

- +
+
+ +

{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}

-
- - - + +
+
+ + +
@@ -20,7 +32,7 @@
{{ I18N[lang].selectCommon }}
{{ I18N[lang].selectNone }}
-
+
{{ I18N[lang].buildLibs }}{{ checkedLibs.length > 0 ? (' (' + checkedLibs.length + ')') : '' }}
@@ -135,24 +147,33 @@

WARNING

{{ I18N[lang].windowsDownSPCWarning }}

+ https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe
{{ I18N[lang].downloadExtOnlyCommand }} -
{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}
+
+ {{ downloadExtCommand }} +
{{ I18N[lang].downloadAllCommand }} -
{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}
+
+ {{ downloadAllCommand }} +
{{ I18N[lang].downloadUPXCommand }} -
{{ spcCommand }} install-pkg upx{{ debug ? ' --debug' : '' }}
+
+ {{ downloadPkgCommand }} +
{{ I18N[lang].compileCommand }} -
{{ spcCommand }} build {{ buildCommand }} "{{ extList }}"{{ additionalLibs }}{{ debug ? ' --debug' : '' }}{{ zts ? ' --enable-zts' : '' }}{{ enableUPX ? ' --with-upx-pack' : '' }}{{ displayINI }}
+
+ {{ buildCommandString }} +
@@ -170,6 +191,15 @@ import libData from '../config/lib.json'; import { getAllExtLibsByDeps } from './DependencyUtil.js'; const ext = ref(extData); +const extFilter = computed(() => { + const ls = []; + for (const [name, item] of Object.entries(ext.value)) { + if (isSupported(name, selectedSystem.value)) { + ls.push(name); + } + } + return ls; +}); const lib = ref(libData); const libContain = ref([]); @@ -234,7 +264,7 @@ const I18N = { microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!', windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!', useUPX: '是否开启 UPX 压缩(减小二进制体积)', - windowsDownSPCWarning: 'Windows 下请手动下载 spc.exe 二进制文件并解压到当前目录!', + windowsDownSPCWarning: 'Windows 下请手动下载 spc.exe 二进制文件,解压到当前目录并重命名为 spc.exe!', usePreBuilt: '如果可能,下载预编译的依赖库(减少编译时间)', }, en: { @@ -268,7 +298,7 @@ const I18N = { microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!', windowsSAPIUnavailable: 'Windows does not support fpm and embed build!', useUPX: 'Enable UPX compression (reduce binary size)', - windowsDownSPCWarning: 'Please download the spc.exe binary file manually and extract it to the current directory on Windows!', + windowsDownSPCWarning: 'Please download the binary file manually, extract it to the current directory and rename to spc.exe on Windows!', usePreBuilt: 'Download pre-built dependencies if possible (reduce compile time)', } }; @@ -325,7 +355,7 @@ const libDisableList = ref([]); const checkedTargets = ref(['cli']); // chosen env -const selectedEnv = ref('native'); +const selectedEnv = ref('spc'); // chosen php version const selectedPhpVersion = ref('8.2'); @@ -348,6 +378,13 @@ const enableUPX = ref(0); const hardcodedINIData = ref(''); const selectedSystem = ref('linux'); + +watch(selectedSystem, () => { + if (selectedSystem.value === 'windows') { + selectedArch.value = 'x86_64'; + } +}); + const selectedArch = ref('x86_64'); // spc command string, alt: spc-alpine-docker, spc @@ -381,6 +418,25 @@ const displayINI = computed(() => { return ' ' + str.map((x) => '-I "' + x + '"').join(' '); }); +const filterText = ref(''); + +const highlightItem = (item, step) => { + if (item.includes(filterText.value)) { + if (step === 0) { + return item.substring(0, item.indexOf(filterText.value)); + } else if (step === 1) { + return filterText.value; + } else { + return item.substring(item.indexOf(filterText.value) + filterText.value.length); + } + } else { + if (step === 0) { + return item; + } + return ''; + } +}; + const onTargetChange = (event) => { let id; if (checkedTargets.value.indexOf('all') !== -1 && event.target.value === 'all') { @@ -427,6 +483,22 @@ const calculateExtDepends = (input) => { return Array.from(result); }; +const downloadAllCommand = computed(() => { + return `${spcCommand.value} download --all --with-php=${selectedPhpVersion.value}${preBuilt.value ? ' --prefer-pre-built' : ''}${debug.value ? ' --debug' : ''}`; +}); + +const downloadExtCommand = computed(() => { + return `${spcCommand.value} download --with-php=${selectedPhpVersion.value} --for-extensions "${extList.value}"${preBuilt.value ? ' --prefer-pre-built' : ''}${debug.value ? ' --debug' : ''}`; +}); + +const downloadPkgCommand = computed(() => { + return `${spcCommand.value} install-pkg upx${debug.value ? ' --debug' : ''}`; +}); + +const buildCommandString = computed(() => { + return `${spcCommand.value} build ${buildCommand.value} "${extList.value}"${additionalLibs.value}${debug.value ? ' --debug' : ''}${zts.value ? ' --enable-zts' : ''}${enableUPX.value ? ' --with-upx-pack' : ''}${displayINI.value}`; +}); + const calculateExtLibDepends = (input) => { const result = new Set(); @@ -539,9 +611,12 @@ h2 { .command-preview { padding: 1.2rem; background: var(--vp-c-divider); + border-radius: 8px; + word-break: break-all; font-family: monospace; overflow-wrap: break-word; } + .option-line { padding: 4px 8px; } @@ -582,12 +657,38 @@ select { background-color: var(--vp-button-alt-active-bg); } .textarea { - border: 1px solid var(--vp-button-alt-border); - padding: 0 4px; - min-width: 300px; + border: 1px solid var(--vp-c-divider); + border-radius: 4px; + width: calc(100% - 12px); + padding: 4px 8px; +} + +.input { + display: block; + border: 1px solid var(--vp-c-divider); + border-radius: 4px; + width: 100%; + padding: 4px 8px; } .command-container { margin-bottom: 24px; } +.modal-button { + padding: 4px 8px; + border-radius: 4px; + border-color: var(--vp-button-alt-border); + color: var(--vp-button-alt-text); + background-color: var(--vp-button-alt-bg); +} +.modal-button:hover { + border-color: var(--vp-button-alt-hover-border); + color: var(--vp-button-alt-hover-text); + background-color: var(--vp-button-alt-hover-bg) +} +.modal-button:active { + border-color: var(--vp-button-alt-active-border); + color: var(--vp-button-alt-active-text); + background-color: var(--vp-button-alt-active-bg) +} diff --git a/docs/.vitepress/components/SearchTable.vue b/docs/.vitepress/components/SearchTable.vue new file mode 100644 index 000000000..6cfdc680e --- /dev/null +++ b/docs/.vitepress/components/SearchTable.vue @@ -0,0 +1,79 @@ + + + + + + + \ No newline at end of file diff --git a/docs/en/guide/cli-generator.md b/docs/en/guide/cli-generator.md index b11c00028..87163d000 100644 --- a/docs/en/guide/cli-generator.md +++ b/docs/en/guide/cli-generator.md @@ -1,3 +1,7 @@ +--- +aside: false +--- + diff --git a/docs/en/guide/extensions.md b/docs/en/guide/extensions.md index 14ec91d28..9ce53f63d 100644 --- a/docs/en/guide/extensions.md +++ b/docs/en/guide/extensions.md @@ -1,3 +1,7 @@ + + # Extensions > - `yes`: supported @@ -5,7 +9,7 @@ > - `no` with issue link: confirmed to be unavailable due to issue > - `partial` with issue link: supported but not perfect due to issue - + ::: tip If an extension you need is missing, you can create a [Feature Request](https://github.com/crazywhalecc/static-php-cli/issues). diff --git a/docs/zh/guide/cli-generator.md b/docs/zh/guide/cli-generator.md index 3b382ed3b..c3936dea2 100644 --- a/docs/zh/guide/cli-generator.md +++ b/docs/zh/guide/cli-generator.md @@ -1,3 +1,7 @@ +--- +aside: false +--- + diff --git a/docs/zh/guide/extensions.md b/docs/zh/guide/extensions.md index 46a561dd3..43095a077 100644 --- a/docs/zh/guide/extensions.md +++ b/docs/zh/guide/extensions.md @@ -1,3 +1,7 @@ + + # 扩展列表 > - `yes`: 已支持 @@ -5,7 +9,8 @@ > - `no` with issue link: 确定不支持或无法支持 > - `partial` with issue link: 已支持,但是无法完美工作 - + + ::: tip 如果缺少您需要的扩展,您可以创建 [功能请求](https://github.com/crazywhalecc/static-php-cli/issues)。