@plasmicapp/cli 0.1.188 → 0.1.189
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/resolve-utils.js +11 -7
- package/package.json +1 -1
- package/src/utils/resolve-utils.ts +25 -14
|
@@ -78,7 +78,8 @@ function checkProjectMeta(meta, root, context, opts) {
|
|
|
78
78
|
// If the codegen version on-disk is invalid, we will sync again the project.
|
|
79
79
|
const checkCodegenVersion = () => __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
const projectLock = context.lock.projects.find((p) => p.projectId === projectId);
|
|
81
|
-
if (!!(projectLock === null || projectLock === void 0 ? void 0 : projectLock.codegenVersion) &&
|
|
81
|
+
if (!!(projectLock === null || projectLock === void 0 ? void 0 : projectLock.codegenVersion) &&
|
|
82
|
+
semver.gte(projectLock.codegenVersion, yield context.api.latestCodegenVersion())) {
|
|
82
83
|
return false;
|
|
83
84
|
}
|
|
84
85
|
return true;
|
|
@@ -92,9 +93,10 @@ function checkProjectMeta(meta, root, context, opts) {
|
|
|
92
93
|
// Always sync if we haven't seen sync'ed before
|
|
93
94
|
return true;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// If version is a branch name, we want to get the latest of the branch
|
|
97
|
+
const newVersionIsLatest = semver.isLatest(newVersion) || !semver.valid(newVersion);
|
|
98
|
+
const versionOnDiskIsLatest = semver.isLatest(versionOnDisk) || !semver.valid(versionOnDisk);
|
|
99
|
+
if (versionOnDiskIsLatest && newVersionIsLatest && meta !== root) {
|
|
98
100
|
// If this is a dependency (not root), and we're dealing with latest dep version
|
|
99
101
|
// just skip, it's confusing
|
|
100
102
|
if (!isOnDiskCodeInvalid) {
|
|
@@ -102,11 +104,11 @@ function checkProjectMeta(meta, root, context, opts) {
|
|
|
102
104
|
}
|
|
103
105
|
return false;
|
|
104
106
|
}
|
|
105
|
-
if (
|
|
107
|
+
if (newVersionIsLatest) {
|
|
106
108
|
// Always sync when version set to "latest"
|
|
107
109
|
return true;
|
|
108
110
|
}
|
|
109
|
-
if (
|
|
111
|
+
if (versionOnDiskIsLatest) {
|
|
110
112
|
// Explicitly allow downgrades from "latest" to published version
|
|
111
113
|
return true;
|
|
112
114
|
}
|
|
@@ -152,8 +154,10 @@ function checkProjectMeta(meta, root, context, opts) {
|
|
|
152
154
|
: deps_1.logger.info(`'${projectName} has never been synced before. Syncing...'`);
|
|
153
155
|
return true;
|
|
154
156
|
}
|
|
157
|
+
// If version is a branch name, we want to get the latest of the branch
|
|
158
|
+
const versionRangeIsLatest = semver.isLatest(versionRange) || !semver.valid(versionRange);
|
|
155
159
|
// If satisfies range in plasmic.json
|
|
156
|
-
if (semver.satisfies(newVersion, versionRange)) {
|
|
160
|
+
if (versionRangeIsLatest || semver.satisfies(newVersion, versionRange)) {
|
|
157
161
|
deps_1.logger.info(`Updating project '${projectName}' to ${newVersion}`);
|
|
158
162
|
return true;
|
|
159
163
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import L from "lodash";
|
|
2
|
-
import { InvalidatedProjectKind } from "typescript";
|
|
3
2
|
import { SyncArgs } from "../actions/sync";
|
|
4
3
|
import { ProjectVersionMeta, VersionResolution } from "../api";
|
|
5
4
|
import { logger } from "../deps";
|
|
@@ -74,7 +73,13 @@ async function checkProjectMeta(
|
|
|
74
73
|
(p) => p.projectId === projectId
|
|
75
74
|
);
|
|
76
75
|
|
|
77
|
-
if (
|
|
76
|
+
if (
|
|
77
|
+
!!projectLock?.codegenVersion &&
|
|
78
|
+
semver.gte(
|
|
79
|
+
projectLock.codegenVersion,
|
|
80
|
+
await context.api.latestCodegenVersion()
|
|
81
|
+
)
|
|
82
|
+
) {
|
|
78
83
|
return false;
|
|
79
84
|
}
|
|
80
85
|
|
|
@@ -95,11 +100,13 @@ async function checkProjectMeta(
|
|
|
95
100
|
return true;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
semver.isLatest(newVersion)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
// If version is a branch name, we want to get the latest of the branch
|
|
104
|
+
const newVersionIsLatest =
|
|
105
|
+
semver.isLatest(newVersion) || !semver.valid(newVersion);
|
|
106
|
+
const versionOnDiskIsLatest =
|
|
107
|
+
semver.isLatest(versionOnDisk) || !semver.valid(versionOnDisk);
|
|
108
|
+
|
|
109
|
+
if (versionOnDiskIsLatest && newVersionIsLatest && meta !== root) {
|
|
103
110
|
// If this is a dependency (not root), and we're dealing with latest dep version
|
|
104
111
|
// just skip, it's confusing
|
|
105
112
|
if (!isOnDiskCodeInvalid) {
|
|
@@ -110,12 +117,12 @@ async function checkProjectMeta(
|
|
|
110
117
|
return false;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
|
-
if (
|
|
120
|
+
if (newVersionIsLatest) {
|
|
114
121
|
// Always sync when version set to "latest"
|
|
115
122
|
return true;
|
|
116
123
|
}
|
|
117
124
|
|
|
118
|
-
if (
|
|
125
|
+
if (versionOnDiskIsLatest) {
|
|
119
126
|
// Explicitly allow downgrades from "latest" to published version
|
|
120
127
|
return true;
|
|
121
128
|
}
|
|
@@ -128,7 +135,7 @@ async function checkProjectMeta(
|
|
|
128
135
|
);
|
|
129
136
|
return true;
|
|
130
137
|
} else {
|
|
131
|
-
if (!isOnDiskCodeInvalid) {
|
|
138
|
+
if (!isOnDiskCodeInvalid) {
|
|
132
139
|
logger.info(
|
|
133
140
|
`Project '${projectName}'@${newVersion} is already up to date; skipping. (To force an update, run again with "--force")`
|
|
134
141
|
);
|
|
@@ -186,8 +193,12 @@ async function checkProjectMeta(
|
|
|
186
193
|
return true;
|
|
187
194
|
}
|
|
188
195
|
|
|
196
|
+
// If version is a branch name, we want to get the latest of the branch
|
|
197
|
+
const versionRangeIsLatest =
|
|
198
|
+
semver.isLatest(versionRange) || !semver.valid(versionRange);
|
|
199
|
+
|
|
189
200
|
// If satisfies range in plasmic.json
|
|
190
|
-
if (semver.satisfies(newVersion, versionRange)) {
|
|
201
|
+
if (versionRangeIsLatest || semver.satisfies(newVersion, versionRange)) {
|
|
191
202
|
logger.info(`Updating project '${projectName}' to ${newVersion}`);
|
|
192
203
|
return true;
|
|
193
204
|
}
|
|
@@ -230,12 +241,12 @@ async function checkProjectMeta(
|
|
|
230
241
|
// we should always sync it, even if nothing has changed
|
|
231
242
|
return true;
|
|
232
243
|
}
|
|
233
|
-
const checkedVersion =
|
|
244
|
+
const checkedVersion =
|
|
234
245
|
(await checkVersionLock()) &&
|
|
235
246
|
(await checkVersionRange()) &&
|
|
236
247
|
(await checkIndirect());
|
|
237
248
|
|
|
238
|
-
|
|
249
|
+
if (!checkedVersion && isOnDiskCodeInvalid) {
|
|
239
250
|
// sync, but try to keep the current version on disk
|
|
240
251
|
const projectLock = context.lock.projects.find(
|
|
241
252
|
(p) => p.projectId === projectId
|
|
@@ -244,7 +255,7 @@ async function checkProjectMeta(
|
|
|
244
255
|
logger.warn(
|
|
245
256
|
`Project '${projectName}' was synced by an incompatible version of Plasmic Codegen. Syncing again on the same version ${projectName}@${versionOnDisk}`
|
|
246
257
|
);
|
|
247
|
-
|
|
258
|
+
|
|
248
259
|
meta.version = versionOnDisk ?? meta.version;
|
|
249
260
|
return true;
|
|
250
261
|
} else if (checkedVersion) {
|