auklet 0.1.3 → 0.1.4
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/README.md +19 -2
- package/dist/build/tsdown/dependencies.js +2 -2
- package/dist/cli/build.js +26 -16
- package/dist/cli/buildArgs.d.ts +2 -1
- package/dist/cli/buildArgs.js +30 -8
- package/dist/cli/buildCss.d.ts +2 -0
- package/dist/cli/buildCss.js +28 -21
- package/dist/cli/dev.js +14 -4
- package/dist/cli/values.d.ts +17 -0
- package/dist/cli/values.js +14 -0
- package/dist/css/core/style/dependencies.d.ts +0 -1
- package/dist/css/core/style/dependencies.js +0 -3
- package/dist/css/core/style/entries.js +2 -2
- package/dist/css/core/style/files.d.ts +0 -1
- package/dist/css/core/style/files.js +0 -3
- package/dist/css/core/stylePackageContext.js +3 -3
- package/dist/css/vite/hmr.js +2 -2
- package/dist/css/vite/moduleGraph/packageSource/monorepo.d.ts +1 -1
- package/dist/css/vite/moduleGraph/packageSource/monorepo.js +2 -2
- package/dist/env.d.ts +22 -0
- package/dist/env.js +105 -0
- package/dist/logger.d.ts +0 -1
- package/dist/logger.js +0 -3
- package/dist/publish/api/npmrc.d.ts +1 -1
- package/dist/publish/api/npmrc.js +1 -4
- package/dist/publish/api/pnpmApi.d.ts +6 -10
- package/dist/publish/api/pnpmApi.js +6 -14
- package/dist/publish/api/pnpmPublishApi.d.ts +2 -2
- package/dist/publish/api/pnpmPublishApi.js +5 -3
- package/dist/publish/cli.d.ts +6 -2
- package/dist/publish/cli.js +90 -52
- package/dist/publish/inspect.js +19 -9
- package/dist/publish/inspectPack.js +6 -2
- package/dist/publish/inspectRegistry.d.ts +3 -2
- package/dist/publish/inspectRegistry.js +11 -4
- package/dist/publish/publishEnv.d.ts +13 -0
- package/dist/publish/publishEnv.js +21 -0
- package/dist/publish/publishRunner.d.ts +3 -2
- package/dist/publish/publishRunner.js +9 -7
- package/dist/publish/runner/packageBuilder.d.ts +2 -3
- package/dist/publish/runner/packageBuilder.js +5 -3
- package/dist/publish/runner/packagePublisher.d.ts +3 -2
- package/dist/publish/runner/packagePublisher.js +4 -2
- package/dist/publish/runner/publishPreflight.d.ts +3 -2
- package/dist/publish/runner/publishPreflight.js +13 -6
- package/dist/publish/runner/versionWriter.d.ts +1 -1
- package/dist/publish/targetResolver.d.ts +2 -2
- package/dist/publish/targetResolver.js +9 -5
- package/dist/publish/types.d.ts +6 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { AukletLogger } from '#auklet/logger';
|
|
2
|
-
import type { PublishOptions, PublishPlan } from '#auklet/publish/types';
|
|
2
|
+
import type { PublishOptions, PublishPlan, PublishRuntime } from '#auklet/publish/types';
|
|
3
3
|
export declare class PublishPreflight {
|
|
4
4
|
private readonly options;
|
|
5
|
+
private readonly runtime;
|
|
5
6
|
private readonly logger;
|
|
6
7
|
private readonly pnpm;
|
|
7
|
-
constructor(options: PublishOptions, logger: AukletLogger);
|
|
8
|
+
constructor(options: PublishOptions, runtime: PublishRuntime, logger: AukletLogger);
|
|
8
9
|
run(plan: PublishPlan): Promise<void>;
|
|
9
10
|
verifyBeforeBuild(plan: PublishPlan): Promise<void>;
|
|
10
11
|
private verifyNpmrcAuthEnv;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { PnpmPublishApi } from '#auklet/publish/api/pnpmPublishApi';
|
|
2
|
-
import { hasPublishedPackageVersion, NpmPackageVersionExistsError,
|
|
2
|
+
import { runPnpmWhoami, hasPublishedPackageVersion, NpmPackageVersionExistsError, } from '#auklet/publish/api/pnpmApi';
|
|
3
3
|
import { findNpmrcFiles, findNpmrcWithAuthToken, toNpmrcRegistryKey, validateNpmrcAuthEnv, } from '#auklet/publish/api/npmrc';
|
|
4
4
|
import { getPublishRegistry } from '#auklet/publish/api/registry';
|
|
5
|
+
import { createPublishTargetEnv } from '#auklet/publish/publishEnv';
|
|
5
6
|
import { logAuthenticationError } from '#auklet/publish/runner/packagePublisher';
|
|
6
7
|
import { PublishTargetError } from '#auklet/publish/runner/publishTargetError';
|
|
7
8
|
export class PublishPreflight {
|
|
8
9
|
options;
|
|
10
|
+
runtime;
|
|
9
11
|
logger;
|
|
10
12
|
pnpm = new PnpmPublishApi();
|
|
11
|
-
constructor(options, logger) {
|
|
13
|
+
constructor(options, runtime, logger) {
|
|
12
14
|
this.options = options;
|
|
15
|
+
this.runtime = runtime;
|
|
13
16
|
this.logger = logger;
|
|
14
17
|
}
|
|
15
18
|
async run(plan) {
|
|
@@ -25,8 +28,9 @@ export class PublishPreflight {
|
|
|
25
28
|
}
|
|
26
29
|
verifyNpmrcAuthEnv(plan) {
|
|
27
30
|
for (const target of plan.targets) {
|
|
31
|
+
const { env } = createPublishTargetEnv(this.options, this.runtime, target);
|
|
28
32
|
validateNpmrcAuthEnv(target.packageRoot, plan.root, {
|
|
29
|
-
|
|
33
|
+
env,
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
}
|
|
@@ -51,7 +55,7 @@ export class PublishPreflight {
|
|
|
51
55
|
await runPnpmWhoami(target.packageRoot, {
|
|
52
56
|
packageName: target.packageName,
|
|
53
57
|
registry,
|
|
54
|
-
|
|
58
|
+
...createPublishTargetEnv(this.options, this.runtime, target),
|
|
55
59
|
});
|
|
56
60
|
checked.add(key);
|
|
57
61
|
}
|
|
@@ -63,7 +67,7 @@ export class PublishPreflight {
|
|
|
63
67
|
};
|
|
64
68
|
for (const target of plan.targets) {
|
|
65
69
|
try {
|
|
66
|
-
await this.pnpm.publish(target, options);
|
|
70
|
+
await this.pnpm.publish(target, options, this.runtime);
|
|
67
71
|
}
|
|
68
72
|
catch (error) {
|
|
69
73
|
logAuthenticationError(this.logger, error);
|
|
@@ -74,7 +78,10 @@ export class PublishPreflight {
|
|
|
74
78
|
async verifyPackageVersions(plan) {
|
|
75
79
|
for (const target of plan.targets) {
|
|
76
80
|
const registry = getPublishRegistry(target.packageJson.publishConfig);
|
|
77
|
-
const exists = await hasPublishedPackageVersion(target.packageRoot, target.packageName, target.publishVersion, {
|
|
81
|
+
const exists = await hasPublishedPackageVersion(target.packageRoot, target.packageName, target.publishVersion, {
|
|
82
|
+
registry,
|
|
83
|
+
...createPublishTargetEnv(this.options, this.runtime, target),
|
|
84
|
+
});
|
|
78
85
|
if (!exists)
|
|
79
86
|
continue;
|
|
80
87
|
this.logExistingVersion(target, registry);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type AukletLogger } from '#auklet/logger';
|
|
1
2
|
import type { PublishOptions, PublishPlan } from '#auklet/publish/types';
|
|
2
|
-
import type { AukletLogger } from '#auklet/logger';
|
|
3
3
|
export declare class VersionWriter {
|
|
4
4
|
private readonly options;
|
|
5
5
|
private readonly logger;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AukletLogger } from '#auklet/logger';
|
|
2
|
-
import type { OwnerOptions, PublishOptions, PublishPlan } from '#auklet/publish/types';
|
|
2
|
+
import type { OwnerOptions, PublishOptions, PublishPlan, PublishRuntime } from '#auklet/publish/types';
|
|
3
3
|
type ResolvePublishTargetsOptions = Pick<PublishOptions, 'cwd' | 'filters' | 'version' | 'dryRun' | 'token'>;
|
|
4
4
|
type ResolveOwnerTargetsOptions = Pick<OwnerOptions, 'cwd' | 'filters' | 'packages'>;
|
|
5
|
-
export declare function resolvePublishPlan(options: ResolvePublishTargetsOptions, logger?: AukletLogger): Promise<PublishPlan>;
|
|
5
|
+
export declare function resolvePublishPlan(options: ResolvePublishTargetsOptions, runtime: PublishRuntime, logger?: AukletLogger): Promise<PublishPlan>;
|
|
6
6
|
export declare function resolveOwnerPackageNames(options: ResolveOwnerTargetsOptions): Promise<string[]>;
|
|
7
7
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import semver from 'semver';
|
|
3
|
-
import { createScopedAukletLogger } from '#auklet/logger';
|
|
4
3
|
import { findWorkspaceRoot } from '#auklet/workspace/root';
|
|
4
|
+
import { createPublishRootEnv } from '#auklet/publish/publishEnv';
|
|
5
|
+
import { createAukletLogger } from '#auklet/logger';
|
|
5
6
|
import { getPublishConfig, readPackageJson, requirePackageName, requirePackageVersion, } from '#auklet/publish/api/packageJsonApi';
|
|
6
7
|
import { readPnpmWorkspacePackages } from '#auklet/publish/api/pnpmApi';
|
|
7
8
|
import { resolvePublishVersion, validateVersionConsistency, } from '#auklet/publish/version';
|
|
8
|
-
export async function resolvePublishPlan(options, logger =
|
|
9
|
+
export async function resolvePublishPlan(options, runtime, logger = createAukletLogger({ scope: 'publish' })) {
|
|
9
10
|
if (options.filters.length) {
|
|
10
|
-
return resolveMonorepoPublishPlan(options, logger);
|
|
11
|
+
return resolveMonorepoPublishPlan(options, runtime, logger);
|
|
11
12
|
}
|
|
12
13
|
return resolveCurrentPackagePublishPlan(options);
|
|
13
14
|
}
|
|
@@ -55,12 +56,15 @@ const resolveCurrentPackagePublishPlan = async (options) => {
|
|
|
55
56
|
workspaceMode: 'single',
|
|
56
57
|
};
|
|
57
58
|
};
|
|
58
|
-
const resolveMonorepoPublishPlan = async (options, logger) => {
|
|
59
|
+
const resolveMonorepoPublishPlan = async (options, runtime, logger) => {
|
|
59
60
|
const root = requireWorkspaceRoot(options.cwd);
|
|
60
61
|
const rootPackageJson = readPackageJson(root);
|
|
61
62
|
const rootVersion = requirePackageVersion(root, rootPackageJson);
|
|
62
|
-
const
|
|
63
|
+
const { env } = createPublishRootEnv({
|
|
63
64
|
token: options.token,
|
|
65
|
+
}, runtime);
|
|
66
|
+
const workspacePackages = await readPnpmWorkspacePackages(root, {
|
|
67
|
+
env,
|
|
64
68
|
});
|
|
65
69
|
const selectedPackages = filterWorkspacePackages(workspacePackages, options.filters);
|
|
66
70
|
const targets = selectedPackages
|
package/dist/publish/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AukletEnvContext } from '#auklet/env';
|
|
2
|
+
import type { DeferredCliValue } from '#auklet/cli/values';
|
|
1
3
|
export type PackageJson = {
|
|
2
4
|
name?: string;
|
|
3
5
|
version?: string;
|
|
@@ -50,9 +52,12 @@ export type PublishOptions = {
|
|
|
50
52
|
filters: Array<string>;
|
|
51
53
|
git?: boolean;
|
|
52
54
|
otp?: string;
|
|
53
|
-
token?:
|
|
55
|
+
token?: DeferredCliValue;
|
|
54
56
|
version?: string;
|
|
55
57
|
};
|
|
58
|
+
export type PublishRuntime = {
|
|
59
|
+
envContext: AukletEnvContext;
|
|
60
|
+
};
|
|
56
61
|
export type OwnerOptions = {
|
|
57
62
|
cwd: string;
|
|
58
63
|
users: Array<string>;
|