Skip to content

Commit

Permalink
Add missed script links
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Jan 22, 2024
1 parent 2de0186 commit bd5a4c2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions application/apps/rustcore/ts-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "node_modules/.bin/tsc -p tsconfig.json",
"prod": "node_modules/.bin/tsc -p tsconfig.json",
"test_cancel": "node_modules/.bin/electron node_modules/jasmine-ts/lib/index.js ./spec/session.cancel.spec.ts",
"lint": "node_modules/.bin/eslint . --ext .ts --max-warnings=0",
"check": "node_modules/.bin/tsc -p tsconfig.json --noemit"
Expand Down
1 change: 1 addition & 0 deletions application/holder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"electron": "npm run build && ./node_modules/.bin/electron --inspect ./dist/app.js",
"electron-win": "node_modules/.bin/electron --inspect ./dist/app.js",
"build": "node_modules/.bin/tsc -p tsconfig.json",
"prod": "node_modules/.bin/tsc -p tsconfig.json",
"start": "npm run build-ts && npm run electron",
"postinstall": "electron-builder install-app-deps",
"build-darwin": "node_modules/.bin/electron-builder --mac --dir",
Expand Down
1 change: 1 addition & 0 deletions application/platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
},
"scripts": {
"build": "node_modules/.bin/tsc -p tsconfig.json",
"prod": "node_modules/.bin/tsc -p tsconfig.json",
"lint": "node_modules/.bin/eslint . --ext .ts --max-warnings=0 ",
"check": "node_modules/.bin/tsc -p tsconfig.json --noemit"
},
Expand Down
16 changes: 13 additions & 3 deletions cli/src/modules/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ impl Manager for Module {
// For app we don't need --production
Some(String::from("yarn install"))
}
async fn after(&self) -> Result<Option<SpawnResult>, Error> {
let src = Target::Client.get().cwd().join("dist/client");
async fn after(&self, prod: bool) -> Result<Option<SpawnResult>, Error> {
let src = Target::Client.get().dist_path(prod).ok_or(Error::new(
ErrorKind::NotFound,
"Fail to get client artifacts",
))?;
let dest = self.cwd().join("dist");
if !src.exists() {
return Err(Error::new(
Expand All @@ -52,7 +55,14 @@ impl Manager for Module {
if prev.exists() {
fstools::rm_folder(prev).await?;
}
fstools::cp_folder(src, dest).await?;
fstools::cp_folder(src.clone(), dest.clone()).await?;
std::fs::rename(
dest.join(src.file_name().ok_or(Error::new(
ErrorKind::NotFound,
"Fail to parse client artifacts path",
))?),
dest.join("client"),
)?;
Ok(None)
}
}
7 changes: 7 additions & 0 deletions cli/src/modules/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ impl Manager for Module {
fn deps(&self) -> Vec<Target> {
vec![Target::Shared, Target::Wasm]
}
fn dist_path(&self, prod: bool) -> Option<PathBuf> {
Some(LOCATION.root.clone().join(PATH).join(if prod {
"dist/release"
} else {
"dist/debug"
}))
}
}
7 changes: 5 additions & 2 deletions cli/src/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ pub trait Manager {
fn kind(&self) -> Kind;
fn owner(&self) -> Target;
fn cwd(&self) -> PathBuf;
fn dist_path(&self, _prod: bool) -> Option<PathBuf> {
None
}
fn deps(&self) -> Vec<Target>;
fn build_cmd(&self, _prod: bool) -> Option<String> {
None
Expand Down Expand Up @@ -114,7 +117,7 @@ pub trait Manager {
Kind::Rs => Ok(SpawnResult::empty()),
}
}
async fn after(&self) -> Result<Option<SpawnResult>, Error> {
async fn after(&self, _prod: bool) -> Result<Option<SpawnResult>, Error> {
Ok(None)
}
async fn build(&self, prod: bool) -> Result<SpawnResult, Error> {
Expand All @@ -138,7 +141,7 @@ pub trait Manager {
if !status.status.success() {
Ok(status)
} else {
let res = self.after().await?;
let res = self.after(prod).await?;
if matches!(self.kind(), Kind::Ts) && prod {
self.clean().await?;
self.install(prod).await?;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/modules/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Manager for Module {
fn deps(&self) -> Vec<Target> {
vec![Target::Binding, Target::Shared]
}
async fn after(&self) -> Result<Option<SpawnResult>, Error> {
async fn after(&self, _prod: bool) -> Result<Option<SpawnResult>, Error> {
let src = Target::Binding.get().cwd().join("dist/index.node");
let dest = self.cwd().join("dist/native");
if !src.exists() {
Expand Down

0 comments on commit bd5a4c2

Please sign in to comment.