@napi-rs/cli 3.1.3 → 3.1.5
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/dist/cli.js +16 -7
- package/dist/index.cjs +16 -7
- package/dist/index.js +16 -7
- package/package.json +1 -1
- package/src/api/build.ts +2 -1
- package/src/api/pre-publish.ts +20 -4
package/package.json
CHANGED
package/src/api/build.ts
CHANGED
|
@@ -980,7 +980,8 @@ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array
|
|
|
980
980
|
this.config.binaryName,
|
|
981
981
|
this.config.packageName,
|
|
982
982
|
idents,
|
|
983
|
-
|
|
983
|
+
// in npm preversion hook
|
|
984
|
+
process.env.npm_new_version ?? this.config.packageJson.version,
|
|
984
985
|
)
|
|
985
986
|
|
|
986
987
|
try {
|
package/src/api/pre-publish.ts
CHANGED
|
@@ -165,10 +165,26 @@ export async function prePublish(userOptions: PrePublishOptions) {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
if (!options.skipOptionalPublish) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
try {
|
|
169
|
+
const output = execSync(`${npmClient} publish`, {
|
|
170
|
+
cwd: pkgDir,
|
|
171
|
+
env: process.env,
|
|
172
|
+
stdio: 'pipe',
|
|
173
|
+
})
|
|
174
|
+
process.stdout.write(output)
|
|
175
|
+
} catch (e) {
|
|
176
|
+
if (
|
|
177
|
+
e instanceof Error &&
|
|
178
|
+
e.message.includes(
|
|
179
|
+
'You cannot publish over the previously published versions',
|
|
180
|
+
)
|
|
181
|
+
) {
|
|
182
|
+
console.info(e.message)
|
|
183
|
+
debug.warn(`${pkgDir} has been published, skipping`)
|
|
184
|
+
} else {
|
|
185
|
+
throw e
|
|
186
|
+
}
|
|
187
|
+
}
|
|
172
188
|
}
|
|
173
189
|
|
|
174
190
|
if (options.ghRelease && repo && owner) {
|