@jahia/create-module 0.0.3 → 0.0.5

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.
Files changed (69) hide show
  1. package/.yarn/releases/{yarn-4.4.0.cjs → yarn-4.5.0.cjs} +224 -224
  2. package/.yarnrc.yml +1 -1
  3. package/README.md +9 -4
  4. package/index.js +68 -88
  5. package/package.json +5 -8
  6. package/template/.babelrc +9 -0
  7. package/{jsx → template}/doteslintrc.cjs +1 -0
  8. package/{handlebars → template}/dotgitignore +3 -0
  9. package/{jsx → template}/dotnpmignore +1 -1
  10. package/{jsx → template}/package.json +4 -4
  11. package/template/settings/README.md +30 -0
  12. package/template/settings/content-types-icons/MODULE_NAMESPACE_simpleContent.png +0 -0
  13. package/{jsx → template/settings}/definitions.cnd +2 -2
  14. package/template/settings/resources/MODULE_NAME.properties +3 -0
  15. package/template/settings/resources/MODULE_NAME_fr.properties +3 -0
  16. package/template/settings/template-thumbnail.png +0 -0
  17. package/{jsx → template}/src/client/index.jsx +1 -1
  18. package/template/src/server/templates/page/PageHome.jsx +31 -0
  19. package/template/src/server/views/index.js +1 -0
  20. package/template/src/server/views/simpleContent/SimpleContentDefault.jsx +19 -0
  21. package/template/src/server/views/simpleContent/index.js +1 -0
  22. package/{jsx → template}/webpack.config.js +4 -1
  23. package/babel.config.cjs.disabled +0 -3
  24. package/handlebars/components/MODULE_NAMESPACE/hello/hello.cnd +0 -6
  25. package/handlebars/components/MODULE_NAMESPACE/hello/hello.default.hbs +0 -1
  26. package/handlebars/components/MODULE_NAMESPACE/hello/hello.icon.png +0 -0
  27. package/handlebars/components/jnt/page/page.home.hbs +0 -18
  28. package/handlebars/components/jnt/page/page.home.png +0 -0
  29. package/handlebars/components/jnt/page/page.home.properties +0 -2
  30. package/handlebars/definitions.cnd +0 -8
  31. package/handlebars/dotenv +0 -4
  32. package/handlebars/doteslintrc.cjs +0 -29
  33. package/handlebars/dotnpmignore +0 -4
  34. package/handlebars/import.xml +0 -8
  35. package/handlebars/locales/de.json +0 -3
  36. package/handlebars/locales/en.json +0 -3
  37. package/handlebars/locales/fr.json +0 -3
  38. package/handlebars/package.json +0 -42
  39. package/handlebars/resources/MODULE_NAME.properties +0 -2
  40. package/handlebars/resources/MODULE_NAME_fr.properties +0 -2
  41. package/handlebars/settings/README.txt +0 -9
  42. package/handlebars/src/index.js +0 -0
  43. package/handlebars/webpack.config.js +0 -67
  44. package/jsx/.yarn/releases/yarn-4.3.1.cjs +0 -894
  45. package/jsx/.yarnrc.yml +0 -3
  46. package/jsx/README.md +0 -31
  47. package/jsx/dotgitignore +0 -18
  48. package/jsx/resources/MODULE_NAME.properties +0 -3
  49. package/jsx/resources/MODULE_NAME_fr.properties +0 -3
  50. package/jsx/settings/README.txt +0 -9
  51. package/jsx/src/server/templates/page/PageHome.jsx +0 -27
  52. package/jsx/src/server/views/hello/HelloDefault.jsx +0 -19
  53. package/jsx/src/server/views/hello/index.js +0 -1
  54. package/jsx/src/server/views/index.js +0 -1
  55. package/jsx/yarn.lock +0 -0
  56. /package/{handlebars → template}/.yarn/releases/yarn-4.3.1.cjs +0 -0
  57. /package/{handlebars → template}/.yarnrc.yml +0 -0
  58. /package/{handlebars → template}/README.md +0 -0
  59. /package/{jsx → template}/css/styles.css +0 -0
  60. /package/{jsx → template}/dotenv +0 -0
  61. /package/{jsx → template/settings}/import.xml +0 -0
  62. /package/{jsx → template/settings}/locales/de.json +0 -0
  63. /package/{jsx → template/settings}/locales/en.json +0 -0
  64. /package/{jsx → template/settings}/locales/fr.json +0 -0
  65. /package/{jsx → template}/src/server/components/index.js +0 -0
  66. /package/{jsx → template}/src/server/index.js +0 -0
  67. /package/{jsx → template}/src/server/templates/index.js +0 -0
  68. /package/{jsx → template}/src/server/templates/page/index.js +0 -0
  69. /package/{handlebars → template}/yarn.lock +0 -0
