@plasmicapp/cli 0.1.180 → 0.1.183
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/__mocks__/api.js +1 -0
- package/dist/actions/init.js +2 -1
- package/dist/actions/sync.js +7 -0
- package/dist/api.d.ts +1 -0
- package/dist/utils/code-utils.js +1 -1
- package/dist/utils/file-utils.js +2 -1
- package/package.json +1 -1
- package/src/__mocks__/api.ts +1 -0
- package/src/actions/init.ts +2 -1
- package/src/actions/sync.ts +12 -0
- package/src/api.ts +1 -0
- package/src/utils/code-utils.ts +1 -1
- package/src/utils/file-utils.ts +4 -1
package/dist/__mocks__/api.js
CHANGED
package/dist/actions/init.js
CHANGED
|
@@ -42,9 +42,10 @@ function initPlasmic(opts) {
|
|
|
42
42
|
if (!process.env.QUIET) {
|
|
43
43
|
deps_1.logger.info("Successfully created plasmic.json.\n");
|
|
44
44
|
}
|
|
45
|
-
const answer = yield user_utils_1.confirmWithUser("@plasmicapp/react-web
|
|
45
|
+
const answer = yield user_utils_1.confirmWithUser("@plasmicapp/host and @plasmicapp/react-web are small runtimes required by Plasmic-generated code.\n Do you want to add them now?", opts.yes);
|
|
46
46
|
if (answer) {
|
|
47
47
|
npm_utils_1.installUpgrade("@plasmicapp/react-web", opts.baseDir);
|
|
48
|
+
npm_utils_1.installUpgrade("@plasmicapp/host", opts.baseDir);
|
|
48
49
|
}
|
|
49
50
|
});
|
|
50
51
|
}
|
package/dist/actions/sync.js
CHANGED
|
@@ -88,6 +88,13 @@ function ensureRequiredPackages(context, baseDir, yes) {
|
|
|
88
88
|
semver.gt(requireds["@plasmicapp/react-web"], reactWebVersion)) {
|
|
89
89
|
yield confirmInstall("@plasmicapp/react-web", requireds["@plasmicapp/react-web"], { global: false, dev: false });
|
|
90
90
|
}
|
|
91
|
+
const hostVersion = npm_utils_1.findInstalledVersion(context, baseDir, "@plasmicapp/host");
|
|
92
|
+
if (!hostVersion || semver.gt(requireds["@plasmicapp/host"], hostVersion)) {
|
|
93
|
+
yield confirmInstall("@plasmicapp/host", requireds["@plasmicapp/host"], {
|
|
94
|
+
global: false,
|
|
95
|
+
dev: false,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
91
98
|
if (context.config.code.reactRuntime === "automatic") {
|
|
92
99
|
// Using automatic runtime requires installing the @plasmicapp/react-web-runtime package
|
|
93
100
|
const runtimeVersion = npm_utils_1.findInstalledVersion(context, baseDir, "@plasmicapp/react-web-runtime");
|
package/dist/api.d.ts
CHANGED
package/dist/utils/code-utils.js
CHANGED
|
@@ -252,7 +252,7 @@ function replaceImports(context, code, fromPath, fixImportContext, removeImportD
|
|
|
252
252
|
const meta = fixImportContext.codeComponentMetas[uuid];
|
|
253
253
|
if (meta.componentImportPath[0] === ".") {
|
|
254
254
|
// Relative path from the project root
|
|
255
|
-
const toPath = upath_1.default.join(
|
|
255
|
+
const toPath = upath_1.default.join(context.rootDir, meta.componentImportPath);
|
|
256
256
|
lang_utils_1.assert(upath_1.default.isAbsolute(toPath));
|
|
257
257
|
const realPath = makeImportPath(context, fromPath, toPath, true, true);
|
|
258
258
|
stmt.source.value = realPath;
|
package/dist/utils/file-utils.js
CHANGED
|
@@ -23,9 +23,10 @@ const code_utils_1 = require("./code-utils");
|
|
|
23
23
|
const config_utils_1 = require("./config-utils");
|
|
24
24
|
const lang_utils_1 = require("./lang-utils");
|
|
25
25
|
const user_utils_1 = require("./user-utils");
|
|
26
|
+
const findExtension = (filename) => { var _a; return (_a = filename === null || filename === void 0 ? void 0 : filename.substring(filename.indexOf("."))) !== null && _a !== void 0 ? _a : filename; };
|
|
26
27
|
function stripExtension(filename, removeComposedPath = false) {
|
|
27
28
|
const ext = removeComposedPath
|
|
28
|
-
?
|
|
29
|
+
? findExtension(lodash_1.default.last(filename.split("/")))
|
|
29
30
|
: upath_1.default.extname(filename);
|
|
30
31
|
if (!ext || filename === ext) {
|
|
31
32
|
return filename;
|
package/package.json
CHANGED
package/src/__mocks__/api.ts
CHANGED
package/src/actions/init.ts
CHANGED
|
@@ -73,11 +73,12 @@ export async function initPlasmic(
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const answer = await confirmWithUser(
|
|
76
|
-
"@plasmicapp/react-web
|
|
76
|
+
"@plasmicapp/host and @plasmicapp/react-web are small runtimes required by Plasmic-generated code.\n Do you want to add them now?",
|
|
77
77
|
opts.yes
|
|
78
78
|
);
|
|
79
79
|
if (answer) {
|
|
80
80
|
installUpgrade("@plasmicapp/react-web", opts.baseDir);
|
|
81
|
+
installUpgrade("@plasmicapp/host", opts.baseDir);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
package/src/actions/sync.ts
CHANGED
|
@@ -143,6 +143,18 @@ async function ensureRequiredPackages(
|
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
const hostVersion = findInstalledVersion(
|
|
147
|
+
context,
|
|
148
|
+
baseDir,
|
|
149
|
+
"@plasmicapp/host"
|
|
150
|
+
);
|
|
151
|
+
if (!hostVersion || semver.gt(requireds["@plasmicapp/host"], hostVersion)) {
|
|
152
|
+
await confirmInstall("@plasmicapp/host", requireds["@plasmicapp/host"], {
|
|
153
|
+
global: false,
|
|
154
|
+
dev: false,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
if (context.config.code.reactRuntime === "automatic") {
|
|
147
159
|
// Using automatic runtime requires installing the @plasmicapp/react-web-runtime package
|
|
148
160
|
const runtimeVersion = findInstalledVersion(
|
package/src/api.ts
CHANGED
package/src/utils/code-utils.ts
CHANGED
|
@@ -330,7 +330,7 @@ export function replaceImports(
|
|
|
330
330
|
const meta = fixImportContext.codeComponentMetas[uuid];
|
|
331
331
|
if (meta.componentImportPath[0] === ".") {
|
|
332
332
|
// Relative path from the project root
|
|
333
|
-
const toPath = path.join(
|
|
333
|
+
const toPath = path.join(context.rootDir, meta.componentImportPath);
|
|
334
334
|
assert(path.isAbsolute(toPath));
|
|
335
335
|
const realPath = makeImportPath(context, fromPath, toPath, true, true);
|
|
336
336
|
stmt.source.value = realPath;
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -15,9 +15,12 @@ import {
|
|
|
15
15
|
import { ensureString } from "./lang-utils";
|
|
16
16
|
import { confirmWithUser } from "./user-utils";
|
|
17
17
|
|
|
18
|
+
const findExtension = (filename?: string) =>
|
|
19
|
+
filename?.substring(filename.indexOf(".")) ?? filename;
|
|
20
|
+
|
|
18
21
|
export function stripExtension(filename: string, removeComposedPath = false) {
|
|
19
22
|
const ext = removeComposedPath
|
|
20
|
-
?
|
|
23
|
+
? findExtension(L.last(filename.split("/")))
|
|
21
24
|
: path.extname(filename);
|
|
22
25
|
if (!ext || filename === ext) {
|
|
23
26
|
return filename;
|