@xdelivered/create-emberflow 0.2.0
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/index.mjs +34 -0
- package/package.json +15 -0
package/index.mjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// create-emberflow — `npm create emberflow@latest` entry point.
|
|
3
|
+
// Ensures `emberflow` is installed in the cwd, then runs `emberflow init`, which
|
|
4
|
+
// scaffolds, installs skills, and launches the studio itself — no separate `dev` call.
|
|
5
|
+
import { spawnSync } from 'node:child_process';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
|
|
9
|
+
const cwd = process.cwd();
|
|
10
|
+
const binExt = process.platform === 'win32' ? '.cmd' : '';
|
|
11
|
+
const localBin = join(cwd, 'node_modules', '.bin', `emberflow${binExt}`);
|
|
12
|
+
|
|
13
|
+
console.log('[create-emberflow] scaffolding and launching an Emberflow project...');
|
|
14
|
+
|
|
15
|
+
if (!existsSync(localBin)) {
|
|
16
|
+
const install = spawnSync('npm', ['i', '-D', '@xdelivered/emberflow'], { cwd, stdio: 'inherit' });
|
|
17
|
+
if (install.status !== 0) {
|
|
18
|
+
process.exit(install.status ?? 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function runEmberflow(args) {
|
|
23
|
+
const result = existsSync(localBin)
|
|
24
|
+
? spawnSync(localBin, args, { cwd, stdio: 'inherit' })
|
|
25
|
+
: spawnSync('npx', ['@xdelivered/emberflow', ...args], { cwd, stdio: 'inherit' });
|
|
26
|
+
if (result.status !== 0) {
|
|
27
|
+
process.exit(result.status ?? 1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Forward the language choice flags straight through to `emberflow init`.
|
|
32
|
+
const languageFlags = process.argv.slice(2).filter((a) => a === '--js' || a === '--ts');
|
|
33
|
+
|
|
34
|
+
runEmberflow(['init', ...languageFlags]);
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xdelivered/create-emberflow",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Scaffold an Emberflow project.",
|
|
6
|
+
"keywords": ["emberflow", "scaffold", "create", "api", "workflow"],
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"publishConfig": { "access": "public" },
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/pmccurley87/emberflow.git"
|
|
12
|
+
},
|
|
13
|
+
"bin": { "create-emberflow": "index.mjs" },
|
|
14
|
+
"files": ["index.mjs"]
|
|
15
|
+
}
|