@genesislcap/blank-app-seed 2.5.0 → 2.5.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.
@@ -1,13 +1,6 @@
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
+ const { registerPartials, generateRoute } = require('./utils');
5
3
 
6
- const makeDirectory = (directory) => {
7
- if (!directoryExists(directory)) {
8
- fs.mkdirSync(directory);
9
- }
10
- };
11
4
  /**
12
5
  * Signature is `async (data: inquirer.Answers, utils: SeedConfigurationUtils)`
13
6
  */
@@ -19,18 +12,10 @@ module.exports = async (data, utils) => {
19
12
  data.applicationVersionWeb = data.applicationVersion.split('-').shift();
20
13
  data.versions = versions;
21
14
 
22
- utils.registerPartial('smart-form', path.resolve(data.directory, '.genx/templates/form.hbs'))
23
- utils.registerPartial('chart', path.resolve(data.directory, '.genx/templates/chart.hbs'))
24
- utils.registerPartial('entity-manager', path.resolve(data.directory, '.genx/templates/entityManager.hbs'))
25
- utils.registerPartial('grid-pro', path.resolve(data.directory, '.genx/templates/grid.hbs'))
26
- // to be exposed via user prompt in the future
27
- data.useDocker = !!process.env.USE_DOCKER;
15
+ registerPartials(utils);
16
+
28
17
  data.routes.forEach(route => {
29
- const routeName = route.name;
30
- makeDirectory(path.resolve(data.directory,`client/src/routes/${routeName}`));
31
- utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${routeName}/${routeName}.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.hbs'));
32
- utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${routeName}/${routeName}.template.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.template.hbs'));
33
- utils.writeFileWithData(path.resolve(data.directory, `client/src/routes/${routeName}/${routeName}.styles.ts`), {route}, path.resolve(data.directory, '.genx/templates/route.styles.hbs'));
34
- })
18
+ generateRoute(route, utils);
19
+ });
35
20
 
36
21
  };
@@ -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.5.0",
4
+ "version": "2.5.2",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -19,11 +19,15 @@ module.exports = async (inquirer, prevAns = {}) => {
19
19
  ])
20
20
 
21
21
  let routesParsed;
