@plasmicapp/cli 0.1.305 → 0.1.307
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/actions/export.d.ts +2 -2
- package/dist/index.js +11 -2
- package/dist/lib.js +7 -1
- package/package.json +2 -2
- package/src/actions/export.ts +7 -4
- package/src/utils/code-utils.ts +1 -1
- package/src/utils/file-utils.ts +8 -0
package/dist/actions/export.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export interface ExportArgs extends CommonArgs {
|
|
|
8
8
|
imagesScheme: "" | "inlined" | "files" | "public-files";
|
|
9
9
|
imagesPublicDir: string;
|
|
10
10
|
imagesPublicUrlPrefix: string;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
i18NKeyScheme: "" | I18NConfig["keyScheme"];
|
|
12
|
+
i18NTagPrefix: "" | I18NConfig["tagPrefix"];
|
|
13
13
|
skipFormatting?: boolean;
|
|
14
14
|
outDir: string;
|
|
15
15
|
}
|
package/dist/index.js
CHANGED
|
@@ -735135,7 +735135,7 @@ var formatAsLocal = (content, filePath, baseDir, defaultOpts = {}) => {
|
|
|
735135
735135
|
if (GLOBAL_SETTINGS.skipFormatting) {
|
|
735136
735136
|
return content;
|
|
735137
735137
|
}
|
|
735138
|
-
const opts = { ...defaultOpts };
|
|
735138
|
+
const opts = { ...defaultOpts, pluginSearchDirs: false };
|
|
735139
735139
|
opts.filepath = filePath;
|
|
735140
735140
|
const res = Prettier.format(content, opts);
|
|
735141
735141
|
const res2 = Prettier.format(res, opts);
|
|
@@ -735751,6 +735751,12 @@ function eqPagePath(a, b) {
|
|
|
735751
735751
|
if (a === b) {
|
|
735752
735752
|
return true;
|
|
735753
735753
|
}
|
|
735754
|
+
const normPagePathBrackets = (p) => {
|
|
735755
|
+
return p.replace("[[", "[").replace("]]", "]");
|
|
735756
|
+
};
|
|
735757
|
+
if (normPagePathBrackets(a) === normPagePathBrackets(b)) {
|
|
735758
|
+
return true;
|
|
735759
|
+
}
|
|
735754
735760
|
if (!a.endsWith("/index") && `${a}/index` === b) {
|
|
735755
735761
|
return true;
|
|
735756
735762
|
}
|
|
@@ -739562,6 +739568,9 @@ var import_fs3 = require("fs");
|
|
|
739562
739568
|
var import_path2 = __toESM(require("path"));
|
|
739563
739569
|
async function exportProjectsCli(opts) {
|
|
739564
739570
|
var _a, _b;
|
|
739571
|
+
if (!opts.outDir) {
|
|
739572
|
+
opts.outDir = "./";
|
|
739573
|
+
}
|
|
739565
739574
|
if (!opts.baseDir)
|
|
739566
739575
|
opts.baseDir = process.cwd();
|
|
739567
739576
|
let configFile = opts.config || findConfigFile(opts.baseDir, { traverseParents: true });
|
|
@@ -739600,7 +739609,7 @@ async function exportProjectsCli(opts) {
|
|
|
739600
739609
|
codeOpts: { lang: opts.codeLang || "ts" },
|
|
739601
739610
|
stylesOpts: { scheme: opts.styleScheme || "css-modules" },
|
|
739602
739611
|
imageOpts: { scheme: opts.imagesScheme || "files" },
|
|
739603
|
-
i18nOpts: opts.
|
|
739612
|
+
i18nOpts: opts.i18NKeyScheme ? { keyScheme: opts.i18NKeyScheme, tagPrefix: opts.i18NTagPrefix } : void 0
|
|
739604
739613
|
});
|
|
739605
739614
|
const extx = opts.codeLang === "js" ? "jsx" : "tsx";
|
|
739606
739615
|
const writeProj = async (bundle) => {
|
package/dist/lib.js
CHANGED
|
@@ -730475,7 +730475,7 @@ var formatAsLocal = (content, filePath, baseDir, defaultOpts = {}) => {
|
|
|
730475
730475
|
if (GLOBAL_SETTINGS.skipFormatting) {
|
|
730476
730476
|
return content;
|
|
730477
730477
|
}
|
|
730478
|
-
const opts = { ...defaultOpts };
|
|
730478
|
+
const opts = { ...defaultOpts, pluginSearchDirs: false };
|
|
730479
730479
|
opts.filepath = filePath;
|
|
730480
730480
|
const res = Prettier.format(content, opts);
|
|
730481
730481
|
const res2 = Prettier.format(res, opts);
|
|
@@ -731091,6 +731091,12 @@ function eqPagePath(a, b) {
|
|
|
731091
731091
|
if (a === b) {
|
|
731092
731092
|
return true;
|
|
731093
731093
|
}
|
|
731094
|
+
const normPagePathBrackets = (p) => {
|
|
731095
|
+
return p.replace("[[", "[").replace("]]", "]");
|
|
731096
|
+
};
|
|
731097
|
+
if (normPagePathBrackets(a) === normPagePathBrackets(b)) {
|
|
731098
|
+
return true;
|
|
731099
|
+
}
|
|
731094
731100
|
if (!a.endsWith("/index") && `${a}/index` === b) {
|
|
731095
731101
|
return true;
|
|
731096
731102
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.307",
|
|
4
4
|
"description": "plasmic cli for syncing local code with Plasmic designs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"wrap-ansi": "^7.0.0",
|
|
79
79
|
"yargs": "^15.4.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "c436471bfd37a5b4ee96e71e634d82c52655b1e9"
|
|
82
82
|
}
|
package/src/actions/export.ts
CHANGED
|
@@ -30,8 +30,8 @@ export interface ExportArgs extends CommonArgs {
|
|
|
30
30
|
imagesScheme: "" | "inlined" | "files" | "public-files";
|
|
31
31
|
imagesPublicDir: string;
|
|
32
32
|
imagesPublicUrlPrefix: string;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
i18NKeyScheme: "" | I18NConfig["keyScheme"];
|
|
34
|
+
i18NTagPrefix: "" | I18NConfig["tagPrefix"];
|
|
35
35
|
|
|
36
36
|
skipFormatting?: boolean;
|
|
37
37
|
|
|
@@ -39,6 +39,9 @@ export interface ExportArgs extends CommonArgs {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export async function exportProjectsCli(opts: ExportArgs): Promise<void> {
|
|
42
|
+
if (!opts.outDir) {
|
|
43
|
+
opts.outDir = "./";
|
|
44
|
+
}
|
|
42
45
|
if (!opts.baseDir) opts.baseDir = process.cwd();
|
|
43
46
|
let configFile =
|
|
44
47
|
opts.config || findConfigFile(opts.baseDir, { traverseParents: true });
|
|
@@ -81,8 +84,8 @@ export async function exportProjectsCli(opts: ExportArgs): Promise<void> {
|
|
|
81
84
|
codeOpts: { lang: opts.codeLang || "ts" },
|
|
82
85
|
stylesOpts: { scheme: opts.styleScheme || "css-modules" },
|
|
83
86
|
imageOpts: { scheme: opts.imagesScheme || "files" },
|
|
84
|
-
i18nOpts: opts.
|
|
85
|
-
? { keyScheme: opts.
|
|
87
|
+
i18nOpts: opts.i18NKeyScheme
|
|
88
|
+
? { keyScheme: opts.i18NKeyScheme, tagPrefix: opts.i18NTagPrefix }
|
|
86
89
|
: undefined,
|
|
87
90
|
});
|
|
88
91
|
|
package/src/utils/code-utils.ts
CHANGED
|
@@ -52,7 +52,7 @@ export const formatAsLocal = (
|
|
|
52
52
|
// a better solution, like maybe letting user specify a prettier config
|
|
53
53
|
// file in plasmic.json
|
|
54
54
|
// const opts = resolveConfig.sync(baseDir) || defaultOpts;
|
|
55
|
-
const opts = { ...defaultOpts };
|
|
55
|
+
const opts: Options = { ...defaultOpts, pluginSearchDirs: false };
|
|
56
56
|
opts.filepath = filePath;
|
|
57
57
|
|
|
58
58
|
// Running Prettier multiple times may actually yield different results!
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -135,6 +135,14 @@ export function eqPagePath(a: string, b: string) {
|
|
|
135
135
|
return true;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
// We also let users rename [...page].js to [[...page]].js
|
|
139
|
+
const normPagePathBrackets = (p: string) => {
|
|
140
|
+
return p.replace("[[", "[").replace("]]", "]");
|
|
141
|
+
};
|
|
142
|
+
if (normPagePathBrackets(a) === normPagePathBrackets(b)) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
138
146
|
// pages/about.* and pages/about/index.* resolve to the same URI, but
|
|
139
147
|
// pages/index.* and pages/index/index.* do not.
|
|
140
148
|
if (!a.endsWith("/index") && `${a}/index` === b) {
|