@nextsparkjs/cli 0.1.0-beta.79 → 0.1.0-beta.80
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/dist/cli.js +67 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3517,6 +3517,14 @@ async function runWizard(options = { mode: "interactive" }) {
|
|
|
3517
3517
|
showError("Failed to install @nextsparkjs/core. Cannot generate project.");
|
|
3518
3518
|
process.exit(1);
|
|
3519
3519
|
}
|
|
3520
|
+
if (config2.projectType === "web-mobile") {
|
|
3521
|
+
console.log("");
|
|
3522
|
+
const mobileInstalled = await installMobile();
|
|
3523
|
+
if (!mobileInstalled) {
|
|
3524
|
+
showError("Failed to install @nextsparkjs/mobile. Cannot generate monorepo project.");
|
|
3525
|
+
process.exit(1);
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3520
3528
|
console.log("");
|
|
3521
3529
|
const spinner = ora7({
|
|
3522
3530
|
text: "Generating your NextSpark project...",
|
|
@@ -3789,6 +3797,65 @@ async function installCore() {
|
|
|
3789
3797
|
return false;
|
|
3790
3798
|
}
|
|
3791
3799
|
}
|
|
3800
|
+
function isMobileInstalled() {
|
|
3801
|
+
const mobilePath = join7(process.cwd(), "node_modules", "@nextsparkjs", "mobile");
|
|
3802
|
+
return existsSync7(mobilePath);
|
|
3803
|
+
}
|
|
3804
|
+
function findLocalMobileTarball() {
|
|
3805
|
+
const cwd = process.cwd();
|
|
3806
|
+
try {
|
|
3807
|
+
const files = readdirSync(cwd);
|
|
3808
|
+
const mobileTarball = files.find(
|
|
3809
|
+
(f) => f.includes("nextsparkjs-mobile") && f.endsWith(".tgz")
|
|
3810
|
+
);
|
|
3811
|
+
if (mobileTarball) {
|
|
3812
|
+
return join7(cwd, mobileTarball);
|
|
3813
|
+
}
|
|
3814
|
+
} catch {
|
|
3815
|
+
}
|
|
3816
|
+
return null;
|
|
3817
|
+
}
|
|
3818
|
+
async function installMobile() {
|
|
3819
|
+
if (isMobileInstalled()) {
|
|
3820
|
+
return true;
|
|
3821
|
+
}
|
|
3822
|
+
const spinner = ora7({
|
|
3823
|
+
text: "Installing @nextsparkjs/mobile...",
|
|
3824
|
+
prefixText: " "
|
|
3825
|
+
}).start();
|
|
3826
|
+
try {
|
|
3827
|
+
const localTarball = findLocalMobileTarball();
|
|
3828
|
+
let packageSpec = "@nextsparkjs/mobile";
|
|
3829
|
+
if (localTarball) {
|
|
3830
|
+
packageSpec = localTarball;
|
|
3831
|
+
spinner.text = "Installing @nextsparkjs/mobile from local tarball...";
|
|
3832
|
+
}
|
|
3833
|
+
const useYarn = existsSync7(join7(process.cwd(), "yarn.lock"));
|
|
3834
|
+
const usePnpm = existsSync7(join7(process.cwd(), "pnpm-lock.yaml"));
|
|
3835
|
+
let installCmd;
|
|
3836
|
+
if (usePnpm) {
|
|
3837
|
+
installCmd = `pnpm add ${packageSpec}`;
|
|
3838
|
+
} else if (useYarn) {
|
|
3839
|
+
installCmd = `yarn add ${packageSpec}`;
|
|
3840
|
+
} else {
|
|
3841
|
+
installCmd = `npm install ${packageSpec}`;
|
|
3842
|
+
}
|
|
3843
|
+
spinner.stop();
|
|
3844
|
+
execSync(installCmd, {
|
|
3845
|
+
stdio: "inherit",
|
|
3846
|
+
cwd: process.cwd()
|
|
3847
|
+
});
|
|
3848
|
+
spinner.succeed(chalk11.green("@nextsparkjs/mobile installed successfully!"));
|
|
3849
|
+
return true;
|
|
3850
|
+
} catch (error) {
|
|
3851
|
+
spinner.fail(chalk11.red("Failed to install @nextsparkjs/mobile"));
|
|
3852
|
+
if (error instanceof Error) {
|
|
3853
|
+
console.log(chalk11.red(` Error: ${error.message}`));
|
|
3854
|
+
}
|
|
3855
|
+
console.log(chalk11.gray(" Hint: Make sure the package is available (npm registry or local tarball)"));
|
|
3856
|
+
return false;
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3792
3859
|
|
|
3793
3860
|
// src/commands/init.ts
|
|
3794
3861
|
function getWizardMode(options) {
|