create-procode 0.0.0-stage → 1.0.0
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/README.md +240 -2
- package/bin/create-procode.mjs +9 -0
- package/package.json +30 -4
- package/src/args.mjs +139 -0
- package/src/cli.mjs +392 -0
- package/src/deps.mjs +195 -0
- package/src/log.mjs +23 -0
- package/src/prompt.mjs +60 -0
- package/src/scaffold.mjs +104 -0
- package/templates/base/README.md.tmpl +183 -0
- package/templates/base/_dotenv.local.example.tmpl +8 -0
- package/templates/base/_dotenv.tmpl +41 -0
- package/templates/base/_doteslintrc.cjs.tmpl +125 -0
- package/templates/base/_dotgitignore.tmpl +32 -0
- package/templates/base/_dotnvmrc.tmpl +1 -0
- package/templates/base/_dotvscode/extensions.json +3 -0
- package/templates/base/index.html.tmpl +18 -0
- package/templates/base/package.json.tmpl +15 -0
- package/templates/base/public/favicon.svg +4 -0
- package/templates/base/src/AdapterProvider/AdapterFactory.ts.tmpl +21 -0
- package/templates/base/src/AdapterProvider/SampleContacts.ts.tmpl +136 -0
- package/templates/base/src/CustomAction.ts.tmpl +47 -0
- package/templates/base/src/CustomAuthorizationProvider.ts.tmpl +77 -0
- package/templates/base/src/Factory/Actions/myAction.ts.tmpl +51 -0
- package/templates/base/src/Factory/Actions/sampleContacts.ts.tmpl +244 -0
- package/templates/base/src/Factory/Actions/setField.ts.tmpl +20 -0
- package/templates/base/src/Factory/CustomRuleEffectFactory.ts.tmpl +30 -0
- package/templates/base/src/Factory/CustomValidationFactory.tsx.tmpl +24 -0
- package/templates/base/src/Factory/CustomWidgetFactory.tsx.tmpl +43 -0
- package/templates/base/src/Factory/RuleEffects/readOnlyEffect.ts.tmpl +27 -0
- package/templates/base/src/Factory/Validations/myValidation.ts.tmpl +52 -0
- package/templates/base/src/Factory/Widgets/MyWidget/index.tsx.tmpl +101 -0
- package/templates/base/src/Factory/Widgets/Notification/index.tsx.tmpl +53 -0
- package/templates/base/src/Factory/Widgets/Notification/notifiFunc.ts.tmpl +9 -0
- package/templates/base/src/Factory/Widgets/SectionNav/index.tsx +193 -0
- package/templates/base/src/Factory/Widgets/SectionNav/style.scss +139 -0
- package/templates/base/src/Module/Sample/Contacts.json.tmpl +965 -0
- package/templates/base/src/Module/index.ts.tmpl +26 -0
- package/templates/base/src/Screens/index.tsx.tmpl +45 -0
- package/templates/base/src/Utils/errorMessages.ts.tmpl +35 -0
- package/templates/base/src/Utils/fieldErrorMapper.ts.tmpl +46 -0
- package/templates/base/src/Utils/logger.ts.tmpl +21 -0
- package/templates/base/src/Utils/responseFormatter.ts.tmpl +39 -0
- package/templates/base/src/Utils/storages.ts.tmpl +35 -0
- package/templates/base/src/assets/styles/index.scss.tmpl +146 -0
- package/templates/base/src/constant.ts.tmpl +53 -0
- package/templates/base/src/icons.ts.tmpl +17 -0
- package/templates/base/src/localizationResolver.ts.tmpl +48 -0
- package/templates/base/src/main.tsx.tmpl +136 -0
- package/templates/base/src/routes.ts.tmpl +20 -0
- package/templates/base/src/vite-env.d.ts.tmpl +20 -0
- package/templates/base/tsconfig.json.tmpl +30 -0
- package/templates/base/tsconfig.node.json.tmpl +11 -0
- package/templates/base/vite.config.ts.tmpl +61 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CoreProps } from "procode-lowcode-core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Extra routes beside the core's own `<base>/:parentslug/*` and
|
|
5
|
+
* `section/:childslug/*`. Each renders the schema getSchemaBySlugService
|
|
6
|
+
* returns for its `customSlug`, so register that slug in src/Module/index.ts
|
|
7
|
+
* too, or the route shows the 404 screen.
|
|
8
|
+
*
|
|
9
|
+
* parentSimblingRoutes beside :parentslug e.g. { path: "dashboard", customSlug: "home-dashboard" }
|
|
10
|
+
* childSimblingRoutes beside section/:childslug
|
|
11
|
+
* childNestedRoutes under the child route
|
|
12
|
+
*
|
|
13
|
+
* ("Simbling" is the library's spelling.) Module scope on purpose: a new object
|
|
14
|
+
* on any render rebuilds the router and remounts the whole app.
|
|
15
|
+
*/
|
|
16
|
+
export const customRoute: NonNullable<CoreProps["customRoute"]> = {
|
|
17
|
+
parentSimblingRoutes: [],
|
|
18
|
+
childSimblingRoutes: [],
|
|
19
|
+
childNestedRoutes: [],
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly VITE_APPLICATION_CODE: string;
|
|
5
|
+
readonly VITE_HOMEPAGE: string;
|
|
6
|
+
readonly VITE_CENTRAL_SERVICE_BASE_URL: string;
|
|
7
|
+
readonly VITE_PROJECT_ENVIROMENT: string;
|
|
8
|
+
readonly VITE_TOOL_BASE_URL: string;
|
|
9
|
+
readonly VITE_TOOL_SCHEMA_FETCH: string;
|
|
10
|
+
readonly VITE_AUTH_URL: string;
|
|
11
|
+
readonly VITE_BASE_LOGOUT_URL?: string;
|
|
12
|
+
readonly VITE_HEADER_SLUG: string;
|
|
13
|
+
readonly VITE_FOOTER_SLUG: string;
|
|
14
|
+
readonly VITE_NOTIFICATION_VISIBLE_DURATION?: string;
|
|
15
|
+
readonly VITE_HARDCODED_TOKEN?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface ImportMeta {
|
|
19
|
+
readonly env: ImportMetaEnv;
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": false,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
|
|
14
|
+
/* Screens are imported .json files — required, not optional. */
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"esModuleInterop": true,
|
|
21
|
+
|
|
22
|
+
/* Linting */
|
|
23
|
+
"strict": true,
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"noUnusedParameters": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true
|
|
27
|
+
},
|
|
28
|
+
"include": ["src"],
|
|
29
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
// Must match VITE_HOMEPAGE in .env. The app is served from this segment, so a
|
|
8
|
+
// screen lives at <base>/<slug> — e.g. __BASE_PATH_SLASH__sample.
|
|
9
|
+
base: "__BASE_PATH_SLASH__",
|
|
10
|
+
|
|
11
|
+
plugins: [react()],
|
|
12
|
+
|
|
13
|
+
resolve: {
|
|
14
|
+
alias: [
|
|
15
|
+
{
|
|
16
|
+
// procode-lowcode-core exports "./styles" as src/Assets/styles/index.scss,
|
|
17
|
+
// but the package ships the folder as src/assets/. Windows and macOS
|
|
18
|
+
// ignore the case and build; Linux (CI, Docker) fails the @import. This
|
|
19
|
+
// points the import at the real path on every OS.
|
|
20
|
+
find: /^procode-lowcode-core\/styles$/,
|
|
21
|
+
replacement: fileURLToPath(
|
|
22
|
+
new URL("./node_modules/procode-lowcode-core/src/assets/styles/index.scss", import.meta.url),
|
|
23
|
+
),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
build: {
|
|
29
|
+
// Must stay >= es2018. Object rest/spread is an ES2018 feature, and the
|
|
30
|
+
// es2015 downlevel transform miscompiles a `const` that declares two rest
|
|
31
|
+
// patterns at once — it drops bindings and emits a bare `{} = null`, which
|
|
32
|
+
// throws "Cannot destructure 'null' as it is null" at runtime. Kendo's
|
|
33
|
+
// CalendarCell.shouldComponentUpdate is written that way, so the date picker
|
|
34
|
+
// crashes on open in built bundles only — never in dev, which skips this
|
|
35
|
+
// transform. Do not lower this to chase bundle size.
|
|
36
|
+
target: "es2020",
|
|
37
|
+
minify: false,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
esbuild: {
|
|
41
|
+
target: "es2020",
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
// The two runtime libraries ship CommonJS-interop shapes that Vite's dep
|
|
45
|
+
// scanner does not find on its own; pre-bundling them keeps dev reloads fast
|
|
46
|
+
// and avoids "outdated optimize dep" full-page reloads on every save.
|
|
47
|
+
optimizeDeps: {
|
|
48
|
+
include: ["procode-lowcode-kendo-widget", "procode-lowcode-core"],
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
// Some transitive dependencies still reference the Node `global`.
|
|
52
|
+
define: {
|
|
53
|
+
global: "globalThis",
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
server: {
|
|
57
|
+
fs: {
|
|
58
|
+
allow: ["..", "."],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|