create-plasmic-app 0.0.98 → 0.0.100
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/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +2 -1
- package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +2 -1
- package/cpa-out/gatsby-codegen-js/package.json +4 -4
- package/cpa-out/gatsby-codegen-js/plasmic.json +14 -8
- package/cpa-out/gatsby-codegen-js/src/components/Button.jsx +1 -3
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +53 -100
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +36 -30
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +3 -15
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +25 -25
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +45 -59
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +3 -3
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/gatsby-codegen-js/src/pages/dynamic/[slug].jsx +5 -4
- package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +5 -4
- package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +2 -1
- package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +2 -1
- package/cpa-out/gatsby-codegen-ts/package.json +9 -9
- package/cpa-out/gatsby-codegen-ts/plasmic.json +14 -8
- package/cpa-out/gatsby-codegen-ts/src/components/Button.tsx +4 -5
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +99 -75
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +80 -49
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +3 -15
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +69 -43
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +90 -77
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +4 -4
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/cpa-out/gatsby-codegen-ts/src/pages/dynamic/[slug].tsx +6 -5
- package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +6 -5
- package/cpa-out/gatsby-loader-js/package.json +3 -3
- package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +1 -0
- package/cpa-out/gatsby-loader-ts/package.json +8 -8
- package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +1 -0
- package/cpa-out/nextjs-app-loader-js/package.json +8 -6
- package/cpa-out/nextjs-app-loader-js/plasmic-init.js +10 -1
- package/cpa-out/nextjs-app-loader-ts/package.json +12 -10
- package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +10 -1
- package/cpa-out/nextjs-app-loader-ts/tsconfig.json +2 -9
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/nextjs-pages-codegen-js/package.json +4 -4
- package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +2 -1
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/cpa-out/nextjs-pages-codegen-ts/package.json +4 -4
- package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +2 -1
- package/cpa-out/nextjs-pages-codegen-ts/pages/dynamic/[slug].tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +1 -0
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +2 -2
- package/cpa-out/nextjs-pages-loader-js/package.json +3 -3
- package/cpa-out/nextjs-pages-loader-ts/package.json +3 -3
- package/cpa-out/react-codegen-js/eslint.config.js +1 -6
- package/cpa-out/react-codegen-js/package.json +10 -11
- package/cpa-out/react-codegen-js/plasmic.json +2 -2
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +6 -5
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.jsx +1 -1
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.jsx +1 -1
- package/cpa-out/react-codegen-ts/package.json +11 -11
- package/cpa-out/react-codegen-ts/plasmic.json +2 -2
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +17 -14
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +1 -1
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +7 -7
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Checksvg.tsx +1 -1
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +1 -1
- package/dist/index.js +7 -8
- package/dist/utils/file-utils.d.ts +2 -2
- package/dist/utils/file-utils.js +29 -28
- package/package.json +5 -13
- package/run-cpa.ts +8 -6
- package/src/index.ts +7 -9
- package/src/utils/file-utils.ts +44 -30
- package/.eslintrc.js +0 -15
- package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +0 -56
- package/cpa-out/nextjs-app-loader-js/app/api/hello/route.js +0 -3
- package/cpa-out/nextjs-app-loader-js/app/layout.js +0 -14
- package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +0 -6
- package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +0 -65
- package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +0 -59
- package/cpa-out/nextjs-app-loader-ts/app/api/hello/route.ts +0 -3
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +0 -18
- package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +0 -6
- package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +0 -65
|
@@ -10,22 +10,22 @@
|
|
|
10
10
|
"preview": "vite preview"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@plasmicapp/cli": "^0.1.
|
|
14
|
-
"@plasmicapp/react-web": "^0.2.
|
|
13
|
+
"@plasmicapp/cli": "^0.1.337",
|
|
14
|
+
"@plasmicapp/react-web": "^0.2.381",
|
|
15
15
|
"react": "^19.0.0",
|
|
16
16
|
"react-dom": "^19.0.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@eslint/js": "^9.
|
|
20
|
-
"@types/react": "^19.0.
|
|
21
|
-
"@types/react-dom": "^19.0.
|
|
19
|
+
"@eslint/js": "^9.22.0",
|
|
20
|
+
"@types/react": "^19.0.10",
|
|
21
|
+
"@types/react-dom": "^19.0.4",
|
|
22
22
|
"@vitejs/plugin-react": "^4.3.4",
|
|
23
|
-
"eslint": "^9.
|
|
24
|
-
"eslint-plugin-react-hooks": "^5.
|
|
25
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
26
|
-
"globals": "^
|
|
23
|
+
"eslint": "^9.22.0",
|
|
24
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
25
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
26
|
+
"globals": "^16.0.0",
|
|
27
27
|
"typescript": "~5.7.2",
|
|
28
|
-
"typescript-eslint": "^8.
|
|
29
|
-
"vite": "^6.1
|
|
28
|
+
"typescript-eslint": "^8.26.1",
|
|
29
|
+
"vite": "^6.3.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -128,6 +128,6 @@
|
|
|
128
128
|
]
|
|
129
129
|
},
|
|
130
130
|
"wrapPagesWithGlobalContexts": true,
|
|
131
|
-
"cliVersion": "0.1.
|
|
132
|
-
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.
|
|
131
|
+
"cliVersion": "0.1.337",
|
|
132
|
+
"$schema": "https://unpkg.com/@plasmicapp/cli@0.1.337/dist/plasmic.schema.json"
|
|
133
133
|
}
|
package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
4
|
/* prettier-ignore-start */
|
|
5
5
|
|
|
6
6
|
/** @jsxRuntime classic */
|
|
@@ -121,19 +121,21 @@ export const PlasmicButton__VariantProps = new Array<VariantPropType>(
|
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
export type PlasmicButton__ArgsType = {
|
|
124
|
-
children?: React.ReactNode;
|
|
125
|
-
startIcon?: React.ReactNode;
|
|
126
|
-
endIcon?: React.ReactNode;
|
|
127
124
|
link?: string;
|
|
128
125
|
submitsForm?: boolean;
|
|
126
|
+
target?: boolean;
|
|
127
|
+
startIcon?: React.ReactNode;
|
|
128
|
+
children?: React.ReactNode;
|
|
129
|
+
endIcon?: React.ReactNode;
|
|
129
130
|
};
|
|
130
131
|
type ArgPropType = keyof PlasmicButton__ArgsType;
|
|
131
132
|
export const PlasmicButton__ArgProps = new Array<ArgPropType>(
|
|
132
|
-
"children",
|
|
133
|
-
"startIcon",
|
|
134
|
-
"endIcon",
|
|
135
133
|
"link",
|
|
136
|
-
"submitsForm"
|
|
134
|
+
"submitsForm",
|
|
135
|
+
"target",
|
|
136
|
+
"startIcon",
|
|
137
|
+
"children",
|
|
138
|
+
"endIcon"
|
|
137
139
|
);
|
|
138
140
|
|
|
139
141
|
export type PlasmicButton__OverridesType = {
|
|
@@ -145,6 +147,7 @@ export type PlasmicButton__OverridesType = {
|
|
|
145
147
|
|
|
146
148
|
export interface DefaultButtonProps extends pp.BaseButtonProps {
|
|
147
149
|
submitsForm?: boolean;
|
|
150
|
+
target?: boolean;
|
|
148
151
|
shape?: SingleChoiceArg<"rounded" | "round" | "sharp">;
|
|
149
152
|
size?: SingleChoiceArg<"compact" | "minimal">;
|
|
150
153
|
color?: SingleChoiceArg<
|
|
@@ -683,15 +686,15 @@ type NodeComponentProps<T extends NodeNameType> =
|
|
|
683
686
|
args?: PlasmicButton__ArgsType;
|
|
684
687
|
overrides?: NodeOverridesType<T>;
|
|
685
688
|
} & Omit<PlasmicButton__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
/* Specify overrides for each element directly as props*/ Omit<
|
|
689
|
+
// Specify args directly as props
|
|
690
|
+
Omit<PlasmicButton__ArgsType, ReservedPropsType> &
|
|
691
|
+
// Specify overrides for each element directly as props
|
|
692
|
+
Omit<
|
|
691
693
|
NodeOverridesType<T>,
|
|
692
694
|
ReservedPropsType | VariantPropType | ArgPropType
|
|
693
695
|
> &
|
|
694
|
-
|
|
696
|
+
// Specify props for the root element
|
|
697
|
+
Omit<
|
|
695
698
|
Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
|
|
696
699
|
ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
|
|
697
700
|
>;
|
package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
4
|
/* prettier-ignore-start */
|
|
5
5
|
|
|
6
6
|
/** @jsxRuntime classic */
|
|
@@ -207,15 +207,15 @@ type NodeComponentProps<T extends NodeNameType> =
|
|
|
207
207
|
args?: PlasmicDynamicPage__ArgsType;
|
|
208
208
|
overrides?: NodeOverridesType<T>;
|
|
209
209
|
} & Omit<PlasmicDynamicPage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
/* Specify overrides for each element directly as props*/ Omit<
|
|
210
|
+
// Specify args directly as props
|
|
211
|
+
Omit<PlasmicDynamicPage__ArgsType, ReservedPropsType> &
|
|
212
|
+
// Specify overrides for each element directly as props
|
|
213
|
+
Omit<
|
|
215
214
|
NodeOverridesType<T>,
|
|
216
215
|
ReservedPropsType | VariantPropType | ArgPropType
|
|
217
216
|
> &
|
|
218
|
-
|
|
217
|
+
// Specify props for the root element
|
|
218
|
+
Omit<
|
|
219
219
|
Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
|
|
220
220
|
ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
|
|
221
221
|
>;
|
package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
4
|
/* prettier-ignore-start */
|
|
5
5
|
|
|
6
6
|
/** @jsxRuntime classic */
|
|
@@ -247,15 +247,15 @@ type NodeComponentProps<T extends NodeNameType> =
|
|
|
247
247
|
args?: PlasmicHomepage__ArgsType;
|
|
248
248
|
overrides?: NodeOverridesType<T>;
|
|
249
249
|
} & Omit<PlasmicHomepage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
/* Specify overrides for each element directly as props*/ Omit<
|
|
250
|
+
// Specify args directly as props
|
|
251
|
+
Omit<PlasmicHomepage__ArgsType, ReservedPropsType> &
|
|
252
|
+
// Specify overrides for each element directly as props
|
|
253
|
+
Omit<
|
|
255
254
|
NodeOverridesType<T>,
|
|
256
255
|
ReservedPropsType | VariantPropType | ArgPropType
|
|
257
256
|
> &
|
|
258
|
-
|
|
257
|
+
// Specify props for the root element
|
|
258
|
+
Omit<
|
|
259
259
|
Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
|
|
260
260
|
ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
|
|
261
261
|
>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
/* tslint:disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
4
|
/* prettier-ignore-start */
|
|
5
5
|
|
|
6
6
|
/** @jsxRuntime classic */
|
|
@@ -194,15 +194,15 @@ type NodeComponentProps<T extends NodeNameType> =
|
|
|
194
194
|
args?: PlasmicRandomDynamicPageButton__ArgsType;
|
|
195
195
|
overrides?: NodeOverridesType<T>;
|
|
196
196
|
} & Omit<PlasmicRandomDynamicPageButton__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/* Specify overrides for each element directly as props*/ Omit<
|
|
197
|
+
// Specify args directly as props
|
|
198
|
+
Omit<PlasmicRandomDynamicPageButton__ArgsType, ReservedPropsType> &
|
|
199
|
+
// Specify overrides for each element directly as props
|
|
200
|
+
Omit<
|
|
202
201
|
NodeOverridesType<T>,
|
|
203
202
|
ReservedPropsType | VariantPropType | ArgPropType
|
|
204
203
|
> &
|
|
205
|
-
|
|
204
|
+
// Specify props for the root element
|
|
205
|
+
Omit<
|
|
206
206
|
Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
|
|
207
207
|
ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
|
|
208
208
|
>;
|
package/dist/index.js
CHANGED
|
@@ -52,8 +52,8 @@ if (process.env.CPA_DEBUG_CHDIR) {
|
|
|
52
52
|
const createPlasmicAppVersion = (0, npm_utils_1.updateNotify)();
|
|
53
53
|
// Specify command-line args
|
|
54
54
|
const argv = yargs_1.default
|
|
55
|
-
.command("$0 [projectName]", "Create a Plasmic app with Next.js, Gatsby, or React (Vite)", (
|
|
56
|
-
|
|
55
|
+
.command("$0 [projectName]", "Create a Plasmic app with Next.js, Gatsby, or React (Vite)", (yargs2) => {
|
|
56
|
+
yargs2
|
|
57
57
|
.usage("Usage: $0 [projectName] [options]")
|
|
58
58
|
.positional("projectName", {
|
|
59
59
|
describe: "Project and NPM package name",
|
|
@@ -91,13 +91,13 @@ const argv = yargs_1.default
|
|
|
91
91
|
.strict()
|
|
92
92
|
.help("h")
|
|
93
93
|
.alias("h", "help")
|
|
94
|
-
.check((
|
|
95
|
-
if (
|
|
96
|
-
!(
|
|
94
|
+
.check((argv2) => {
|
|
95
|
+
if (argv2.scheme === "loader" &&
|
|
96
|
+
!(argv2.platform === "nextjs" || argv2.platform === "gatsby")) {
|
|
97
97
|
throw new Error(`Loader scheme may only be used with Next.js or Gatsby`);
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
!(
|
|
99
|
+
if (argv2.appDir &&
|
|
100
|
+
!(argv2.platform === "nextjs" && argv2.scheme === "loader")) {
|
|
101
101
|
throw new Error(`App dir may only be used with Next.js and loader scheme`);
|
|
102
102
|
}
|
|
103
103
|
return true;
|
|
@@ -133,7 +133,6 @@ function maybePrompt(question) {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
// Keeping these as globals to easily share with our `crash` function
|
|
136
|
-
const projectName = argv._.length > 0 ? argv._[0] + "" : undefined;
|
|
137
136
|
let resolvedProjectPath;
|
|
138
137
|
/**
|
|
139
138
|
* Main function
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlasmicConfig } from "@plasmicapp/cli/dist/utils/config-utils";
|
|
2
|
-
import { JsOrTs, PlatformType } from "
|
|
2
|
+
import { JsOrTs, PlatformType } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Runs the search pattern through `glob` and deletes all resulting files
|
|
5
5
|
* @param searchPattern - glob search query
|
|
@@ -28,7 +28,7 @@ export declare function generateHomePage(componentAbsPath: string, indexAbsPath:
|
|
|
28
28
|
* @param noPages - don't render links to pages
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
|
-
export declare function generateWelcomePage(config:
|
|
31
|
+
export declare function generateWelcomePage(config: PlasmicConfig, platform: string): string;
|
|
32
32
|
export declare function getPlasmicConfig(projectPath: string, platform: PlatformType, scheme: string): Promise<PlasmicConfig>;
|
|
33
33
|
export declare function ensureTsconfig(projectPath: string): Promise<void>;
|
|
34
34
|
export declare function ifTs(ts: JsOrTs, str: string): string;
|
package/dist/utils/file-utils.js
CHANGED
|
@@ -134,40 +134,41 @@ exports.generateHomePage = generateHomePage;
|
|
|
134
134
|
* @returns
|
|
135
135
|
*/
|
|
136
136
|
function generateWelcomePage(config, platform) {
|
|
137
|
-
var _a, _b, _c;
|
|
138
|
-
let
|
|
139
|
-
let pageComponents;
|
|
140
|
-
let pagesDir;
|
|
137
|
+
var _a, _b, _c, _d;
|
|
138
|
+
let pages;
|
|
141
139
|
if (platform !== "react" && config && lodash_1.default.isArray(config.projects)) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
140
|
+
const components = lodash_1.default.flatMap(config.projects, (p) => p.components).filter((c) => c.componentType === "page");
|
|
141
|
+
const dir = (_b = (_a = config === null || config === void 0 ? void 0 : config.nextjsConfig) === null || _a === void 0 ? void 0 : _a.pagesDir) !== null && _b !== void 0 ? _b : (_c = config === null || config === void 0 ? void 0 : config.gatsbyConfig) === null || _c === void 0 ? void 0 : _c.pagesDir;
|
|
142
|
+
if (components.length > 0 && dir) {
|
|
143
|
+
pages = {
|
|
144
|
+
components,
|
|
145
|
+
dir,
|
|
146
|
+
getPageSection: () => {
|
|
147
|
+
const pageLinks = components
|
|
148
|
+
.map((pc) => {
|
|
149
|
+
// Get the relative path on the filesystem
|
|
150
|
+
const relativePath = path.relative(dir, pc.importSpec.modulePath);
|
|
151
|
+
// Format as an absolute path without the extension name
|
|
152
|
+
const relativeLink = "/" + stripExtension(relativePath);
|
|
153
|
+
if (platform === "nextjs") {
|
|
154
|
+
return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
.join("\n");
|
|
161
|
+
return `
|
|
164
162
|
<h3>Your pages:</h3>
|
|
165
163
|
<ul>
|
|
166
164
|
${pageLinks}
|
|
167
165
|
</ul>
|
|
168
166
|
`;
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const content = (0, welcomePage_1.WELCOME_PAGE)(!!pages, platform, (_d = pages === null || pages === void 0 ? void 0 : pages.getPageSection()) !== null && _d !== void 0 ? _d : "");
|
|
171
172
|
return content;
|
|
172
173
|
}
|
|
173
174
|
exports.generateWelcomePage = generateWelcomePage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-plasmic-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.100",
|
|
4
4
|
"description": "Create Plasmic-powered React apps",
|
|
5
5
|
"main": "./dist/lib.js",
|
|
6
6
|
"types": "./dist/lib.d.ts",
|
|
@@ -12,9 +12,8 @@
|
|
|
12
12
|
"create-plasmic-app": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand --watch",
|
|
15
|
+
"test": "TEST_CWD=`pwd` yarn --cwd=../.. test --passWithNoTests",
|
|
16
|
+
"coverage": "TEST_CWD=`pwd` yarn --cwd=../.. test --coverage --passWithNoTests",
|
|
18
17
|
"build": "eslint 'src/**' && tsc",
|
|
19
18
|
"run-cpa": "yarn build && ts-node run-cpa.ts",
|
|
20
19
|
"create-plasmic-app": "ts-node src/index.ts",
|
|
@@ -30,14 +29,7 @@
|
|
|
30
29
|
"@types/semver": "^7.3.5",
|
|
31
30
|
"@types/update-notifier": "^5.0.0",
|
|
32
31
|
"@types/validate-npm-package-name": "^3.0.2",
|
|
33
|
-
"@types/yargs": "^16.0.0"
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
35
|
-
"@typescript-eslint/parser": "5.59.0",
|
|
36
|
-
"eslint": "^8.50.0",
|
|
37
|
-
"jest": "^26.6.3",
|
|
38
|
-
"jest-circus": "^26.6.3",
|
|
39
|
-
"ts-jest": "^26.5.3",
|
|
40
|
-
"ts-node": "^10.9.1"
|
|
32
|
+
"@types/yargs": "^16.0.0"
|
|
41
33
|
},
|
|
42
34
|
"dependencies": {
|
|
43
35
|
"@plasmicapp/cli": "0.1.187",
|
|
@@ -54,5 +46,5 @@
|
|
|
54
46
|
"validate-npm-package-name": "^3.0.0",
|
|
55
47
|
"yargs": "^16.2.0"
|
|
56
48
|
},
|
|
57
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "46ededb427fd9f6b017065e6623a082de0f10ec8"
|
|
58
50
|
}
|
package/run-cpa.ts
CHANGED
|
@@ -30,11 +30,13 @@ async function run() {
|
|
|
30
30
|
scheme,
|
|
31
31
|
typescript,
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
if (scheme === "codegen") {
|
|
34
|
+
allArgSets.push({
|
|
35
|
+
platform: "react",
|
|
36
|
+
scheme,
|
|
37
|
+
typescript,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
allArgSets.push({
|
|
@@ -69,7 +71,7 @@ Valid arg sets:\n\tall\n\t${allArgSetNames.join("\n\t")}`,
|
|
|
69
71
|
message: "Select arg sets:",
|
|
70
72
|
choices: allArgSetNames,
|
|
71
73
|
pageSize: allArgSetNames.length,
|
|
72
|
-
validate: (input) => {
|
|
74
|
+
validate: (input: string[]) => {
|
|
73
75
|
if (input.length === 0) {
|
|
74
76
|
return "Please select at least 1 arg set.";
|
|
75
77
|
}
|
package/src/index.ts
CHANGED
|
@@ -22,8 +22,8 @@ const argv = yargs
|
|
|
22
22
|
.command(
|
|
23
23
|
"$0 [projectName]",
|
|
24
24
|
"Create a Plasmic app with Next.js, Gatsby, or React (Vite)",
|
|
25
|
-
(
|
|
26
|
-
|
|
25
|
+
(yargs2) => {
|
|
26
|
+
yargs2
|
|
27
27
|
.usage("Usage: $0 [projectName] [options]")
|
|
28
28
|
.positional("projectName", {
|
|
29
29
|
describe: "Project and NPM package name",
|
|
@@ -62,17 +62,17 @@ const argv = yargs
|
|
|
62
62
|
.strict()
|
|
63
63
|
.help("h")
|
|
64
64
|
.alias("h", "help")
|
|
65
|
-
.check((
|
|
65
|
+
.check((argv2) => {
|
|
66
66
|
if (
|
|
67
|
-
|
|
68
|
-
!(
|
|
67
|
+
argv2.scheme === "loader" &&
|
|
68
|
+
!(argv2.platform === "nextjs" || argv2.platform === "gatsby")
|
|
69
69
|
) {
|
|
70
70
|
throw new Error(`Loader scheme may only be used with Next.js or Gatsby`);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
if (
|
|
74
|
-
|
|
75
|
-
!(
|
|
74
|
+
argv2.appDir &&
|
|
75
|
+
!(argv2.platform === "nextjs" && argv2.scheme === "loader")
|
|
76
76
|
) {
|
|
77
77
|
throw new Error(
|
|
78
78
|
`App dir may only be used with Next.js and loader scheme`
|
|
@@ -119,8 +119,6 @@ async function maybePrompt<T>(
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
// Keeping these as globals to easily share with our `crash` function
|
|
122
|
-
const projectName: string | undefined =
|
|
123
|
-
argv._.length > 0 ? argv._[0] + "" : undefined;
|
|
124
122
|
let resolvedProjectPath: string;
|
|
125
123
|
|
|
126
124
|
/**
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentConfig,
|
|
3
|
+
PlasmicConfig,
|
|
4
|
+
} from "@plasmicapp/cli/dist/utils/config-utils";
|
|
2
5
|
import { existsSync, promises as fs, unlinkSync } from "fs";
|
|
3
6
|
import glob from "glob";
|
|
4
7
|
import L from "lodash";
|
|
5
8
|
import * as path from "upath";
|
|
6
9
|
import { README } from "../templates/readme";
|
|
7
10
|
import { WELCOME_PAGE } from "../templates/welcomePage";
|
|
8
|
-
import { JsOrTs, PlatformType } from "../utils/types";
|
|
9
11
|
import { ensure } from "./lang-utils";
|
|
10
12
|
import { installUpgrade } from "./npm-utils";
|
|
13
|
+
import { JsOrTs, PlatformType } from "./types";
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Runs the search pattern through `glob` and deletes all resulting files
|
|
@@ -121,45 +124,56 @@ export default App;
|
|
|
121
124
|
* @param noPages - don't render links to pages
|
|
122
125
|
* @returns
|
|
123
126
|
*/
|
|
124
|
-
export function generateWelcomePage(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
127
|
+
export function generateWelcomePage(
|
|
128
|
+
config: PlasmicConfig,
|
|
129
|
+
platform: string
|
|
130
|
+
): string {
|
|
131
|
+
let pages:
|
|
132
|
+
| {
|
|
133
|
+
components: ComponentConfig[];
|
|
134
|
+
dir: string;
|
|
135
|
+
getPageSection: () => string;
|
|
136
|
+
}
|
|
137
|
+
| undefined;
|
|
128
138
|
if (platform !== "react" && config && L.isArray(config.projects)) {
|
|
129
|
-
|
|
139
|
+
const components = L.flatMap(config.projects, (p) => p.components).filter(
|
|
130
140
|
(c) => c.componentType === "page"
|
|
131
141
|
);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
const dir =
|
|
143
|
+
config?.nextjsConfig?.pagesDir ?? config?.gatsbyConfig?.pagesDir;
|
|
144
|
+
if (components.length > 0 && dir) {
|
|
145
|
+
pages = {
|
|
146
|
+
components,
|
|
147
|
+
dir,
|
|
148
|
+
getPageSection: () => {
|
|
149
|
+
const pageLinks = components
|
|
150
|
+
.map((pc) => {
|
|
151
|
+
// Get the relative path on the filesystem
|
|
152
|
+
const relativePath = path.relative(dir, pc.importSpec.modulePath);
|
|
153
|
+
// Format as an absolute path without the extension name
|
|
154
|
+
const relativeLink = "/" + stripExtension(relativePath);
|
|
155
|
+
if (platform === "nextjs") {
|
|
156
|
+
return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
|
|
157
|
+
} else {
|
|
158
|
+
return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
.join("\n");
|
|
162
|
+
return `
|
|
152
163
|
<h3>Your pages:</h3>
|
|
153
164
|
<ul>
|
|
154
165
|
${pageLinks}
|
|
155
166
|
</ul>
|
|
156
167
|
`;
|
|
157
|
-
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
158
172
|
|
|
159
173
|
const content = WELCOME_PAGE(
|
|
160
|
-
|
|
174
|
+
!!pages,
|
|
161
175
|
platform,
|
|
162
|
-
|
|
176
|
+
pages?.getPageSection() ?? ""
|
|
163
177
|
);
|
|
164
178
|
return content;
|
|
165
179
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
es2020: true,
|
|
6
|
-
},
|
|
7
|
-
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
|
|
8
|
-
parser: "@typescript-eslint/parser",
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: 11,
|
|
11
|
-
sourceType: "module",
|
|
12
|
-
},
|
|
13
|
-
plugins: ["@typescript-eslint"],
|
|
14
|
-
rules: {},
|
|
15
|
-
};
|