@nitro/exporter 10.0.3 → 11.0.0-beta.1
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/package.json +8 -8
- package/tasks/export-clean.js +1 -1
- package/tasks/export-processing.js +21 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitro/exporter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-beta.1",
|
|
4
4
|
"description": "An exporting package for nitro. Generate static packages with ease.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"author": "The Nitro Team",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=
|
|
13
|
-
"npm": ">=10.
|
|
12
|
+
"node": ">=22.11.0 <25",
|
|
13
|
+
"npm": ">=10.9.0 <12"
|
|
14
14
|
},
|
|
15
15
|
"main": "index.js",
|
|
16
16
|
"scripts": {
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"exporter"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@nitro/app": ">=
|
|
32
|
-
"@nitro/gulp": ">=
|
|
31
|
+
"@nitro/app": ">=11.0.0-beta.1",
|
|
32
|
+
"@nitro/gulp": ">=11.0.0-beta.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"array-unique": "0.3.2",
|
|
36
|
-
"del": "
|
|
36
|
+
"del": "8.0.1",
|
|
37
37
|
"delete-empty": "3.0.0",
|
|
38
|
-
"glob": "
|
|
38
|
+
"glob": "13.0.2",
|
|
39
39
|
"glob-parent": "6.0.2",
|
|
40
40
|
"gulp-filter": "7.0.0",
|
|
41
41
|
"gulp-html-minifier-terser": "7.1.0",
|
|
42
|
-
"gulp-zip": "
|
|
42
|
+
"gulp-zip": "6.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@merkle-open/eslint-config": "4.0.1",
|
package/tasks/export-clean.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const del =
|
|
3
|
+
const del = (...args) => import('del').then(m => m.deleteAsync(...args));
|
|
4
4
|
const deleteEmpty = require('delete-empty');
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const globParent = require('glob-parent');
|
|
7
7
|
const { globSync } = require('glob');
|
|
8
|
-
const gulpZip = require('gulp-zip');
|
|
9
8
|
const htmlmin = require('gulp-html-minifier-terser');
|
|
10
9
|
const path = require('path');
|
|
11
10
|
const unique = require('array-unique');
|
|
@@ -102,8 +101,8 @@ module.exports = function (gulp, config) {
|
|
|
102
101
|
function move() {
|
|
103
102
|
gulp.src(renames[i].src, { base: renames[i].base, encoding: false, allowEmpty: true })
|
|
104
103
|
.pipe(gulp.dest(renames[i].dest))
|
|
105
|
-
.on('end', () => {
|
|
106
|
-
del
|
|
104
|
+
.on('end', async () => {
|
|
105
|
+
await del(renames[i++].src);
|
|
107
106
|
if (i < renames.length) {
|
|
108
107
|
move();
|
|
109
108
|
} else {
|
|
@@ -161,21 +160,26 @@ module.exports = function (gulp, config) {
|
|
|
161
160
|
|
|
162
161
|
if (configEntry.zip) {
|
|
163
162
|
getZipPromise = function () {
|
|
164
|
-
return new Promise((resolve) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
163
|
+
return new Promise(async (resolve, reject) => {
|
|
164
|
+
try {
|
|
165
|
+
const { default: gulpZip } = await import('gulp-zip');
|
|
166
|
+
const pkg = JSON.parse(
|
|
167
|
+
fs.readFileSync(`${config.nitro.basePath}package.json`, {
|
|
168
|
+
encoding: 'utf-8',
|
|
169
|
+
flag: 'r',
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
gulp.src(`${configEntry.dest}/**/*`, {encoding: false})
|
|
173
|
+
.pipe(gulpZip(`${pkg.name}-${pkg.version}.zip`))
|
|
174
|
+
.pipe(gulp.dest(configEntry.dest))
|
|
175
|
+
.on('error', reject)
|
|
176
|
+
.on('end', async () => {
|
|
177
|
+
await del(['**/*', '!*.zip'], { cwd: configEntry.dest, dot: true });
|
|
176
178
|
resolve();
|
|
177
179
|
});
|
|
178
|
-
|
|
180
|
+
} catch (err) {
|
|
181
|
+
reject(err);
|
|
182
|
+
}
|
|
179
183
|
});
|
|
180
184
|
};
|
|
181
185
|
}
|