22
- try {
23
- routesParsed = JSON.parse(routes);
24
- } catch (error) {
25
- console.error("Error parsing `routes` parameter as JSON:", error.message);
26
- console.log("Falling back to the default routes value");
22
+ if (routes) {
23
+ try {
24
+ routesParsed = JSON.parse(routes);
25
+ } catch (error) {
26
+ console.error("Error parsing `routes` parameter as JSON:", error.message);
27
+ console.log("Falling back to the default routes value");
28
+ routesParsed = JSON.parse(defaultRoutes);
29
+ }
30
+ } else {
27
31
  routesParsed = JSON.parse(defaultRoutes);
28
32
  }
29
33
 
@@ -1,9 +1,9 @@
1
1
  import { customElement, FASTElement } from '@microsoft/fast-element';
2
- import { {{pascalCase route.name}}Styles as styles } from './{{route.name}}.styles';
3
- import { {{pascalCase route.name}}Template as template } from './{{route.name}}.template';
2
+ import { {{pascalCase route.name}}Styles as styles } from './{{kebabCase route.name}}.styles';
3
+ import { {{pascalCase route.name}}Template as template } from './{{kebabCase route.name}}.template';
4
4
 
5
5
  @customElement({
6
- name: '{{route.name}}-route',
6
+ name: '{{kebabCase route.name}}-route',
7
7
  template,
8
8
  styles,
9
9
  })
package/.genx/utils.js ADDED
@@ -0,0 +1,29 @@
1
+ const {existsSync, mkdirSync} = require('node:fs');
2
+ const { resolve } = require('node:path');
3
+
4
+ const makeDirectory = (directory) => {
5
+ if (!existsSync(directory)) {
6
+ mkdirSync(directory);
7
+ }
8
+ };
9
+
10
+ const registerPartials = ({ registerPartial }) => {
11
+ registerPartial('smart-form', resolve(__dirname, 'templates/form.hbs'))
12
+ registerPartial('chart', resolve(__dirname, 'templates/chart.hbs'))
13
+ registerPartial('entity-manager', resolve(__dirname, 'templates/entityManager.hbs'))
14
+ registerPartial('grid-pro', resolve(__dirname, 'templates/grid.hbs'))
15
+ };
16
+
17
+ const generateRoute = (route, { writeFileWithData, changeCase }) => {
18
+ const routeName = changeCase.paramCase(route.name);
19
+ makeDirectory(resolve(__dirname, `../client/src/routes/${routeName}`));
20
+ writeFileWithData(resolve(__dirname, `../client/src/routes/${routeName}/${routeName}.ts`), {route}, resolve(__dirname, 'templates/route.hbs'));
21
+ writeFileWithData(resolve(__dirname, `../client/src/routes/${routeName}/${routeName}.template.ts`), {route}, resolve(__dirname, 'templates/route.template.hbs'));
22
+ writeFileWithData(resolve(__dirname, `../client/src/routes/${routeName}/${routeName}.styles.ts`), {route}, resolve(__dirname, 'templates/route.styles.hbs'));
23
+ };
24
+
25
+ module.exports = {
26
+ makeDirectory,
27
+ registerPartials,
28
+ generateRoute
29
+ };
@@ -29,7 +29,7 @@ Add file / directory pointers.
29
29
 
30
30
 
31
31
  ```
32
- npx -y @genesislcap/genx@latest init prtest -x --ref YOUR-BRANCH-NAME
32
+ npx -y @genesislcap/genx@latest init prtest -x --ref YOUR-BRANCH-NAME --no-npm
33
33
  ```
34
34
 
35
35
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.2](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.1...v2.5.2) (2024-03-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * make absolute app paths work with local seeds GENC-183 (#152) 67d0c41
9
+
10
+ ## [2.5.1](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.0...v2.5.1) (2024-03-19)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * consistent route file and web component naming GENC-176 (#151) 14a3b2a
16
+
3
17
  ## [2.5.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.4.0...v2.5.0) (2024-03-15)
4
18
 
5
19
 
@@ -10,7 +10,7 @@ import { Route } from '@microsoft/fast-router';
10
10
  import { defaultLayout, loginLayout } from '../layouts';
11
11
  import { NotFound } from './not-found/not-found';
12
12
  {{#each routes}}
13
- import { {{pascalCase this.name}} } from './{{this.name}}/{{this.name}}';
13
+ import { {{pascalCase this.name}} } from './{{kebabCase this.name}}/{{kebabCase this.name}}';
14
14
  {{/each}}
15
15
 
16
16
  // eslint-disable-next-line
@@ -57,7 +57,7 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
57
57
  );
58
58
  configure(this.container, {
59
59
  autoConnect: true,
60
- defaultRedirectUrl: '{{routes.[0].name}}',
60
+ defaultRedirectUrl: '{{kebabCase routes.[0].name}}',
61
61
  ...ssoSettings,
62
62
  });
63
63
  return define({
@@ -74,10 +74,10 @@ export class MainRouterConfig extends FoundationRouterConfiguration<LoginSetting
74
74
  { path: 'not-found', element: NotFound, title: 'Not Found', name: 'not-found' },
75
75
  {{#each routes}}
76
76
  {
77
- path: '{{this.name}}',
77
+ path: '{{kebabCase this.name}}',
78
78
  element: {{pascalCase this.name}},
79
79
  title: '{{sentenceCase this.name}}',
80
- name: '{{this.name}}',
80
+ name: '{{kebabCase this.name}}',
81
81
  navItems: [
82
82
  {
83
83
  title: '{{sentenceCase this.name}}',
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.5.0",
4
+ "version": "2.5.2",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"
@@ -1,8 +1,8 @@
1
1
  systemDefinition {
2
2
  global {
3
3
  item(name = "DbLayer", value = "SQL")
4
- item(name = "DictionarySource", value = "FILE")
5
- item(name = "DbHost", value = "jdbc:h2:file:./server/h2/test;DB_CLOSE_DELAY=-1;NON_KEYWORDS=VALUE,KEY;AUTO_SERVER=TRUE")
4
+ item(name = "DictionarySource", value = "DB")
5
+ item(name = "DbHost", value = "jdbc:h2:file:~/{{appName}}/server/h2/test;DB_CLOSE_DELAY=-1;NON_KEYWORDS=VALUE,KEY;AUTO_SERVER=TRUE")
6
6
  item(name = "DbQuotedIdentifiers", value = true)
7
7
  item(name = "DEPLOYED_PRODUCT", value = "{{appName}}")
8
8
  item(name = "MqLayer", value = env["MQ_LAYER", "ZeroMQ"])