build-strap 5.0.4-dev.106 → 5.0.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/package.json +1 -1
- package/src/npm.js +1 -1
- package/src/pkg.d.ts +1 -0
- package/src/pkg.js +10 -0
- package/src/publish.js +2 -2
- package/src/yarn.js +3 -4
package/package.json
CHANGED
package/src/npm.js
CHANGED
|
@@ -60,7 +60,7 @@ email=${creds.email}`
|
|
|
60
60
|
export async function npmPublish({ npmAuthToken, npmConfig, npmCreds, npmPath, publishPath = '.', skipExisting = false, tag, workDir: passedWorkDir, } = {}) {
|
|
61
61
|
const creds = npmCreds || envNpmCreds;
|
|
62
62
|
const authToken = npmAuthToken || process.env.NPM_TOKEN;
|
|
63
|
-
const name = getPkgName();
|
|
63
|
+
const name = getPkgName(true);
|
|
64
64
|
const { access, dryRun, publish, registry } = npmConfig || getNpmConfig();
|
|
65
65
|
if (!publish) {
|
|
66
66
|
buildLog('npm publish info missing from package.json, skipping npm publish');
|
package/src/pkg.d.ts
CHANGED
|
@@ -36,3 +36,4 @@ export declare function getCfg(): BuildStrapConfig;
|
|
|
36
36
|
export declare function setPkg(p: PackageJson): void;
|
|
37
37
|
export declare function getPkgName(includeScope?: boolean): string;
|
|
38
38
|
export declare function getPkgScope(): null | string;
|
|
39
|
+
export declare function getPkgSafeName(): null | string;
|
package/src/pkg.js
CHANGED
|
@@ -31,3 +31,13 @@ export function getPkgScope() {
|
|
|
31
31
|
const pkgName = getPkgName(true);
|
|
32
32
|
return pkgName.match(pkgNameRegex)?.[1] || null;
|
|
33
33
|
}
|
|
34
|
+
export function getPkgSafeName() {
|
|
35
|
+
const pkgName = getPkgName(true);
|
|
36
|
+
const match = pkgName.match(pkgNameRegex);
|
|
37
|
+
if (!match) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const [, scope, name] = match;
|
|
41
|
+
const safeScope = scope?.slice(1);
|
|
42
|
+
return safeScope ? `${safeScope}-${name}` : name;
|
|
43
|
+
}
|
package/src/publish.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { npmPublish } from './npm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getPkgSafeName } from './pkg.js';
|
|
5
5
|
import { buildLog, run } from './run.js';
|
|
6
6
|
import { tgzDir } from './tgz.js';
|
|
7
7
|
import { getVersion } from './version.js';
|
|
8
8
|
// create tgz from distDir in outDir
|
|
9
9
|
export async function createArtifact({ distDir, fileName, outDir, }) {
|
|
10
10
|
const version = await getVersion();
|
|
11
|
-
const name =
|
|
11
|
+
const name = getPkgSafeName() || '';
|
|
12
12
|
buildLog(`gzipping ${name} v${version.info}...`);
|
|
13
13
|
const tgzFileName = fileName || `${name}-${version.info}.tgz`;
|
|
14
14
|
const tgzFilePath = path.join(outDir, tgzFileName);
|
package/src/yarn.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import { spawn } from './cp.js';
|
|
4
4
|
import { readDir } from './fs.js';
|
|
5
5
|
import { envNpmCreds, getNpmConfig, npmGetVersions, npmWriteRc, } from './npm.js';
|
|
6
|
-
import { getPkg, getPkgName } from './pkg.js';
|
|
6
|
+
import { getPkg, getPkgName, getPkgSafeName } from './pkg.js';
|
|
7
7
|
import { buildLog } from './run.js';
|
|
8
8
|
import { generateFileHash } from './tgz.js';
|
|
9
9
|
import { getDevBranch, getVersion } from './version.js';
|
|
@@ -78,7 +78,6 @@ export async function yarnUpgrade({ all = false, outdated = false, } = {}) {
|
|
|
78
78
|
export async function yarnPublish({ npmAuthToken, npmConfig, npmCreds, npmPath, publishPath = '.', skipExisting = false, tag, workDir: passedWorkDir, } = {}) {
|
|
79
79
|
const creds = npmCreds || envNpmCreds;
|
|
80
80
|
const authToken = npmAuthToken || process.env.NPM_TOKEN;
|
|
81
|
-
const name = getPkgName();
|
|
82
81
|
const { access, publish, registry } = npmConfig || getNpmConfig();
|
|
83
82
|
if (!publish) {
|
|
84
83
|
buildLog('npm publish info missing from package.json, skipping npm publish');
|
|
@@ -102,7 +101,7 @@ export async function yarnPublish({ npmAuthToken, npmConfig, npmCreds, npmPath,
|
|
|
102
101
|
registry,
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
|
-
const existing = await npmGetVersions(
|
|
104
|
+
const existing = await npmGetVersions(getPkgName(true), npmPath);
|
|
106
105
|
const { branch, isRelease, npm: npmVersion } = await getVersion();
|
|
107
106
|
if (existing.includes(npmVersion)) {
|
|
108
107
|
if (skipExisting) {
|
|
@@ -142,7 +141,7 @@ export async function yarnPublish({ npmAuthToken, npmConfig, npmCreds, npmPath,
|
|
|
142
141
|
export async function yarnPack({ destination, workDir = '.', }) {
|
|
143
142
|
await fs.ensureDir(destination);
|
|
144
143
|
const version = await getVersion();
|
|
145
|
-
const name =
|
|
144
|
+
const name = getPkgSafeName();
|
|
146
145
|
const filename = path.resolve(destination, `${name}-${version.npm}.tgz`);
|
|
147
146
|
await yarn({
|
|
148
147
|
args: ['pack', ...(destination ? ['--filename', filename] : [])],
|