package/.yarnrc.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  nodeLinker: node-modules
2
2
 
3
- yarnPath: .yarn/releases/yarn-4.4.0.cjs
3
+ yarnPath: .yarn/releases/yarn-4.5.0.cjs
package/README.md CHANGED
@@ -4,7 +4,12 @@ This project provides an NPM/NPX starter project template to quickly get up and
4
4
 
5
5
  ## Usage
6
6
 
7
- npx @jahia/create-module@latest my-module-name my-module-type
8
-
9
- where `my-module-name` can be anything you want to call your project
10
- and `my-module-type`is jsx or handlebars
7
+ npx @jahia/create-module@latest project-name [module-type] [namespace-definitions]
8
+
9
+ where
10
+ - `project-name` (mandatory) can be anything you want to call your project
11
+ - `module-type` (optional) Can be one of:
12
+ - `templatesSet`: A collection of templates and components. A template set is required when creating a website.
13
+ - `module`: Standard Jahia module. This is the default value.
14
+ - `system`: Critical module for the whole platform.
15
+ - `namespace-definitions` (optional) The namespace used for content definitions. Default is the project name in camel case.
package/index.js CHANGED
@@ -5,54 +5,83 @@
5
5
  import fs from 'fs';
6
6
  import path from 'path';
7
7
  import {fileURLToPath} from 'url';
8
- import replace from 'replace-in-file';
8
+ import {replaceInFileSync} from 'replace-in-file';
9
9
  import camelCase from 'camelcase';
10
10
  import {execSync} from 'child_process';
11
11
 
12
12
  const __filename = fileURLToPath(import.meta.url);
13
13
  const __dirname = path.dirname(__filename);
14
14
 
