@postxl/generator 1.6.1 → 1.6.3
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/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/sync.d.ts +9 -1
- package/dist/utils/sync.js +14 -2
- package/package.json +1 -1
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/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
|
}
|