-
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.
Merge pull request #2 from dh-org/feat/pinia-install
add install pinia
- Loading branch information
Showing
4 changed files
with
54 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use std::process::Command; | ||
|
||
pub fn install() { | ||
println!("Installing Pinia..."); | ||
|
||
let npm_install = Command::new("npm") | ||
.arg("install") | ||
.arg("pinia") | ||
.spawn(); | ||
|
||
match npm_install { | ||
Ok(mut child) => { | ||
let status = child.wait().expect("Failed to wait for npm install"); | ||
|
||
if status.success() { | ||
let mkdir_status = Command::new("mkdir") | ||
.arg("store") | ||
.status() | ||
.expect("Failed to execute mkdir command"); | ||
|
||
if mkdir_status.success() { | ||
let mv_status = Command::new("mv") | ||
.arg("store.js") | ||
.arg("./store/store.js") | ||
.status() | ||
.expect("Failed to execute mv command"); | ||
|
||
if mv_status.success() { | ||
println!("Pinia successfully installed!"); | ||
} else { | ||
println!("Failed to move store.js. mv command failed."); | ||
} | ||
} else { | ||
println!("Failed to create the 'store' directory. mkdir command failed."); | ||
} | ||
} else { | ||
println!("Failed to install Pinia. npm install command failed."); | ||
} | ||
} | ||
Err(e) => { | ||
println!("Failed to run npm install: {}", e); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<h1>App.vue</h1> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { defineStore } from 'pinia' | ||
export const useAlertsStore = defineStore('alerts', { | ||
// other options... | ||
}) |