15
- // The first argument will be the project name.
16
- // The second argument will be the project type (handlebars or jsx)
17
- // The third argument is optional, it will be the namespace of the module.
18
- if (process.argv.length < 3) {
19
- console.error('Missing module-name parameter. Ex: npx @jahia/create-module@latest module-name module-type [namespace]');
15
+ // Show help if no argment is provided
16
+ // eslint-disable-next-line no-unused-vars
17
+ const [nodeCommand, npxCommand, projectName, moduleType = 'module', namespace = camelCase(projectName || '')] = process.argv;
18
+
19
+ if (!projectName) {
20
+ console.log(`\x1B[1m## Usage\x1B[0m
21
+
22
+ npx @jahia/create-module@latest project-name [module-type] [namespace-definitions]
23
+
24
+ where
25
+ - \x1B[1mproject-name\x1B[0m (mandatory) can be anything you want to call your project
26
+ - \x1B[1mmodule-type\x1B[0m (optional) Can be one of:
27
+ - \x1B[3mtemplatesSet\x1B[0m A collection of templates and components. A template set is required when creating a website.
28
+ - \x1B[3mmodule\x1B[0m sStandard Jahia module. This is the default value.
29
+ - \x1B[3msystem\x1B[0m Critical module for the whole platform .
30
+ - \x1B[1mnamespace-definitions\x1B[0m (optional) The namespace used for content definitions. Default is the project name in camel case.
31
+ `);
20
32
  process.exit(9);
21
33
  }
22
34
 
23
- const projectName = process.argv[2];
24
- const camelProjectName = camelCase(projectName);
25
-
26
35
  // First let's do some version checks
27
36
  console.log('Node version detected:', process.versions.node);
28
37
  const yarnVersion = execSync('yarn --version', {encoding: 'utf8'});
29
38
  console.log('Yarn version:', yarnVersion);
30
39
 
31
- let projectType;
32
- if (process.argv[3] === 'handlebars' || process.argv[3] === 'jsx') {
33
- projectType = process.argv[3];
34
- } else {
35
- console.error(`Invalid module-type parameter, should be handlebars or jsx, got:${process.argv[3]}. Ex: npx @jahia/create-module@latest module-name module-type [namespace]`);
36
- process.exit(9);
37
- }
38
-
39
- let namespace;
40
- if (process.argv.length > 4) {
41
- namespace = process.argv[4];
42
- } else {
43
- namespace = camelProjectName;
44
- }
45
-
46
40
  // Create a project directory with the project name.
47
41
  const currentDir = process.cwd();
48
42
  const projectDir = path.resolve(currentDir, projectName);
49
43
  fs.mkdirSync(projectDir, {recursive: true});
50
44
 
45
+ console.log(`Creating a new Jahia module project \x1B[1m${projectName}\x1B[0m of type \x1B[1m${moduleType}\x1B[0m and definitions namespace \x1B[1m${namespace}\x1B[0m`);
46
+
51
47
  // A common approach to building a starter template is to
52
48
  // create a `template` folder which will house the template
53
49
  // and the files we want to create.
54
- const templateDir = path.resolve(__dirname, projectType);
55
- fs.cpSync(templateDir, projectDir, {recursive: true});
50
+ const templateDir = path.resolve(__dirname, 'template');
51
+ const isTemplatesSet = moduleType === 'templatesSet';
52
+ fs.cpSync(templateDir, projectDir, {
53
+ recursive: true,
54
+ filter: src => {
55
+ // The file template-thumbnail.png is only used for the type templatesSet
56
+ return (isTemplatesSet || src !== path.join(templateDir, 'settings', 'template-thumbnail.png'));
57
+ }
58
+ });
59
+
60
+ // Find and replace all markers with the appropriate substitution values
61
+ // Doing it before renaming the dotfiles so they are not excluded
62
+ const targetFiles = `${projectDir}/**`;
63
+
64
+ try {
65
+ replaceInFileSync({
66
+ files: targetFiles,
67
+ from: /\$\$MODULE_TYPE\$\$/g,
68
+ to: moduleType
69
+ });
70
+
71
+ replaceInFileSync({
72
+ files: targetFiles,
73
+ from: /\$\$MODULE_NAME\$\$/g,
74
+ to: projectName
75
+ });
76
+
77
+ replaceInFileSync({
78
+ files: targetFiles,
79
+ from: /\$\$MODULE_NAMESPACE\$\$/g,
80
+ to: namespace
81
+ });
82
+ } catch (error) {
83
+ console.error('Error occurred:', error);
84
+ }
56
85
 
57
86
  // It is good practice to have dotfiles stored in the
58
87
  // template without the dot (so they do not get picked
@@ -78,79 +107,30 @@ fs.renameSync(
78
107
 
79
108
  // Rename the resource file to use the project name
80
109
  fs.renameSync(
81
- path.join(projectDir, 'resources/MODULE_NAME.properties'),
82
- path.join(projectDir, 'resources/' + projectName + '.properties')
110
+ path.join(projectDir, 'settings', 'resources', 'MODULE_NAME.properties'),
111
+ path.join(projectDir, 'settings', 'resources', projectName + '.properties')
83
112
  );
84
113
 
85
114
  fs.renameSync(
86
- path.join(projectDir, 'resources/MODULE_NAME_fr.properties'),
87
- path.join(projectDir, 'resources/' + projectName + '_fr.properties')
115
+ path.join(projectDir, 'settings', 'resources', 'MODULE_NAME_fr.properties'),
116
+ path.join(projectDir, 'settings', 'resources', projectName + '_fr.properties')
88
117
  );
89
118
 
90
- // Rename the resource file to use the project name
91
- if (process.argv[3] === 'handlebars') {
92
- fs.renameSync(
93
- path.join(projectDir, 'components/MODULE_NAMESPACE'),
94
- path.join(projectDir, 'components/' + namespace)
95
- );
96
- }
119
+ fs.renameSync(
120
+ path.join(projectDir, 'settings', 'content-types-icons', 'MODULE_NAMESPACE_simpleContent.png'),
121
+ path.join(projectDir, 'settings', 'content-types-icons', namespace + '_simpleContent.png')
122
+ );
97
123
 
98
124
  // Create empty directories for static resources and configurations
99
125
  fs.mkdirSync(path.join(projectDir, 'css'), {recursive: true});
100
126
  fs.mkdirSync(path.join(projectDir, 'images'), {recursive: true});
101
127
  fs.mkdirSync(path.join(projectDir, 'javascript'), {recursive: true});
102
- fs.mkdirSync(path.join(projectDir, 'settings/configurations'), {recursive: true});
103
- fs.mkdirSync(path.join(projectDir, 'settings/jahia-content-editor-forms'), {recursive: true});
104
- fs.mkdirSync(path.join(projectDir, 'settings/jahia-content-editor-forms/forms'), {recursive: true});
105
- fs.mkdirSync(path.join(projectDir, 'settings/jahia-content-editor-forms/fieldsets'), {recursive: true});
106
-
107
- // Find and replace all markers with the appropriate substitution values
108
- const targetFiles = [
109
- path.join(projectDir, 'README.md'),
110
- path.join(projectDir, 'import.xml'),
111
- path.join(projectDir, 'package.json'),
112
- path.join(projectDir, 'definitions.cnd'),
113
- path.join(projectDir, 'resources/' + projectName + '.properties'),
114
- path.join(projectDir, 'resources/' + projectName + '_fr.properties')
115
- ];
116
-
117
- if (projectType === 'jsx') {
118
- targetFiles.push(path.join(projectDir, 'src/server/templates/page/PageHome.jsx'));
119
- targetFiles.push(path.join(projectDir, 'src/server/views/hello/HelloDefault.jsx'));
120
- targetFiles.push(path.join(projectDir, 'src/client/index.jsx'));
121
- targetFiles.push(path.join(projectDir, 'webpack.config.js'));
122
- }
123
-
124
- if (projectType === 'handlebars') {
125
- targetFiles.push(path.join(projectDir, 'components/' + namespace + '/hello/hello.cnd'));
126
- }
127
-
128
- try {
129
- replace.sync({
130
- files: targetFiles,
131
- from: /\$\$CAMEL_MODULE_NAME\$\$/g,
132
- to: camelProjectName,
133
- disableGlobs: true // This is required otherwise the replaces fail under Windows (see https://jira.jahia.org/browse/BACKLOG-21353)
134
- });
135
-
136
- replace.sync({
137
- files: targetFiles,
138
- from: /\$\$MODULE_NAME\$\$/g,
139
- to: projectName,
140
- disableGlobs: true // This is required otherwise the replaces fail under Windows (see https://jira.jahia.org/browse/BACKLOG-21353)
141
- });
142
-
143
- replace.sync({
144
- files: targetFiles,
145
- from: /\$\$MODULE_NAMESPACE\$\$/g,
146
- to: namespace,
147
- disableGlobs: true // This is required otherwise the replaces fail under Windows (see https://jira.jahia.org/browse/BACKLOG-21353)
148
- });
149
- } catch (error) {
150
- console.error('Error occurred:', error);
151
- }
128
+ fs.mkdirSync(path.join(projectDir, 'settings', 'configurations'), {recursive: true});
129
+ fs.mkdirSync(path.join(projectDir, 'settings', 'content-editor-forms'), {recursive: true});
130
+ fs.mkdirSync(path.join(projectDir, 'settings', 'content-editor-forms', 'forms'), {recursive: true});
131
+ fs.mkdirSync(path.join(projectDir, 'settings', 'content-editor-forms', 'fieldsets'), {recursive: true});
152
132
 
153
- console.log(`Created ${projectName} at ${projectDir}`);
133
+ console.log(`Created \x1B[1m${projectName}\x1B[0m at \x1B[1m${projectDir}\x1B[0m`);
154
134
  console.log('Success! Your new project is ready.');
155
135
  console.log('You can now change into your project and launch "yarn" to install everything to get started.');
156
136
  console.log('---');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/create-module",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": "./index.js",
@@ -19,13 +19,13 @@
19
19
  "dependencies": {
20
20
  "camelcase": "^8.0.0",
21
21
  "path": "^0.12.7",
22
- "replace-in-file": "^7.0.1",
22
+ "replace-in-file": "^8.2.0",
23
23
  "semver": "^7.5.4",
24
24
  "url": "^0.11.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@jahia/eslint-config": "^2.1.2",
28
- "@jahia/scripts": "^1.3.3",
28
+ "@jahia/scripts": "^1.3.5",
29
29
  "eslint": "^8.43.0",
30
30
  "eslint-plugin-jest": "latest",
31
31
  "eslint-plugin-react": "latest",
@@ -34,14 +34,11 @@
34
34
  "scripts": {
35
35
  "lint": "eslint .",
36
36
  "posttest": "yarn lint",
37
- "test-hbs": "rm -rf test-project-hbs && node index.js test-project-hbs handlebars && cd test-project-hbs && yarn && yarn build && yarn lint && yarn test && cd ..",
38
- "test-jsx": "rm -rf test-project-jsx && node index.js test-project-jsx jsx && cd test-project-jsx && yarn && yarn build && yarn lint && yarn test && cd ..",
39
- "test": "yarn test-hbs && yarn test-jsx",
40
- "version": "git add README.md"
37
+ "test": "rm -rf test-project && node index.js test-project && cd test-project && yarn && yarn build && yarn lint && yarn test && cd .."
41
38
  },
42
39
  "engines": {
43
40
  "node": ">=18.0.0",
44
41
  "yarn": ">=4.0.0"
45
42
  },
46
- "packageManager": "yarn@4.4.0"
43
+ "packageManager": "yarn@4.5.0"
47
44
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ "@babel/preset-react"
5
+ ],
6
+ "plugins": [
7
+ "styled-jsx/babel"
8
+ ]
9
+ }
@@ -25,5 +25,6 @@ module.exports = {
25
25
  },
26
26
  ignorePatterns: ['dist', 'css', 'javascript'],
27
27
  rules: {
28
+ 'react/prop-types': 'off'
28
29
  }
29
30
  };
