Skip to content

Commit

Permalink
feat(build): 添加全域名通用脚本打包 user.common.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Dec 5, 2023
1 parent 63b58d5 commit 81f2cfa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Userscript Auto Releases
on:
push:
tags:
- "*"
- '*'

jobs:
build:
Expand Down Expand Up @@ -40,6 +40,6 @@ jobs:
- name: Create release
uses: ncipollo/release-action@v1
with:
artifactContentType: "html/text"
artifacts: "./release/core.js,./release/ocs.user.js"
bodyFile: "./CHANGELOG_CURRENT.md"
artifactContentType: 'html/text'
artifacts: './release/core.js,./release/ocs.user.js./release/ocs.common.user.js'
bodyFile: './CHANGELOG_CURRENT.md'
22 changes: 17 additions & 5 deletions scripts/build-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ async function createUserJs(cb) {
description:
`OCS(online-course-script) 网课助手,官网 https://docs.ocsjs.com ,专注于帮助大学生从网课中释放出来。
让自己的时间把握在自己的手中,拥有人性化的操作页面,流畅的步骤提示,支持
${ocs.definedProjects()
${ocs
.definedProjects()
.filter((p) => p.studyProject)
.map((s) => `【${s.name}】`)
.join(' ')},等网课的学习,作业。具体的功能请查看脚本悬浮窗中的教程页面。`.replace(/\n+/g, ' ').replace(/\t+/g, ' '),
.join(' ')},等网课的学习,作业。具体的功能请查看脚本悬浮窗中的教程页面。`
.replace(/\n+/g, ' ')
.replace(/\t+/g, ' '),
author: 'enncy',
license: 'MIT',
namespace: 'https://enncy.cn',
Expand Down Expand Up @@ -99,9 +102,10 @@ async function createUserJs(cb) {
dist: path.join(__dirname, distPath, 'ocs.user.js')
});

await createUserScript(createOptions());
const opts = createOptions();
const opts = createOptions()

/** 创建调试脚本 */
const devOpts = createOptions();
opts.parseRequire = false;
opts.parseResource = false;
opts.metadata.name = opts.metadata.name + '(dev)';
Expand All @@ -115,7 +119,15 @@ async function createUserJs(cb) {
path.join(distResolvedPath, 'style.css')
);

await createUserScript(opts);
/** 创建全Connect域名通用脚本 */
const commonOpts = createOptions();
commonOpts.metadata.name = commonOpts.metadata.name + ' - 全域名通用版';
commonOpts.metadata.connect = ['*'];
commonOpts.metadata.antifeature = undefined
commonOpts.dist = path.join(distResolvedPath, 'ocs.common.user.js');


await Promise.all([createUserScript(opts), createUserScript(devOpts), createUserScript(commonOpts)]);
}

exports.default = series(cleanOutput, buildPackages, createUserJs);

0 comments on commit 81f2cfa

Please sign in to comment.