@vacantthinker/firefox-addon-framework-easy 2026.5.2210 → 2026.5.2212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,5 +1,3 @@
1
- export * from './src/baseService.js'
2
- export * from './src/baseRuntimeSetup.js'
3
1
 
4
2
 
5
3
  export * from './src/baseOp.js'
@@ -7,4 +5,8 @@ export * from './src/baseOpTab.js'
7
5
  export * from './src/baseOpStorage.js'
8
6
 
9
7
 
10
- export * from './src/baseORM.js'
8
+ export * from './src/baseORM.js'
9
+
10
+ export * from './src/baseService.js'
11
+ export * from './src/baseRuntimeSetup.js'
12
+ export * from './src/baseServiceZipFilesOrDirectorys.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.5.2210",
3
+ "version": "2026.5.2212",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "npm_install": "npm install",
11
- "git_acp": "git add . && git commit -m 'fix import' && git push",
11
+ "git_acp": "git add . && git commit -m 'add baseServiceZipFilesOrDirectorys.js' && git push",
12
12
  "npm_publish": "npm publish",
13
13
  "webpack": "webpack",
14
14
  "webpack_pack": "webpack && node _zipit.js"
@@ -49,7 +49,7 @@ export const fileExt = {
49
49
  }
50
50
 
51
51
  /**
52
- * eg: fnName('', 'abc', 'txt')
52
+ * eg: fnName('this is content', 'this is a filename without ext', 'txt')
53
53
  * @param {string} content
54
54
  * @param {string} filename eg: abc
55
55
  * @param {string} ext txt json cmd js ...
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * @param {string}videolinkOrigin
4
+ * @returns {{
5
+ * videolink: string,
6
+ * vid: string
7
+ *
8
+ * }|null}
9
+ */
10
+ export function servicePureVideolinkYTB(videolinkOrigin) {
11
+ if (!videolinkOrigin) {
12
+ return null;
13
+ }
14
+
15
+ const u = new URL(videolinkOrigin)
16
+ let vid = u.searchParams.get('v');
17
+
18
+ let searchValue = '/shorts/';
19
+ if (u.pathname.startsWith(searchValue)) {
20
+ vid = u.pathname.replace(searchValue, '')
21
+ }
22
+ let videolink = `https://www.youtube.com/watch?v=${vid}`
23
+ return {videolink, vid}
24
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ *
3
+ * // zip dist dir => output: current-project-name.zip
4
+ * zipFilesOrDirectorys(null, 'dist');
5
+ *
6
+ *
7
+ *
8
+ * // zip all files all dirs , ignore [.git, .idea, node_modules, dist]
9
+ * => output: curret-project-name-ALL.zip
10
+ * zipFilesOrDirectorys(
11
+ * 'ALL',
12
+ * null,
13
+ * {
14
+ * "exclude": ['.git', '.idea', 'node_modules', 'dist'],
15
+ * "suffix": ['.zip']
16
+ * }
17
+ * );
18
+ *
19
+ * @param outputAppendName{string|null}
20
+ * @param oneDirecoty{string|null}
21
+ * @param ignoreObj{{
22
+ * exclude: [string],
23
+ * suffix: [string]
24
+ * }|null}
25
+ */
26
+ export function zipFilesOrDirectorys(
27
+ outputAppendName,
28
+ oneDirecoty = null,
29
+ ignoreObj = null) {
30
+
31
+ const archiver = require('archiver')
32
+ const fs = require('fs')
33
+ const path = require('path')
34
+ const basename = path.basename(__dirname)
35
+
36
+ const arrFilename = Array.from([basename])
37
+ if (outputAppendName) {
38
+ arrFilename.push(outputAppendName)
39
+ }
40
+ const output = fs.createWriteStream(
41
+ path.join(__dirname, `${arrFilename.join('-')}.zip`))
42
+ const archive = archiver('zip')
43
+ output.on('close', () => {
44
+ console.info(`${outputAppendName} zip finish!`)
45
+ })
46
+ archive.on('error', (e) => {
47
+ console.info('e=');
48
+ console.info(e);
49
+ })
50
+
51
+ archive.pipe(output)
52
+
53
+ if (oneDirecoty) {
54
+ // todo one dir
55
+ archive.directory(`${oneDirecoty}/`, false)
56
+ } else if (ignoreObj) {
57
+ let strings = fs.readdirSync(__dirname);
58
+
59
+ let {exclude, suffix} = ignoreObj
60
+ let arrFilter = strings
61
+ .filter(name => !exclude.includes(name))
62
+ .filter(name => !suffix.some(value => name.endsWith(value)))
63
+ console.info('arrFilter=');
64
+ console.info(arrFilter);
65
+
66
+ arrFilter.forEach(filename => {
67
+ let pathFile = path.join(__dirname, filename);
68
+ let stats = fs.lstatSync(pathFile);
69
+ if (stats.isDirectory()) {
70
+ archive.directory(`${filename}/`)
71
+ } else if (stats.isFile()) {
72
+ archive.file(pathFile, {name: filename})
73
+ }
74
+ })
75
+ } else {
76
+
77
+ }
78
+
79
+ archive.finalize();
80
+ console.info(`${outputAppendName} zip starting`)
81
+ }
82
+
83
+ export function zipFilesOrDirectorysDist() {
84
+ zipFilesOrDirectorys(null, 'dist');
85
+ }
86
+
87
+ export function zipFilesOrDirectorysALL() {
88
+ zipFilesOrDirectorys(
89
+ 'ALL',
90
+ null,
91
+ {
92
+ "exclude": ['.git', '.idea', 'node_modules', 'dist'],
93
+ "suffix": ['.zip']
94
+ }
95
+ );
96
+ }
97
+
98
+
99
+