@@ -16,3 +16,6 @@ node_modules
16
16
  !.yarn/sdks
17
17
  !.yarn/versions
18
18
  yarn-error.log
19
+
20
+ # generated .tgz file
21
+ $$MODULE_NAME$$-*.tgz
@@ -6,5 +6,5 @@
6
6
  .vscode
7
7
  webpack.config.js
8
8
  README.md
9
- settings/README.txt
9
+ settings/README.md
10
10
  src
@@ -8,15 +8,15 @@
8
8
  "build:production": "webpack --mode=production && jahia-pack",
9
9
  "deploy": "jahia-deploy",
10
10
  "watch": "webpack --mode=development --watch",
11
- "lint": "eslint .",
11
+ "lint": "eslint --ext js,jsx .",
12
12
  "test": "yarn lint"
13
13
  },
14
14
  "jahia": {
15
15
  "module-dependencies": "default",
16
- "module-type": "",
16
+ "module-type": "$$MODULE_TYPE$$",
17
17
  "module-type-comment": "Use templatesSet in the module type to declare a template set",
18
18
  "server": "dist/main.js",
19
- "static-resources": "/css,/images,/javascript,/locales"
19
+ "static-resources": "/css,/icons,/images,/javascript,/locales"
20
20
  },
21
21
  "dependencies": {
22
22
  "@jahia/js-server-core": "^0.0.13",
@@ -32,7 +32,7 @@
32
32
  "@babel/preset-env": "^7.16.4",
33
33
  "@babel/preset-react": "^7.16.0",
34
34
  "@jahia/eslint-config": "^2.1.2",
35
- "@jahia/scripts": "^1.3.3",
35
+ "@jahia/scripts": "^1.3.5",
36
36
  "babel-loader": "^8.2.3",
37
37
  "clean-webpack-plugin": "^4.0.0",
38
38
  "copy-webpack-plugin": "^10.0.0",
@@ -0,0 +1,30 @@
1
+ # Directory Structure
2
+
3
+ In this directory, you can directly put:
4
+ - **Rule files** (`*.drl`, `*.dsl`)
5
+ - **URL rewrite XML files**
6
+ - **import.xml** file
7
+ - **definitions.cnd** file
8
+ - **template-thumbnail.png** file to associate a preview image with the current module (in case it's a template module)
9
+
10
+ ## Configurations Directory
11
+
12
+ In the `configurations` directory, you can put:
13
+ - **OSGi configuration files** (`*.cfg`, `*.yml`)
14
+
15
+ ## Content Editor Forms Directory
16
+
17
+ In the `content-editor-forms` directory, you can put content editor form and field set overrides.
18
+ See examples here: [Jahia Content Editor Form Examples](https://academy.jahia.com/documentation/jahia/jahia-8/developer/extending-and-customizing-jahia-ui/customizing-content-editor-forms/examples-of-content-definition-json-overrides)
19
+
20
+ ## Content Types Icons Directory
21
+
22
+ In the `content-types-icons` directory, you can put content type icons following the naming convention: `namespace_type.png`
23
+
24
+ ## Locales Directory
25
+
26
+ In the `locales` directory, you can put locale files (e.g., `en.json`, `fr.json`) used for internationalization in JavaScript views.
27
+
28
+ ## Resources Directory
29
+
30
+ In the `resources` directory, you can put resource bundles for content types internationalization.
@@ -13,5 +13,5 @@
13
13
  // to see in this category.
14
14
  [$$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components] > jmix:droppableContent, jmix:accessControllableContent mixin
15
15
 
16
- [$$MODULE_NAMESPACE$$:hello] > jnt:content, $$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components
17
- - textHello (string) = 'Hello world !' i18n
16
+ [$$MODULE_NAMESPACE$$:simpleContent] > jnt:content, $$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components
17
+ - title (string) = 'Hello world !' i18n
@@ -0,0 +1,3 @@
1
+ $$MODULE_NAMESPACE$$mix_$$MODULE_NAMESPACE$$Components = $$MODULE_NAMESPACE$$ Components
2
+ $$MODULE_NAMESPACE$$_simpleContent=Simple Content
3
+ $$MODULE_NAMESPACE$$_simpleContent.title=Title
@@ -0,0 +1,3 @@
1
+ $$MODULE_NAMESPACE$$mix_$$MODULE_NAMESPACE$$Components = Composants $$MODULE_NAMESPACE$$
2
+ $$MODULE_NAMESPACE$$_simpleContent=Contenu simple
3
+ $$MODULE_NAMESPACE$$_simpleContent.title=Titre
@@ -2,4 +2,4 @@
2
2
  // Since JS can be aggregated by Jahia on live, the path of the original file is lost
3
3
  // Also the context of the server should be handled properly
4
4
  // eslint-disable-next-line camelcase, no-undef
5
- __webpack_public_path__ = `${window.__APPSHELL_INIT_DATA__.moduleBaseUrl}/$$MODULE_NAME$$/javascript/client/`;
5
+ __webpack_public_path__ = `${window.__APPSHELL_INIT_DATA__.moduleBaseUrl}/$$MODULE_NAME$$/javascript/client/`;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import {Area, AddResources, defineJahiaComponent, useServerContext} from '@jahia/js-server-core';
3
+ import {useTranslation} from 'react-i18next';
4
+
5
+ export const PageHome = () => {
6
+ const {t} = useTranslation();
7
+ const {currentResource} = useServerContext();
8
+ const lang = currentResource.getLocale().getLanguage();
9
+ return (
10
+ <html lang={lang}>
11
+ <head>
12
+ <AddResources type="css" resources="styles.css"/>
13
+ <title>Home</title>
14
+ </head>
15
+ <body>
16
+ <main>
17
+ {/* Using i18next defined in locales */}
18
+ <h1>{t('homeTitle')}</h1>
19
+ <Area name="pagecontent"/>
20
+ </main>
21
+ </body>
22
+ </html>
23
+ );
24
+ };
25
+
26
+ PageHome.jahiaComponent = defineJahiaComponent({
27
+ nodeType: 'jnt:page',
28
+ name: 'home',
29
+ displayName: 'Home page',
30
+ componentType: 'template'
31
+ });
@@ -0,0 +1 @@
1
+ export * from './simpleContent';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import {useServerContext, getNodeProps, defineJahiaComponent} from '@jahia/js-server-core';
3
+
4
+ export const SimpleContentDefault = () => {
5
+ const {currentNode} = useServerContext();
6
+ const simpleContent = getNodeProps(currentNode, ['title']);
7
+ return (
8
+ <div>
9
+ <h2>{simpleContent.title}</h2>
10
+ </div>
11
+ );
12
+ };
13
+
14
+ SimpleContentDefault.jahiaComponent = defineJahiaComponent({
15
+ name: 'default',
16
+ nodeType: '$$MODULE_NAMESPACE$$:simpleContent',
17
+ displayName: 'Simple Content (default)',
18
+ componentType: 'view'
19
+ });
@@ -0,0 +1 @@
1
+ export * from './SimpleContentDefault';
@@ -142,6 +142,9 @@ module.exports = (env, mode) => {
142
142
  // Also an additional sleep is added to avoid watch triggering too much in a short time
143
143
  // (Feel free to adjust the sleep time according to your needs)
144
144
  if (mode.watch) {
145
+ // Sleep time in seconds, can be adjusted
146
+ const sleepTime = 5;
147
+
145
148
  configs.push({
146
149
  name: 'watch',
147
150
  mode: 'development',
@@ -171,7 +174,7 @@ module.exports = (env, mode) => {
171
174
  scripts: [
172
175
  'yarn jahia-pack',
173
176
  'yarn jahia-deploy',
174
- 'sleep 5' // Sleep for 5 seconds, can be adjusted
177
+ process.platform === 'win32' ? 'timeout ' + sleepTime : 'sleep ' + sleepTime
175
178
  ],
176
179
  blocking: true,
177
180
  parallel: false
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- presets: ['@babel/preset-env', '@babel/preset-react']
3
- };
@@ -1,6 +0,0 @@
1
- <jnt = 'http://www.jahia.org/jahia/nt/1.0'>
2
- <jmix = 'http://www.jahia.org/jahia/mix/1.0'>
3
- <$$MODULE_NAMESPACE$$ = 'http://www.acme.org/$$MODULE_NAME$$/nt/1.0'>
4
-
5
- [$$MODULE_NAMESPACE$$:hello] > jnt:content, jmix:droppableContent
6
- - textHello (string) = 'Hello world !' i18n
@@ -1 +0,0 @@
1
- <h1>{{currentContent.properties.textHello}}</h1>
@@ -1,18 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" class="no-js">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width, initial-scale=1">
8
- <title>Home Template</title>
9
- </head>
10
-
11
- <body>
12
- <h1>Home Template</h1>
13
- <main>
14
- {{jArea name="pagecontent"}}
15
- </main>
16
- </body>
17
-
18
- </html>
@@ -1,2 +0,0 @@
1
- name=Home page
2
- componentType=template
@@ -1,8 +0,0 @@
1
- <jnt = 'http://www.jahia.org/jahia/nt/1.0'>
2
- <jmix = 'http://www.jahia.org/jahia/mix/1.0'>
3
- <$$MODULE_NAMESPACE$$ = 'http://www.acme.org/$$MODULE_NAME$$/nt/1.0'>
4
- <$$MODULE_NAMESPACE$$mix = 'http://www.acme.org/$$MODULE_NAME$$/mix/1.0'>
5
-
6
- // This mixin creates a category to regroup types in the content type selector UI. Apply it to any definition you want
7
- // to see in this category.
8
- [$$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components] > jmix:droppableContent, jmix:accessControllableContent mixin
package/handlebars/dotenv DELETED
@@ -1,4 +0,0 @@
1
- JAHIA_USER=root:root1234
2
- JAHIA_HOST=http://localhost:8080
3
- JAHIA_DOCKER_NAME=jahia-ee-dev
4
- JAHIA_DEPLOY_METHOD=curl
@@ -1,29 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- browser: true,
5
- es2021: true
6
- },
7
- extends: '@jahia',
8
- overrides: [
9
- {
10
- env: {
11
- node: true
12
- },
13
- files: [
14
- '.eslintrc.{js,cjs}'
15
- ],
16
- parserOptions: {
17
- sourceType: 'script'
18
- }
19
- }
20
- ],
21
- parserOptions: {
22
- requireConfigFile: false,
23
- ecmaVersion: 'latest',
24
- sourceType: 'module'
25
- },
26
- ignorePatterns: ['dist'],
27
- rules: {
28
- }
29
- };
@@ -1,4 +0,0 @@
1
- .env
2
- .eslintrc.cjs
3
- .idea
4
- *.tgz
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <content xmlns:j="http://www.jahia.org/jahia/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
3
- <modules jcr:primaryType="jnt:modules">
4
- <$$MODULE_NAME$$>
5
- <home j:isHomePage="true" j:templateName="home" jcr:primaryType="jnt:page" />
6
- </$$MODULE_NAME$$>
7
- </modules>
8
- </content>
@@ -1,3 +0,0 @@
1
- {
2
- "greeting": "Hallo !"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "greeting": "Hello !"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "greeting": "Salut !"
3
- }
@@ -1,42 +0,0 @@
1
- {
2
- "name": "$$MODULE_NAME$$",
3
- "version": "1.0.0",
4
- "license": "MIT",
5
- "scripts": {
6
- "build": "webpack --mode=development --env pack",
7
- "build:production": "webpack --mode=production --env pack",
8
- "deploy": "jahia-deploy",
9
- "watch": "webpack --mode=development --env deploy --watch",
10
- "lint": "eslint .",
11
- "test": "yarn lint"
12
- },
13
- "jahia": {
14
- "module-dependencies": "default",
15
- "module-type": "templatesSet",
16
- "server": "dist/main.js",
17
- "static-resources": "/css,/images,/javascript"
18
- },
19
- "devDependencies": {
20
- "@jahia/eslint-config": "^2.1.2",
21
- "@jahia/scripts": "^1.3.3",
22
- "eslint": "^8.43.0",
23
- "eslint-plugin-jest": "latest",
24
- "eslint-plugin-react": "latest",
25
- "eslint-plugin-react-hooks": "latest",
26
- "extra-watch-webpack-plugin": "latest",
27
- "handlebars-loader": "^1.7.3",
28
- "typescript": "^5.3.3",
29
- "webpack": "^5.88.1",
30
- "webpack-cli": "^5.1.4",
31
- "webpack-shell-plugin-next": "^2.3.1"
32
- },
33
- "dependencies": {
34
- "@jahia/js-server-core": "^0.0.13",
35
- "handlebars": "^4.7.7"
36
- },
37
- "engines": {
38
- "node": ">=16.0.0",
39
- "yarn": ">=4.0.0"
40
- },
41
- "packageManager": "yarn@4.3.1"
42
- }
@@ -1,2 +0,0 @@
1
- $$MODULE_NAMESPACE$$_hello=Hello
2
- $$MODULE_NAMESPACE$$_hello.textHello=Hello world !
@@ -1,2 +0,0 @@
1
- $$MODULE_NAMESPACE$$_hello=Bonjour
2
- $$MODULE_NAMESPACE$$_hello.textHello=Bonjour le monde !