Skip to content

Commit

Permalink
fix npm (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyNikiforov authored Apr 12, 2024
1 parent 83b6d81 commit 80f3211
Show file tree
Hide file tree
Showing 14 changed files with 140 additions and 17 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -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: |
Expand Down Expand Up @@ -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 "
Expand All @@ -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: |
Expand Down Expand Up @@ -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"

Expand All @@ -1726,6 +1730,7 @@ jobs:
echo "
storage: ${{ github.workspace }}/verdaccio
max_body_size: 1000mb
log: { type: stdout, format: pretty, level: http }
packages:
'**':
access: \$anonymous
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion npm/@icloudpd/darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion npm/@icloudpd/darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions npm/@icloudpd/linux-arm/README.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions npm/@icloudpd/linux-arm/package.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
3 changes: 3 additions & 0 deletions npm/@icloudpd/linux-arm64/README.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions npm/@icloudpd/linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
3 changes: 3 additions & 0 deletions npm/@icloudpd/linux-ia32/README.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions npm/@icloudpd/linux-ia32/package.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
5 changes: 4 additions & 1 deletion npm/@icloudpd/linux-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion npm/@icloudpd/win32-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
14 changes: 14 additions & 0 deletions npm/icloudpd/bin/icloudpd.js
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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}'`);
Expand Down
21 changes: 21 additions & 0 deletions scripts/build_npm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 80f3211

Please sign in to comment.