@es-pkg/publish 1.0.7 → 1.0.9
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/cjs/index.js +238 -225
- package/esm/index.js +8 -6
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -1,242 +1,255 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
!mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
default: () => src_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
var import_gulp = __toESM(require("@es-pkg/gulp"));
|
|
36
|
+
var import_chalk = __toESM(require("chalk"));
|
|
37
|
+
var import_gulp_logger = __toESM(require("@es-pkg/gulp-logger"));
|
|
38
|
+
var import_fs = __toESM(require("fs"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
var import_utils = require("@es-pkg/utils");
|
|
41
|
+
var import_config = require("@es-pkg/config");
|
|
42
|
+
var import_prompts = __toESM(require("prompts"));
|
|
14
43
|
const scoped = /^@[a-zA-Z0-9-]+\/.+$/;
|
|
15
|
-
const REGISTRY =
|
|
16
|
-
const json =
|
|
17
|
-
const publishDir =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
44
|
+
const REGISTRY = import_config.config.publishRegistry;
|
|
45
|
+
const json = import_config.pkg;
|
|
46
|
+
const publishDir = import_path.default.join(import_config.config.publishDir, "./__npm__");
|
|
47
|
+
import_gulp.default.task("clean", async () => {
|
|
48
|
+
(0, import_utils.log)(`\u6E05\u9664${publishDir}\u5F00\u59CB`);
|
|
49
|
+
try {
|
|
50
|
+
await (0, import_utils.remove)(publishDir);
|
|
51
|
+
(0, import_utils.log)(`\u6E05\u9664${publishDir}\u5B8C\u6210`);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
(0, import_utils.log)(`\u6E05\u9664${publishDir}\u5931\u8D25\uFF1A`, e);
|
|
54
|
+
}
|
|
27
55
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
import_gulp.default.task("del-cjs-iife-es", async () => {
|
|
57
|
+
if (import_config.config.iife) {
|
|
58
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.iife)} \u5F00\u59CB`);
|
|
59
|
+
await (0, import_utils.remove)(`${import_path.default.join(`${publishDir}`, import_config.config.iife)}`);
|
|
60
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.iife)} \u7ED3\u675F`);
|
|
61
|
+
}
|
|
62
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.cjs)} \u5F00\u59CB`);
|
|
63
|
+
await (0, import_utils.remove)(`${import_path.default.join(`${publishDir}`, import_config.config.cjs)}`);
|
|
64
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.cjs)} \u7ED3\u675F`);
|
|
65
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.es)} \u5F00\u59CB`);
|
|
66
|
+
await (0, import_utils.remove)(`${import_path.default.join(`${publishDir}`, import_config.config.es)}`);
|
|
67
|
+
(0, import_utils.log)(`\u5220\u9664 ${import_path.default.join(`${publishDir}`, import_config.config.es)} \u7ED3\u675F`);
|
|
40
68
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
json.files = Array.from(new Set([ESExists && es, CJSExists && cjs, IIFEExists && iife])).filter(Boolean);
|
|
69
|
+
import_gulp.default.task("copy-info", (0, import_gulp.series)(async () => {
|
|
70
|
+
(0, import_utils.log)(`\u751F\u6210 package \u5F00\u59CB`);
|
|
71
|
+
let errored = false;
|
|
72
|
+
let version = "";
|
|
73
|
+
try {
|
|
74
|
+
const { stdout } = await (0, import_utils.run)(`npm`, ["view", import_config.pkg.name, "version"], {
|
|
75
|
+
stdio: void 0,
|
|
76
|
+
cwd: import_path.default.join(process.cwd(), import_config.config.publishDir)
|
|
77
|
+
});
|
|
78
|
+
if (stdout) {
|
|
79
|
+
version = stdout;
|
|
80
|
+
}
|
|
81
|
+
if (!version) {
|
|
82
|
+
const controller = new AbortController();
|
|
83
|
+
const timer = setTimeout(() => {
|
|
84
|
+
controller.abort();
|
|
85
|
+
}, 3e3);
|
|
86
|
+
const start = Date.now();
|
|
87
|
+
const url = `https://img.shields.io/npm/v/${import_config.pkg.name}`;
|
|
88
|
+
const response = await (0, import_utils.fetch)(url, {
|
|
89
|
+
signal: controller.signal
|
|
90
|
+
}).finally(async () => {
|
|
91
|
+
import_utils.log.warn(`\u8FDC\u7A0B\u83B7\u53D6\u7248\u672C\u82B1\u8D39\u65F6\u95F4:${Date.now() - start}`);
|
|
92
|
+
});
|
|
93
|
+
const htmlString = await response.text();
|
|
94
|
+
const regex = /<title>npm: v([\d.]+)<\/title>/;
|
|
95
|
+
version = htmlString.match(regex)?.[1];
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
}
|
|
98
|
+
(0, import_utils.log)(`\u8FDC\u7A0B\u83B7\u53D6\u7248\u672C\u4FE1\u606F tag:`, version);
|
|
99
|
+
if (version) {
|
|
100
|
+
json.version = (0, import_utils.compare)(import_config.pkg.version, version) <= 0 ? (0, import_utils.autoUpgrade)(version) : import_config.pkg.version;
|
|
101
|
+
} else {
|
|
102
|
+
errored = true;
|
|
103
|
+
}
|
|
104
|
+
} catch (e) {
|
|
105
|
+
errored = true;
|
|
106
|
+
}
|
|
107
|
+
if (errored) {
|
|
108
|
+
const { version: version2 } = await (0, import_prompts.default)({
|
|
109
|
+
type: "text",
|
|
110
|
+
name: "version",
|
|
111
|
+
message: "\u8FDC\u7A0B\u83B7\u53D6\u7248\u672C\u5931\u8D25\uFF01\u8BF7\u8F93\u5165\u7248\u672C\u53F7",
|
|
112
|
+
initial: import_config.pkg.version
|
|
113
|
+
});
|
|
114
|
+
json.version = version2;
|
|
115
|
+
}
|
|
116
|
+
delete json.devDependencies;
|
|
117
|
+
delete json.scripts;
|
|
118
|
+
if (!json.publishConfig) {
|
|
119
|
+
json.publishConfig = {
|
|
120
|
+
access: "public",
|
|
121
|
+
registry: REGISTRY
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const es = import_path.default.basename(import_config.config.es);
|
|
125
|
+
const cjs = import_path.default.basename(import_config.config.cjs);
|
|
126
|
+
const iife = import_config.config.iife ? import_path.default.basename(import_config.config.iife) : "";
|
|
127
|
+
const CJSExists = import_fs.default.existsSync(import_path.default.join(`${import_config.config.publishDir}`, cjs));
|
|
128
|
+
const ESExists = import_fs.default.existsSync(import_path.default.join(`${import_config.config.publishDir}`, es));
|
|
129
|
+
const IIFEExists = iife ? import_fs.default.existsSync(import_path.default.join(`${import_config.config.publishDir}`, iife)) : false;
|
|
130
|
+
const mainExists = !!json.main && import_fs.default.existsSync(import_path.default.join((0, import_config.resolveApp)(""), json.main));
|
|
131
|
+
const browserExists = !!json.browser && import_fs.default.existsSync(import_path.default.join((0, import_config.resolveApp)(""), json.main));
|
|
132
|
+
const moduleExists = !!json.module && import_fs.default.existsSync(import_path.default.join((0, import_config.resolveApp)(""), json.main));
|
|
133
|
+
const _es = (0, import_config.getEntrypoint)(import_config.config.es);
|
|
134
|
+
const _cjs = (0, import_config.getEntrypoint)(import_config.config.cjs);
|
|
135
|
+
if (!mainExists) {
|
|
136
|
+
if (ESExists) {
|
|
137
|
+
json.main = _es || _cjs;
|
|
138
|
+
}
|
|
139
|
+
if (CJSExists) {
|
|
140
|
+
json.main = _cjs || _es;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (!moduleExists && CJSExists) {
|
|
144
|
+
json.module = _es || _cjs;
|
|
145
|
+
}
|
|
146
|
+
if (!browserExists && IIFEExists) {
|
|
147
|
+
json.browser = (0, import_config.getEntrypoint)(import_config.config.iife);
|
|
148
|
+
}
|
|
149
|
+
if (!json.types) {
|
|
150
|
+
const type = (0, import_config.getEntrypoint)(import_config.config.es, import_config.config.typings) || _es || _cjs;
|
|
151
|
+
const { dir, name, ext } = import_path.default.parse(type);
|
|
152
|
+
json.types = [".ts", ".tsx"].includes(ext) ? type : `${dir}/${name}.d.ts`;
|
|
153
|
+
}
|
|
154
|
+
json.files = Array.from(/* @__PURE__ */ new Set([ESExists && es, CJSExists && cjs, IIFEExists && iife])).filter(Boolean);
|
|
155
|
+
if (json.dependencies) {
|
|
129
156
|
json.dependencies = Object.fromEntries(Object.entries(json.dependencies).map(([key, value]) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
157
|
+
if (value.startsWith("file://") || value.startsWith("workspace:")) {
|
|
158
|
+
return [key, "latest"];
|
|
159
|
+
}
|
|
160
|
+
return [key, value];
|
|
134
161
|
}));
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
162
|
+
}
|
|
163
|
+
let jsonStr = JSON.stringify(json, null, " ");
|
|
164
|
+
const ex = import_fs.default.existsSync(`${import_config.config.publishDir}/`);
|
|
165
|
+
if (!ex) {
|
|
166
|
+
import_fs.default.mkdirSync(`${import_config.config.publishDir}/`, { recursive: true });
|
|
167
|
+
}
|
|
168
|
+
import_fs.default.writeFileSync(`${import_config.config.publishDir}/package.json`, jsonStr);
|
|
169
|
+
(0, import_utils.log)(`\u751F\u6210 package\u5B8C\u6210`, import_chalk.default.green(json.version));
|
|
170
|
+
(0, import_utils.log)(`\u751F\u6210 .npmrc \u5F00\u59CB`);
|
|
171
|
+
import_fs.default.writeFileSync(`${import_config.config.publishDir}/.npmrc`, `registry=${REGISTRY}`);
|
|
172
|
+
(0, import_utils.log)(`\u751F\u6210 .npmrc \u5B8C\u6210`);
|
|
173
|
+
(0, import_utils.log)(`\u62F7\u8D1D README \u5F00\u59CB`);
|
|
146
174
|
}, () => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}))
|
|
153
|
-
.pipe(gulp.dest(`${config.config.publishDir}/`));
|
|
175
|
+
return import_gulp.default.src([`./README.md`]).pipe((0, import_gulp_logger.default)({
|
|
176
|
+
before: "copy README...",
|
|
177
|
+
after: "copy README complete!",
|
|
178
|
+
showChange: false
|
|
179
|
+
})).pipe(import_gulp.default.dest(`${import_config.config.publishDir}/`));
|
|
154
180
|
}));
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}))
|
|
166
|
-
.pipe(gulp.dest(path.join(`${publishDir}`, path.basename(config.config.iife))));
|
|
181
|
+
import_gulp.default.task("copy-iife", (c) => {
|
|
182
|
+
if (!import_config.config.iife) {
|
|
183
|
+
return c();
|
|
184
|
+
}
|
|
185
|
+
(0, import_utils.log)(`\u62F7\u8D1D '/iife/**' \u5F00\u59CB`);
|
|
186
|
+
return import_gulp.default.src([`${import_config.config.iife}/.**`, `${import_config.config.iife}/**`]).pipe((0, import_gulp_logger.default)({
|
|
187
|
+
before: "copy iife...",
|
|
188
|
+
after: "copy iife complete!",
|
|
189
|
+
showChange: false
|
|
190
|
+
})).pipe(import_gulp.default.dest(import_path.default.join(`${publishDir}`, import_path.default.basename(import_config.config.iife))));
|
|
167
191
|
});
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}))
|
|
175
|
-
.pipe(gulp.dest(path.join(`${publishDir}`, path.basename(config.config.cjs))));
|
|
192
|
+
import_gulp.default.task("copy-cjs", () => {
|
|
193
|
+
return import_gulp.default.src([`${import_config.config.cjs}/.**`, `${import_config.config.cjs}/**`]).pipe((0, import_gulp_logger.default)({
|
|
194
|
+
before: "copy cjs...",
|
|
195
|
+
after: "copy cjs complete!",
|
|
196
|
+
showChange: false
|
|
197
|
+
})).pipe(import_gulp.default.dest(import_path.default.join(`${publishDir}`, import_path.default.basename(import_config.config.cjs))));
|
|
176
198
|
});
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}))
|
|
184
|
-
.pipe(gulp.dest(path.join(`${publishDir}`, path.basename(config.config.es))));
|
|
199
|
+
import_gulp.default.task("copy-es", () => {
|
|
200
|
+
return import_gulp.default.src([`${import_config.config.es}/.**`, `${import_config.config.es}/**`]).pipe((0, import_gulp_logger.default)({
|
|
201
|
+
before: "copy es...",
|
|
202
|
+
after: "copy es complete!",
|
|
203
|
+
showChange: false
|
|
204
|
+
})).pipe(import_gulp.default.dest(import_path.default.join(`${publishDir}`, import_path.default.basename(import_config.config.es))));
|
|
185
205
|
});
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
import_gulp.default.task("remove-__npm__", (0, import_gulp.series)(() => {
|
|
207
|
+
let promises = [];
|
|
208
|
+
const includes = [import_config.config.es, import_config.config.cjs, import_config.config.iife].flatMap((val) => {
|
|
209
|
+
if (!val) {
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
const some = (0, import_config.getIncludeFiles)().some((item) => import_path.default.resolve(val).startsWith(import_path.default.resolve(item.path)));
|
|
213
|
+
return some ? [] : [val];
|
|
214
|
+
});
|
|
215
|
+
promises = includes.map((item) => (0, import_utils.remove)(item));
|
|
216
|
+
return Promise.all(promises);
|
|
197
217
|
}, () => {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}))
|
|
204
|
-
.pipe(gulp.dest(`${config.config.publishDir}/`));
|
|
218
|
+
return import_gulp.default.src([`${publishDir}/**`, `${publishDir}/.**`]).pipe((0, import_gulp_logger.default)({
|
|
219
|
+
before: "copy __npm__...",
|
|
220
|
+
after: "copy __npm__ complete!",
|
|
221
|
+
showChange: false
|
|
222
|
+
})).pipe(import_gulp.default.dest(`${import_config.config.publishDir}/`));
|
|
205
223
|
}, async () => {
|
|
206
|
-
|
|
224
|
+
await (0, import_utils.remove)(publishDir);
|
|
207
225
|
}));
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
import_gulp.default.task("npm-publish", async function() {
|
|
227
|
+
let publishAccess = [];
|
|
228
|
+
if (scoped.test(import_config.pkg.name)) {
|
|
229
|
+
publishAccess = ["--access", "public"];
|
|
230
|
+
}
|
|
231
|
+
if (import_config.config.publishAccess) {
|
|
232
|
+
publishAccess = import_config.config.publishAccess;
|
|
233
|
+
}
|
|
234
|
+
try {
|
|
235
|
+
const { stdout } = await (0, import_utils.run)(`npm`, ["whoami", "--registry", REGISTRY], { stdio: void 0 });
|
|
236
|
+
import_utils.log.warn(`===npm\u767B\u5F55\u4FE1\u606F===>${stdout}`);
|
|
237
|
+
} catch (e) {
|
|
238
|
+
import_utils.log.warn(`===npm${REGISTRY}\u672A\u767B\u5F55\uFF01\uFF01\u8BF7\u767B\u5F55`);
|
|
239
|
+
await (0, import_utils.run)(`npm`, ["login", "--registry", REGISTRY]);
|
|
240
|
+
}
|
|
241
|
+
const { confirm } = await (0, import_prompts.default)({
|
|
242
|
+
type: "confirm",
|
|
243
|
+
name: "confirm",
|
|
244
|
+
message: "\u662F\u5426\u53D1\u5E03\uFF1F"
|
|
245
|
+
});
|
|
246
|
+
if (confirm) {
|
|
247
|
+
await (0, import_utils.run)(`npm`, ["publish", ...publishAccess, "--registry", REGISTRY], {
|
|
248
|
+
cwd: import_path.default.join(process.cwd(), import_config.config.publishDir)
|
|
229
249
|
});
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
utils.success(`${json.name}@${json.version}:发布成功!`);
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
utils.error(`${json.name}@${json.version}:取消成功!`);
|
|
238
|
-
}
|
|
250
|
+
(0, import_utils.success)(`${json.name}@${json.version}:\u53D1\u5E03\u6210\u529F\uFF01`);
|
|
251
|
+
} else {
|
|
252
|
+
(0, import_utils.error)(`${json.name}@${json.version}:\u53D6\u6D88\u6210\u529F\uFF01`);
|
|
253
|
+
}
|
|
239
254
|
});
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
exports.default = index;
|
|
255
|
+
var src_default = import_gulp.default.series("clean", "del-cjs-iife-es", "copy-cjs", "copy-es", "copy-iife", "remove-__npm__", "copy-info", "npm-publish");
|
package/esm/index.js
CHANGED
|
@@ -122,12 +122,14 @@ gulp.task('copy-info', series(async () => {
|
|
|
122
122
|
json.types = ['.ts', '.tsx'].includes(ext) ? type : `${dir}/${name}.d.ts`;
|
|
123
123
|
}
|
|
124
124
|
json.files = Array.from(new Set([ESExists && es, CJSExists && cjs, IIFEExists && iife])).filter(Boolean);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
if (json.dependencies) {
|
|
126
|
+
json.dependencies = Object.fromEntries(Object.entries(json.dependencies).map(([key, value]) => {
|
|
127
|
+
if (value.startsWith('file://') || value.startsWith('workspace:')) {
|
|
128
|
+
return [key, 'latest'];
|
|
129
|
+
}
|
|
130
|
+
return [key, value];
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
131
133
|
let jsonStr = JSON.stringify(json, null, "\t");
|
|
132
134
|
const ex = fs.existsSync(`${config.publishDir}/`);
|
|
133
135
|
if (!ex) {
|