initial commit
20
.edaignore
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/.git/
|
||||||
|
/.husky/
|
||||||
|
/.vscode/
|
||||||
|
/build/
|
||||||
|
/config/
|
||||||
|
/coverage/
|
||||||
|
/node_modules/
|
||||||
|
/src/
|
||||||
|
/.editorconfig
|
||||||
|
/.eslintcache
|
||||||
|
/.eslintrc.js
|
||||||
|
/.gitattributes
|
||||||
|
/.gitignore
|
||||||
|
/.npmrc
|
||||||
|
/.prettierignore
|
||||||
|
/.prettierrc.js
|
||||||
|
/package-lock.json
|
||||||
|
/package.json
|
||||||
|
/tsconfig.json
|
||||||
|
debug.log
|
||||||
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{html,js,json,ts,css}]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.txt]
|
||||||
|
insert_final_newline = false
|
||||||
|
|
||||||
|
[*.{md,yml,yaml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
14
.eslintrc.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: ['eslint-plugin-tsdoc'],
|
||||||
|
extends: ['alloy', 'alloy/typescript'],
|
||||||
|
ignorePatterns: ['/build/dist/', '/coverage/', '/dist/', '/node_modules/', '/.eslintcache', 'debug.log'],
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'no-param-reassign': 'off',
|
||||||
|
'max-params': 'off',
|
||||||
|
'tsdoc/syntax': 'warn',
|
||||||
|
},
|
||||||
|
root: true,
|
||||||
|
};
|
||||||
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.json linguist-language=JSON-with-Comments
|
||||||
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/.vscode/*
|
||||||
|
!/.vscode/extensions.json
|
||||||
|
!/.vscode/settings.json
|
||||||
|
/coverage/
|
||||||
|
/dist/
|
||||||
|
/node_modules/
|
||||||
|
/.eslintcache
|
||||||
|
debug.log
|
||||||
1
.husky/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
_
|
||||||
3
.husky/pre-commit
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
npm install
|
||||||
|
npx lint-staged
|
||||||
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/eext-jiepei.iml" filepath="$PROJECT_DIR$/.idea/eext-jiepei.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
2
.npmrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# 位于中国大陆网络环境的用户,可以取消下行的注释,以获得更快的 NPM 安装速度
|
||||||
|
# registry=https://registry.npmmirror.com
|
||||||
6
.prettierignore
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/build/dist/
|
||||||
|
/coverage/
|
||||||
|
/dist/
|
||||||
|
/node_modules/
|
||||||
|
/.eslintcache
|
||||||
|
debug.log
|
||||||
28
.prettierrc.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/** @type {import("prettier").Options} */
|
||||||
|
module.exports = {
|
||||||
|
printWidth: 150,
|
||||||
|
tabWidth: 4,
|
||||||
|
useTabs: true,
|
||||||
|
semi: true,
|
||||||
|
singleQuote: true,
|
||||||
|
quoteProps: 'preserve',
|
||||||
|
trailingComma: 'all',
|
||||||
|
bracketSpacing: true,
|
||||||
|
bracketSameLine: false,
|
||||||
|
arrowParens: 'always',
|
||||||
|
rangeStart: 0,
|
||||||
|
rangeEnd: Infinity,
|
||||||
|
requirePragma: false,
|
||||||
|
insertPragma: false,
|
||||||
|
proseWrap: 'preserve',
|
||||||
|
htmlWhitespaceSensitivity: 'css',
|
||||||
|
endOfLine: 'lf',
|
||||||
|
embeddedLanguageFormatting: 'auto',
|
||||||
|
singleAttributePerLine: false,
|
||||||
|
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
||||||
|
importOrder: ['<THIRD_PARTY_MODULES>', '^[./]'],
|
||||||
|
importOrderSeparation: true,
|
||||||
|
importOrderSortSpecifiers: true,
|
||||||
|
importOrderGroupNamespaceSpecifiers: false,
|
||||||
|
importOrderCaseInsensitive: false,
|
||||||
|
};
|
||||||
3
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"recommendations": ["editorconfig.editorconfig", "streetsidesoftware.code-spell-checker", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
|
||||||
|
}
|
||||||
47
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"eslint.validate": ["javascript", "typescript"],
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": "explicit"
|
||||||
|
},
|
||||||
|
"prettier.requireConfig": true,
|
||||||
|
"files.associations": {
|
||||||
|
"*.json": "jsonc"
|
||||||
|
},
|
||||||
|
"cSpell.words": [
|
||||||
|
"easyeda",
|
||||||
|
"edaignore",
|
||||||
|
"EDMT",
|
||||||
|
"eext",
|
||||||
|
"ELIB",
|
||||||
|
"EPCB",
|
||||||
|
"EPNL",
|
||||||
|
"ESCH",
|
||||||
|
"eslintcache",
|
||||||
|
"ESYS",
|
||||||
|
"Gitee",
|
||||||
|
"IDMT",
|
||||||
|
"iife",
|
||||||
|
"ILIB",
|
||||||
|
"IPCB",
|
||||||
|
"IPNL",
|
||||||
|
"ISCH",
|
||||||
|
"ISYS",
|
||||||
|
"jlceda",
|
||||||
|
"lceda",
|
||||||
|
"nodebuffer",
|
||||||
|
"npmrc",
|
||||||
|
"OSHW",
|
||||||
|
"outdir",
|
||||||
|
"SZJLC",
|
||||||
|
"TDMT",
|
||||||
|
"TLIB",
|
||||||
|
"TPCB",
|
||||||
|
"TPNL",
|
||||||
|
"trivago",
|
||||||
|
"TSCH",
|
||||||
|
"tsdoc",
|
||||||
|
"TSYS"
|
||||||
|
]
|
||||||
|
}
|
||||||
7
CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 1.0.1
|
||||||
|
|
||||||
|
放弃使用 CDN,构建扩展前使用 Tailwind CLI 编译 CSS
|
||||||
|
|
||||||
|
# 1.0.0
|
||||||
|
|
||||||
|
初始版本
|
||||||
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [2024] JLCEDA <support[#]lceda.cn>
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
34
README.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# 捷配下单助手
|
||||||
|
|
||||||
|
一键前往捷配下单 PCB,支持保存下单偏好,~~这很牛头人了~~
|
||||||
|
|
||||||
|
## 如何使用
|
||||||
|
|
||||||
|
### 安装扩展
|
||||||
|
|
||||||
|
参考 [嘉立创 EDA 用户指南](https://prodocs.lceda.cn/cn/api/user-guide/using-extension.html#%E5%AE%89%E8%A3%85%E6%89%A9%E5%B1%95) 安装扩展。
|
||||||
|
|
||||||
|
*使用本扩展的“检查更新”功能需要给予扩展“外部交互”权限。*
|
||||||
|
|
||||||
|
### 使用扩展
|
||||||
|
|
||||||
|
**本扩展仅在 PCB 界面激活**,菜单栏中将出现“捷配”菜单,“下单”子菜单为本扩展的主界面。
|
||||||
|
|
||||||
|
可直接在主界面选择 PCB 生产工艺参数,点击“前往下单”按钮即可前往捷配下单 PCB 页面。
|
||||||
|
|
||||||
|
> **下单前务必仔细检查所有项目是否符合预期,捷配官网可能与本扩展显示存在出入,本扩展不对工艺组合可行性进行验证,以捷配官网为准。**
|
||||||
|
|
||||||
|
**本扩展提供“工艺预设”功能**,可将常用的工艺参数保存为预设,方便下次使用:
|
||||||
|
- **【新建预设】**在“下单”界面顶部“订单工艺预设”面板新建预设,设置工艺参数与个性化服务选项,点击底部“保存预设”按钮即可保存;
|
||||||
|
- **【使用预设】**在“下单”界面顶部“订单工艺预设”面板选择已有的预设,将自动应用此前保存的参数与个性化选项;
|
||||||
|
- **【删除预设】**在“下单”界面顶部“订单工艺预设”面板选择已有的预设,点击底部“删除预设”按钮即可删除。
|
||||||
|
|
||||||
|
**本扩展支持自动计算 PCB 尺寸**,点击“选择板框”按钮后在画布上选择板框图元,即可自动计算板框大小。
|
||||||
|
|
||||||
|
## 即将推出的新特性
|
||||||
|
|
||||||
|
- 自动识别板子大小【Coming s∞n】
|
||||||
|
|
||||||
|
## 开源许可
|
||||||
|
|
||||||
|
本扩展使用 [Apache License 2.0](https://choosealicense.com/licenses/apache-2.0/) 开源许可协议。
|
||||||
2
build/dist/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.zip
|
||||||
|
*.eext
|
||||||
90
build/packaged.ts
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import fs from 'fs-extra';
|
||||||
|
import ignore from 'ignore';
|
||||||
|
import JSZip from 'jszip';
|
||||||
|
|
||||||
|
import * as extensionConfig from '../extension.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将多行字符串拆分成字符串数组
|
||||||
|
*
|
||||||
|
* @param str - 多行字符串
|
||||||
|
* @returns 字符串数组
|
||||||
|
*/
|
||||||
|
function multiLineStrToArray(str: string): Array<string> {
|
||||||
|
return str.split(/[\r\n]+/);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查 UUID 是否合法
|
||||||
|
*
|
||||||
|
* @param uuid - UUID
|
||||||
|
* @returns 是否合法
|
||||||
|
*/
|
||||||
|
function testUuid(uuid?: string): uuid is string {
|
||||||
|
const regExp = /^[a-z0-9]{32}$/g;
|
||||||
|
if (uuid && uuid !== '00000000000000000000000000000000') {
|
||||||
|
return regExp.test(uuid.trim());
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取正确的 UUID
|
||||||
|
*
|
||||||
|
* @param uuid - UUID
|
||||||
|
* @returns UUID
|
||||||
|
*/
|
||||||
|
function fixUuid(uuid?: string): string {
|
||||||
|
uuid = uuid?.trim() || undefined;
|
||||||
|
if (testUuid(uuid)) {
|
||||||
|
return uuid.trim();
|
||||||
|
} else {
|
||||||
|
return crypto.randomUUID().replaceAll('-', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主逻辑方法
|
||||||
|
*/
|
||||||
|
function main() {
|
||||||
|
if (!testUuid(extensionConfig.uuid)) {
|
||||||
|
const newExtensionConfig = { ...extensionConfig };
|
||||||
|
// @ts-ignore
|
||||||
|
delete newExtensionConfig.default;
|
||||||
|
newExtensionConfig.uuid = fixUuid(extensionConfig.uuid);
|
||||||
|
fs.writeJsonSync(__dirname + '/../extension.json', newExtensionConfig, { spaces: '\t', EOL: '\n', encoding: 'utf-8' });
|
||||||
|
}
|
||||||
|
const filepathListWithoutFilter = fs.readdirSync(__dirname + '/../', { encoding: 'utf-8', recursive: true });
|
||||||
|
const edaignoreListWithoutResolve = multiLineStrToArray(fs.readFileSync(__dirname + '/../.edaignore', { encoding: 'utf-8' }));
|
||||||
|
const edaignoreList: Array<string> = [];
|
||||||
|
for (const edaignoreLine of edaignoreListWithoutResolve) {
|
||||||
|
if (edaignoreLine.endsWith('/') || edaignoreLine.endsWith('\\')) {
|
||||||
|
edaignoreList.push(edaignoreLine.slice(0, edaignoreLine.length - 1));
|
||||||
|
} else {
|
||||||
|
edaignoreList.push(edaignoreLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const edaignore = ignore().add(edaignoreList);
|
||||||
|
const filepathListWithoutResolve = edaignore.filter(filepathListWithoutFilter);
|
||||||
|
const fileList: Array<string> = [];
|
||||||
|
const folderList: Array<string> = []; // 无用数据
|
||||||
|
for (const filepath of filepathListWithoutResolve) {
|
||||||
|
if (fs.lstatSync(filepath).isFile()) {
|
||||||
|
fileList.push(filepath.replace(/\\/g, '/'));
|
||||||
|
} else {
|
||||||
|
folderList.push(filepath.replace(/\\/g, '/'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const zip = new JSZip();
|
||||||
|
for (const file of fileList) {
|
||||||
|
zip.file(file, fs.createReadStream(__dirname + '/../' + file));
|
||||||
|
}
|
||||||
|
|
||||||
|
zip.generateNodeStream({ type: 'nodebuffer', streamFiles: true }).pipe(
|
||||||
|
fs.createWriteStream(__dirname + '/dist/' + extensionConfig.name + '_v' + extensionConfig.version + '.eext'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
21
config/esbuild.common.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import type esbuild from 'esbuild';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
entryPoints: {
|
||||||
|
'index': './src/index',
|
||||||
|
},
|
||||||
|
entryNames: '[name]',
|
||||||
|
assetNames: '[name]',
|
||||||
|
bundle: true, // 用于内部方法调用,请勿修改
|
||||||
|
minify: false, // 用于内部方法调用,请勿修改
|
||||||
|
loader: {},
|
||||||
|
outdir: './dist/',
|
||||||
|
sourcemap: undefined,
|
||||||
|
platform: 'browser', // 用于内部方法调用,请勿修改
|
||||||
|
format: 'iife', // 用于内部方法调用,请勿修改
|
||||||
|
globalName: 'edaEsbuildExportName', // 用于内部方法调用,请勿修改
|
||||||
|
treeShaking: true,
|
||||||
|
ignoreAnnotations: true,
|
||||||
|
define: {},
|
||||||
|
external: [],
|
||||||
|
} satisfies Parameters<(typeof esbuild)['build']>[0];
|
||||||
13
config/esbuild.prod.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import esbuild from 'esbuild';
|
||||||
|
|
||||||
|
import common from './esbuild.common';
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const ctx = await esbuild.context(common);
|
||||||
|
if (process.argv.includes('--watch')) {
|
||||||
|
await ctx.watch();
|
||||||
|
} else {
|
||||||
|
await ctx.rebuild();
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
})();
|
||||||
46
extension.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "jiepei-helper",
|
||||||
|
"uuid": "817c3321fba54f70b0186500933ed47b",
|
||||||
|
"displayName": "捷配下单助手",
|
||||||
|
"description": "一键前往捷配下单 PCB,支持保存下单偏好",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"publisher": "Mr_Fang",
|
||||||
|
"engines": {
|
||||||
|
"eda": "^2.3.0"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "extension-store",
|
||||||
|
"url": ""
|
||||||
|
},
|
||||||
|
"categories": "Other",
|
||||||
|
"keywords": ["Helper"],
|
||||||
|
"images": {
|
||||||
|
"logo": "./images/logo.png"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/klxf",
|
||||||
|
"bugs": "",
|
||||||
|
"activationEvents": {},
|
||||||
|
"entry": "./dist/index",
|
||||||
|
"dependentExtensions": {},
|
||||||
|
"headerMenus": {
|
||||||
|
"pcb": [
|
||||||
|
{
|
||||||
|
"id": "jiepei-helper",
|
||||||
|
"title": "捷配",
|
||||||
|
"menuItems": [
|
||||||
|
{
|
||||||
|
"id": "order",
|
||||||
|
"title": "下单",
|
||||||
|
"registerFn": "order"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "about",
|
||||||
|
"title": "关于",
|
||||||
|
"registerFn": "about"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
61
iframe/about.html
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>关于软件</title>
|
||||||
|
<link rel="stylesheet" href="/iframe/css/index.css">
|
||||||
|
</head>
|
||||||
|
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
|
||||||
|
<div class="min-h-screen bg-gray-100 flex items-center justify-center">
|
||||||
|
<div class="bg-white p-6 rounded-lg w-[400px] h-[200px] flex flex-col justify-between items-center text-center">
|
||||||
|
<div>
|
||||||
|
<h1 class="text-2xl font-bold text-gray-800 mb-2" id="name"></h1>
|
||||||
|
<p class="text-[12px] text-gray-600" id="description"></p>
|
||||||
|
<p class="text-gray-600 text-sm" id="version"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex justify-center space-x-4 mt-auto">
|
||||||
|
<a href="#" id="home" class="text-blue-600 hover:text-blue-800 text-sm transition duration-300 ease-in-out">
|
||||||
|
🏠 扩展主页
|
||||||
|
</a>
|
||||||
|
<a href="/iframe/order_iframe.html" id="bugs" class="text-blue-600 hover:text-blue-800 text-sm transition duration-300 ease-in-out">
|
||||||
|
🐞 Bug反馈
|
||||||
|
</a>
|
||||||
|
<a id="check" class="text-blue-600 hover:text-blue-800 text-sm transition duration-300 ease-in-out">
|
||||||
|
✨ 检查更新
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
// 页面加载完成
|
||||||
|
document.addEventListener('DOMContentLoaded', async function () {
|
||||||
|
const file = await eda.sys_FileSystem.getExtensionFile("/extension.json");
|
||||||
|
if (file) {
|
||||||
|
const extensionData = JSON.parse(await file.text());
|
||||||
|
document.getElementById('name').textContent = extensionData.displayName;
|
||||||
|
document.getElementById('description').textContent = extensionData.description;
|
||||||
|
document.getElementById('version').textContent = `V${extensionData.version}`;
|
||||||
|
document.getElementById('home').setAttribute('href', extensionData.homepage);
|
||||||
|
document.getElementById('bugs').setAttribute('href', extensionData.bugs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', function (event) {
|
||||||
|
if (event.target.tagName.toLowerCase() === 'a') {
|
||||||
|
event.preventDefault();
|
||||||
|
const url = event.target.getAttribute('href');
|
||||||
|
if (url) {
|
||||||
|
eda.sys_Window.open(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('check').addEventListener('click', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
eda.sys_Message.showToastMessage("🥺 尚未支持", 'info');
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1220
iframe/css/index.css
Normal file
3
iframe/css/input.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
BIN
iframe/img/(1)a.jpg
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
iframe/img/(2)a.jpg
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
iframe/img/(3)a.jpg
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
iframe/img/(4)a.jpg
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
iframe/img/color_none.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
iframe/img/img_pro_22F.png
Normal file
|
After Width: | Height: | Size: 948 B |
BIN
iframe/img/img_pro_Aluminum.png
Normal file
|
After Width: | Height: | Size: 533 B |
BIN
iframe/img/img_pro_CEM1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
iframe/img/img_pro_CEM3.png
Normal file
|
After Width: | Height: | Size: 808 B |
BIN
iframe/img/img_pro_Copper.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
iframe/img/img_pro_FR1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
iframe/img/img_pro_FR4.png
Normal file
|
After Width: | Height: | Size: 406 B |
BIN
iframe/img/img_pro_HDI.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
iframe/img/img_pro_Rogers.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
iframe/img/img_pro_fpc.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
4
iframe/img/none_color.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<line x1="18" y1="6" x2="6" y2="18" color="lightgrey"></line>
|
||||||
|
<line x1="6" y1="6" x2="18" y2="18" color="lightgrey"></line>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 315 B |
1866
iframe/order_iframe.html
Normal file
BIN
images/logo.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
4
locales/en.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"About": "About",
|
||||||
|
"EasyEDA extension SDK v": "EasyEDA extension SDK v${1}"
|
||||||
|
}
|
||||||
3
locales/extensionJson/en.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"About...": "About..."
|
||||||
|
}
|
||||||
3
locales/extensionJson/zh-Hans.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"About...": "关于..."
|
||||||
|
}
|
||||||
4
locales/zh-Hans.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"About": "关于",
|
||||||
|
"EasyEDA extension SDK v": "嘉立创EDA 扩展 SDK v${1}"
|
||||||
|
}
|
||||||
5555
package-lock.json
generated
Normal file
47
package.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "pro-api-sdk",
|
||||||
|
"version": "1.1.1",
|
||||||
|
"description": "嘉立创EDA & EasyEDA 专业版扩展 API 开发工具",
|
||||||
|
"author": "JLCEDA <support@lceda.cn>",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"homepage": "https://pro.lceda.cn/",
|
||||||
|
"scripts": {
|
||||||
|
"compile": "rimraf ./dist/ && ts-node ./config/esbuild.prod.ts",
|
||||||
|
"prepare": "husky",
|
||||||
|
"prettier:all": "prettier --write .",
|
||||||
|
"eslint:all": "eslint --ext .ts --fix .",
|
||||||
|
"fix": "npm run prettier:all && npm run eslint:all",
|
||||||
|
"tailwind": "tailwindcss -i ./iframe/css/input.css -o ./iframe/css/index.css",
|
||||||
|
"build": "npm run tailwind && npm run compile && ts-node ./build/packaged.ts"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@jlceda/pro-api-types": "^0.1.156",
|
||||||
|
"@microsoft/tsdoc": "^0.15.1",
|
||||||
|
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
|
||||||
|
"@types/fs-extra": "^11.0.4",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
|
"@typescript-eslint/parser": "^7.18.0",
|
||||||
|
"esbuild": "^0.24.2",
|
||||||
|
"eslint": "^8.57.0",
|
||||||
|
"eslint-config-alloy": "^5.1.2",
|
||||||
|
"eslint-plugin-tsdoc": "^0.4.0",
|
||||||
|
"fs-extra": "^11.3.0",
|
||||||
|
"husky": "^9.1.7",
|
||||||
|
"ignore": "^7.0.3",
|
||||||
|
"jszip": "^3.10.1",
|
||||||
|
"lint-staged": "^15.3.0",
|
||||||
|
"prettier": "^3.4.2",
|
||||||
|
"rimraf": "^6.0.1",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"tailwindcss": "^3.4.17",
|
||||||
|
"@tailwindcss/cli": "^4.1.8"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.ts": "eslint --cache --fix",
|
||||||
|
"*.{js,ts,html,css,json,md}": "prettier --write"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/index.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 入口文件
|
||||||
|
*
|
||||||
|
* 本文件为默认扩展入口文件,如果你想要配置其它文件作为入口文件,
|
||||||
|
* 请修改 `extension.json` 中的 `entry` 字段;
|
||||||
|
*
|
||||||
|
* 请在此处使用 `export` 导出所有你希望在 `headerMenus` 中引用的方法,
|
||||||
|
* 方法通过方法名与 `headerMenus` 关联。
|
||||||
|
*
|
||||||
|
* 如需了解更多开发细节,请阅读:
|
||||||
|
* https://prodocs.lceda.cn/cn/api/guide/
|
||||||
|
*/
|
||||||
|
// import * as extensionConfig from '../extension.json';
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
export function activate(status?: 'onStartupFinished', arg?: string): void {}
|
||||||
|
|
||||||
|
export function about(): void {
|
||||||
|
/* eda.sys_Dialog.showInformationMessage(
|
||||||
|
eda.sys_I18n.text('EasyEDA extension SDK v', undefined, undefined, extensionConfig.version),
|
||||||
|
eda.sys_I18n.text('About'),
|
||||||
|
); */
|
||||||
|
eda.sys_IFrame.openIFrame('/iframe/about.html', 400, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function order(): void {
|
||||||
|
eda.sys_IFrame.openIFrame("/iframe/order_iframe.html");
|
||||||
|
}
|
||||||
9
tailwind.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: ["./iframe/**/*.{html,css,js}"],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}
|
||||||
|
|
||||||
28
tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"incremental": true,
|
||||||
|
"target": "ESNext",
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"module": "CommonJS",
|
||||||
|
"moduleResolution": "Node10",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"sourceMap": false,
|
||||||
|
"outDir": "./dist/",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"strictFunctionTypes": true,
|
||||||
|
"strictBindCallApply": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"useUnknownInCatchVariables": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"isolatedModules": true
|
||||||
|
},
|
||||||
|
"include": ["./src/", "./node_modules/@jlceda/pro-api-types/"]
|
||||||
|
}
|
||||||