From 80f32112890fb6df4ea226e9051115e171da4ead Mon Sep 17 00:00:00 2001 From: Andrey Nikiforov Date: Thu, 11 Apr 2024 20:26:19 -0700 Subject: [PATCH] fix npm (#814) --- .github/workflows/build-package.yml | 31 ++++++++++++++----------- CHANGELOG.md | 2 ++ npm/@icloudpd/darwin-arm64/package.json | 5 +++- npm/@icloudpd/darwin-x64/package.json | 5 +++- npm/@icloudpd/linux-arm/README.md | 3 +++ npm/@icloudpd/linux-arm/package.json | 20 ++++++++++++++++ npm/@icloudpd/linux-arm64/README.md | 3 +++ npm/@icloudpd/linux-arm64/package.json | 20 ++++++++++++++++ npm/@icloudpd/linux-ia32/README.md | 3 +++ npm/@icloudpd/linux-ia32/package.json | 20 ++++++++++++++++ npm/@icloudpd/linux-x64/package.json | 5 +++- npm/@icloudpd/win32-x64/package.json | 5 +++- npm/icloudpd/bin/icloudpd.js | 14 +++++++++++ scripts/build_npm | 21 +++++++++++++++++ 14 files changed, 140 insertions(+), 17 deletions(-) create mode 100644 npm/@icloudpd/linux-arm/README.md create mode 100644 npm/@icloudpd/linux-arm/package.json create mode 100644 npm/@icloudpd/linux-arm64/README.md create mode 100644 npm/@icloudpd/linux-arm64/package.json create mode 100644 npm/@icloudpd/linux-ia32/README.md create mode 100644 npm/@icloudpd/linux-ia32/package.json diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 5f16fb265..60bca7766 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -1423,7 +1423,13 @@ jobs: steps: + - name: Get image + id: get_image + run: | + echo digest=$(docker pull --platform linux/${{ matrix.prop[1] }} ${{ matrix.prop[2] }}${{ matrix.image[1] }} | grep Digest | head -n 1 | cut -d: -f 2-3 | tr -d ' ') >> $GITHUB_OUTPUT + - name: Create Config + if: steps.get_image.outputs.digest != '' run: | touch ${{ github.workspace }}/npm_config.yaml echo " @@ -1437,14 +1443,10 @@ jobs: cat ${{ github.workspace }}/npm_config.yaml - name: Start Registry + if: steps.get_image.outputs.digest != '' shell: bash run: docker run -d -p 4873:4873 -e VERDACCIO_PORT=4873 -v ${{ github.workspace }}/npm_config.yaml:/verdaccio/conf/config.yaml:ro verdaccio/verdaccio:5 - - name: Get image - id: get_image - run: | - echo digest=$(docker pull --platform linux/${{ matrix.prop[1] }} ${{ matrix.prop[2] }}${{ matrix.image[1] }} | grep Digest | head -n 1 | cut -d: -f 2-3 | tr -d ' ') >> $GITHUB_OUTPUT - - name: Make folder for compatibility if: steps.get_image.outputs.digest != '' run: | @@ -1593,7 +1595,13 @@ jobs: steps: + - name: Get image + id: get_image + run: | + echo digest=$(docker pull --platform linux/${{ matrix.prop[1] }} ${{ matrix.prop[2] }}${{ matrix.image[1] }} | grep Digest | head -n 1 | cut -d: -f 2-3 | tr -d ' ') >> $GITHUB_OUTPUT + - name: Create Config + if: steps.get_image.outputs.digest != '' run: | touch ${{ github.workspace }}/npm_config.yaml echo " @@ -1607,14 +1615,10 @@ jobs: cat ${{ github.workspace }}/npm_config.yaml - name: Start Registry + if: steps.get_image.outputs.digest != '' shell: bash run: docker run -d -p 4873:4873 -e VERDACCIO_PORT=4873 -v ${{ github.workspace }}/npm_config.yaml:/verdaccio/conf/config.yaml:ro verdaccio/verdaccio:5 - - name: Get image - id: get_image - run: | - echo digest=$(docker pull --platform linux/${{ matrix.prop[1] }} ${{ matrix.prop[2] }}${{ matrix.image[1] }} | grep Digest | head -n 1 | cut -d: -f 2-3 | tr -d ' ') >> $GITHUB_OUTPUT - - name: Make folder for compatibility if: steps.get_image.outputs.digest != '' run: | @@ -1715,7 +1719,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - registry-url: 'http://localhost:4873' + registry-url: 'http://0.0.0.0:4873' env: NODE_AUTH_TOKEN: "fake" @@ -1726,6 +1730,7 @@ jobs: echo " storage: ${{ github.workspace }}/verdaccio max_body_size: 1000mb + log: { type: stdout, format: pretty, level: http } packages: '**': access: \$anonymous @@ -1756,7 +1761,7 @@ jobs: echo "log..." cat ${{ github.workspace }}/verdaccio.log echo "curl..." - curl -v http://localhost:4873 + curl -v http://0.0.0.0:4873 - name: Publish NPM run: | @@ -1795,7 +1800,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ "windows-2019" ] + os: [ "windows-2019", "windows-2022" ] runs-on: ${{ matrix.os }} needs: [ build_npm ] defaults: diff --git a/CHANGELOG.md b/CHANGELOG.md index b4df7296e..797bee6a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- experimental: fix errors in npm packages + ## 1.17.4 (2024-04-10) - fix: restore support for SMS MFA [#803](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/803) diff --git a/npm/@icloudpd/darwin-arm64/package.json b/npm/@icloudpd/darwin-arm64/package.json index 72bc4c0c3..589373607 100644 --- a/npm/@icloudpd/darwin-arm64/package.json +++ b/npm/@icloudpd/darwin-arm64/package.json @@ -2,7 +2,10 @@ "name": "@icloudpd/darwin-arm64", "version": "0.0.1", "description": "The macOS ARM 64-bit binary for icloudpd, a iCloud Photo Downloader.", - "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, "license": "MIT", "engines": { "node": ">=12" diff --git a/npm/@icloudpd/darwin-x64/package.json b/npm/@icloudpd/darwin-x64/package.json index 57808e68a..9f168c168 100644 --- a/npm/@icloudpd/darwin-x64/package.json +++ b/npm/@icloudpd/darwin-x64/package.json @@ -2,7 +2,10 @@ "name": "@icloudpd/darwin-x64", "version": "0.0.1", "description": "The macOS 64-bit binary for icloudpd, a iCloud Photo Downloader.", - "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, "license": "MIT", "engines": { "node": ">=12" diff --git a/npm/@icloudpd/linux-arm/README.md b/npm/@icloudpd/linux-arm/README.md new file mode 100644 index 000000000..6141d3cc1 --- /dev/null +++ b/npm/@icloudpd/linux-arm/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The Linux ARM/v7 binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details. \ No newline at end of file diff --git a/npm/@icloudpd/linux-arm/package.json b/npm/@icloudpd/linux-arm/package.json new file mode 100644 index 000000000..3f5e1433b --- /dev/null +++ b/npm/@icloudpd/linux-arm/package.json @@ -0,0 +1,20 @@ +{ + "name": "@icloudpd/linux-arm", + "version": "0.0.1", + "description": "The Linux ARM/v7 binary for icloudpd, a iCloud Photo Downloader.", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "preferUnplugged": true, + "os": [ + "linux" + ], + "cpu": [ + "arm" + ] + } \ No newline at end of file diff --git a/npm/@icloudpd/linux-arm64/README.md b/npm/@icloudpd/linux-arm64/README.md new file mode 100644 index 000000000..14bae21b5 --- /dev/null +++ b/npm/@icloudpd/linux-arm64/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The Linux ARM 64-bit binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details. \ No newline at end of file diff --git a/npm/@icloudpd/linux-arm64/package.json b/npm/@icloudpd/linux-arm64/package.json new file mode 100644 index 000000000..e3607a5ae --- /dev/null +++ b/npm/@icloudpd/linux-arm64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@icloudpd/linux-arm64", + "version": "0.0.1", + "description": "The Linux ARM 64-bit binary for icloudpd, a iCloud Photo Downloader.", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "preferUnplugged": true, + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ] + } \ No newline at end of file diff --git a/npm/@icloudpd/linux-ia32/README.md b/npm/@icloudpd/linux-ia32/README.md new file mode 100644 index 000000000..6abc0c5d9 --- /dev/null +++ b/npm/@icloudpd/linux-ia32/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The Linux i386 32-bit binary for icloudpd, a iCloud Photo Downloader. See https://github.com/icloud_photo_downloader/icloud_photo_downloader for details. \ No newline at end of file diff --git a/npm/@icloudpd/linux-ia32/package.json b/npm/@icloudpd/linux-ia32/package.json new file mode 100644 index 000000000..209d3bb4b --- /dev/null +++ b/npm/@icloudpd/linux-ia32/package.json @@ -0,0 +1,20 @@ +{ + "name": "@icloudpd/linux-ia32", + "version": "0.0.1", + "description": "The Linux i386 32-bit binary for icloudpd, a iCloud Photo Downloader.", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "preferUnplugged": true, + "os": [ + "linux" + ], + "cpu": [ + "ia32" + ] + } \ No newline at end of file diff --git a/npm/@icloudpd/linux-x64/package.json b/npm/@icloudpd/linux-x64/package.json index fba4ae4b3..45bfa2dfe 100644 --- a/npm/@icloudpd/linux-x64/package.json +++ b/npm/@icloudpd/linux-x64/package.json @@ -2,7 +2,10 @@ "name": "@icloudpd/linux-x64", "version": "0.0.1", "description": "The Linux 64-bit binary for icloudpd, a iCloud Photo Downloader.", - "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, "license": "MIT", "engines": { "node": ">=12" diff --git a/npm/@icloudpd/win32-x64/package.json b/npm/@icloudpd/win32-x64/package.json index 22f36eec8..4f9840c13 100644 --- a/npm/@icloudpd/win32-x64/package.json +++ b/npm/@icloudpd/win32-x64/package.json @@ -2,7 +2,10 @@ "name": "@icloudpd/win32-x64", "version": "0.0.1", "description": "The Windows 64-bit binary for icloudpd, a iCloud Photo Downloader.", - "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, "license": "MIT", "preferUnplugged": true, "engines": { diff --git a/npm/icloudpd/bin/icloudpd.js b/npm/icloudpd/bin/icloudpd.js index 847059066..5f776b630 100644 --- a/npm/icloudpd/bin/icloudpd.js +++ b/npm/icloudpd/bin/icloudpd.js @@ -1,12 +1,25 @@ #!/usr/bin/env node "use strict"; var os = require("os"); +var fs = require("fs"); var platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; var knownPlatforms = { "linux x64 LE": { "pkgName": "@icloudpd/linux-x64", "subPath": "bin/icloudpd" }, + "linux ia32 LE": { + "pkgName": "@icloudpd/linux-ia32", + "subPath": "bin/icloudpd" + }, + "linux arm64 LE": { + "pkgName": "@icloudpd/linux-arm64", + "subPath": "bin/icloudpd" + }, + "linux arm LE": { + "pkgName": "@icloudpd/linux-arm", + "subPath": "bin/icloudpd" + }, "darwin x64 LE": { "pkgName": "@icloudpd/darwin-x64", "subPath": "bin/icloudpd" @@ -23,6 +36,7 @@ var knownPlatforms = { if (platformKey in knownPlatforms) { var { pkgName, subPath } = knownPlatforms[platformKey]; var binPath = require.resolve(`${pkgName}/${subPath}`); + fs.chmodSync(binPath, 493); require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" }); } else { throw new Error(`Unsupported platform: '${platformKey}'`); diff --git a/scripts/build_npm b/scripts/build_npm index 7f00578ac..57a2e2211 100755 --- a/scripts/build_npm +++ b/scripts/build_npm @@ -30,6 +30,27 @@ chmod +x dist/npm/@icloudpd/linux-x64/bin/icloudpd cp LICENSE.md dist/npm/@icloudpd/linux-x64/ jq --arg version $1 --from-file jq/version.jq < npm/@icloudpd/linux-x64/package.json > dist/npm/@icloudpd/linux-x64/package.json +# linux-arm64 +mkdir -p dist/npm/@icloudpd/linux-arm64/bin +cp dist/icloudpd-$1-linux-arm64 dist/npm/@icloudpd/linux-arm64/bin/icloudpd +chmod +x dist/npm/@icloudpd/linux-arm64/bin/icloudpd +cp LICENSE.md dist/npm/@icloudpd/linux-arm64/ +jq --arg version $1 --from-file jq/version.jq < npm/@icloudpd/linux-arm64/package.json > dist/npm/@icloudpd/linux-arm64/package.json + +# linux-arm +mkdir -p dist/npm/@icloudpd/linux-arm/bin +cp dist/icloudpd-$1-linux-arm32v7 dist/npm/@icloudpd/linux-arm/bin/icloudpd +chmod +x dist/npm/@icloudpd/linux-arm/bin/icloudpd +cp LICENSE.md dist/npm/@icloudpd/linux-arm/ +jq --arg version $1 --from-file jq/version.jq < npm/@icloudpd/linux-arm/package.json > dist/npm/@icloudpd/linux-arm/package.json + +# linux-ia32 +mkdir -p dist/npm/@icloudpd/linux-ia32/bin +cp dist/icloudpd-$1-linux-386 dist/npm/@icloudpd/linux-ia32/bin/icloudpd +chmod +x dist/npm/@icloudpd/linux-ia32/bin/icloudpd +cp LICENSE.md dist/npm/@icloudpd/linux-ia32/ +jq --arg version $1 --from-file jq/version.jq < npm/@icloudpd/linux-ia32/package.json > dist/npm/@icloudpd/linux-ia32/package.json + # macos x64 mkdir -p dist/npm/@icloudpd/darwin-x64/bin cp dist/icloudpd-$1-macos-amd64 dist/npm/@icloudpd/darwin-x64/bin/icloudpd