-
Notifications
You must be signed in to change notification settings - Fork 57
Remove PHP-WASM dependencies from Studio #2281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2f07699
remove php-wasm from Studio
bcotrim 76ebd94
remove php-wasm and wp-playground code from Studio
bcotrim 9444ed3
move PHP-WASM packages to devDependencies
bcotrim 49d15d5
remove unnecessary PHP-WASM ignore patterns from forge config
bcotrim 07bc3c9
remove PHP-WASM references from Jest config
bcotrim 68552af
update documentation for PHP-WASM removal
bcotrim f00dea0
merge trunk, keep PHP-WASM removal
bcotrim 92ffd24
remove outdated playground-cli-workflow design doc
bcotrim e21e57a
trigger ci e2e
bcotrim 270ab29
merge dev/studio-cli-i2, keep PHP-WASM removal
bcotrim faf7407
replace unzipper with yauzl for zip extraction
bcotrim fa9ce7b
fix lint and unit tests
bcotrim ae79eee
Consolidate studio site set-* commands into single command (#2355)
bcotrim 47dce34
Studio CLI: Add support for xdebug beta flag (#2316)
bcotrim 141f102
CLI: Update `studio-cli.bat` so we can read from stdin (#2304)
fredrikekelund 43f08cf
Merge remote-tracking branch 'origin/dev/studio-cli-i2' into stu-960-…
bcotrim eb23db8
Fix lint issues after merge with dev/studio-cli-i2
bcotrim cfaa5d8
Fix DEFAULT_WORDPRESS_VERSION reference in edit-site-details
bcotrim f2ea007
fix unit tests
bcotrim d9d3db6
Merge trunk into stu-960-remove-php-wasm-from-studio
bcotrim 3629839
pr feedback
bcotrim 78015d0
`--studio-no-path` to appease TS
fredrikekelund 7111f6a
Merge branch 'trunk' into stu-960-remove-php-wasm-from-studio
bcotrim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
common/lib/cli-args-sanitizer.ts → cli/lib/cli-args-sanitizer.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import path from 'path'; | ||
| import { promisify } from 'util'; | ||
| import fs from 'fs-extra'; | ||
| import yauzl from 'yauzl'; | ||
|
|
||
| const openZip = promisify< string, yauzl.Options, yauzl.ZipFile >( yauzl.open ); | ||
|
|
||
| export async function extractZip( zipPath: string, destinationFolder: string ): Promise< void > { | ||
| const zipFile = await openZip( zipPath, { lazyEntries: true } ); | ||
| const openReadStream = promisify( zipFile.openReadStream.bind( zipFile ) ); | ||
| const resolvedDestination = path.resolve( destinationFolder ); | ||
|
|
||
| return new Promise( ( resolve, reject ) => { | ||
| zipFile.on( 'entry', async ( entry: yauzl.Entry ) => { | ||
| if ( entry.fileName.endsWith( '/' ) ) { | ||
| zipFile.readEntry(); | ||
| return; | ||
| } | ||
|
|
||
| const normalizedPath = path.normalize( entry.fileName ); | ||
| const fullPath = path.join( resolvedDestination, normalizedPath ); | ||
|
|
||
| if ( ! fullPath.startsWith( resolvedDestination + path.sep ) ) { | ||
| console.warn( `Skipping invalid path: ${ entry.fileName }` ); | ||
| zipFile.readEntry(); | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| await fs.ensureDir( path.dirname( fullPath ) ); | ||
|
|
||
| const readStream = await openReadStream( entry ); | ||
| const writeStream = fs.createWriteStream( fullPath ); | ||
|
|
||
| function onError( error: Error ) { | ||
| if ( ! readStream.destroyed ) { | ||
| readStream.destroy(); | ||
| } | ||
| if ( ! writeStream.destroyed ) { | ||
| writeStream.destroy(); | ||
| } | ||
| reject( error ); | ||
| } | ||
|
|
||
| readStream.once( 'error', onError ); | ||
| writeStream.once( 'error', onError ); | ||
|
|
||
| writeStream.once( 'finish', () => { | ||
| zipFile.readEntry(); | ||
| } ); | ||
|
|
||
| readStream.pipe( writeStream ); | ||
| } catch ( error ) { | ||
| reject( error ); | ||
| } | ||
| } ); | ||
|
|
||
| zipFile.on( 'end', () => { | ||
| resolve(); | ||
| } ); | ||
|
|
||
| zipFile.on( 'error', reject ); | ||
|
|
||
| zipFile.readEntry(); | ||
| } ); | ||
| } |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export type { Blueprint, BlueprintV1Declaration, StepDefinition } from '@wp-playground/blueprints'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * Local type definitions for PHP versions. | ||
| * These replace imports from @php-wasm/universal to avoid bundling PHP-WASM in the desktop app. | ||
| * | ||
| * Note: Keep these values in sync with @php-wasm/universal if the upstream package changes. | ||
| */ | ||
|
|
||
| export const SupportedPHPVersions = [ | ||
| '8.4', | ||
| '8.3', | ||
| '8.2', | ||
| '8.1', | ||
| '8.0', | ||
| '7.4', | ||
| '7.3', | ||
| '7.2', | ||
| ] as const; | ||
|
|
||
| export const LatestSupportedPHPVersion = '8.4' as const; | ||
|
|
||
| export const SupportedPHPVersionsList: string[] = [ ...SupportedPHPVersions ]; | ||
|
|
||
| export type SupportedPHPVersion = ( typeof SupportedPHPVersions )[ number ]; | ||
|
|
||
| /** | ||
| * The recommended PHP version for new sites. | ||
| * This replaces RecommendedPHPVersion from @wp-playground/common. | ||
| */ | ||
| export const RecommendedPHPVersion: SupportedPHPVersion = '8.3'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use this function in
scripts/download-node-binary.mjs, too?In the future, we might consider also targeting
src/lib/import-export/import/handlers/backup-handler-zip.ts, but that's for another PR.