@leverege/build-tools 2.115.0 → 2.115.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 +1 -1
- package/src/prepack.mjs +16 -15
package/package.json
CHANGED
package/src/prepack.mjs
CHANGED
|
@@ -18,15 +18,20 @@ const { compile, 'manual-tag' : manualTag, 'force-tag' : forceTag, 'push-tag' :
|
|
|
18
18
|
boolean : [ 'compile', 'manual-tag', 'force-tag', 'push-tag' ]
|
|
19
19
|
} )
|
|
20
20
|
|
|
21
|
-
try {
|
|
22
|
-
await $`git diff --exit-code --quiet`
|
|
23
|
-
} catch ( err ) {
|
|
24
|
-
console.log( chalk.redBright( 'Your git index is not clean. Stage and/or commit all changes before attempting to publish a version to npm.' ) )
|
|
25
|
-
process.exit( err.exitCode )
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const isYarn = ( await fs.exists( path.join( process.cwd(), 'yarn.lock' ) ) ) || ( await fs.exists( path.join( process.cwd(), '.yarn' ) ) )
|
|
29
21
|
const packageJson = await fs.readJSON( path.join( process.cwd(), 'package.json' ) )
|
|
22
|
+
const isYarn = ( await fs.exists( path.join( process.cwd(), 'yarn.lock' ) ) ) || ( await fs.exists( path.join( process.cwd(), '.yarn' ) ) )
|
|
23
|
+
const version = packageJson.version
|
|
24
|
+
const semanticVersion = semverParse( version )
|
|
25
|
+
const isPrerelease = semanticVersion.prerelease.length > 0
|
|
26
|
+
|
|
27
|
+
if ( !isPrerelease ) {
|
|
28
|
+
try {
|
|
29
|
+
await $`git diff --exit-code --quiet`
|
|
30
|
+
} catch ( err ) {
|
|
31
|
+
console.log( chalk.redBright( 'Your git index is not clean. Stage and/or commit all changes before attempting to publish a version to npm.' ) )
|
|
32
|
+
process.exit( err.exitCode )
|
|
33
|
+
}
|
|
34
|
+
}
|
|
30
35
|
|
|
31
36
|
if ( compile && packageJson.scripts?.compile != null ) {
|
|
32
37
|
try {
|
|
@@ -38,10 +43,6 @@ if ( compile && packageJson.scripts?.compile != null ) {
|
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
const version = packageJson.version
|
|
42
|
-
const semanticVersion = semverParse( version )
|
|
43
|
-
const isPrerelease = semanticVersion.prerelease.length > 0
|
|
44
|
-
|
|
45
46
|
if ( !isPrerelease || forceTag ) {
|
|
46
47
|
const name = packageJson.name.replace( /^@leverege\//, '' )
|
|
47
48
|
const isWorkspace = await isInWorkspace( process.cwd() )
|
|
@@ -66,7 +67,7 @@ if ( !isPrerelease || forceTag ) {
|
|
|
66
67
|
try {
|
|
67
68
|
await $( {
|
|
68
69
|
quiet : true
|
|
69
|
-
} )`git push
|
|
70
|
+
} )`git push origin ${tagName}`
|
|
70
71
|
} catch ( error ) {
|
|
71
72
|
process.stderr.write( chalk.redBright( 'Failed to push git tag with error:\n' ) )
|
|
72
73
|
process.stderr.write( error.text() )
|
|
@@ -90,14 +91,14 @@ function compileCmd( { isYarn } ) {
|
|
|
90
91
|
async function isInWorkspace( dir ) {
|
|
91
92
|
const parent = path.dirname( dir )
|
|
92
93
|
if ( parent === dir ) {
|
|
93
|
-
return false
|
|
94
|
+
return false
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
const parentPkgPath = path.join( parent, 'package.json' )
|
|
97
98
|
if ( await fs.exists( parentPkgPath ) ) {
|
|
98
99
|
const pkg = JSON.parse( await fs.readFile( parentPkgPath, 'utf8' ) )
|
|
99
100
|
if ( pkg.workspaces ) {
|
|
100
|
-
return true
|
|
101
|
+
return true
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
|