@genesislcap/blank-app-seed 2.5.10 → 2.6.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,5 @@
1
1
  const versions = require('./versions.json');
2
- const { registerPartials, generateRoute } = require('./utils');
2
+ const { registerPartials, generateRoute, generateEmptyCsv } = require('./utils');
3
3
 
4
4
  /**
5
5
  * Signature is `async (data: inquirer.Answers, utils: SeedConfigurationUtils)`
@@ -20,4 +20,13 @@ module.exports = async (data, utils) => {
20
20
  generateRoute(route, utils);
21
21
  });
22
22
 
23
+ data.csv
24
+ .map(entity => ({
25
+ name: entity.name.toUpperCase(),
26
+ fields: entity.fields.map( (field, index) => ({name: field.toUpperCase(), isLast: index === (entity.fields.length -1) }))
27
+ }))
28
+ .forEach(entity => {
29
+ generateEmptyCsv(entity, data.appName, utils);
30
+ });
31
+
23
32
  };
@@ -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.10",
4
+ "version": "2.6.0",
5
5
  "license": "Apache-2.0",
6
6
  "genxSeedConfig": {
7
7
  "exclude": [
@@ -1,10 +1,23 @@
1
1
  const {mavenArtifactVersionRegex} = require('./validators');
2
2
 
3
+ const parsecsv = (inputEntities) => {
4
+ if (!inputEntities){
5
+ return [];
6
+ }
7
+ try {
8
+ return JSON.parse(inputEntities);
9
+ } catch (error) {
10
+ console.error("Error parsing `csv` parameter as JSON:", error.message);
11
+ return [];
12
+ }
13
+ }
14
+
3
15
  module.exports = async (inquirer, prevAns = {}) => {
4
16
  const {
5
17
  groupId = prevAns.groupId,
6
18
  applicationVersion = prevAns.applicationVersion,
7
- enableDeployPlugin = prevAns.enableDeployPlugin
19
+ enableDeployPlugin = prevAns.enableDeployPlugin,
20
+ csv = prevAns.csv,
8
21
  } = await inquirer.prompt([
9
22
  {
10
23
  name: 'groupId',
@@ -28,10 +41,19 @@ module.exports = async (inquirer, prevAns = {}) => {
28
41
  when: prevAns.enableDeployPlugin === undefined,
29
42
  default: prevAns.enableDeployPlugin || false
30
43
  },
44
+ {
45
+ name: 'csv',
46
+ type: 'input',
47
+ message: 'Generate empty CSV for entities? (config in json format)',
48
+ when: !prevAns.csv,
49
+ default: '[]'
50
+ },
31
51
  ]);
52
+
32
53
  return {
33
54
  groupId,
34
55
  applicationVersion,
35
56
  enableDeployPlugin,
57
+ csv: parsecsv(csv)
36
58
  };
37
59
  };
package/.genx/prompts.js CHANGED
@@ -12,7 +12,7 @@ module.exports = async (inquirer, prevAns = {}) => {
12
12
  License: ${license}`);
13
13
 
14
14
  const {apiHost, enableSSO} = await apiPrompts(inquirer, prevAns)
15
- const {groupId, applicationVersion, enableDeployPlugin} = await genesisServerPrompts(inquirer, prevAns);
15
+ const {groupId, applicationVersion, enableDeployPlugin, csv} = await genesisServerPrompts(inquirer, prevAns);
16
16
  const {routes} = await uiPrompts(inquirer, prevAns);
17
17
 
18
18
  return {
@@ -22,5 +22,6 @@ module.exports = async (inquirer, prevAns = {}) => {
22
22
  groupId,
23
23
  applicationVersion,
24
24
  enableDeployPlugin,
25
+ csv,
25
26
  };
26
27
  };
@@ -0,0 +1 @@
1
+ {{#each entity.fields}}{{this.name}}{{#unless this.isLast }},{{/unless}}{{/each}}
package/.genx/utils.js CHANGED
@@ -22,8 +22,13 @@ const generateRoute = (route, { writeFileWithData, changeCase }) => {
22
22
  writeFileWithData(resolve(__dirname, `../client/src/routes/${routeName}/${routeName}.styles.ts`), {route}, resolve(__dirname, 'templates/route.styles.hbs'));
23
23
  };
24
24
 
25
+ const generateEmptyCsv = (entity, appName, { writeFileWithData }) => {
26
+ writeFileWithData(resolve(__dirname, `../server/{{appName}}-app/src/main/genesis/data/${entity.name}.csv`), {entity}, resolve(__dirname, 'templates/csv.hbs'));
27
+ };
28
+
25
29
  module.exports = {
26
30
  makeDirectory,
27
31
  registerPartials,
28
- generateRoute
32
+ generateRoute,
33
+ generateEmptyCsv,
29
34
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.6.0](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.10...v2.6.0) (2024-04-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * support to generate empty data csvs (GENC-280) (#175) a992a91
9
+
3
10
  ## [2.5.10](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v2.5.9...v2.5.10) (2024-04-09)
4
11
 
5
12
 
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.10",
4
+ "version": "2.6.0",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"