forked from single-spa/create-single-spa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customize destination directory and use global vue/angular when possi…
…ble. Resolves single-spa#56 (single-spa#76) * Customize destination directory and use global vue/angular when possible. Resolves single-spa#56. * Interactive choosing of destination dir * Carlos' feedback * Self review
- Loading branch information
1 parent
0c50dde
commit 8c80eac
Showing
7 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 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 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
20 changes: 18 additions & 2 deletions
20
packages/generator-single-spa/src/angular/generator-single-spa-angular.js
This file contains 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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
const Generator = require("yeoman-generator"); | ||
const { spawn } = require("child_process"); | ||
const util = require("util"); | ||
const commandExists = util.promisify(require("command-exists")); | ||
|
||
module.exports = class SingleSpaAngularGenerator extends Generator { | ||
async runAngularCli() { | ||
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx"; | ||
spawn(npxCmd, ["@angular/cli", "new"], { stdio: "inherit" }); | ||
const globalInstallation = await commandExists("ng"); | ||
|
||
let command, | ||
args = []; | ||
if (globalInstallation) { | ||
command = "ng"; | ||
} else { | ||
command = process.platform === "win32" ? "npx.cmd" : "npx"; | ||
args.push("@angular/cli"); | ||
} | ||
|
||
spawn( | ||
command, | ||
args.concat(["new", "--directory", this.options.dir || "."]), | ||
{ stdio: "inherit" } | ||
); | ||
} | ||
}; |
This file contains 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
18 changes: 16 additions & 2 deletions
18
packages/generator-single-spa/src/vue/generator-single-spa-vue.js
This file contains 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 |
---|---|---|
@@ -1,9 +1,23 @@ | ||
const Generator = require("yeoman-generator"); | ||
const { spawn } = require("child_process"); | ||
const util = require("util"); | ||
const commandExists = util.promisify(require("command-exists")); | ||
|
||
module.exports = class SingleSpaVueGenerator extends Generator { | ||
async runVueCli() { | ||
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx"; | ||
spawn(npxCmd, ["@vue/cli", "create", "."], { stdio: "inherit" }); | ||
const globalInstallation = await commandExists("vue"); | ||
|
||
let command, | ||
args = []; | ||
if (globalInstallation) { | ||
command = "vue"; | ||
} else { | ||
command = process.platform === "win32" ? "npx.cmd" : "npx"; | ||
args.push("@vue/cli"); | ||
} | ||
|
||
spawn(command, args.concat(["create", this.options.dir || "."]), { | ||
stdio: "inherit", | ||
}); | ||
} | ||
}; |
This file contains 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