telescope icon indicating copy to clipboard operation
telescope copied to clipboard

Fix for transpile on windows OS

Open bz888 opened this issue 1 year ago • 6 comments

https://github.com/cosmology-tech/telescope/issues/499 Fix for windows OS on telescope transpile

bz888 avatar Oct 30 '23 19:10 bz888

After some manual testing, i am getting this on codegen, but it does build. Unsure if it a desired output. If you are able to point me to a direction. will fix this

export * from "./ics23\\bundle";
export * from "./cosmos_proto\\bundle";
export * from "./cosmos\\bundle";
export * from "./cosmwasm\\bundle";
export * from "./google\\bundle";
export * from "./ibc\\bundle";
export * from "./osmosis\\bundle";
export * from "./tendermint\\bundle";

bz888 avatar Oct 31 '23 09:10 bz888

After some manual testing, i am getting this on codegen, but it does build. Unsure if it a desired output. If you are able to point me to a direction. will fix this

export * from "./ics23\\bundle";
export * from "./cosmos_proto\\bundle";
export * from "./cosmos\\bundle";
export * from "./cosmwasm\\bundle";
export * from "./google\\bundle";
export * from "./ibc\\bundle";
export * from "./osmosis\\bundle";
export * from "./tendermint\\bundle";

Hi, Thank you very much for the PR!

I think this's the place generating exports: https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/generators/create-index.ts#L26C34-L26C34

So I guess we can see how 'path' will handle relative under windows. If the string with '\' is returned by 'relative', then I guess we can be fine with it. https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/utils/index.ts#L105

Or if there's '\' in the f2, I think we can find where we create the dir string. I think it's here: https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/bundle.ts#L42C32-L42C32

Zetazzz avatar Oct 31 '23 18:10 Zetazzz

After some manual testing, i am getting this on codegen, but it does build. Unsure if it a desired output. If you are able to point me to a direction. will fix this

export * from "./ics23\\bundle";
export * from "./cosmos_proto\\bundle";
export * from "./cosmos\\bundle";
export * from "./cosmwasm\\bundle";
export * from "./google\\bundle";
export * from "./ibc\\bundle";
export * from "./osmosis\\bundle";
export * from "./tendermint\\bundle";

Hi, Thank you very much for the PR!

I think this's the place generating exports: https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/generators/create-index.ts#L26C34-L26C34

So I guess we can see how 'path' will handle relative under windows. If the string with '' is returned by 'relative', then I guess we can be fine with it.

https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/utils/index.ts#L105

Or if there's '' in the f2, I think we can find where we create the dir string. I think it's here: https://github.com/cosmology-tech/telescope/blob/c79d977ddaea4e7f612b2482a088fecf2b779783/packages/telescope/src/bundle.ts#L42C32-L42C32

Thank you, I've managed to fix up the bundle.ts files and index.ts, but i am still bumping into undesired back slashes on other codegen files. Is there a more generalised entry point for the imports ? Or do i have to add a path replacer on each package ?

tendermint/abci/types.ts

import { Header, HeaderAmino, HeaderSDKType } from "..\\types\\types";
import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "..\\crypto\\proof";
import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "..\\types\\params";
import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "..\\crypto\\keys";
import { Long } from "..\\..\\helpers";

tendermint/crypto/proof.ts

import { Long } from "..\\..\\..\\helpers";
export interface BitArray {
  bits: Long;
  elems: Long[];
}

bz888 avatar Nov 02 '23 00:11 bz888

Does this modify output of generated code? or just the ability to read the files via fs?

pyramation avatar Nov 02 '23 06:11 pyramation

Does this modify output of generated code? or just the ability to read the files via fs?

Currently its doing both, for the ability to read files via fs the splat must be converted to win pathing const protoFiles = glob(convertIfWinPath(ToUnixPath, '/', protoSplat)); Due to the update to pathing the imports on codegen have been changed to use \\ instead of / But it does not impact build e.g.

import { Header, HeaderAmino, HeaderSDKType } from "..\\types\\types";
import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "..\\crypto\\proof";
import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "..\\types\\params";
import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "..\\crypto\\keys";
import { Long } from "..\\..\\helpers";

bz888 avatar Nov 02 '23 10:11 bz888

@Zetazzz @pyramation any updates on this for any further changes i should make for this PR ?

bz888 avatar Nov 21 '23 12:11 bz888

fixed with #648

pyramation avatar Sep 18 '24 02:09 pyramation