@jahia/create-module 0.0.3 → 0.0.4
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/.yarn/releases/{yarn-4.4.0.cjs → yarn-4.5.0.cjs} +224 -224
- package/.yarnrc.yml +1 -1
- package/README.md +9 -4
- package/index.js +34 -67
- package/package.json +5 -8
- package/template/.babelrc +9 -0
- package/{jsx → template}/dotnpmignore +1 -1
- package/{jsx → template}/package.json +2 -2
- package/template/settings/README.md +30 -0
- package/{jsx → template}/src/server/templates/page/PageHome.jsx +10 -8
- package/{jsx → template}/webpack.config.js +4 -1
- package/babel.config.cjs.disabled +0 -3
- package/handlebars/components/MODULE_NAMESPACE/hello/hello.cnd +0 -6
- package/handlebars/components/MODULE_NAMESPACE/hello/hello.default.hbs +0 -1
- package/handlebars/components/MODULE_NAMESPACE/hello/hello.icon.png +0 -0
- package/handlebars/components/jnt/page/page.home.hbs +0 -18
- package/handlebars/components/jnt/page/page.home.png +0 -0
- package/handlebars/components/jnt/page/page.home.properties +0 -2
- package/handlebars/definitions.cnd +0 -8
- package/handlebars/dotenv +0 -4
- package/handlebars/doteslintrc.cjs +0 -29
- package/handlebars/dotnpmignore +0 -4
- package/handlebars/import.xml +0 -8
- package/handlebars/locales/de.json +0 -3
- package/handlebars/locales/en.json +0 -3
- package/handlebars/locales/fr.json +0 -3
- package/handlebars/package.json +0 -42
- package/handlebars/resources/MODULE_NAME.properties +0 -2
- package/handlebars/resources/MODULE_NAME_fr.properties +0 -2
- package/handlebars/settings/README.txt +0 -9
- package/handlebars/src/index.js +0 -0
- package/handlebars/webpack.config.js +0 -67
- package/jsx/.yarn/releases/yarn-4.3.1.cjs +0 -894
- package/jsx/.yarnrc.yml +0 -3
- package/jsx/README.md +0 -31
- package/jsx/dotgitignore +0 -18
- package/jsx/settings/README.txt +0 -9
- package/jsx/yarn.lock +0 -0
- /package/{handlebars → template}/.yarn/releases/yarn-4.3.1.cjs +0 -0
- /package/{handlebars → template}/.yarnrc.yml +0 -0
- /package/{handlebars → template}/README.md +0 -0
- /package/{jsx → template}/css/styles.css +0 -0
- /package/{jsx → template}/dotenv +0 -0
- /package/{jsx → template}/doteslintrc.cjs +0 -0
- /package/{handlebars → template}/dotgitignore +0 -0
- /package/{jsx → template/settings}/definitions.cnd +0 -0
- /package/{jsx → template/settings}/import.xml +0 -0
- /package/{jsx → template/settings}/locales/de.json +0 -0
- /package/{jsx → template/settings}/locales/en.json +0 -0
- /package/{jsx → template/settings}/locales/fr.json +0 -0
- /package/{jsx → template/settings}/resources/MODULE_NAME.properties +0 -0
- /package/{jsx → template/settings}/resources/MODULE_NAME_fr.properties +0 -0
- /package/{jsx → template}/src/client/index.jsx +0 -0
- /package/{jsx → template}/src/server/components/index.js +0 -0
- /package/{jsx → template}/src/server/index.js +0 -0
- /package/{jsx → template}/src/server/templates/index.js +0 -0
- /package/{jsx → template}/src/server/templates/page/index.js +0 -0
- /package/{jsx → template}/src/server/views/hello/HelloDefault.jsx +0 -0
- /package/{jsx → template}/src/server/views/hello/index.js +0 -0
- /package/{jsx → template}/src/server/views/index.js +0 -0
- /package/{handlebars → template}/yarn.lock +0 -0
package/.yarnrc.yml
CHANGED
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
|
|
8
|
-
|
|
9
|
-
where
|
|
10
|
-
|
|
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,53 +5,49 @@
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import {fileURLToPath} from 'url';
|
|
8
|
-
import
|
|
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
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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,
|
|
50
|
+
const templateDir = path.resolve(__dirname, 'template');
|
|
55
51
|
fs.cpSync(templateDir, projectDir, {recursive: true});
|
|
56
52
|
|
|
57
53
|
// It is good practice to have dotfiles stored in the
|
|
@@ -78,23 +74,15 @@ fs.renameSync(
|
|
|
78
74
|
|
|
79
75
|
// Rename the resource file to use the project name
|
|
80
76
|
fs.renameSync(
|
|
81
|
-
path.join(projectDir, 'resources/MODULE_NAME.properties'),
|
|
82
|
-
path.join(projectDir, 'resources/' + projectName + '.properties')
|
|
77
|
+
path.join(projectDir, 'settings/resources/MODULE_NAME.properties'),
|
|
78
|
+
path.join(projectDir, 'settings/resources/' + projectName + '.properties')
|
|
83
79
|
);
|
|
84
80
|
|
|
85
81
|
fs.renameSync(
|
|
86
|
-
path.join(projectDir, 'resources/MODULE_NAME_fr.properties'),
|
|
87
|
-
path.join(projectDir, 'resources/' + projectName + '_fr.properties')
|
|
82
|
+
path.join(projectDir, 'settings/resources/MODULE_NAME_fr.properties'),
|
|
83
|
+
path.join(projectDir, 'settings/resources/' + projectName + '_fr.properties')
|
|
88
84
|
);
|
|
89
85
|
|
|
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
|
-
}
|
|
97
|
-
|
|
98
86
|
// Create empty directories for static resources and configurations
|
|
99
87
|
fs.mkdirSync(path.join(projectDir, 'css'), {recursive: true});
|
|
100
88
|
fs.mkdirSync(path.join(projectDir, 'images'), {recursive: true});
|
|
@@ -105,52 +93,31 @@ fs.mkdirSync(path.join(projectDir, 'settings/jahia-content-editor-forms/forms'),
|
|
|
105
93
|
fs.mkdirSync(path.join(projectDir, 'settings/jahia-content-editor-forms/fieldsets'), {recursive: true});
|
|
106
94
|
|
|
107
95
|
// 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
|
-
}
|
|
96
|
+
const targetFiles = `${projectDir}/**`;
|
|
127
97
|
|
|
128
98
|
try {
|
|
129
|
-
|
|
99
|
+
replaceInFileSync({
|
|
130
100
|
files: targetFiles,
|
|
131
|
-
from: /\$\$
|
|
132
|
-
to:
|
|
133
|
-
disableGlobs: true // This is required otherwise the replaces fail under Windows (see https://jira.jahia.org/browse/BACKLOG-21353)
|
|
101
|
+
from: /\$\$MODULE_TYPE\$\$/g,
|
|
102
|
+
to: camelCase(moduleType)
|
|
134
103
|
});
|
|
135
104
|
|
|
136
|
-
|
|
105
|
+
replaceInFileSync({
|
|
137
106
|
files: targetFiles,
|
|
138
107
|
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)
|
|
108
|
+
to: projectName
|
|
141
109
|
});
|
|
142
110
|
|
|
143
|
-
|
|
111
|
+
replaceInFileSync({
|
|
144
112
|
files: targetFiles,
|
|
145
113
|
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)
|
|
114
|
+
to: namespace
|
|
148
115
|
});
|
|
149
116
|
} catch (error) {
|
|
150
117
|
console.error('Error occurred:', error);
|
|
151
118
|
}
|
|
152
119
|
|
|
153
|
-
console.log(`Created ${projectName} at ${projectDir}`);
|
|
120
|
+
console.log(`Created \x1B[1m${projectName}\x1B[0m at \x1B[1m${projectDir}\x1B[0m`);
|
|
154
121
|
console.log('Success! Your new project is ready.');
|
|
155
122
|
console.log('You can now change into your project and launch "yarn" to install everything to get started.');
|
|
156
123
|
console.log('---');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/create-module",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
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": "^
|
|
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.
|
|
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
|
|
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.
|
|
43
|
+
"packageManager": "yarn@4.5.0"
|
|
47
44
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
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
19
|
"static-resources": "/css,/images,/javascript,/locales"
|
|
@@ -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.
|
|
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.
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {Area, AddResources, defineJahiaComponent} from '@jahia/js-server-core';
|
|
2
|
+
import {Area, AddResources, defineJahiaComponent, useServerContext} from '@jahia/js-server-core';
|
|
3
3
|
import {useTranslation} from 'react-i18next';
|
|
4
4
|
|
|
5
5
|
export const PageHome = () => {
|
|
6
6
|
const {t} = useTranslation();
|
|
7
|
-
|
|
7
|
+
const {currentResource} = useServerContext();
|
|
8
|
+
const lang = currentResource.getLocale().getLanguage();
|
|
9
|
+
return (<html lang={lang}>
|
|
8
10
|
<head>
|
|
9
11
|
<AddResources type='css' resources='styles.css' />
|
|
10
12
|
<title>Home</title>
|
|
11
13
|
</head>
|
|
12
14
|
<body>
|
|
13
|
-
{/* Using i18next defined in locales */}
|
|
14
|
-
<h1>{t('homeTitle')}</h1>
|
|
15
15
|
<main>
|
|
16
|
+
{/* Using i18next defined in locales */}
|
|
17
|
+
<h1>{t('homeTitle')}</h1>
|
|
16
18
|
<Area name="pagecontent" />
|
|
17
19
|
</main>
|
|
18
20
|
</body>
|
|
19
|
-
|
|
21
|
+
</html>);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
PageHome.jahiaComponent = defineJahiaComponent({
|
|
23
|
-
nodeType: 'jnt:page',
|
|
24
|
-
name: 'home',
|
|
25
|
-
displayName: 'Home page',
|
|
25
|
+
nodeType: 'jnt:page',
|
|
26
|
+
name: 'home',
|
|
27
|
+
displayName: 'Home page',
|
|
26
28
|
componentType: 'template'
|
|
27
29
|
});
|
|
@@ -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
|
-
'
|
|
177
|
+
process.platform === 'win32' ? 'timeout ' + sleepTime : 'sleep ' + sleepTime
|
|
175
178
|
],
|
|
176
179
|
blocking: true,
|
|
177
180
|
parallel: false
|
|
@@ -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>
|
|
Binary file
|
|
@@ -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>
|
|
Binary file
|
|
@@ -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,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
|
-
};
|
package/handlebars/dotnpmignore
DELETED
package/handlebars/import.xml
DELETED
|
@@ -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>
|
package/handlebars/package.json
DELETED
|
@@ -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,9 +0,0 @@
|
|
|
1
|
-
In this directory you can put directly :
|
|
2
|
-
- Rule files (*.drl, *.dsl)
|
|
3
|
-
- URL rewrite XML files
|
|
4
|
-
|
|
5
|
-
In the configurations directory you can put :
|
|
6
|
-
- OSGi configuration files (*.cfg, *.yml)
|
|
7
|
-
|
|
8
|
-
In the jahia-content-editor-forms you can put content editor form and field set overrides,
|
|
9
|
-
see examples here : https://academy.jahia.com/documentation/jahia/jahia-8/developer/extending-and-customizing-jahia-ui/customizing-content-editor-forms/examples-of-content-definition-json-overrides
|
package/handlebars/src/index.js
DELETED
|
File without changes
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
|
|
3
|
-
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
module.exports = env => {
|
|
6
|
-
// Unique config for jahia's server-side source code (components using server side rendering)
|
|
7
|
-
// Those components have access to jahia's custom types and functions (https://academy.jahia.com/documentation/jahia/jahia-8/developer/javascript-module-development/javascript-modules-reference-documentation)
|
|
8
|
-
const config = {
|
|
9
|
-
entry: {
|
|
10
|
-
main: path.resolve(__dirname, 'src/index')
|
|
11
|
-
},
|
|
12
|
-
output: {
|
|
13
|
-
path: path.resolve(__dirname, 'dist')
|
|
14
|
-
},
|
|
15
|
-
externals: {
|
|
16
|
-
// Those libraries are supplied to webpack at runtime (by the npm-module-engine project), and are not packaged in the output bundle
|
|
17
|
-
'@jahia/js-server-core': 'jsServerCoreLibraryBuilder.getLibrary()',
|
|
18
|
-
handlebars: 'jsServerCoreLibraryBuilder.getSharedLibrary(\'handlebars\')'
|
|
19
|
-
},
|
|
20
|
-
plugins: [
|
|
21
|
-
// This plugin help you to attach extra files or dirs to webpack's watch system
|
|
22
|
-
new ExtraWatchWebpackPlugin({
|
|
23
|
-
files: [
|
|
24
|
-
'src/**/*',
|
|
25
|
-
'components/**/*',
|
|
26
|
-
'views/**/*',
|
|
27
|
-
'images/**/*',
|
|
28
|
-
'css/**/*',
|
|
29
|
-
'javascript/**/*',
|
|
30
|
-
'locales/**/*.json',
|
|
31
|
-
'resources/**/*.properties',
|
|
32
|
-
'settings/**/*',
|
|
33
|
-
'definitions.cnd',
|
|
34
|
-
'import.xml',
|
|
35
|
-
'package.json'
|
|
36
|
-
]
|
|
37
|
-
})
|
|
38
|
-
],
|
|
39
|
-
devtool: 'inline-source-map'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// 'jahia-pack' is a custom jahia script that makes a tgz package of the module's bundle
|
|
43
|
-
if (env.pack) {
|
|
44
|
-
config.plugins.push(
|
|
45
|
-
// This plugin allows you to run any shell commands before or after webpack builds.
|
|
46
|
-
new WebpackShellPluginNext({
|
|
47
|
-
onAfterDone: {
|
|
48
|
-
scripts: ['yarn jahia-pack']
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// 'jahia-deploy' is a custom jahia script that makes a tgz package of the module's bundle and deploy it to jahia via curl.
|
|
55
|
-
if (env.deploy) {
|
|
56
|
-
config.plugins.push(
|
|
57
|
-
// This plugin allows you to run any shell commands before or after webpack builds.
|
|
58
|
-
new WebpackShellPluginNext({
|
|
59
|
-
onAfterDone: {
|
|
60
|
-
scripts: ['yarn jahia-deploy']
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return config;
|
|
67
|
-
};
|