Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Windows #141

Open
Starmania opened this issue Nov 28, 2024 · 3 comments
Open

Building on Windows #141

Starmania opened this issue Nov 28, 2024 · 3 comments

Comments

@Starmania
Copy link
Contributor

Starmania commented Nov 28, 2024

Hey Tim, I've been thinking about this for a long time, and Oclif is now able to build (and pack) on windows, so here we are...

Would it be interesting to make the build compatible between windows/linux?

I've done a few tests and according to the Oclif example, here's which version Httptoolkit-server should have:
I only include what should be updated for the sake of brievity

  "dependencies": {
    "@oclif/core": "^4", // from "@oclif/command ^1.5.2
    "@oclif/plugin-help": "^6", //from ^2.2.3
    "@oclif/plugin-plugins": "^5"
    "@oclif/plugin-update": "^4" // from ^1.3.8
  },
  "devDependencies": {
    "@oclif/prettier-config": "^0.2.1",
    "@oclif/test": "^4",
    "eslint": "^8",
    "eslint-config-oclif": "^5",
    "eslint-config-oclif-typescript": "^3",
    "eslint-config-prettier": "^9",
    "oclif": "^4",
    "shx": "^0.3.3",
    "typescript": "^5" // from ~4.7, still compatible
  },
full package.json
{
  "name": "example-cli",
  "description": "A new CLI generated with oclif",
  "version": "0.0.0",
  "author": "Starmania",
  "bin": {
    "text-cli": "./bin/run.js"
  },
  "dependencies": {
    "@oclif/core": "^4",
    "@oclif/plugin-help": "^6",
    "@oclif/plugin-plugins": "^5"
  },
  "devDependencies": {
    "@oclif/prettier-config": "^0.2.1",
    "@oclif/test": "^4",
    "@types/chai": "^4",
    "@types/mocha": "^10",
    "@types/node": "^18",
    "chai": "^4",
    "eslint": "^8",
    "eslint-config-oclif": "^5",
    "eslint-config-oclif-typescript": "^3",
    "eslint-config-prettier": "^9",
    "mocha": "^10",
    "oclif": "^4",
    "shx": "^0.3.3",
    "ts-node": "^10",
    "typescript": "^5"
  },
  "engines": {
    "node": ">=18.0.0"
  },
  "files": [
    "/bin",
    "/dist",
    "/oclif.manifest.json"
  ],
  "license": "MIT",
  "main": "dist/index.js",
  
  "oclif": {
    "bin": "text-cli",
    "dirname": "text-cli",
    "commands": "./dist/commands",
    "plugins": [
      "@oclif/plugin-help",
      "@oclif/plugin-plugins"
    ],
    "topicSeparator": " ",
    "topics": {
      "hello": {
        "description": "Say hello to the world and others"
      }
    }
  },
  "scripts": {
    "build": "shx rm -rf dist && tsc -b",
    "lint": "eslint . --ext .ts",
    "postpack": "shx rm -f oclif.manifest.json",
    "posttest": "npm run lint",
    "prepack": "oclif manifest && oclif readme",
    "test": "mocha --forbid-only \"test/**/*.test.ts\"",
    "version": "oclif readme && git add README.md"
  },
  "types": "dist/index.d.ts"
}

I'm ok to write a PR for that because I know it's boring stuff

@pimterry
Copy link
Member

Unfortunately there are quite a few other breaking changes in that Oclif update that would need handling first to make this possible, but I'm definitely interested in going in that direction though if we can so you're welcome to investigate if you're interested. I've had oclif/oclif#828 for example in my todo list for a long while but I've never found time to look into it properly.

What's the state of this if you build on Windows currently, does it just fail unavoidably?

@Starmania
Copy link
Contributor Author

Starmania commented Nov 29, 2024

The current version of Oclif will refuse to run on windows. And just upgrading these libs is not possible. There are changes to do before that. 3 majors versions is a little bit too much :)

But upgrading to the latest version of oclif/command is possible without any problem. oclif/core is what replace oclif/command, but I didn't try to go further that oclif/command for now

@Starmania
Copy link
Contributor Author

Starmania commented Nov 29, 2024

Ok, it seemes that I was a little bit too exited to see that, indeed, you could build for windows, and get the installer, but you can't "pack"...
I will check if this is possible with an environment like MYSYS2 (Cygwin on steroïds). So my PR won't update Oclif version but just provide instructions on how to build on Windows... Arggh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants