@postxl/generator 1.6.0 → 1.6.2
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/helpers/package-json.generator.d.ts +1 -1
- package/dist/helpers/package-json.generator.js +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/lockfile.d.ts +1 -1
- package/dist/utils/sync.d.ts +9 -1
- package/dist/utils/sync.js +14 -2
- package/package.json +6 -6
|
@@ -3,7 +3,7 @@ import { PackageName } from './branded.types';
|
|
|
3
3
|
* Hardcoded pnpm version used across all generated projects.
|
|
4
4
|
* Update this when upgrading pnpm.
|
|
5
5
|
*/
|
|
6
|
-
export declare const PNPM_VERSION = "10.
|
|
6
|
+
export declare const PNPM_VERSION = "10.33.2";
|
|
7
7
|
/**
|
|
8
8
|
* Hardcoded Node.js version used across all generated projects.
|
|
9
9
|
* Update this when upgrading Node.js.
|
|
@@ -7,7 +7,7 @@ exports.generatePackageJson = generatePackageJson;
|
|
|
7
7
|
* Hardcoded pnpm version used across all generated projects.
|
|
8
8
|
* Update this when upgrading pnpm.
|
|
9
9
|
*/
|
|
10
|
-
exports.PNPM_VERSION = '10.
|
|
10
|
+
exports.PNPM_VERSION = '10.33.2';
|
|
11
11
|
/**
|
|
12
12
|
* Hardcoded Node.js version used across all generated projects.
|
|
13
13
|
* Update this when upgrading Node.js.
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from './checksum';
|
|
1
2
|
export * from './classify-path';
|
|
2
3
|
export * from './custom-blocks';
|
|
3
4
|
export * from './jsdoc';
|
|
4
5
|
export * from './lint';
|
|
6
|
+
export * from './lockfile';
|
|
5
7
|
export * from './path';
|
|
6
8
|
export * from './promise';
|
|
7
9
|
export * from './prettier';
|
package/dist/utils/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./checksum"), exports);
|
|
17
18
|
__exportStar(require("./classify-path"), exports);
|
|
18
19
|
__exportStar(require("./custom-blocks"), exports);
|
|
19
20
|
__exportStar(require("./jsdoc"), exports);
|
|
20
21
|
__exportStar(require("./lint"), exports);
|
|
22
|
+
__exportStar(require("./lockfile"), exports);
|
|
21
23
|
__exportStar(require("./path"), exports);
|
|
22
24
|
__exportStar(require("./promise"), exports);
|
|
23
25
|
__exportStar(require("./prettier"), exports);
|
package/dist/utils/lockfile.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type EjectedSentinel = typeof EJECTED_SENTINEL;
|
|
|
24
24
|
* checksum, or the {@link EJECTED_SENTINEL} marking the file as permanently ejected.
|
|
25
25
|
*/
|
|
26
26
|
export type LockEntry = Checksum | EjectedSentinel;
|
|
27
|
-
declare const zLockFile: z.ZodPipe<z.ZodRecord<z.core.$ZodBranded<z.ZodString, "PXL.PosixPath", "out">, z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PXL.Checksum", "out">, z.ZodLiteral<"ejected">]>>, z.ZodTransform<Map<string & z.core.$brand<"PXL.PosixPath">, LockEntry>, Record<string & z.core.$brand<"PXL.PosixPath">,
|
|
27
|
+
declare const zLockFile: z.ZodPipe<z.ZodRecord<z.core.$ZodBranded<z.ZodString, "PXL.PosixPath", "out">, z.ZodUnion<readonly [z.core.$ZodBranded<z.ZodString, "PXL.Checksum", "out">, z.ZodLiteral<"ejected">]>>, z.ZodTransform<Map<string & z.core.$brand<"PXL.PosixPath">, LockEntry>, Record<string & z.core.$brand<"PXL.PosixPath">, (string & z.core.$brand<"PXL.Checksum">) | "ejected">>>;
|
|
28
28
|
type LockFile = z.infer<typeof zLockFile>;
|
|
29
29
|
export declare function isEjected(entry: LockEntry | undefined): entry is EjectedSentinel;
|
|
30
30
|
export declare function writeLockFile(lockFilePath: string, vfs: VirtualFileSystem, opts?: {
|
package/dist/utils/sync.d.ts
CHANGED
|
@@ -75,6 +75,14 @@ type SyncParams = {
|
|
|
75
75
|
* generation via `-m <names...>`.
|
|
76
76
|
*/
|
|
77
77
|
selectiveGeneration?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* When true, computes the actions that *would* be performed but skips
|
|
80
|
+
* executing them — no files are written, deleted, or merge-conflict-marked,
|
|
81
|
+
* and the lock file is left untouched. The returned `SyncResults` still
|
|
82
|
+
* report the planned `action` per file, so callers can use
|
|
83
|
+
* `logSyncResult` to summarize the diff.
|
|
84
|
+
*/
|
|
85
|
+
dryRun?: boolean;
|
|
78
86
|
};
|
|
79
87
|
/**
|
|
80
88
|
* Error returned when files with unresolved merge conflicts are detected
|
|
@@ -117,7 +125,7 @@ export type SyncResults = {
|
|
|
117
125
|
* merge conflict markers. If found, the sync will abort immediately and return an error with the
|
|
118
126
|
* list of files that need to be resolved before generation can continue.
|
|
119
127
|
*/
|
|
120
|
-
export declare function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneration, }: SyncParams): Promise<SyncResults>;
|
|
128
|
+
export declare function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneration, dryRun, }: SyncParams): Promise<SyncResults>;
|
|
121
129
|
type FileState = {
|
|
122
130
|
state: 'empty';
|
|
123
131
|
} | {
|
package/dist/utils/sync.js
CHANGED
|
@@ -121,7 +121,7 @@ const Path = __importStar(require("./path"));
|
|
|
121
121
|
* merge conflict markers. If found, the sync will abort immediately and return an error with the
|
|
122
122
|
* list of files that need to be resolved before generation can continue.
|
|
123
123
|
*/
|
|
124
|
-
async function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneration, }) {
|
|
124
|
+
async function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneration, dryRun, }) {
|
|
125
125
|
const diskPathNormalized = Path.normalize(diskFilePath);
|
|
126
126
|
const files = await getFilesStates({ vfs, lockFilePath, diskFilePath, selectiveGeneration: !!selectiveGeneration });
|
|
127
127
|
// Check for unresolved merge conflicts before writing any files
|
|
@@ -156,6 +156,16 @@ async function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneratio
|
|
|
156
156
|
continue;
|
|
157
157
|
}
|
|
158
158
|
const [action, isEjectedFile] = determineActionState({ virtual, lock, disk }, force);
|
|
159
|
+
if (dryRun) {
|
|
160
|
+
// Dry-run: record the planned action but do not touch disk.
|
|
161
|
+
result.files[filePath] = {
|
|
162
|
+
action,
|
|
163
|
+
inputState,
|
|
164
|
+
actionResult: utils_1.Result.ok(undefined),
|
|
165
|
+
isEjected: isEjectedFile,
|
|
166
|
+
};
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
159
169
|
const task = limit(async () => {
|
|
160
170
|
const actionResult = await executeAction(Path.join(diskPathNormalized, filePath), action);
|
|
161
171
|
if (actionResult.isErr()) {
|
|
@@ -165,7 +175,9 @@ async function sync({ vfs, lockFilePath, diskFilePath, force, selectiveGeneratio
|
|
|
165
175
|
});
|
|
166
176
|
tasks.push(task);
|
|
167
177
|
}
|
|
168
|
-
|
|
178
|
+
if (!dryRun) {
|
|
179
|
+
tasks.push(limit(() => (0, lockfile_1.writeLockFile)(lockFilePath, vfs, selectiveGeneration ? { selectiveGeneration: true } : {})));
|
|
180
|
+
}
|
|
169
181
|
await Promise.all(tasks);
|
|
170
182
|
return { success: true, ...result };
|
|
171
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postxl/generator",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "Core package that orchestrates the code generation of a PXL project",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"directory": "packages/generator"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
42
|
-
"prettier": "3.8.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "8.59.2",
|
|
42
|
+
"prettier": "3.8.3",
|
|
43
43
|
"diff": "8.0.3",
|
|
44
44
|
"globals": "16.5.0",
|
|
45
45
|
"isbinaryfile": "5.0.7",
|
|
46
46
|
"jszip": "3.10.1",
|
|
47
|
-
"minimatch": "^10.2.
|
|
47
|
+
"minimatch": "^10.2.5",
|
|
48
48
|
"p-limit": "3.1.0",
|
|
49
|
-
"@postxl/schema": "^2.0.
|
|
50
|
-
"@postxl/utils": "^1.4.
|
|
49
|
+
"@postxl/schema": "^2.0.1",
|
|
50
|
+
"@postxl/utils": "^1.4.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/diff": "8.0.0"
|