Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 1.81 KB

File metadata and controls

19 lines (16 loc) · 1.81 KB

Package Manager

A package manager for Scripting app that allows users to install packages from npm and download the bundled JS files.

Usage

  • Search for packages on npm by name in the search page.
  • Select the package you want to install.
  • Click the install button, and the package manager will download the bundled JS file of the package.
  • The Package Manager will create a folder with the package name in the packages folder under Scripting app's iCloud Documents (if iCloud is enabled) or Scripting's App Group Documents directory, and save the downloaded JS file as index.js in that folder, along with the package.json file.
  • You need to use the "Add to Script" feature of the Package Manager to add the downloaded package to your script. It will be added as a symlink to the script's modules directory, e.g., packages/dayjs/index.js will be symlinked to scripts/your_script/modules/dayjs.js.
  • You can use these modules in your script by importing them with import pkgName from './modules/pkgName', for example: import dayjs from './modules/dayjs'.

Notes

  • Currently, when searching on npm and trying to download the bundled JS file from unpkg.com, you may encounter some packages that do not have a bundled file or the bundled file does not meet expectations.
  • Currently, .d.ts files are not supported for download, but may be supported in the future.
  • If the package is pure JS logic and does not depend on browser or Node.js, it can be used directly in Scripting app. Node.js packages are not supported at the moment, and packages that depend on browser APIs can be called through WebViewController.
  • Currently, automatic installation of package dependencies is not supported. Please install packages that provide bundled single-file versions.

Contribution

Contributions to improve the Package Manager are welcome.