🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

create-wps-airscript

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-wps-airscript

快速创建wps airscript项目

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
-80%
Maintainers
1
Weekly downloads
 
Created
Source

create-wps-airscript

介绍

用于快速创建wps airscript项目,使用日常流行的前端开发方式进行开发,最后将其打包成适合airscript的脚本代码。

相对于直接在WPS AirScript脚本编辑器中写代码,优势在于:

  • 支持typescript
  • 支持使用任意npm包
  • 支持使用airscript不支持的语法(官方文档),最终转换成es5
  • 使用rollup打包,可压缩混淆代码

项目默认使用 wps-airscript-router ,可定义脚本内部路由,并通过webhook传递不同的路由参数调用对应的处理函数,以实现复杂的功能。你也可不使用或手动移除此包,只进行简单的脚本开发。

项目中自带安装wps-airscript-types,可使用airscript中全局变量的类型声明和代码提示。

安装使用

npx create-wps-airscript my-airscript-project
cd my-airscript-project
npm install

然后就可以编辑src/index.ts,编写你的脚本了。

构建airscript脚本

npm run build

dist目录下会生成airscript脚本文件,包含未经压缩混淆的index.js和压缩混淆后的index.min.js。根据你的需要,将其复制粘贴到WPS AirScript脚本编辑器中即可。

配置

{
    "version": "",
    "copyright": "",
    "description": "",
    "scripts": ["src/index.ts"]
}

说明:

  • version:版本号,会作为注释添加到最终生成的代码前。
  • copyright:版权声明,会作为注释添加到最终生成的代码前。
  • description:脚本描述,会作为注释添加到最终生成的代码前。
  • scripts:脚本入口文件,重要,必填,默认为["src/index.ts"],你也可以修改为你定义的文件名。如果你需要生成多个脚本,可以配置多个入口文件,如["src/index.ts", "src/other.ts"],编译后会在dist目录下生成index.js、index.min.js、other.js、other.min.js。

Keywords

wps

FAQs

Package last updated on 04 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts