Skip to content

Isomorphic PHP, Isomorphic Blueprints #214

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 25 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
79c2bc7
UniversalPHP
adamziel Apr 22, 2023
263aade
Make PHP Isomorphic and universal with respect to Local / Remote runtime
adamziel Apr 23, 2023
7730c98
Extract blueprints to a separate package to decouple them from Playgr…
adamziel Apr 23, 2023
4e27f3b
Add defineSiteUrl and runWpInstallationWizard helpers
adamziel Apr 23, 2023
5b96ff7
Move WordPress patcher to blueprints
adamziel Apr 23, 2023
0a57903
Add playground/node package to run Blueprints in node.js
adamziel Apr 23, 2023
2b11f8c
Settle the API shape
adamziel Apr 24, 2023
1685f64
Build blueprints and php-wasm/universal as both ESM and CJS
adamziel Apr 24, 2023
643bb29
Rename files
adamziel Apr 24, 2023
f31a4fe
Revert unnecessary function rename in php-wasm-node
adamziel Apr 24, 2023
4435b92
Rename test.sh to ensure-both-outputs-run-in-node.sh
adamziel Apr 24, 2023
10340e5
Use mkdirSync with recursive: true instead of checking whether fileEx…
adamziel Apr 24, 2023
e734f30
Revert changes from packages/php-wasm/node/src/lib/networking/outboun…
adamziel Apr 24, 2023
a819f19
Expand STR and NUM to STRING and NUMBER
adamziel Apr 24, 2023
373c233
Remove WithProgress interface
adamziel Apr 24, 2023
94dd955
Adjust doc generation conf
adamziel Apr 24, 2023
9175526
Remove parseWorkerStartupOptions from php-wasm/node
adamziel Apr 24, 2023
e44bef0
Spawn node directly in assert-built-esm-and-cjs executor
adamziel Apr 24, 2023
5594e8e
Correct typos in loadPHPRuntime()
adamziel Apr 24, 2023
a377bb0
Rename patchFile to updateFile
adamziel Apr 24, 2023
68bbbb0
Prevent defining WP_HOME and WP_SITEURL contants twice
adamziel Apr 24, 2023
ad7ffce
Relocate step types to the handler files
adamziel Apr 24, 2023
43d02ca
Document admin_password2
adamziel Apr 24, 2023
364eab9
Export step types
adamziel Apr 24, 2023
7e1c652
Export SemaphoreOptions as a type
adamziel Apr 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": []
"depConstraints": [
{
"sourceTag": "*",
"notDependOnLibsWithTags": ["scope:web-client"]
}
]
}
],
"no-inner-declarations": 0,
Expand Down
5 changes: 5 additions & 0 deletions packages/nx-extensions/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"implementation": "./src/executors/package-json/executor",
"schema": "./src/executors/package-json/schema.json",
"description": "package-json executor"
},
"assert-built-esm-and-cjs": {
"implementation": "./src/executors/assert-built-esm-and-cjs/executor",
"schema": "./src/executors/assert-built-esm-and-cjs/schema.json",
"description": "assert-built-esm-and-cjs executor"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { ExecutorContext } from '@nrwl/devkit';
import { spawn } from 'child_process';
import { mkdirSync, writeFileSync } from 'fs';
import * as path from 'path';
import { AssertBuiltEsmAndCjsExecutorSchema } from './schema';

/**
* Test whether a module can be imported as both ESM and CJS.
*
* @param options
* @param context
* @returns
*/
export default async function runExecutor(
options: AssertBuiltEsmAndCjsExecutorSchema,
context: ExecutorContext
) {
const buildDir = options.outputPath.split('/')[0];
const testsPath = path.join(context.root, buildDir, 'test-esm-cjs');
mkdirSync(testsPath, { recursive: true });

writeFileSync(
path.join(testsPath, 'test-esm.mjs'),
`import * as result from '../../${options.outputPath}/index.js';`
);
writeFileSync(
path.join(testsPath, 'test-cjs.cjs'),
`require('../../${options.outputPath}');`
);
const checkForSuccess = (scriptName) =>
new Promise((resolve, reject) => {
const test = spawn('node', [scriptName], {
cwd: testsPath,
stdio: 'pipe',
});

let stdout = '';
test.stdout!.on('data', (chunk) => (stdout += chunk));

let stderr = '';
test.stderr!.on('data', (chunk) => (stderr += chunk));

test.on('close', (statusCode) => {
return statusCode === 0
? resolve(stdout)
: reject(
`${context.targetName} could not be imported as both ESM and CJS: ${stdout} ${stderr}`
);
});
});

await checkForSuccess('test-esm.mjs');
await checkForSuccess('test-cjs.cjs');
return { success: true };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface AssertBuiltEsmAndCjsExecutorSchema {
outputPath: string;
} // eslint-disable-line
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "http://json-schema.org/schema",
"version": 2,
"cli": "nx",
"title": "AssertBuiltEsmAndCjs executor",
"description": "",
"type": "object",
"properties": {
"outputPath": {
"type": "string",
"description": "The path to the built module"
}
},
"required": ["outputPath"]
}
12 changes: 0 additions & 12 deletions packages/php-wasm/abstract/README.md

This file was deleted.

39 changes: 0 additions & 39 deletions packages/php-wasm/abstract/project.json

This file was deleted.

Loading