@group107/create-wp107 1.0.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # `@group107/create-wp107`
2
+
3
+ Public launcher for Group 107's private WP107 platform:
4
+
5
+ ```bash
6
+ npx @group107/create-wp107
7
+ ```
8
+
9
+ Run it from a WordPress site (the root or any folder below it). The launcher contains no platform or starter
10
+ source. It verifies access to the pinned private WP107 release, then delegates every argument to that release's
11
+ canonical `create-wp107` CLI.
12
+
13
+ Developers need Git, Node 24 and read access to `Israel-IT/WP107`. If authentication fails:
14
+
15
+ ```bash
16
+ gh auth login
17
+ gh auth setup-git
18
+ git ls-remote https://github.com/Israel-IT/WP107.git
19
+ ```
20
+
21
+ Project setup and resume behavior are documented by the installed WP107 release.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { existsSync, realpathSync } from 'node:fs';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ export const WP107_VERSION = '1.0.0-dev.6';
8
+ export const DEFAULT_SPEC = `git+https://github.com/Israel-IT/WP107.git#v${WP107_VERSION}`;
9
+
10
+ export function accessTarget(spec) {
11
+ if (/^(file:|\.|[A-Za-z]:[\\/])/.test(spec)) return null;
12
+ const [url, fragment] = spec.replace(/^git\+/, '').split('#');
13
+ return url && fragment ? { url, ref: fragment.startsWith('v') ? `refs/tags/${fragment}` : fragment } : null;
14
+ }
15
+
16
+ export function checkAccess(spec, execute = spawnSync) {
17
+ const target = accessTarget(spec);
18
+ if (!target) return { ok: true, skipped: true };
19
+ const result = execute('git', ['ls-remote', '--exit-code', target.url, target.ref], {
20
+ encoding: 'utf8', env: { ...process.env, GIT_TERMINAL_PROMPT: '0' }, windowsHide: true,
21
+ });
22
+ return { ok: result.status === 0, status: result.status, target };
23
+ }
24
+
25
+ export function npmCli(env = process.env) {
26
+ const candidates = [
27
+ env.npm_execpath,
28
+ join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js'),
29
+ ].filter(Boolean);
30
+ return candidates.find((candidate) => existsSync(candidate)) ?? null;
31
+ }
32
+
33
+ export function launch(args, { env = process.env, execute = spawnSync } = {}) {
34
+ const spec = env.WP107_PLATFORM_SPEC || DEFAULT_SPEC;
35
+ const access = checkAccess(spec, execute);
36
+ if (!access.ok) {
37
+ console.error(`[create-wp107] Cannot read the private WP107 release ${access.target.ref}.\n` +
38
+ 'Run `gh auth login` and `gh auth setup-git`, confirm Israel-IT/WP107 access, then retry.');
39
+ return 1;
40
+ }
41
+ const cli = npmCli(env);
42
+ if (!cli) {
43
+ console.error('[create-wp107] npm could not be located. Install the supported Node/npm release and retry.');
44
+ return 1;
45
+ }
46
+ const result = execute(process.execPath, [cli, 'exec', '--yes', `--package=${spec}`, '--', 'create-wp107', ...args], {
47
+ stdio: 'inherit', env, windowsHide: true,
48
+ });
49
+ if (result.error) {
50
+ console.error(`[create-wp107] Could not start the private initializer: ${result.error.message}`);
51
+ return 1;
52
+ }
53
+ return result.status ?? 1;
54
+ }
55
+
56
+ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
57
+ process.exitCode = launch(process.argv.slice(2));
58
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@group107/create-wp107",
3
+ "version": "1.0.0-dev.6",
4
+ "description": "Thin public launcher for the private WP107 project initializer",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Israel-IT/WP107.git",
10
+ "directory": "packages/create-wp107"
11
+ },
12
+ "bin": {
13
+ "create-wp107": "bin/create-wp107.mjs"
14
+ },
15
+ "files": [
16
+ "bin/",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=24 <25"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
25
+ }