@genesislcap/blank-app-seed 2.2.0 → 2.3.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.
@@ -1,5 +1,13 @@
1
1
  const versions = require('./versions.json');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ const directoryExists = (directory) => fs.existsSync(directory);
2
5
 
6
+ const makeDirectory = (directory) => {
7
+ if (!directoryExists(directory)) {
8
+ fs.mkdirSync(directory);
9
+ }
10
+ };
3
11
  /**
4
12
  * Signature is `async (data: inquirer.Answers, utils: SeedConfigurationUtils)`
5
13
  */
@@ -12,4 +20,12 @@ module.exports = async (data, utils) => {
12
20
  data.versions = versions;
13
21
  // to be exposed via user prompt in the future
14
22
  data.useDocker = !!process.env.USE_DOCKER;
23
+ data.routes.forEach(route => {
24
+ // utils.makeDirectory(path.resolve(data.directory,`client/src/routes/${route}`))
25
+ makeDirectory(path.resolve(data.directory,`client/src/routes/${route}`));
26
+ utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.hbs'));
27
+ utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.template.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.template.hbs'));
28
+ utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${route}/${route}.styles.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.styles.hbs'));
29
+ })
30
+
15
31
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -0,0 +1,22 @@
1
+ const routesInto = () => console.log(`
2
+ Pages to be added to the navigation header
3
+ `);
4
+
5
+ module.exports = async (inquirer, prevAns = {}) => {
6
+ routesInto();
7
+ const {
8
+ routes = prevAns.routes,
9
+ } = await inquirer.prompt([
10
+ {
11
+ name: 'routes',
12
+ type: 'input',
13
+ message: 'Pages in comma separated format e.g. home,dashboard,admin',
14
+ when: !prevAns.routes,
15
+ default: prevAns.routes || 'home',
16
+ },
17
+ ])
18
+
19
+ return {
20
+ routes: routes?.split(','),
21
+ };
22
+ };
package/.genx/prompts.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const apiPrompts = require('./prompts/api');
2
2
  const genesisServerPrompts = require('./prompts/server');
3
+ const uiPrompts = require('./prompts/ui');
3
4
  const {description, license, name, version} = require('./package.json');
4
5
 
5
6
  module.exports = async (inquirer, prevAns = {}) => {
@@ -12,9 +13,11 @@ module.exports = async (inquirer, prevAns = {}) => {
12
13
 
13
14
  const {apiHost, enableSSO} = await apiPrompts(inquirer, prevAns)
14
15
  const {groupId, applicationVersion, enableDeployPlugin} = await genesisServerPrompts(inquirer, prevAns);
16
+ const {routes} = await uiPrompts(inquirer, prevAns);
15
17
 
16
18
  return {
17
19
  apiHost,
20
+ routes,
18
21
  enableSSO,
19
22
  groupId,
20
23
  applicationVersion,
@@ -0,0 +1,14 @@
1
+ import { customElement, FASTElement } from '@microsoft/fast-element';
2
+ import { {{pascalCase route}}Styles as styles } from './{{route}}.styles';
3
+ import { {{pascalCase route}}Template as template } from './{{route}}.template';
4
+
5
+ @customElement({
6
+ name: '{{route}}-route',
7
+ template,
8
+ styles,
9
+ })
10
+ export class {{pascalCase route}} extends FASTElement {
11
+ constructor() {
12
+ super();
13
+ }
14
+ }
@@ -1,6 +1,6 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
 
3
- export const HomeStyles = css`
3
+ export const {{pascalCase route}}Styles = css`
4
4
  :host {
5
5
  /* insert css styles here */
6
6
  }
@@ -0,0 +1,7 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ import type { {{pascalCase route}} } from './{{route}}';
3
+
4
+ export const {{pascalCase route}}Template = html<{{pascalCase route}}>`
5
+ <!-- insert template code here -->
6
+ Welcome to {{route}}
7
+ `;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.2.0...v2.3.0) (2024-03-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * route generation GENC-57 (#144) 5374330
9
+
3
10
  ## [2.2.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.1.0...v2.2.0) (2024-03-11)
4
11
 
5
12
 
@@ -8,8 +8,10 @@ import { FoundationRouterConfiguration } from '@genesislcap/foundation-ui';
8
8
  import { optional } from '@microsoft/fast-foundation';
9
9
  import { Route } from '@microsoft/fast-router';
10
10
  import { defaultLayout, loginLayout } from '../layouts';
11
- import { Home } from './home/home';
12
11
  import { NotFound } from './not-found/not-found';
12
+ {{#each routes}}
13
+ import { {{pascalCase this}} } from './{{this}}/{{this}}';
14
+ {{/each}}
13
15
 
14
16
  // eslint-disable-next-line
15
17
  declare var ENABLE_SSO: string;
@@ -55,7 +57,7 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
55
57
  );
56
58
  configure(this.container, {
57
59
  autoConnect: true,
58
- defaultRedirectUrl: 'home',
60
+ defaultRedirectUrl: '{{routes.[0]}}',
59
61
  ...ssoSettings,
60
62
  });
61
63
  return define({
@@ -69,22 +71,24 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
69
71
  settings: { public: true },
70
72
  childRouters: true,
71
73
  },
74
+ { path: 'not-found', element: NotFound, title: 'Not Found', name: 'not-found' },
75
+ {{#each routes}}
72
76
  {
73
- path: 'home',
74
- name: 'home',
75
- title: 'Home',
76
- element: Home,
77
+ path: '{{this}}',
78
+ element: {{pascalCase this}},
79
+ title: '{{sentenceCase this}}',
80
+ name: '{{this}}',
77
81
  navItems: [
78
82
  {
79
- title: 'Home',
83
+ title: '{{sentenceCase this}}',
80
84
  icon: {
81
- name: 'home',
85
+ name: 'cog',
82
86
  variant: 'solid',
83
87
  },
84
88
  },
85
89
  ],
86
90
  },
87
- { path: 'not-found', element: NotFound, title: 'Not Found', name: 'not-found' },
91
+ {{/each}}
88
92
  );
89
93
 
90
94
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -1,6 +0,0 @@
1
- import { html } from '@microsoft/fast-element';
2
- import type { Home } from './home';
3
-
4
- export const HomeTemplate = html<Home>`
5
- <!-- insert template code here -->
6
- `;
@@ -1,14 +0,0 @@
1
- import { customElement, FASTElement } from '@microsoft/fast-element';
2
- import { HomeStyles as styles } from './home.styles';
3
- import { HomeTemplate as template } from './home.template';
4
-
5
- @customElement({
6
- name: 'home-route',
7
- template,
8
- styles,
9
- })
10
- export class Home extends FASTElement {
11
- constructor() {
12
- super();
13
- }
14
- }