@kosdev-code/kos-nx-plugin 2.0.2
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 +11 -0
- package/generators.json +70 -0
- package/migrations.json +81 -0
- package/package.json +25 -0
- package/src/generators/kos-companion-model/files/types/index.d.ts.template +11 -0
- package/src/generators/kos-companion-model/generator.d.ts +5 -0
- package/src/generators/kos-companion-model/generator.d.ts.map +1 -0
- package/src/generators/kos-companion-model/generator.js +45 -0
- package/src/generators/kos-companion-model/generator.js.map +1 -0
- package/src/generators/kos-companion-model/schema.d.ts +6 -0
- package/src/generators/kos-companion-model/schema.json +36 -0
- package/src/generators/kos-component/cui/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/cui/__nameDashCase__.tsx__template__ +35 -0
- package/src/generators/kos-component/cui/index.ts__template__ +1 -0
- package/src/generators/kos-component/files/__nameDashCase__.css__template__ +2 -0
- package/src/generators/kos-component/files/__nameDashCase__.tsx__template__ +20 -0
- package/src/generators/kos-component/files/index.ts__template__ +1 -0
- package/src/generators/kos-component/generator.d.ts +5 -0
- package/src/generators/kos-component/generator.d.ts.map +1 -0
- package/src/generators/kos-component/generator.js +270 -0
- package/src/generators/kos-component/generator.js.map +1 -0
- package/src/generators/kos-component/nav/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/nav/__nameDashCase__.tsx__template__ +25 -0
- package/src/generators/kos-component/nav/index.ts__template__ +1 -0
- package/src/generators/kos-component/schema.d.ts +18 -0
- package/src/generators/kos-component/schema.json +88 -0
- package/src/generators/kos-component/setting/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/setting/__nameDashCase__.tsx__template__ +25 -0
- package/src/generators/kos-component/setting/index.ts__template__ +1 -0
- package/src/generators/kos-component/setup/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/setup/__nameDashCase__.tsx__template__ +32 -0
- package/src/generators/kos-component/setup/index.ts__template__ +1 -0
- package/src/generators/kos-component/trouble-action/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/trouble-action/__nameDashCase__.tsx__template__ +58 -0
- package/src/generators/kos-component/trouble-action/index.ts__template__ +1 -0
- package/src/generators/kos-component/utility/__nameDashCase__.stories.tsx__template__ +30 -0
- package/src/generators/kos-component/utility/__nameDashCase__.tsx__template__ +45 -0
- package/src/generators/kos-component/utility/index.ts__template__ +1 -0
- package/src/generators/kos-container-model/files/model/__nameDashCase__-model.ts.template +80 -0
- package/src/generators/kos-container-model/files/model/__nameDashCase__-registration.ts.template +113 -0
- package/src/generators/kos-container-model/files/model/index.ts.template +6 -0
- package/src/generators/kos-container-model/files/model/types/index.d.ts.template +24 -0
- package/src/generators/kos-container-model/files/services/__modelNameDashCase__-services.ts.template +28 -0
- package/src/generators/kos-container-model/files/services/index.ts.template +1 -0
- package/src/generators/kos-container-model/generator.d.ts +5 -0
- package/src/generators/kos-container-model/generator.d.ts.map +1 -0
- package/src/generators/kos-container-model/generator.js +74 -0
- package/src/generators/kos-container-model/generator.js.map +1 -0
- package/src/generators/kos-container-model/lib/normalize-options.d.ts +4 -0
- package/src/generators/kos-container-model/lib/normalize-options.d.ts.map +1 -0
- package/src/generators/kos-container-model/lib/normalize-options.js +32 -0
- package/src/generators/kos-container-model/lib/normalize-options.js.map +1 -0
- package/src/generators/kos-container-model/lib/normalize-value.d.ts +7 -0
- package/src/generators/kos-container-model/lib/normalize-value.d.ts.map +1 -0
- package/src/generators/kos-container-model/lib/normalize-value.js +28 -0
- package/src/generators/kos-container-model/lib/normalize-value.js.map +1 -0
- package/src/generators/kos-container-model/lib/utils/name-utils.d.ts +6 -0
- package/src/generators/kos-container-model/lib/utils/name-utils.d.ts.map +1 -0
- package/src/generators/kos-container-model/lib/utils/name-utils.js +53 -0
- package/src/generators/kos-container-model/lib/utils/name-utils.js.map +1 -0
- package/src/generators/kos-container-model/lib/utils/ts-visitor.d.ts +8 -0
- package/src/generators/kos-container-model/lib/utils/ts-visitor.d.ts.map +1 -0
- package/src/generators/kos-container-model/lib/utils/ts-visitor.js +122 -0
- package/src/generators/kos-container-model/lib/utils/ts-visitor.js.map +1 -0
- package/src/generators/kos-container-model/schema.d.ts +35 -0
- package/src/generators/kos-container-model/schema.json +50 -0
- package/src/generators/kos-context/files/__nameDashCase__-provider.tsx.template +40 -0
- package/src/generators/kos-context/files/index.ts.template +1 -0
- package/src/generators/kos-context/generator.d.ts +5 -0
- package/src/generators/kos-context/generator.d.ts.map +1 -0
- package/src/generators/kos-context/generator.js +56 -0
- package/src/generators/kos-context/generator.js.map +1 -0
- package/src/generators/kos-context/schema.d.ts +14 -0
- package/src/generators/kos-context/schema.json +36 -0
- package/src/generators/kos-hook/files/index.ts.template +2 -0
- package/src/generators/kos-hook/files/use-__nameDashCase__.ts.template +13 -0
- package/src/generators/kos-hook/files/with-__nameDashCase__.tsx.template +28 -0
- package/src/generators/kos-hook/generator.d.ts +5 -0
- package/src/generators/kos-hook/generator.d.ts.map +1 -0
- package/src/generators/kos-hook/generator.js +56 -0
- package/src/generators/kos-hook/generator.js.map +1 -0
- package/src/generators/kos-hook/schema.d.ts +21 -0
- package/src/generators/kos-hook/schema.json +36 -0
- package/src/generators/kos-i18n-project/files/.kos.json.template +5 -0
- package/src/generators/kos-i18n-project/files/src/assets/locales/en/__nameDashCase__.json.template +3 -0
- package/src/generators/kos-i18n-project/generator.d.ts +5 -0
- package/src/generators/kos-i18n-project/generator.d.ts.map +1 -0
- package/src/generators/kos-i18n-project/generator.js +82 -0
- package/src/generators/kos-i18n-project/generator.js.map +1 -0
- package/src/generators/kos-i18n-project/schema.d.ts +3 -0
- package/src/generators/kos-i18n-project/schema.json +18 -0
- package/src/generators/kos-init/generator.d.ts +5 -0
- package/src/generators/kos-init/generator.d.ts.map +1 -0
- package/src/generators/kos-init/generator.js +43 -0
- package/src/generators/kos-init/generator.js.map +1 -0
- package/src/generators/kos-init/schema.d.ts +5 -0
- package/src/generators/kos-init/schema.json +29 -0
- package/src/generators/kos-model/files/model/__nameDashCase__-model.ts.template +57 -0
- package/src/generators/kos-model/files/model/__nameDashCase__-registration.ts.template +110 -0
- package/src/generators/kos-model/files/model/index.ts__template__ +4 -0
- package/src/generators/kos-model/files/model/types/index.d.ts.template +7 -0
- package/src/generators/kos-model/files/services/__nameDashCase__-services.ts.template +28 -0
- package/src/generators/kos-model/files/services/index.ts.template +1 -0
- package/src/generators/kos-model/generator.d.ts +5 -0
- package/src/generators/kos-model/generator.d.ts.map +1 -0
- package/src/generators/kos-model/generator.js +115 -0
- package/src/generators/kos-model/generator.js.map +1 -0
- package/src/generators/kos-model/lib/normalize-options.d.ts +4 -0
- package/src/generators/kos-model/lib/normalize-options.d.ts.map +1 -0
- package/src/generators/kos-model/lib/normalize-options.js +35 -0
- package/src/generators/kos-model/lib/normalize-options.js.map +1 -0
- package/src/generators/kos-model/lib/normalize-value.d.ts +7 -0
- package/src/generators/kos-model/lib/normalize-value.d.ts.map +1 -0
- package/src/generators/kos-model/lib/normalize-value.js +28 -0
- package/src/generators/kos-model/lib/normalize-value.js.map +1 -0
- package/src/generators/kos-model/lib/utils/name-utils.d.ts +6 -0
- package/src/generators/kos-model/lib/utils/name-utils.d.ts.map +1 -0
- package/src/generators/kos-model/lib/utils/name-utils.js +42 -0
- package/src/generators/kos-model/lib/utils/name-utils.js.map +1 -0
- package/src/generators/kos-model/lib/utils/ts-visitor.d.ts +8 -0
- package/src/generators/kos-model/lib/utils/ts-visitor.d.ts.map +1 -0
- package/src/generators/kos-model/lib/utils/ts-visitor.js +126 -0
- package/src/generators/kos-model/lib/utils/ts-visitor.js.map +1 -0
- package/src/generators/kos-model/schema.d.ts +41 -0
- package/src/generators/kos-model/schema.json +91 -0
- package/src/generators/kos-plugin-project/files/.env.template +7 -0
- package/src/generators/kos-plugin-project/files/.kos.json.template +40 -0
- package/src/generators/kos-plugin-project/files/.storybook/main.ts.template +45 -0
- package/src/generators/kos-plugin-project/files/.storybook/preview.tsx.template +82 -0
- package/src/generators/kos-plugin-project/files/.storybook/registration.ts.template +40 -0
- package/src/generators/kos-plugin-project/files/index.html.template +15 -0
- package/src/generators/kos-plugin-project/files/module-federation.config.ts.template +1 -0
- package/src/generators/kos-plugin-project/files/src/app/app.css.template +2 -0
- package/src/generators/kos-plugin-project/files/src/app/app.tsx.template +54 -0
- package/src/generators/kos-plugin-project/files/src/app/components/main-view/index.ts.template +1 -0
- package/src/generators/kos-plugin-project/files/src/app/components/main-view/main-view.tsx.template +14 -0
- package/src/generators/kos-plugin-project/files/src/app/tools/experience-resolver.ts.template +10 -0
- package/src/generators/kos-plugin-project/files/src/app/tools/index.ts.template +2 -0
- package/src/generators/kos-plugin-project/files/src/app/tools/kOSJSON.ts.template +1 -0
- package/src/generators/kos-plugin-project/files/src/assets/kos-logo.svg.template +4 -0
- package/src/generators/kos-plugin-project/files/src/assets/locales/en/__nameDashCase__.json.template +3 -0
- package/src/generators/kos-plugin-project/files/src/registration.ts.template +13 -0
- package/src/generators/kos-plugin-project/files/webpack.config.prod.ts.template +24 -0
- package/src/generators/kos-plugin-project/files/webpack.config.ts.template +7 -0
- package/src/generators/kos-plugin-project/generator.d.ts +5 -0
- package/src/generators/kos-plugin-project/generator.d.ts.map +1 -0
- package/src/generators/kos-plugin-project/generator.js +108 -0
- package/src/generators/kos-plugin-project/generator.js.map +1 -0
- package/src/generators/kos-plugin-project/schema.d.ts +5 -0
- package/src/generators/kos-plugin-project/schema.json +33 -0
- package/src/generators/kos-splash-project/files/project/project.json.template +17 -0
- package/src/generators/kos-splash-project/files/project/src/start.html.template +13 -0
- package/src/generators/kos-splash-project/files/tools/splashtool.mjs.template +247 -0
- package/src/generators/kos-splash-project/generator.d.ts +5 -0
- package/src/generators/kos-splash-project/generator.d.ts.map +1 -0
- package/src/generators/kos-splash-project/generator.js +17 -0
- package/src/generators/kos-splash-project/generator.js.map +1 -0
- package/src/generators/kos-splash-project/schema.d.ts +3 -0
- package/src/generators/kos-splash-project/schema.json +18 -0
- package/src/generators/kos-theme-project/files/.kos.json.template +5 -0
- package/src/generators/kos-theme-project/files/theme/component.css.template +2 -0
- package/src/generators/kos-theme-project/files/theme/generic.css.template +2 -0
- package/src/generators/kos-theme-project/files/theme/semantic.css.template +2 -0
- package/src/generators/kos-theme-project/files/theme/theme-overlay.css.template +7 -0
- package/src/generators/kos-theme-project/files/vite.config.ts.template +48 -0
- package/src/generators/kos-theme-project/generator.d.ts +5 -0
- package/src/generators/kos-theme-project/generator.d.ts.map +1 -0
- package/src/generators/kos-theme-project/generator.js +54 -0
- package/src/generators/kos-theme-project/generator.js.map +1 -0
- package/src/generators/kos-theme-project/schema.d.ts +3 -0
- package/src/generators/kos-theme-project/schema.json +18 -0
- package/src/generators/kos-ui-project/files/.env.template +7 -0
- package/src/generators/kos-ui-project/files/.kos.json.template +5 -0
- package/src/generators/kos-ui-project/files/bootstrap.tsx.template +13 -0
- package/src/generators/kos-ui-project/files/main.ts.template +18 -0
- package/src/generators/kos-ui-project/files/src/app/app.css.template +38 -0
- package/src/generators/kos-ui-project/files/src/app/app.tsx.template +45 -0
- package/src/generators/kos-ui-project/files/src/app/components/main-view/index.ts.template +1 -0
- package/src/generators/kos-ui-project/files/src/app/components/main-view/main-view.tsx.template +31 -0
- package/src/generators/kos-ui-project/files/src/app/registration.ts.template +13 -0
- package/src/generators/kos-ui-project/files/src/assets/kos-logo.svg.template +4 -0
- package/src/generators/kos-ui-project/files/src/assets/locales/en/__nameDashCase__.json.template +4 -0
- package/src/generators/kos-ui-project/files/src/bootstrap.tsx.template +13 -0
- package/src/generators/kos-ui-project/files/src/index.html.template +14 -0
- package/src/generators/kos-ui-project/files/webpack.config.ts.template +45 -0
- package/src/generators/kos-ui-project/generator.d.ts +5 -0
- package/src/generators/kos-ui-project/generator.d.ts.map +1 -0
- package/src/generators/kos-ui-project/generator.js +135 -0
- package/src/generators/kos-ui-project/generator.js.map +1 -0
- package/src/generators/kos-ui-project/internal/vite.config.ts.template +49 -0
- package/src/generators/kos-ui-project/schema.d.ts +7 -0
- package/src/generators/kos-ui-project/schema.json +34 -0
- package/src/generators/preset/api/utils/service.ts.template +15 -0
- package/src/generators/preset/files/.env.template +7 -0
- package/src/generators/preset/files/.kos.json.template +5 -0
- package/src/generators/preset/files/src/app/app.css.template +38 -0
- package/src/generators/preset/files/src/app/app.tsx.template +38 -0
- package/src/generators/preset/files/src/app/components/main-view/index.ts.template +1 -0
- package/src/generators/preset/files/src/app/components/main-view/main-view.tsx.template +32 -0
- package/src/generators/preset/files/src/app/registration.ts.template +20 -0
- package/src/generators/preset/files/src/assets/kos-logo.svg.template +4 -0
- package/src/generators/preset/files/src/assets/locales/en/__nameDashCase__.json.template +4 -0
- package/src/generators/preset/files/src/bootstrap.tsx.template +13 -0
- package/src/generators/preset/files/src/index.html.template +15 -0
- package/src/generators/preset/files/src/main.ts.template +6 -0
- package/src/generators/preset/files/webpack.config.ts.template +45 -0
- package/src/generators/preset/generator.d.ts +5 -0
- package/src/generators/preset/generator.d.ts.map +1 -0
- package/src/generators/preset/generator.js +252 -0
- package/src/generators/preset/generator.js.map +1 -0
- package/src/generators/preset/local/.env.local.template +5 -0
- package/src/generators/preset/schema.d.ts +8 -0
- package/src/generators/preset/schema.json +14 -0
- package/src/generators/preset/tools/tools/scripts/archiver.js.template +79 -0
- package/src/generators/preset/tools/tools/scripts/descriptor.mjs.template +114 -0
- package/src/generators/preset/tools/tools/scripts/generate-api-types.mjs.template +25 -0
- package/src/generators/preset/tools/tools/scripts/kabtool.mjs.template +87 -0
- package/src/generators/preset/tools/tools/scripts/update.mjs.template +67 -0
- package/src/generators/preset/tools/tools/tsconfig.tools.json.template +12 -0
- package/src/index.d.ts +1 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -0
- package/src/migrations/add-overrides/add-overrides.d.ts +3 -0
- package/src/migrations/add-overrides/add-overrides.d.ts.map +1 -0
- package/src/migrations/add-overrides/add-overrides.js +85 -0
- package/src/migrations/add-overrides/add-overrides.js.map +1 -0
- package/src/migrations/add-overrides/files/.env.local__template__ +5 -0
- package/src/migrations/add-overrides/files/tools/scripts/archiver.js__template__ +79 -0
- package/src/migrations/add-overrides/files/tools/scripts/kabtool.mjs__template__ +85 -0
- package/src/migrations/add-overrides/projectFiles/.kos.json__template__ +5 -0
- package/src/migrations/add-update-tool/files/tools/scripts/update.mjs.template +67 -0
- package/src/migrations/add-update-tool/migrate.d.ts +3 -0
- package/src/migrations/add-update-tool/migrate.d.ts.map +1 -0
- package/src/migrations/add-update-tool/migrate.js +24 -0
- package/src/migrations/add-update-tool/migrate.js.map +1 -0
- package/src/migrations/cms-sdk/cms-sdk.d.ts +3 -0
- package/src/migrations/cms-sdk/cms-sdk.d.ts.map +1 -0
- package/src/migrations/cms-sdk/cms-sdk.js +22 -0
- package/src/migrations/cms-sdk/cms-sdk.js.map +1 -0
- package/src/migrations/consolidate-sdk/api/utils/service.ts.template +15 -0
- package/src/migrations/consolidate-sdk/consolidate-sdk.d.ts +3 -0
- package/src/migrations/consolidate-sdk/consolidate-sdk.d.ts.map +1 -0
- package/src/migrations/consolidate-sdk/consolidate-sdk.js +100 -0
- package/src/migrations/consolidate-sdk/consolidate-sdk.js.map +1 -0
- package/src/migrations/consolidate-sdk/files/tools/scripts/generate-api-types.mjs.template +25 -0
- package/src/migrations/default-projects/default-projects.d.ts +3 -0
- package/src/migrations/default-projects/default-projects.d.ts.map +1 -0
- package/src/migrations/default-projects/default-projects.js +45 -0
- package/src/migrations/default-projects/default-projects.js.map +1 -0
- package/src/migrations/default-projects/files/index.ts__template__ +2 -0
- package/src/migrations/freestyle-sdk/freestyle-sdk.d.ts +3 -0
- package/src/migrations/freestyle-sdk/freestyle-sdk.d.ts.map +1 -0
- package/src/migrations/freestyle-sdk/freestyle-sdk.js +18 -0
- package/src/migrations/freestyle-sdk/freestyle-sdk.js.map +1 -0
- package/src/migrations/kabtool-env/migrate.d.ts +3 -0
- package/src/migrations/kabtool-env/migrate.d.ts.map +1 -0
- package/src/migrations/kabtool-env/migrate.js +11 -0
- package/src/migrations/kabtool-env/migrate.js.map +1 -0
- package/src/migrations/migrate-extensions/migrate-extensions.d.ts +3 -0
- package/src/migrations/migrate-extensions/migrate-extensions.d.ts.map +1 -0
- package/src/migrations/migrate-extensions/migrate-extensions.js +77 -0
- package/src/migrations/migrate-extensions/migrate-extensions.js.map +1 -0
- package/src/migrations/translation-format/translation-format.d.ts +3 -0
- package/src/migrations/translation-format/translation-format.d.ts.map +1 -0
- package/src/migrations/translation-format/translation-format.js +56 -0
- package/src/migrations/translation-format/translation-format.js.map +1 -0
- package/src/migrations/translations/add-descriptor.d.ts +3 -0
- package/src/migrations/translations/add-descriptor.d.ts.map +1 -0
- package/src/migrations/translations/add-descriptor.js +48 -0
- package/src/migrations/translations/add-descriptor.js.map +1 -0
- package/src/migrations/translations/files/tools/scripts/descriptor.mjs.template +114 -0
- package/src/migrations/update-kabtool/files/tools/scripts/kabtool.mjs.template +87 -0
- package/src/migrations/update-kabtool/update-kabtool.d.ts +3 -0
- package/src/migrations/update-kabtool/update-kabtool.d.ts.map +1 -0
- package/src/migrations/update-kabtool/update-kabtool.js +11 -0
- package/src/migrations/update-kabtool/update-kabtool.js.map +1 -0
- package/src/migrations/update-sdk/update-sdk.d.ts +3 -0
- package/src/migrations/update-sdk/update-sdk.d.ts.map +1 -0
- package/src/migrations/update-sdk/update-sdk.js +17 -0
- package/src/migrations/update-sdk/update-sdk.js.map +1 -0
- package/src/utils/java-home.d.ts +2 -0
- package/src/utils/java-home.d.ts.map +1 -0
- package/src/utils/java-home.js +44 -0
- package/src/utils/java-home.js.map +1 -0
- package/src/utils/logger.d.ts +9 -0
- package/src/utils/logger.d.ts.map +1 -0
- package/src/utils/logger.js +46 -0
- package/src/utils/logger.js.map +1 -0
- package/src/utils/name-utils.d.ts +6 -0
- package/src/utils/name-utils.d.ts.map +1 -0
- package/src/utils/name-utils.js +60 -0
- package/src/utils/name-utils.js.map +1 -0
- package/src/utils/normalize-value.d.ts +7 -0
- package/src/utils/normalize-value.d.ts.map +1 -0
- package/src/utils/normalize-value.js +33 -0
- package/src/utils/normalize-value.js.map +1 -0
- package/src/utils/project-utils.d.ts +36 -0
- package/src/utils/project-utils.d.ts.map +1 -0
- package/src/utils/project-utils.js +102 -0
- package/src/utils/project-utils.js.map +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Global } from '@emotion/react';
|
|
2
|
+
import {
|
|
3
|
+
ApplicationComponentConfigurationProvider,
|
|
4
|
+
ApplicationProvider,
|
|
5
|
+
} from '@kosdev-code/kos-ddk-model-components';
|
|
6
|
+
import { getStyles } from '@kosdev-code/kos-ddk-styles';
|
|
7
|
+
import {
|
|
8
|
+
ErrorBoundaryWithFallback,
|
|
9
|
+
KosTranslationProvider,
|
|
10
|
+
LoadingMessage,
|
|
11
|
+
getLogLevel,
|
|
12
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
13
|
+
import log from 'loglevel';
|
|
14
|
+
import { Suspense } from 'react';
|
|
15
|
+
import { Route, HashRouter as Router, Routes } from 'react-router-dom';
|
|
16
|
+
import { KosCoreContextProvider } from '../registration';
|
|
17
|
+
import "@kosdev-code/kos-ddk-components/style.css";
|
|
18
|
+
import './app.css';
|
|
19
|
+
import { MainView } from './components/main-view';
|
|
20
|
+
|
|
21
|
+
const level = getLogLevel();
|
|
22
|
+
|
|
23
|
+
log.setLevel(level);
|
|
24
|
+
|
|
25
|
+
const App = () => (
|
|
26
|
+
<>
|
|
27
|
+
<Global styles={getStyles()}></Global>
|
|
28
|
+
<ErrorBoundaryWithFallback>
|
|
29
|
+
<Suspense fallback={<LoadingMessage></LoadingMessage>}>
|
|
30
|
+
<KosCoreContextProvider>
|
|
31
|
+
<KosTranslationProvider
|
|
32
|
+
appContext={['app/system', 'app/kosdev.ddk']}
|
|
33
|
+
locale="en"
|
|
34
|
+
>
|
|
35
|
+
<ApplicationProvider>
|
|
36
|
+
<ApplicationComponentConfigurationProvider>
|
|
37
|
+
<div className="App">
|
|
38
|
+
<Router window={window}>
|
|
39
|
+
<Routes>
|
|
40
|
+
<Route index element={<MainView />} />
|
|
41
|
+
<Route path=":id" element={<MainView />} />
|
|
42
|
+
</Routes>
|
|
43
|
+
</Router>
|
|
44
|
+
</div>
|
|
45
|
+
</ApplicationComponentConfigurationProvider>
|
|
46
|
+
</ApplicationProvider>
|
|
47
|
+
</KosTranslationProvider>
|
|
48
|
+
</KosCoreContextProvider>
|
|
49
|
+
</Suspense>
|
|
50
|
+
</ErrorBoundaryWithFallback>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export default App;
|
package/src/generators/kos-plugin-project/files/src/app/components/main-view/index.ts.template
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./main-view";
|
package/src/generators/kos-plugin-project/files/src/app/components/main-view/main-view.tsx.template
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { kosComponent, KosLog } from '@kosdev-code/kos-ui-sdk';
|
|
2
|
+
import { resolver, kOSJSON } from '../../tools';
|
|
3
|
+
import { DynamicContainer, Shell } from '@kosdev-code/kos-ui-plugin/dev';
|
|
4
|
+
|
|
5
|
+
const log = KosLog.createLogger({ name: 'main-view' });
|
|
6
|
+
log.debug('main-view component loaded');
|
|
7
|
+
|
|
8
|
+
export const MainView: React.FunctionComponent = kosComponent(() => {
|
|
9
|
+
return (
|
|
10
|
+
<Shell>
|
|
11
|
+
<DynamicContainer kOSJSON={kOSJSON} resolver={resolver} />
|
|
12
|
+
</Shell>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const resolver = async (location: string) => {
|
|
2
|
+
const regexp = /\.\/src\/app\/(.+)\/.+/;
|
|
3
|
+
const match = location.match(regexp);
|
|
4
|
+
|
|
5
|
+
if (!match) throw new Error("Invalid location");
|
|
6
|
+
|
|
7
|
+
const target = match[1];
|
|
8
|
+
|
|
9
|
+
return await import(`../${target}`);
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as kOSJSON } from '../../../.kos.json';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg id="kos_logo_full" data-name="kos_logo_full" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 41.58 16.95">
|
|
3
|
+
<path d="m21.49,12.39c-.7-.38-1.25-.91-1.64-1.59-.4-.68-.59-1.45-.59-2.32s.2-1.64.59-2.32c.4-.68.94-1.21,1.64-1.59.7-.38,1.49-.57,2.38-.57s1.68.19,2.38.57c.7.38,1.25.91,1.64,1.59.4.68.59,1.45.59,2.32s-.2,1.64-.59,2.32c-.4.68-.94,1.21-1.64,1.59-.7.38-1.49.57-2.38.57s-1.68-.19-2.38-.57Zm3.76-1.49c.4-.24.72-.56.95-.98.23-.42.34-.9.34-1.43s-.11-1.01-.34-1.43c-.23-.42-.54-.75-.95-.98-.4-.24-.86-.35-1.37-.35s-.97.12-1.37.35c-.4.24-.72.56-.95.98-.23.42-.34.9-.34,1.43s.11,1.01.34,1.43c.23.42.54.75.95.98.4.24.86.35,1.37.35s.97-.12,1.37-.35Zm6.34,1.67c-.73-.24-1.32-.56-1.76-.98l1.16-1.42c.81.72,1.77,1.08,2.89,1.08.51,0,.92-.1,1.24-.29.31-.19.47-.43.47-.71,0-.21-.09-.38-.28-.53-.18-.14-.5-.26-.94-.35l-1.84-.35c-.8-.15-1.4-.43-1.79-.83-.4-.4-.59-.91-.59-1.51,0-.54.16-1.02.47-1.42.32-.4.76-.71,1.32-.93s1.2-.32,1.91-.32c.67,0,1.32.1,1.93.29s1.15.49,1.6.9l-1.08,1.38c-.76-.62-1.6-.92-2.51-.92-.49,0-.89.08-1.22.25-.32.17-.49.38-.49.64,0,.17.08.32.25.44.16.13.48.24.94.32l1.7.31c.85.16,1.49.46,1.91.91.43.44.64.97.64,1.59,0,.55-.15,1.04-.44,1.46s-.71.75-1.25.98-1.17.35-1.88.35c-.86,0-1.65-.12-2.38-.35ZM41.5,1c0-.55-.46-1-1.01-1H1C.45,0,0,.45,0,1v14.95c0,.55.45,1,1,1h15.2v-.02s.06.02.1.02h24.29c.55,0,1-.45.99-1l-.08-14.95Zm-25.21,14.95l-.09-14.95h24.3s.09,14.95.09,14.95h-24.3Zm-8.34-7.1l-1.66,1.64v2.32h-1.88V4.16h1.88v4.09l4.1-4.09h2.27l-3.42,3.4,3.62,5.24h-2.23l-2.69-3.96Z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Application, DDKModels } from '@kosdev-code/kos-ddk-models';
|
|
2
|
+
import { KosModelRegistry } from '@kosdev-code/kos-dispense-sdk';
|
|
3
|
+
|
|
4
|
+
import { initKosProvider, registerLegacyModel } from '@kosdev-code/kos-ui-sdk';
|
|
5
|
+
|
|
6
|
+
KosModelRegistry.dispense.models().model(Application);
|
|
7
|
+
Object.keys(DDKModels).forEach((key) => {
|
|
8
|
+
const model = DDKModels[key];
|
|
9
|
+
registerLegacyModel(KosModelRegistry)(key, model);
|
|
10
|
+
});
|
|
11
|
+
const { KosCoreContextProvider } = initKosProvider();
|
|
12
|
+
|
|
13
|
+
export { KosCoreContextProvider };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { generatePluginConfiguration } from '@kosdev-code/kos-ui-plugin/utilities';
|
|
2
|
+
import { withKosConfig } from '@kosdev-code/kos-ui-plugin/webpack';
|
|
3
|
+
import { withReact } from '@nx/react';
|
|
4
|
+
import { withModuleFederation } from '@nx/react/module-federation';
|
|
5
|
+
import { composePlugins, withNx } from '@nx/webpack';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import * as webpack from 'webpack';
|
|
9
|
+
|
|
10
|
+
const kosConfig = JSON.parse(
|
|
11
|
+
readFileSync(join(__dirname, './.kos.json'), 'utf-8')
|
|
12
|
+
);
|
|
13
|
+
const baseConfig = generatePluginConfiguration(kosConfig);
|
|
14
|
+
const config = {
|
|
15
|
+
...baseConfig,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Nx plugins for webpack to build config object from Nx options and context.
|
|
19
|
+
export default composePlugins(
|
|
20
|
+
withNx(),
|
|
21
|
+
withReact({}),
|
|
22
|
+
withModuleFederation(config),
|
|
23
|
+
withKosConfig(webpack)
|
|
24
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { withKosConfig } from '@kosdev-code/kos-ui-plugin/webpack';
|
|
2
|
+
import { withReact } from '@nx/react';
|
|
3
|
+
import { composePlugins, withNx } from '@nx/webpack';
|
|
4
|
+
import * as webpack from 'webpack';
|
|
5
|
+
|
|
6
|
+
// Nx plugins for webpack to build config object from Nx options and context.
|
|
7
|
+
export default composePlugins(withNx(), withReact({}), withKosConfig(webpack));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from "@nx/devkit";
|
|
2
|
+
import { KosPluginProjectGeneratorSchema } from "./schema";
|
|
3
|
+
export declare function kosPluginProjectGenerator(tree: Tree, options: KosPluginProjectGeneratorSchema): Promise<void>;
|
|
4
|
+
export default kosPluginProjectGenerator;
|
|
5
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-plugin-project/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAC3D,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,iBA6HzC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kosPluginProjectGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const eslint_1 = require("@nx/eslint");
|
|
6
|
+
const react_1 = require("@nx/react");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const normalize_value_1 = require("../kos-model/lib/normalize-value");
|
|
9
|
+
async function kosPluginProjectGenerator(tree, options) {
|
|
10
|
+
const normalizedOptions = (0, normalize_value_1.normalizeAllValues)({
|
|
11
|
+
name: options.name,
|
|
12
|
+
});
|
|
13
|
+
const normalized = {
|
|
14
|
+
...normalizedOptions,
|
|
15
|
+
template: "",
|
|
16
|
+
directory: options.directory,
|
|
17
|
+
projectName: options.name,
|
|
18
|
+
uiType: options.uiType ?? "ddk.ncui.plugin",
|
|
19
|
+
};
|
|
20
|
+
console.log(normalized);
|
|
21
|
+
const projectRoot = path.join(options.directory ?? "plugins", normalized.name);
|
|
22
|
+
await (0, react_1.remoteGenerator)(tree, {
|
|
23
|
+
e2eTestRunner: "none",
|
|
24
|
+
projectNameAndRootFormat: "as-provided",
|
|
25
|
+
dynamic: true,
|
|
26
|
+
linter: eslint_1.Linter.EsLint,
|
|
27
|
+
name: normalized.name,
|
|
28
|
+
directory: projectRoot,
|
|
29
|
+
tags: "type:plugin",
|
|
30
|
+
unitTestRunner: "none",
|
|
31
|
+
style: "@emotion/styled",
|
|
32
|
+
skipFormat: false,
|
|
33
|
+
typescriptConfiguration: true,
|
|
34
|
+
});
|
|
35
|
+
await (0, react_1.storybookConfigurationGenerator)(tree, {
|
|
36
|
+
project: normalized.name,
|
|
37
|
+
generateStories: false,
|
|
38
|
+
interactionTests: false,
|
|
39
|
+
});
|
|
40
|
+
const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, normalized.projectName);
|
|
41
|
+
const externalJson = {
|
|
42
|
+
kab: {
|
|
43
|
+
command: `node tools/scripts/kabtool.mjs build ${normalized.nameDashCase} && node tools/scripts/kabtool.mjs list ${normalized.nameDashCase} `,
|
|
44
|
+
options: {
|
|
45
|
+
outputPath: `dist/archives/packages/${normalized.nameDashCase}/`,
|
|
46
|
+
zipName: "ui.zip",
|
|
47
|
+
kabName: `${normalized.nameDashCase}.kab`,
|
|
48
|
+
},
|
|
49
|
+
dependsOn: ["zip"],
|
|
50
|
+
},
|
|
51
|
+
zip: {
|
|
52
|
+
command: `node tools/scripts/archiver.js ${normalized.nameDashCase}`,
|
|
53
|
+
options: {
|
|
54
|
+
outputPath: `dist/archives/packages/${normalized.nameDashCase}/`,
|
|
55
|
+
zipName: "ui.zip",
|
|
56
|
+
},
|
|
57
|
+
dependsOn: ["build:production", "descriptor"],
|
|
58
|
+
},
|
|
59
|
+
descriptor: {
|
|
60
|
+
command: `node tools/scripts/descriptor.mjs ${normalized.nameDashCase}`,
|
|
61
|
+
options: {
|
|
62
|
+
outputPath: `dist/plugins/${normalized.nameDashCase}`,
|
|
63
|
+
fileName: "descriptor.json",
|
|
64
|
+
},
|
|
65
|
+
dependsOn: ["build"],
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
(0, devkit_1.updateJson)(tree, `${projectConfiguration.root}/project.json`, (json) => {
|
|
69
|
+
json.targets = {
|
|
70
|
+
...json.targets,
|
|
71
|
+
...externalJson,
|
|
72
|
+
};
|
|
73
|
+
if (json.targets?.build?.configurations?.production) {
|
|
74
|
+
json.targets.build.configurations.production.webpackConfig = `plugins/${normalized.nameDashCase}/webpack.config.prod.ts`;
|
|
75
|
+
}
|
|
76
|
+
return json;
|
|
77
|
+
});
|
|
78
|
+
(0, devkit_1.updateJson)(tree, `${projectConfiguration.root}/tsconfig.json`, (json) => {
|
|
79
|
+
json.compilerOptions = {
|
|
80
|
+
...json.compilerOptions,
|
|
81
|
+
moduleResolution: "Bundler",
|
|
82
|
+
resolveJsonModule: true,
|
|
83
|
+
};
|
|
84
|
+
return json;
|
|
85
|
+
});
|
|
86
|
+
(0, devkit_1.updateJson)(tree, `${projectConfiguration.root}/tsconfig.storybook.json`, (json) => {
|
|
87
|
+
json.include.push(".storybook/*.jsx");
|
|
88
|
+
json.include.push(".storybook/*.tsx");
|
|
89
|
+
return json;
|
|
90
|
+
});
|
|
91
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files"), projectConfiguration.root, normalized);
|
|
92
|
+
tree.delete(`${projectConfiguration.root}/src/app/nx-welcome.tsx`);
|
|
93
|
+
tree.delete(`${projectConfiguration.root}/src/index.ts`);
|
|
94
|
+
tree.delete(`${projectConfiguration.root}/src/app/app.spec.tsx`);
|
|
95
|
+
tree.delete(`${projectConfiguration.root}/.storybook/preview.ts`);
|
|
96
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
97
|
+
"@kosdev-code/kos-ddk": "^0.2.0",
|
|
98
|
+
"@kosdev-code/kos-ddk-components": "^0.2.0",
|
|
99
|
+
"@kosdev-code/kos-ddk-model-components": "^0.2.0",
|
|
100
|
+
"@kosdev-code/kos-ddk-models": "^0.2.0",
|
|
101
|
+
"@kosdev-code/kos-ddk-styles": "^0.2.0",
|
|
102
|
+
"@kosdev-code/kos-ui-plugin": "^0.2.0",
|
|
103
|
+
}, {});
|
|
104
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
105
|
+
}
|
|
106
|
+
exports.kosPluginProjectGenerator = kosPluginProjectGenerator;
|
|
107
|
+
exports.default = kosPluginProjectGenerator;
|
|
108
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-plugin-project/generator.ts"],"names":[],"mappings":";;;AAAA,uCAOoB;AACpB,uCAAoC;AACpC,qCAA6E;AAC7E,6BAA6B;AAC7B,sEAAsE;AAE/D,KAAK,UAAU,yBAAyB,CAC7C,IAAU,EACV,OAAwC;IAExC,MAAM,iBAAiB,GAAG,IAAA,oCAAkB,EAAC;QAC3C,IAAI,EAAE,OAAO,CAAC,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|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use?"
|
|
15
|
+
},
|
|
16
|
+
"directory": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "",
|
|
19
|
+
"required": false,
|
|
20
|
+
"$default": {
|
|
21
|
+
"$source": "argv",
|
|
22
|
+
"index": 1
|
|
23
|
+
},
|
|
24
|
+
"x-prompt": "What directory would you like to use?"
|
|
25
|
+
},
|
|
26
|
+
"uiType": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "KAB type of UI",
|
|
29
|
+
"default": "ddk.ncui.plugin"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"required": ["name"]
|
|
33
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= nameDashCase %>",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "splash/<%= nameDashCase %>/src",
|
|
5
|
+
"projectType": "application",
|
|
6
|
+
"targets": {
|
|
7
|
+
"splash": {
|
|
8
|
+
"command": "node tools/scripts/splashtool.mjs <%= nameDashCase %>",
|
|
9
|
+
"options": {
|
|
10
|
+
"outputPath": "dist/archives/packages/<%= nameDashCase %>/",
|
|
11
|
+
"layerName": "<%= nameDashCase %>",
|
|
12
|
+
"startPath": "start.html"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"tags": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title><%= nameDashCase %></title>
|
|
6
|
+
<base href="./" />
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root">Hello World</div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import devkit from '@nx/devkit';
|
|
3
|
+
import archiver from 'archiver';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { spawn } from 'child_process';
|
|
6
|
+
import dotenv from 'dotenv';
|
|
7
|
+
import dotenvExpand from 'dotenv-expand';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
const { readCachedProjectGraph } = devkit;
|
|
11
|
+
|
|
12
|
+
const [, , projectName] = process.argv;
|
|
13
|
+
|
|
14
|
+
const graph = readCachedProjectGraph();
|
|
15
|
+
const project = graph.nodes[projectName];
|
|
16
|
+
const config = dotenv.config({
|
|
17
|
+
path: path.resolve(process.cwd(), '.env'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
dotenvExpand.expand(config);
|
|
21
|
+
const splashOptions = project.data?.targets?.splash?.options;
|
|
22
|
+
|
|
23
|
+
const { outputPath, layerName, startPath } = splashOptions;
|
|
24
|
+
const installPath = process.env.KOS_INSTALL_PATH;
|
|
25
|
+
if (!fs.existsSync(outputPath)) {
|
|
26
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const htmlPath = path.resolve(project.data.sourceRoot, startPath);
|
|
30
|
+
fs.copyFileSync(htmlPath, path.resolve(outputPath, 'start.html'));
|
|
31
|
+
|
|
32
|
+
const packPath = path.resolve(outputPath, 'layer.pack');
|
|
33
|
+
if (!fs.existsSync(packPath)) {
|
|
34
|
+
fs.writeFileSync(
|
|
35
|
+
packPath,
|
|
36
|
+
`# gensquashfs pack file
|
|
37
|
+
|
|
38
|
+
dir /usr/share/www 0755 0 0
|
|
39
|
+
file /usr/share/www/start.html 0644 0 0 ./start.html`,
|
|
40
|
+
{ encoding: 'utf-8' }
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
createDiskImage({
|
|
44
|
+
outputPath,
|
|
45
|
+
layerName: `${layerName}.img`,
|
|
46
|
+
packPath,
|
|
47
|
+
installPath,
|
|
48
|
+
})
|
|
49
|
+
.then((imgPath) => {
|
|
50
|
+
console.log('imgPath: ', imgPath);
|
|
51
|
+
const zipPath = path.resolve(outputPath, `${layerName}.zip`);
|
|
52
|
+
console.log('zipPath: ', zipPath);
|
|
53
|
+
return archiveDiskImage({ zipPath, imgPath });
|
|
54
|
+
})
|
|
55
|
+
.then((zipPath) => {
|
|
56
|
+
console.log('zipPath from archive: ', zipPath);
|
|
57
|
+
const kabName = `${layerName}.kab`;
|
|
58
|
+
return createKabFile({
|
|
59
|
+
zipPath,
|
|
60
|
+
kabName,
|
|
61
|
+
outputPath,
|
|
62
|
+
installPath,
|
|
63
|
+
layerName,
|
|
64
|
+
}).then(() => {
|
|
65
|
+
console.log(chalk.green('done'));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
async function createDiskImage({
|
|
69
|
+
outputPath,
|
|
70
|
+
layerName,
|
|
71
|
+
packPath,
|
|
72
|
+
installPath,
|
|
73
|
+
}) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
console.log(`packPath: ${packPath}`);
|
|
76
|
+
|
|
77
|
+
if (!fs.existsSync(outputPath)) {
|
|
78
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
79
|
+
}
|
|
80
|
+
const layerPath = path.resolve(outputPath, layerName);
|
|
81
|
+
console.log(`layerName: ${layerPath}`);
|
|
82
|
+
|
|
83
|
+
const genSquashFsLocation =
|
|
84
|
+
process.platform === 'darwin'
|
|
85
|
+
? path.join(
|
|
86
|
+
'Contents',
|
|
87
|
+
'MacOS',
|
|
88
|
+
'lib',
|
|
89
|
+
'squashfs-tools-ng',
|
|
90
|
+
'bin',
|
|
91
|
+
'gensquashfs'
|
|
92
|
+
)
|
|
93
|
+
: path.join(
|
|
94
|
+
'release',
|
|
95
|
+
'lib',
|
|
96
|
+
'squashfs-tools-ng',
|
|
97
|
+
'bin',
|
|
98
|
+
'gensquashfs'
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
console.log(installPath, genSquashFsLocation);
|
|
102
|
+
const gensquashfsPath = path.resolve(installPath, genSquashFsLocation);
|
|
103
|
+
|
|
104
|
+
const command = gensquashfsPath;
|
|
105
|
+
|
|
106
|
+
const baseBuildArgs = [
|
|
107
|
+
'-F',
|
|
108
|
+
packPath,
|
|
109
|
+
'--compressor=gzip',
|
|
110
|
+
'--force',
|
|
111
|
+
layerPath,
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
const args = [...baseBuildArgs];
|
|
115
|
+
|
|
116
|
+
const ps = spawn(command, args);
|
|
117
|
+
|
|
118
|
+
ps.stdout.on('data', (data) => {
|
|
119
|
+
console.log(chalk.blue(`studio: ${data}`));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
ps.stderr.on('data', (data) => {
|
|
123
|
+
console.error(chalk.red(`studio: ${data}`));
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
ps.on('close', (code) => {
|
|
127
|
+
console.log(`child process exited with code ${code}`);
|
|
128
|
+
if (code === 0) {
|
|
129
|
+
resolve(layerPath);
|
|
130
|
+
} else {
|
|
131
|
+
reject();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async function archiveDiskImage({ zipPath, imgPath }) {
|
|
137
|
+
console.log(`archiveDiskImage: zipPath: ${zipPath}, imgPath: ${imgPath}`);
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
const output = fs.createWriteStream(zipPath);
|
|
140
|
+
const archive = archiver('zip', {
|
|
141
|
+
zlib: { level: 9 }, // Sets the compression level.
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// listen for all archive data to be written
|
|
145
|
+
// 'close' event is fired only when a file descriptor is involved
|
|
146
|
+
output.on('close', function () {
|
|
147
|
+
console.log(archive.pointer() + ' total bytes');
|
|
148
|
+
console.log(
|
|
149
|
+
'archiver has been finalized and the output file descriptor has closed.'
|
|
150
|
+
);
|
|
151
|
+
resolve(zipPath);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// This event is fired when the data source is drained no matter what was the data source.
|
|
155
|
+
// It is not part of this library but rather from the NodeJS Stream API.
|
|
156
|
+
// @see: https://nodejs.org/api/stream.html#stream_event_end
|
|
157
|
+
output.on('end', function () {
|
|
158
|
+
console.log('Data has been drained');
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// good practice to catch warnings (ie stat failures and other non-blocking errors)
|
|
162
|
+
archive.on('warning', function (err) {
|
|
163
|
+
if (err.code === 'ENOENT') {
|
|
164
|
+
// log warning
|
|
165
|
+
} else {
|
|
166
|
+
// throw error
|
|
167
|
+
reject();
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// good practice to catch this error explicitly
|
|
172
|
+
archive.on('error', function (err) {
|
|
173
|
+
reject();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// pipe archive data to the file
|
|
177
|
+
archive.pipe(output);
|
|
178
|
+
|
|
179
|
+
// append a file from stream
|
|
180
|
+
|
|
181
|
+
// append files from a sub-directory, putting its contents at the root of archive
|
|
182
|
+
archive.file(imgPath, { name: 'layer.img' });
|
|
183
|
+
|
|
184
|
+
// finalize the archive (ie we are done appending files but streams have to finish yet)
|
|
185
|
+
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand
|
|
186
|
+
archive.finalize();
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async function createKabFile({
|
|
191
|
+
zipPath,
|
|
192
|
+
kabName,
|
|
193
|
+
outputPath,
|
|
194
|
+
installPath,
|
|
195
|
+
layerName,
|
|
196
|
+
}) {
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
if (!fs.existsSync(outputPath)) {
|
|
199
|
+
fs.mkdirSync(outputPath, { recursive: true });
|
|
200
|
+
}
|
|
201
|
+
const kabPath = path.resolve(outputPath, kabName);
|
|
202
|
+
console.log(`kabPath: ${kabPath}`);
|
|
203
|
+
|
|
204
|
+
const kabtoolLocation =
|
|
205
|
+
process.platform === 'darwin'
|
|
206
|
+
? path.join('Contents', 'MacOS', 'bin', 'kabtool')
|
|
207
|
+
: path.join('release', 'bin', 'kabtool');
|
|
208
|
+
|
|
209
|
+
const kabtoolPath = path.resolve(installPath, kabtoolLocation);
|
|
210
|
+
console.log(kabtoolPath);
|
|
211
|
+
const command = kabtoolPath;
|
|
212
|
+
|
|
213
|
+
const baseBuildArgs = [
|
|
214
|
+
'-b',
|
|
215
|
+
'-t',
|
|
216
|
+
'kos.layer',
|
|
217
|
+
'-n',
|
|
218
|
+
layerName,
|
|
219
|
+
'-v',
|
|
220
|
+
'0.0.1',
|
|
221
|
+
'-z',
|
|
222
|
+
zipPath,
|
|
223
|
+
];
|
|
224
|
+
|
|
225
|
+
const args = [...baseBuildArgs, kabPath];
|
|
226
|
+
|
|
227
|
+
console.log(command, args);
|
|
228
|
+
const ps = spawn(command, args);
|
|
229
|
+
|
|
230
|
+
ps.stdout.on('data', (data) => {
|
|
231
|
+
console.log(chalk.blue(`studio: ${data}`));
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
ps.stderr.on('data', (data) => {
|
|
235
|
+
console.error(chalk.red(`studio: ${data}`));
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
ps.on('close', (code) => {
|
|
239
|
+
console.log(`child process exited with code ${code}`);
|
|
240
|
+
if (code === 0) {
|
|
241
|
+
resolve();
|
|
242
|
+
} else {
|
|
243
|
+
reject();
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tree } from "@nx/devkit";
|
|
2
|
+
import { KosSplashProjectGeneratorSchema } from "./schema";
|
|
3
|
+
export declare function kosSplashProjectGenerator(tree: Tree, options: KosSplashProjectGeneratorSchema): Promise<void>;
|
|
4
|
+
export default kosSplashProjectGenerator;
|
|
5
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-splash-project/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,IAAI,EAAE,MAAM,YAAY,CAAC;AAG9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AAC3D,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,+BAA+B,iBAoBzC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kosSplashProjectGenerator = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const normalize_value_1 = require("../../utils/normalize-value");
|
|
7
|
+
async function kosSplashProjectGenerator(tree, options) {
|
|
8
|
+
const normalized = (0, normalize_value_1.normalizeAllValues)(options);
|
|
9
|
+
const projectRoot = `splash/${normalized.nameDashCase}`;
|
|
10
|
+
const toolsRoot = path.join("tools", "scripts");
|
|
11
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "project"), projectRoot, normalized);
|
|
12
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, "files", "tools"), toolsRoot, normalized);
|
|
13
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
14
|
+
}
|
|
15
|
+
exports.kosSplashProjectGenerator = kosSplashProjectGenerator;
|
|
16
|
+
exports.default = kosSplashProjectGenerator;
|
|
17
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/generators/kos-splash-project/generator.ts"],"names":[],"mappings":";;;AAAA,uCAA8D;AAC9D,6BAA6B;AAC7B,iEAAiE;AAE1D,KAAK,UAAU,yBAAyB,CAC7C,IAAU,EACV,OAAwC;IAExC,MAAM,UAAU,GAAG,IAAA,oCAAkB,EAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,WAAW,GAAG,UAAU,UAAU,CAAC,YAAY,EAAE,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,EACxC,WAAW,EACX,UAAU,CACX,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EACtC,SAAS,EACT,UAAU,CACX,CAAC;IACF,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAtBD,8DAsBC;AAED,kBAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "KosSplashProject",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"name": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "argv",
|
|
12
|
+
"index": 0
|
|
13
|
+
},
|
|
14
|
+
"x-prompt": "What name would you like to use?"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["name"]
|
|
18
|
+
}
|