xseman / bysquare

Encode & Decode "PAY by square" QR string.
https://xseman.github.io/bysquare/
Apache License 2.0
31 stars 6 forks source link

Unsupported platform #4

Closed pkempec closed 2 years ago

pkempec commented 2 years ago

npm install bysquare

npm ERR! code EBADPLATFORM npm ERR! notsup Unsupported platform for bysquare@1.1.0: wanted {"os":"darwin,linux"} (current: {"os":"win32","arch":"x64"}) npm ERR! notsup Valid OS: darwin,linux npm ERR! notsup Valid Arch: undefined npm ERR! notsup Actual OS: win32 npm ERR! notsup Actual Arch: x64

Why there was set restriction for linux darwin only?

https://github.com/xseman/bysquare/blob/231689eecc9d6a537f6ad04f2acdc647210c5d0c/package.json#L53-L56

xseman commented 2 years ago

Thanks @pkempec for creating the issue.

My testing is limited to Unix platforms. If you're interested in Windows platforms, you can test the project on your computer, but my request is to test the package on w7, w8, w10, w11.

Would you like to help?

The test is simple, clone the repo, add win32 to package.json and run npm test.

If all goes well, we will add this platform as well.

pkempec commented 2 years ago

I tried to created PR with fix, but it is locked.

The issue lies with Linux commands you are using (rm, chmod).

There is package that can handle such executions in both OS (win and linux).

Please consider changing the package.json this way:

{
    "name": "bysquare",
    "description": "It's a national standard for payment QR codes adopted by Slovak Banking Association (SBA)",
    "version": "1.1.0",
    "license": "Apache-2.0",
    "author": "Filip Seman <filip.seman@protonmail.com>",
    "keywords": [
        "pay by square",
        "by square",
        "paybysquare",
        "bysquare",
        "payments",
        "qr-string",
        "qr",
        "cli"
    ],
    "repository": {
        "type": "git",
        "url": "git+https://github.com/xseman/bysquare.git"
    },
    "homepage": "https://github.com/xseman/bysquare#readme",
    "funding": "https://github.com/sponsors/xseman",
    "scripts": {
        "build": "shx rm -rf ./lib && tsc && shx chmod +x ./lib/cli.js",
        "test": "npm run build && xv ./lib",
        "cli:local": "npm link bysquare",
        "version": "git flow release start v$npm_package_version",
        "prepare": "",
        "prepublishOnly": "npm run build",
        "preversion": "git checkout develop",
        "postversion": ""
    },
    "dependencies": {
        "lzma-native": "8.0.6"
    },
    "devDependencies": {
        "@types/lzma-native": "^4.0.1",
        "@types/node": "14.14.20",
        "shx": "^0.3.4",
        "typescript": "4.5.5",
        "xv": "1.1.1"
    },
    "files": [
        "lib",
        "!lib/*.test.*"
    ],
    "bin": "lib/cli.js",
    "main": "lib/index.js",
    "types": "lib/index.d.ts",
    "engines": {
        "node": ">=14.14.x",
        "npm": ">= 7.0"
    },
    "os": [
        "darwin",
        "linux",
        "win32"
    ]
}

There are 2 changes: added lib shx -> "shx": "^0.3.4", updated build script -> "build": "shx rm -rf ./lib && tsc && shx chmod +x ./lib/cli.js", (both && are important)

After these changes the build and test pass correctly.

Please let me know if you do release. With the current version it is not possible to install and use your lib on win as a 3rd party.

xseman commented 2 years ago

I prefer native built-ins. For Windows there is git bash or wsl2, which includes common Unix utilities like, rm and chmod.

pkempec commented 2 years ago

Sure, make your choose. It was actually the first thing a found. I did not search much. Will you handle the update and release today?

xseman commented 2 years ago

I really can't unless someone help me test w7, w8, w10, w11 platforms.

pkempec commented 2 years ago

I already wrote the test passed after the changes I made. npm run test I am using win 10. If you prefer any other command wrapper it should work also.

pkempec commented 2 years ago

Seems it stuck. Any reason for not releasing fixed version?

xseman commented 2 years ago

If w10 is ok we have 3 more platforms to test.

pkempec commented 2 years ago

hmm, ok please consider is as irrelevant.

xseman commented 2 years ago

You can test v1.2.1

The Github workflow supports Windows Server 2022, I have added tests that pass, but I do not guarantee support for any other Windows platform other than the latest Github provides.