diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index d9fa56c75..117e7adba 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -77,6 +77,7 @@ jobs: - name: Build Release Executables (MacOS) run: | + pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile icloudpd.py icloud.py --name icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile exec.py --name icloudpd-ex-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 if: ${{ matrix.os == 'macos-latest' }} @@ -156,13 +157,55 @@ jobs: path: | dist - - name: Publish + - name: Publish PyPI env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python3 -m twine upload --non-interactive --disable-progress-bar dist/*.whl + publish_npm: + runs-on: ubuntu-latest + needs: [get_version,build] + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '16.x' + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Make Package + run: | + cp -r npm dist/npm + cp LICENSE.md dist/npm/icloudpd + mkdir dist/npm/@icloudpd/win32-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-windows-amd64.exe dist/npm/@icloudpd/win32-x64/bin/icloudpd.exe + cp LICENSE.md dist/npm/@icloudpd/win32-x64/ + mkdir dist/npm/@icloudpd/linux-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-linux-amd64 dist/npm/@icloudpd/linux-x64/bin/icloudpd + cp LICENSE.md dist/npm/@icloudpd/linux-x64/ + mkdir dist/npm/@icloudpd/darwin-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 dist/npm/@icloudpd/darwin-x64/bin/icloudpd + cp LICENSE.md dist/npm/@icloudpd/darwin-x64/ + + - name: Publish NPM + run: | + npm publish dist/npm/@icloudpd/linux-x64 + npm publish dist/npm/@icloudpd/win32-x64 + npm publish dist/npm/@icloudpd/darwin-x64 + npm publish dist/npm/icloudpd + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + release: needs: [get_version, build] runs-on: ubuntu-latest diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 4cd3e542b..0ee614fb1 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -103,6 +103,7 @@ jobs: - name: Build Release Executables (MacOS) run: | + pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile icloudpd.py icloud.py --name icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 pyinstaller --collect-all keyrings.alt --hidden-import pkgutil --collect-all tzdata --onefile exec.py --name icloudpd-ex-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 if: ${{ matrix.os == 'macos-latest' }} @@ -143,3 +144,43 @@ jobs: tags: | icloudpd/icloudpd:latest icloudpd/icloudpd:${{needs.get_version.outputs.icloudpd_version}} + + build_npm: + runs-on: ubuntu-latest + needs: [get_version,build] + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '16.x' + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: icloudpd-${{needs.get_version.outputs.icloudpd_version}}-artifacts + path: | + dist + + - name: Make Package + run: | + cp -r npm dist/npm + cp LICENSE.md dist/npm/icloudpd + mkdir dist/npm/@icloudpd/win32-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-windows-amd64.exe dist/npm/@icloudpd/win32-x64/bin/icloudpd.exe + cp LICENSE.md dist/npm/@icloudpd/win32-x64/ + mkdir dist/npm/@icloudpd/linux-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-linux-amd64 dist/npm/@icloudpd/linux-x64/bin/icloudpd + cp LICENSE.md dist/npm/@icloudpd/linux-x64/ + mkdir dist/npm/@icloudpd/darwin-x64/bin + mv dist/icloudpd-${{needs.get_version.outputs.icloudpd_version}}-macos-amd64 dist/npm/@icloudpd/darwin-x64/bin/icloudpd + cp LICENSE.md dist/npm/@icloudpd/darwin-x64/ + + - name: Publish NPM (Dry-run) + run: | + npm publish dist/npm/@icloudpd/linux-x64 --dry-run=true + npm publish dist/npm/@icloudpd/win32-x64 --dry-run=true + npm publish dist/npm/@icloudpd/darwin-x64 --dry-run=true + npm publish dist/npm/icloudpd --dry-run=true diff --git a/.gitignore b/.gitignore index a9cbc0fcc..4fabbc7f2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ icloudpd-latest-py2.py3-none-any.whl .venv venv *.spec +# exclude since there is no js development, just for local testing npm packaging +node_modules/ +/package.json +/package-lock.json diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4cf6eca..4437984b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- experimental: add support for distributing `icloudpd` with [npm](README_NPM.md) package manager + ## 1.13.0 (2023-04-21) - fix: only delete files successfully downloaded [#614](https://github.com/icloud-photos-downloader/icloud_photos_downloader/issues/614) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fc8df18d..dc03d7d7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -133,7 +133,7 @@ When testing a bugfix it is important to test the faulty behavior and also the e ## How to release We have github actions taking care for building, testing, and releasing software. Building and testing are happenning automatically on git pushed, pull requests, and merges. For releases the following steps are manual: -- Bump version in setup.py and any .md files +- Bump version in setup.py, all .md files, and all package.json files in npm subfolder - Update CHANGELOG.md with date of the release - Update CHANGELOG.md with release changes if they were not added with commits - Commit & push/merge changes diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md diff --git a/README.md b/README.md index c9ee2b1c9..08f662183 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ - A command-line tool to download all your iCloud photos. - Works on Linux, Windows, and MacOS; laptop, desktop, and NAS -- Available as an executable for direct downloading and through package managers/ecosystems ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md)) +- Available as an executable for direct downloading and through package managers/ecosystems ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md), Experimental: [Npm](README_NPM.md)) - Developed and maintained by volunteers (we are always looking for [help](CONTRIBUTING.md)). We aim to release new versions once a week (Friday), if there is something worth delivering. @@ -11,7 +11,7 @@ We aim to release new versions once a week (Friday), if there is something worth There are three ways to run `icloudpd`: 1. Download executable for your platform from the Github [Release](https://github.com/icloud-photos-downloader/icloud_photos_downloader/releases) and run it -1. Use package manager to install, update, and, in some cases, run ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md)) +1. Use package manager to install, update, and, in some cases, run ([Docker](README_DOCKER.md), [PyPI](README_PYPI.md), Experimental: [Npm](README_NPM.md)) 1. Build and run from the source ## Features diff --git a/README_DOCKER.md b/README_DOCKER.md index b7be4c1b5..f7b1cb8e7 100644 --- a/README_DOCKER.md +++ b/README_DOCKER.md @@ -1,4 +1,4 @@ -# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) A command-line tool to download all your iCloud photos. diff --git a/README_NPM.md b/README_NPM.md new file mode 100644 index 000000000..c4ede1864 --- /dev/null +++ b/README_NPM.md @@ -0,0 +1,23 @@ +# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) + +A command-line tool to download all your iCloud photos. + +## [EXPERIMENTAL] Install, Run, and Use + +``` sh +npx icloudpd --directory /data --username my@email.address --watch-with-interval 3600 +``` + +Synchronization logic can be adjusted with command-line parameters. Run the following to get full list: + +``` sh +npx icloudpd --help +``` + +## Getting Node and Npm + +You can get NodeJS with accompanying Npm from [Official site](https://nodejs.org/en/download). + +## More + +See [Project page](https://github.com/icloud-photos-downloader/icloud_photos_downloader/) for more details. diff --git a/README_PYPI.md b/README_PYPI.md index 80e7a19f1..e802b3c82 100644 --- a/README_PYPI.md +++ b/README_PYPI.md @@ -1,8 +1,8 @@ -# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) +# iCloud Photos Downloader [![Quality Checks](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Quality%20Checks/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/quality-checks.yml) [![Multi Platform Docker Build](https://github.com/icloud-photos-downloader/icloud_photos_downloader/workflows/Docker%20Build/badge.svg)](https://github.com/icloud-photos-downloader/icloud_photos_downloader/actions/workflows/docker-build.yml) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) A command-line tool to download all your iCloud photos. -## Install, Run, and Use +## Install ``` sh pip install icloudpd diff --git a/npm/@icloudpd/darwin-x64/README.md b/npm/@icloudpd/darwin-x64/README.md new file mode 100644 index 000000000..0679e6fea --- /dev/null +++ b/npm/@icloudpd/darwin-x64/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The macOS 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/darwin-x64/package.json b/npm/@icloudpd/darwin-x64/package.json new file mode 100644 index 000000000..454f6ff4f --- /dev/null +++ b/npm/@icloudpd/darwin-x64/package.json @@ -0,0 +1,17 @@ +{ + "name": "@icloudpd/darwin-x64", + "version": "1.13.0", + "description": "The macOS 64-bit binary for icloudpd, a iCloud Photo Downloader.", + "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "preferUnplugged": true, + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ] + } \ No newline at end of file diff --git a/npm/@icloudpd/linux-x64/README.md b/npm/@icloudpd/linux-x64/README.md new file mode 100644 index 000000000..14ba64934 --- /dev/null +++ b/npm/@icloudpd/linux-x64/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The Linux 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-x64/package.json b/npm/@icloudpd/linux-x64/package.json new file mode 100644 index 000000000..e3250d7dc --- /dev/null +++ b/npm/@icloudpd/linux-x64/package.json @@ -0,0 +1,17 @@ +{ + "name": "@icloudpd/linux-x64", + "version": "1.13.0", + "description": "The Linux 64-bit binary for icloudpd, a iCloud Photo Downloader.", + "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "preferUnplugged": true, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] + } \ No newline at end of file diff --git a/npm/@icloudpd/win32-x64/README.md b/npm/@icloudpd/win32-x64/README.md new file mode 100644 index 000000000..7e17d5782 --- /dev/null +++ b/npm/@icloudpd/win32-x64/README.md @@ -0,0 +1,3 @@ +# icloudpd + +The Windows 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/win32-x64/package.json b/npm/@icloudpd/win32-x64/package.json new file mode 100644 index 000000000..d9b8e91f2 --- /dev/null +++ b/npm/@icloudpd/win32-x64/package.json @@ -0,0 +1,17 @@ +{ + "name": "@icloudpd/win32-x64", + "version": "1.13.0", + "description": "The Windows 64-bit binary for icloudpd, a iCloud Photo Downloader.", + "repository": "https://github.com/icloud_photo_downloader/icloud_photo_downloader", + "license": "MIT", + "preferUnplugged": true, + "engines": { + "node": ">=12" + }, + "os": [ + "win32" + ], + "cpu": [ + "x64" + ] + } \ No newline at end of file diff --git a/npm/icloudpd/README.md b/npm/icloudpd/README.md new file mode 100644 index 000000000..23c7e29d3 --- /dev/null +++ b/npm/icloudpd/README.md @@ -0,0 +1,3 @@ +# icloudpd + +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/bin/icloudpd.js b/npm/icloudpd/bin/icloudpd.js new file mode 100644 index 000000000..9b724d2f1 --- /dev/null +++ b/npm/icloudpd/bin/icloudpd.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node +"use strict"; +var os = require("os"); +var platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; +var knownPlatforms = { + "linux x64 LE": { + "pkgName": "@icloudpd/linux-x64", + "subPath": "bin/icloudpd" + }, + "darwin x64 LE": { + "pkgName": "@icloudpd/darwin-x64", + "subPath": "bin/icloudpd" + }, + "win32 x64 LE": { + "pkgName": "@icloudpd/win32-x64", + "subPath": "bin/icloudpd.exe" + } +}; +if (platformKey in knownPlatforms) { + var { pkgName, subPath } = knownPlatforms[platformKey]; + var binPath = require.resolve(`${pkgName}/${subPath}`); + require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" }); +} else { + throw new Error(`Unsupported platform: ${platformKey}`); +} \ No newline at end of file diff --git a/npm/icloudpd/package.json b/npm/icloudpd/package.json new file mode 100644 index 000000000..44285554b --- /dev/null +++ b/npm/icloudpd/package.json @@ -0,0 +1,30 @@ +{ + "name": "icloudpd", + "version": "1.13.0", + "description": "iCloud Photo Downloader", + "engines": { + "node": ">=12" + }, + "bin": { + "icloudpd": "bin/icloudpd.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/icloud_photos_downloader/icloud_photos_downloader.git" + }, + "keywords": [ + "icloud", + "photo" + ], + "author": "The iCloud Photo Downloader Authors", + "license": "MIT", + "bugs": { + "url": "https://github.com/icloud_photos_downloader/icloud_photos_downloader/issues" + }, + "homepage": "https://github.com/icloud_photos_downloader/icloud_photos_downloader#readme", + "optionalDependencies": { + "@icloudpd/linux-x64": "1.13.0", + "@icloudpd/win32-x64": "1.13.0", + "@icloudpd/darwin-x64": "1.13.0" + } +} diff --git a/setup.py b/setup.py index 66f2b0830..a049ab9f7 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ description=( "icloudpd is a command-line tool to download photos and videos from iCloud." ), - maintainer="The iCloud Authors", + maintainer="The iCloud Photo Downloader Authors", maintainer_email=" ", license="MIT", packages=find_packages(),