@jahia/create-module 0.5.3 → 0.5.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.
Files changed (79) hide show
  1. package/index.js +88 -150
  2. package/package.json +11 -19
  3. package/template/README.md +1 -1
  4. package/template/{dotenv → dot/env} +1 -1
  5. package/template/dot/github/workflows/build.yml +18 -0
  6. package/template/dot/node-version +1 -0
  7. package/template/dot/vscode/extensions.json +3 -0
  8. package/template/dot/vscode/settings.json +8 -0
  9. package/template/dot/yarnrc.yml +1 -0
  10. package/template/package.json +20 -20
  11. package/template/prettier.config.js +0 -1
  12. package/template/settings/content-types-icons/$MODULE_HelloCard.png +0 -0
  13. package/template/settings/content-types-icons/$MODULE_HelloWorld.png +0 -0
  14. package/template/settings/content-types-icons/$MODULE_LanguageSwitcher.png +0 -0
  15. package/template/settings/content-types-icons/$MODULE_component.png +0 -0
  16. package/template/settings/definitions.cnd +2 -7
  17. package/template/settings/import.xml +103 -11
  18. package/template/settings/locales/en.json +10 -3
  19. package/template/settings/locales/fr.json +10 -3
  20. package/template/settings/resources/$MODULE.properties +15 -0
  21. package/template/settings/resources/$MODULE_fr.properties +15 -0
  22. package/template/src/components/HelloCard/component.module.css +14 -0
  23. package/template/src/components/HelloCard/default.server.tsx +18 -0
  24. package/template/src/components/HelloCard/definition.cnd +3 -0
  25. package/template/src/components/HelloWorld/Celebrate.client.tsx +30 -0
  26. package/template/src/components/HelloWorld/component.module.css +105 -0
  27. package/template/src/components/HelloWorld/default.server.tsx +85 -0
  28. package/template/src/components/HelloWorld/definition.cnd +3 -0
  29. package/template/src/components/LanguageSwitcher/component.module.css +5 -0
  30. package/template/src/components/LanguageSwitcher/default.server.tsx +45 -0
  31. package/template/src/components/LanguageSwitcher/definition.cnd +1 -0
  32. package/template/src/pages/Layout.tsx +24 -0
  33. package/template/src/pages/basic.server.tsx +16 -0
  34. package/template/src/pages/global.css +11 -0
  35. package/template/src/types.d.ts +1 -0
  36. package/template/static/arrows/bottom.svg +1 -0
  37. package/template/static/arrows/left.svg +1 -0
  38. package/template/static/illustrations/code.svg +1 -0
  39. package/template/static/illustrations/coffee.svg +1 -0
  40. package/template/static/illustrations/interface.svg +1 -0
  41. package/template/static/illustrations/read.svg +1 -0
  42. package/template/static/illustrations/write.svg +1 -0
  43. package/template/tsconfig.json +11 -19
  44. package/template/vite.config.mjs +6 -10
  45. package/babel.config.cjs +0 -3
  46. package/node/node +0 -0
  47. package/node/npm +0 -65
  48. package/node/npm.cmd +0 -20
  49. package/node/npx +0 -65
  50. package/node/npx.cmd +0 -20
  51. package/node/yarn/dist/LICENSE +0 -26
  52. package/node/yarn/dist/README.md +0 -60
  53. package/node/yarn/dist/bin/yarn +0 -35
  54. package/node/yarn/dist/bin/yarn.cmd +0 -2
  55. package/node/yarn/dist/bin/yarn.js +0 -31
  56. package/node/yarn/dist/bin/yarnpkg +0 -2
  57. package/node/yarn/dist/bin/yarnpkg.cmd +0 -2
  58. package/node/yarn/dist/lib/cli.js +0 -154071
  59. package/node/yarn/dist/lib/v8-compile-cache.js +0 -351
  60. package/node/yarn/dist/package.json +0 -28
  61. package/node/yarn/dist/preinstall.js +0 -60
  62. package/pom.xml +0 -134
  63. package/sync-version.js +0 -16
  64. package/template/dotgithub/workflows/build.yml +0 -21
  65. package/template/dotidea/jsLinters/eslint.xml +0 -6
  66. package/template/dotvscode/settings.json +0 -11
  67. package/template/dotyarnrc.yml +0 -1
  68. package/template/settings/content-types-icons/MODULE_NAMESPACE_simpleContent.png +0 -0
  69. package/template/settings/locales/de.json +0 -5
  70. package/template/settings/resources/MODULE_NAME.properties +0 -3
  71. package/template/settings/resources/MODULE_NAME_fr.properties +0 -3
  72. package/template/src/client/index.jsx +0 -1
  73. package/template/src/server/templates/page/PageHome.tsx +0 -43
  74. package/template/src/server/views/simpleContent/SimpleContentDefault.tsx +0 -16
  75. package/template/static/css/styles.css +0 -8
  76. package/tests/create-templatesSet-project.test.js +0 -136
  77. /package/template/{dotgitignore → dot/gitignore} +0 -0
  78. /package/template/{dotidea → dot/idea}/prettier.xml +0 -0
  79. /package/template/{dotprettierignore → dot/prettierignore} +0 -0
package/index.js CHANGED
@@ -1,158 +1,96 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import process from "node:process";
5
+ import { fileURLToPath } from "node:url";
6
+ import camelCase from "camelcase";
7
+ import { styleText } from "node:util";
2
8
 
3
- // Usage: npx @jahia/create-module@latest module-name [namespace]
9
+ try {
10
+ console.log(styleText("bgBlueBright", " Jahia JavaScript Module Creator "), "\n");
4
11
 
5
- import fs from "fs";
6
- import path from "path";
7
- import { fileURLToPath } from "url";
8
- import { replaceInFileSync } from "replace-in-file";
9
- import camelCase from "camelcase";
12
+ const nodeVersion = Number(process.versions.node.split(".")[0]);
10
13
 
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = path.dirname(__filename);
13
-
14
- // Show help if no argument is provided
15
- const [
16
- ,
17
- ,
18
- projectName,
19
- moduleType = "module",
20
- namespace = camelCase(projectName || ""),
21
- ] = process.argv;
22
-
23
- if (!projectName) {
24
- console.log(`\x1B[1m## Usage\x1B[0m
25
-
26
- npx @jahia/create-module@latest project-name [module-type] [namespace-definitions]
27
-
28
- where
29
- - \x1B[1mproject-name\x1B[0m (mandatory) can be anything you want to call your project
30
- - \x1B[1mmodule-type\x1B[0m (optional) Can be one of:
31
- - \x1B[3mtemplatesSet\x1B[0m A collection of templates and components. A template set is required when creating a website.
32
- - \x1B[3mmodule\x1B[0m sStandard Jahia module. This is the default value.
33
- - \x1B[3msystem\x1B[0m Critical module for the whole platform .
34
- - \x1B[1mnamespace-definitions\x1B[0m (optional) The namespace used for content definitions. Default is the project name in camel case.
35
- `);
36
- process.exit(9);
37
- }
14
+ if (nodeVersion < 22) {
15
+ console.warn(
16
+ `You are using ${styleText("redBright", `Node.js ${process.versions.node}`)} which is not officially supported.
17
+ Please upgrade to ${styleText("greenBright", "Node.js 22 or later")} if you encounter any issues.
18
+ Upgrade guide: ${styleText("underline", "https://nodejs.org/en/download")}
19
+ `,
20
+ );
21
+ }
38
22
 
39
- // First let's do some version checks
40
- console.log("Node version detected:", process.versions.node);
41
-
42
- // Create a project directory with the project name.
43
- const currentDir = process.cwd();
44
- const projectDir = path.resolve(currentDir, projectName);
45
- fs.mkdirSync(projectDir, { recursive: true });
46
-
47
- console.log(
48
- `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`,
49
- );
50
-
51
- // A common approach to building a starter template is to
52
- // create a `template` folder which will house the template
53
- // and the files we want to create.
54
- const templateDir = path.resolve(__dirname, "template");
55
- const isTemplatesSet = moduleType === "templatesSet";
56
- fs.cpSync(templateDir, projectDir, {
57
- recursive: true,
58
- filter: (src) => {
59
- // The file template-thumbnail.png is only used for the type templatesSet
60
- return isTemplatesSet || src !== path.join(templateDir, "settings", "template-thumbnail.png");
61
- },
62
- });
63
-
64
- // Find and replace all markers with the appropriate substitution values
65
- // Doing it before renaming the dotfiles so they are not excluded
66
- const targetFiles = `${projectDir}/**`;
23
+ const name = process.argv[2];
67
24
 
68
- try {
69
- replaceInFileSync({
70
- files: targetFiles,
71
- from: /\$\$MODULE_TYPE\$\$/g,
72
- to: moduleType,
73
- });
74
-
75
- replaceInFileSync({
76
- files: targetFiles,
77
- from: /\$\$MODULE_NAME\$\$/g,
78
- to: projectName,
79
- });
80
-
81
- replaceInFileSync({
82
- files: targetFiles,
83
- from: /\$\$MODULE_NAMESPACE\$\$/g,
84
- to: namespace,
85
- });
25
+ if (!name) {
26
+ console.error(
27
+ `No module name provided.
28
+
29
+ Usage: npm init @jahia/module ${styleText("blueBright", "<module-name>")}
30
+
31
+ It will create a new module at this location with the provided name:
32
+
33
+ ${path.join(process.cwd(), styleText("blueBright", "<module-name>"))}`,
34
+ );
35
+ process.exit(1);
36
+ }
37
+
38
+ // Module name and output directory
39
+ const module = camelCase(name);
40
+ const output = path.join(process.cwd(), name);
41
+
42
+ console.log(`Creating a new Jahia module project...
43
+
44
+ Module name: ${styleText("blueBright", module)}
45
+ Path: ${styleText("blueBright", output)}
46
+ `);
47
+
48
+ /** Renames the `dot` directory to dotfiles and dotdirs. */
49
+ const renameDot = (/** @type {string} */ name) =>
50
+ name.startsWith(`dot${path.sep}`) ? `.${name.slice(4)}` : name;
51
+
52
+ /** Replaces `$MODULE` with the actual module name. */
53
+ const templatify = (/** @type {string} */ str) => str.replaceAll("$MODULE", module);
54
+
55
+ // Copy the template to the output directory
56
+ const input = fileURLToPath(new URL("template/", import.meta.url));
57
+ for (const entry of fs.readdirSync(input, { recursive: true, withFileTypes: true })) {
58
+ if (entry.isDirectory()) continue;
59
+
60
+ const from = path.join(entry.parentPath, entry.name);
61
+ const to = path.join(output, templatify(renameDot(path.relative(input, from))));
62
+
63
+ // Ensure the parent directory exists
64
+ fs.mkdirSync(path.dirname(to), { recursive: true });
65
+
66
+ // Binary files are copied as is, text files are templated
67
+ if (entry.name.endsWith(".png")) {
68
+ fs.copyFileSync(from, to);
69
+ } else {
70
+ const contents = fs.readFileSync(from, "utf-8");
71
+ fs.writeFileSync(to, templatify(contents));
72
+ }
73
+ }
74
+
75
+ console.log(`${styleText("greenBright", "Successfully created a new Jahia module project!")}
76
+
77
+ Next steps:
78
+ ${styleText("magentaBright", `cd ${name}`)}
79
+ ${styleText("magentaBright", "yarn")} ${styleText("dim", "# Install dependencies")}
80
+ ${styleText("magentaBright", 'git init && git add . && git commit -m "chore: create module"')} ${styleText(
81
+ "dim",
82
+ "# Commit all files",
83
+ )}
84
+ ${styleText("magentaBright", "code .")} ${styleText("dim", "# Open the project in VSCode")}
85
+ ${styleText("magentaBright", "yarn dev")} ${styleText("dim", "# Start the development server")}
86
+ `);
86
87
  } catch (error) {
87
- console.error("Error occurred:", error);
88
+ console.error(
89
+ `${styleText("bgRedBright", "Something went wrong")}
90
+
91
+ If you believe this is a bug, please report it at:
92
+ ${styleText("underline", "https://github.com/Jahia/javascript-modules/issues")}
93
+ `,
94
+ error,
95
+ );
88
96
  }
89
-
90
- // It is good practice to have dotfiles stored in the
91
- // template without the dot (so they do not get picked
92
- // up by the starter template repository). We can rename
93
- // the dotfiles after we have copied them over to the
94
- // new project directory.
95
- fs.renameSync(path.join(projectDir, "dotenv"), path.join(projectDir, ".env"));
96
- fs.renameSync(path.join(projectDir, "dotgitignore"), path.join(projectDir, ".gitignore"));
97
- fs.renameSync(path.join(projectDir, "dotprettierignore"), path.join(projectDir, ".prettierignore"));
98
- fs.renameSync(path.join(projectDir, "dotyarnrc.yml"), path.join(projectDir, ".yarnrc.yml"));
99
- fs.renameSync(path.join(projectDir, "dotgithub"), path.join(projectDir, ".github"));
100
- fs.renameSync(path.join(projectDir, "dotidea"), path.join(projectDir, ".idea"));
101
- fs.renameSync(path.join(projectDir, "dotvscode"), path.join(projectDir, ".vscode"));
102
-
103
- // Rename the resource file to use the project name
104
- fs.renameSync(
105
- path.join(projectDir, "settings", "resources", "MODULE_NAME.properties"),
106
- path.join(projectDir, "settings", "resources", projectName + ".properties"),
107
- );
108
-
109
- fs.renameSync(
110
- path.join(projectDir, "settings", "resources", "MODULE_NAME_fr.properties"),
111
- path.join(projectDir, "settings", "resources", projectName + "_fr.properties"),
112
- );
113
-
114
- fs.renameSync(
115
- path.join(projectDir, "settings", "content-types-icons", "MODULE_NAMESPACE_simpleContent.png"),
116
- path.join(projectDir, "settings", "content-types-icons", namespace + "_simpleContent.png"),
117
- );
118
-
119
- // Create empty directories for static resources and configurations
120
- fs.mkdirSync(path.join(projectDir, "static", "css"), { recursive: true });
121
- fs.mkdirSync(path.join(projectDir, "static", "images"), { recursive: true });
122
- fs.mkdirSync(path.join(projectDir, "static", "javascript"), { recursive: true });
123
- fs.mkdirSync(path.join(projectDir, "settings", "configurations"), { recursive: true });
124
- fs.mkdirSync(path.join(projectDir, "settings", "content-editor-forms"), { recursive: true });
125
- fs.mkdirSync(path.join(projectDir, "settings", "content-editor-forms", "forms"), {
126
- recursive: true,
127
- });
128
- fs.mkdirSync(path.join(projectDir, "settings", "content-editor-forms", "fieldsets"), {
129
- recursive: true,
130
- });
131
-
132
- // Add an empty yarn.lock in case any parent folder is using yarn
133
- fs.writeFileSync(path.join(projectDir, "yarn.lock"), "", "utf8");
134
-
135
- console.log(`Created \x1B[1m${projectName}\x1B[0m at \x1B[1m${projectDir}\x1B[0m`);
136
- console.log("Success! Your new project is ready.");
137
- console.log(
138
- 'You can now change into your project and launch "yarn" to install everything to get started.',
139
- );
140
- console.log("---");
141
- console.log("Available project scripts will then be :");
142
- console.log(" - yarn build : build the project");
143
- console.log(
144
- " - yarn deploy : deploy the project. Make sure you have updated the .env file to match your setup if needed.",
145
- );
146
- console.log(
147
- " - yarn watch : will build and watch for file modifications, and deploy automatically when changes are detected. Use CTRL+C to stop watching.",
148
- );
149
- console.log(
150
- " - yarn lint : use to check that your code follows the recommended syntax guidelines. Append --fix to automatically fix most problems.",
151
- );
152
- console.log(
153
- " - yarn test : to test your project. By default only performs yarn lint but you are encouraged to add your own testing system here.",
154
- );
155
- console.log("---");
156
- console.log(
157
- "You can also check the documentation available here for more details: https://academy.jahia.com/get-started/developers/templating",
158
- );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jahia/create-module",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "keywords": [
5
5
  "template"
6
6
  ],
@@ -17,31 +17,23 @@
17
17
  "author": "Jahia <support@jahia.com>",
18
18
  "type": "module",
19
19
  "bin": "./index.js",
20
+ "files": [
21
+ "template"
22
+ ],
20
23
  "scripts": {
24
+ "build": "yarn pack --out dist/package.tgz && publint",
21
25
  "lint": "yarn run --top-level lint",
22
- "test": "node --test",
23
- "build": "mkdir -p dist && yarn pack --out dist/package.tgz && publint",
24
- "posttest": "yarn lint"
26
+ "playground-to-template": "rm -rf template && node ./playground-to-template.js",
27
+ "template-to-playground": "rm -rf playground && create-module playground",
28
+ "test": "node --test"
25
29
  },
26
30
  "dependencies": {
27
- "camelcase": "^8.0.0",
28
- "path": "^0.12.7",
29
- "replace-in-file": "^8.2.0",
30
- "semver": "^7.5.4",
31
- "url": "^0.11.1"
31
+ "camelcase": "^8.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@jahia/eslint-config": "^2.1.2",
35
- "@jahia/scripts": "^1.3.7",
36
- "eslint": "^8.43.0",
37
- "eslint-plugin-jest": "latest",
38
- "eslint-plugin-react": "latest",
39
- "eslint-plugin-react-hooks": "latest",
40
- "publint": "^0.3.6",
41
- "tar": "^7.4.3"
34
+ "publint": "^0.3.6"
42
35
  },
43
36
  "engines": {
44
- "node": ">=18.0.0",
45
- "yarn": ">=4.0.0"
37
+ "node": ">=22.0.0"
46
38
  }
47
39
  }
@@ -1,4 +1,4 @@
1
- # $$MODULE_NAME$$
1
+ # Jahia Javascript Module
2
2
 
3
3
  A simple Jahia Javascript module created using the Javascript module starter project template
4
4
 
@@ -1,4 +1,4 @@
1
1
  JAHIA_USER=root:root1234
2
2
  JAHIA_HOST=http://localhost:8080
3
3
  # JAHIA_DOCKER_NAME=jahia-ee-dev
4
- JAHIA_DEPLOY_METHOD=curl
4
+ JAHIA_DEPLOY_METHOD=curl
@@ -0,0 +1,18 @@
1
+ # Build and upload the package on every push
2
+ name: Build
3
+
4
+ on: push
5
+
6
+ jobs:
7
+ build-and-upload:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v4
11
+ - uses: actions/setup-node@v4
12
+ - run: corepack enable
13
+ - run: yarn install
14
+ - run: yarn build
15
+ - uses: actions/upload-artifact@v4
16
+ with:
17
+ name: package.tgz
18
+ path: dist/package.tgz
@@ -0,0 +1 @@
1
+ v22
@@ -0,0 +1,3 @@
1
+ {
2
+ "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "lokalise.i18n-ally"]
3
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
3
+ "editor.formatOnSave": true,
4
+ "i18n-ally.extract.keygenStrategy": "random",
5
+ "i18n-ally.keystyle": "flat",
6
+ "i18n-ally.localesPaths": ["settings/locales"],
7
+ "typescript.tsdk": "node_modules/typescript/lib"
8
+ }
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
@@ -1,12 +1,10 @@
1
1
  {
2
- "name": "$$MODULE_NAME$$",
3
- "version": "0.1.0",
4
- "license": "MIT",
2
+ "name": "$MODULE",
3
+ "version": "0.0.1",
5
4
  "type": "module",
6
- "main": "dist/server/index.js",
7
5
  "files": [
8
- "dist/client/**/*",
9
- "dist/server/**/*",
6
+ "dist",
7
+ "src/**/*.cnd",
10
8
  "settings",
11
9
  "static"
12
10
  ],
@@ -16,43 +14,45 @@
16
14
  "deploy": "jahia-deploy",
17
15
  "format": "prettier --write --list-different .",
18
16
  "lint": "eslint .",
19
- "package": "mkdir -p dist && yarn pack --out dist/package.tgz",
20
- "watch": "vite build --watch",
17
+ "package": "yarn pack --out dist/package.tgz",
18
+ "dev": "vite build --watch",
19
+ "watch": "run dev",
21
20
  "watch:callback": "run package && run deploy"
22
21
  },
22
+ "dependencies": {
23
+ "canvas-confetti": "^1.9.3",
24
+ "clsx": "^2.1.1",
25
+ "modern-normalize": "^3.0.1"
26
+ },
23
27
  "devDependencies": {
24
28
  "@eslint-react/eslint-plugin": "^1.26.2",
25
29
  "@eslint/compat": "^1.2.6",
26
30
  "@eslint/js": "^9.20.0",
27
- "@jahia/javascript-modules-library": "0.x || ^1.0.0",
28
- "@jahia/vite-plugin": "^0.5.1",
31
+ "@jahia/javascript-modules-library": "latest",
32
+ "@jahia/vite-plugin": "latest",
33
+ "@types/canvas-confetti": "^1.9.0",
29
34
  "@types/react": "^19.0.0",
30
35
  "eslint": "^9.20.1",
31
36
  "eslint-plugin-cypress": "^4.1.0",
32
37
  "globals": "^15.15.0",
33
38
  "i18next": "^23.10.1",
34
39
  "prettier": "^3.5.1",
35
- "prettier-plugin-jsdoc": "^1.3.2",
36
- "prettier-plugin-packagejson": "^2.5.8",
37
40
  "react-i18next": "^15.4.0",
38
41
  "typescript": "^5.7.3",
39
42
  "typescript-eslint": "^8.24.0",
43
+ "typescript-plugin-css-modules": "^5.1.0",
40
44
  "vite": "^6.1.0"
41
45
  },
42
- "packageManager": "yarn@4.3.1",
46
+ "packageManager": "yarn@4.7.0",
43
47
  "engines": {
44
- "node": ">=18.0.0",
48
+ "node": ">=22.0.0",
45
49
  "yarn": ">=4.0.0"
46
50
  },
47
51
  "jahia": {
48
52
  "snapshot": true,
49
53
  "module-dependencies": "default",
50
- "module-type": "$$MODULE_TYPE$$",
51
- "module-type-comment": "Use templatesSet in the module type to declare a template set",
54
+ "module-type": "templatesSet",
52
55
  "server": "dist/server/index.js",
53
- "static-resources": "/icons,/images,/javascript,/locales"
54
- },
55
- "dependencies": {
56
- "modern-normalize": "^3.0.1"
56
+ "static-resources": "/dist,/locales,/images,/icons"
57
57
  }
58
58
  }
@@ -5,5 +5,4 @@
5
5
  export default {
6
6
  quoteProps: "consistent",
7
7
  printWidth: 100,
8
- plugins: ["prettier-plugin-jsdoc", "prettier-plugin-packagejson"],
9
8
  };
@@ -1,17 +1,12 @@
1
1
  <jnt = 'http://www.jahia.org/jahia/nt/1.0'>
2
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'>
3
+ <$MODULE = 'https://example.com/$MODULE/1.0'>
5
4
 
6
5
  // Defining the content types is similar to defining a data model: once deployed, you cannot change the type of a property.
7
6
  // If you need to do changes during the development phase, it is possible to remove the definitions from the tools:
8
7
  // http://localhost:8080/cms/login?redirect=/modules/tools/definitionsBrowser.jsp however that will remove content created with this type.
9
8
  // Learn more about content types definitions here: https://academy.jahia.com/developer/content-types"
10
9
 
11
-
12
10
  // This mixin creates a category to regroup types in the content type selector UI. Apply it to any definition you want
13
11
  // to see in this category.
14
- [$$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components] > jmix:droppableContent, jmix:accessControllableContent mixin
15
-
16
- [$$MODULE_NAMESPACE$$:simpleContent] > jnt:content, $$MODULE_NAMESPACE$$mix:$$MODULE_NAMESPACE$$Components
17
- - title (string) = 'Hello world !' i18n
12
+ [$MODULE:component] > jmix:droppableContent, jmix:accessControllableContent mixin
@@ -1,13 +1,105 @@
1
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
- <j:translation_en jcr:language="en"
7
- jcr:mixinTypes="mix:title"
8
- jcr:primaryType="jnt:translation"
9
- jcr:title="Home"/>
10
- </home>
11
- </$$MODULE_NAME$$>
12
- </modules>
2
+ <content
3
+ xmlns:j="http://www.jahia.org/jahia/1.0"
4
+ xmlns:jcr="http://www.jcp.org/jcr/1.0"
5
+ >
6
+ <modules jcr:primaryType="jnt:modules">
7
+ <$MODULE>
8
+ <home
9
+ j:isHomePage="true"
10
+ j:templateName="basic"
11
+ jcr:primaryType="jnt:page"
12
+ >
13
+ <j:translation_en
14
+ jcr:language="en"
15
+ jcr:mixinTypes="mix:title"
16
+ jcr:primaryType="jnt:translation"
17
+ jcr:title="Home"
18
+ />
19
+ <j:translation_fr
20
+ jcr:language="fr"
21
+ jcr:mixinTypes="mix:title"
22
+ jcr:primaryType="jnt:translation"
23
+ jcr:title="Accueil"
24
+ />
25
+ <main
26
+ jcr:mixinTypes="jmix:isAreaList"
27
+ jcr:primaryType="jnt:contentList"
28
+ >
29
+ <hello-world jcr:primaryType="$MODULE:HelloWorld">
30
+ <j:translation_en
31
+ jcr:language="en"
32
+ jcr:primaryType="jnt:translation"
33
+ name="World"
34
+ />
35
+ <j:translation_fr
36
+ jcr:language="fr"
37
+ jcr:primaryType="jnt:translation"
38
+ name="le monde"
39
+ />
40
+ <read-the-documentation
41
+ jcr:primaryType="$MODULE:HelloCard"
42
+ illustration="read"
43
+ >
44
+ <j:translation_en
45
+ jcr:language="en"
46
+ jcr:primaryType="jnt:translation"
47
+ title="Read the documentation"
48
+ />
49
+ <j:translation_fr
50
+ jcr:language="fr"
51
+ jcr:primaryType="jnt:translation"
52
+ title="Lire la documentation"
53
+ />
54
+ </read-the-documentation>
55
+ <code-a-new-component
56
+ jcr:primaryType="$MODULE:HelloCard"
57
+ illustration="code"
58
+ >
59
+ <j:translation_en
60
+ jcr:language="en"
61
+ jcr:primaryType="jnt:translation"
62
+ title="Code a new component"
63
+ />
64
+ <j:translation_fr
65
+ jcr:language="fr"
66
+ jcr:primaryType="jnt:translation"
67
+ title="Coder un nouveau composant"
68
+ />
69
+ </code-a-new-component>
70
+ <explore-the-interface
71
+ jcr:primaryType="$MODULE:HelloCard"
72
+ illustration="interface"
73
+ >
74
+ <j:translation_en
75
+ jcr:language="en"
76
+ jcr:primaryType="jnt:translation"
77
+ title="Explore the interface"
78
+ />
79
+ <j:translation_fr
80
+ jcr:language="fr"
81
+ jcr:primaryType="jnt:translation"
82
+ title="Explorer l'interface"
83
+ />
84
+ </explore-the-interface>
85
+ <create-content
86
+ jcr:primaryType="$MODULE:HelloCard"
87
+ illustration="write"
88
+ >
89
+ <j:translation_en
90
+ jcr:language="en"
91
+ jcr:primaryType="jnt:translation"
92
+ title="Create content"
93
+ />
94
+ <j:translation_fr
95
+ jcr:language="fr"
96
+ jcr:primaryType="jnt:translation"
97
+ title="Créer du contenu"
98
+ />
99
+ </create-content>
100
+ </hello-world>
101
+ </main>
102
+ </home>
103
+ </$MODULE>
104
+ </modules>
13
105
  </content>
@@ -1,5 +1,12 @@
1
1
  {
2
- "greeting": "Hello !",
3
- "welcomeTitle": "Welcome to Jahia !",
4
- "homeTitle": "Home Template"
2
+ "Mbvdf2LrCB5sW9PUFXO48": "Hello <mark>{{name}}</mark>!",
3
+ "0U2mp51dWjqWXje4x-eUV": "Double-click to edit the name",
4
+ "7l9zetMbU4cKpL4NxSOtL": "Welcome to Jahia! You successfully created a new JavaScript Module and a Jahia Website built with it. Here are a few things you can do now:",
5
+ "8S0DVCRSnmQRKF9lZnNGj": "Illustrations by <a>Katerina Limpitsouni</a>",
6
+ "89D3xFLMZmCAencaqw68C": "Click this button to add a new content node",
7
+ "hBBhbeE0-a4KS9HVFPsOz": "Hydrated client-side",
8
+ "AI95bg1EJsr48SR-4f_pl": "Rendered server-side",
9
+ "OfBsezopuIko8aJ6X3kpw": "Despite being written with React, this page is fully rendered server-side. No JavaScript is sent to the client by default! This does not mean you cannot use client-side code:",
10
+ "nr31fYHB-RqO06BCl4rYO": "This pattern is named <a>Islands Architecture.</a>",
11
+ "JI87mYV8J5pAEST4RIUcb": "This page is available in:"
5
12
  }
@@ -1,5 +1,12 @@
1
1
  {
2
- "greeting": "Salut !",
3
- "welcomeTitle": "Bienvenue chez Jahia !",
4
- "homeTitle": "Template Accueil"
2
+ "Mbvdf2LrCB5sW9PUFXO48": "Bonjour <mark>{{name}}</mark> !",
3
+ "0U2mp51dWjqWXje4x-eUV": "Double-cliquez pour changer le nom",
4
+ "7l9zetMbU4cKpL4NxSOtL": "Bienvenue sur Jahia! Votre module JavaScript a été créé avec succès et avec lui un site Jahia. Voici ce que vous pouvez faire à partir de là :",
5
+ "8S0DVCRSnmQRKF9lZnNGj": "Illustrations par <a>Katerina Limpitsouni</a>",
6
+ "89D3xFLMZmCAencaqw68C": "Cliquez ce bouton pour ajouter un nouveau contenu",
7
+ "AI95bg1EJsr48SR-4f_pl": "Rendu par le serveur",
8
+ "OfBsezopuIko8aJ6X3kpw": "Bien que cette page soit codée avec React, elle est entièrement rendue par le serveur. Le JavaScript côté client n'est pas nécessaire par défaut ! Vous pouvez tout de même vous en servir quand vous le souhaitez :",
9
+ "hBBhbeE0-a4KS9HVFPsOz": "Hydraté côté client",
10
+ "nr31fYHB-RqO06BCl4rYO": "Cela s'appelle la <a>Conception en archipel (en)</a>.",
11
+ "JI87mYV8J5pAEST4RIUcb": "Cette page est disponible en :"
5
12
  }
@@ -0,0 +1,15 @@
1
+ $MODULE_component=$MODULE - Components
2
+
3
+ $MODULE_HelloWorld=Hello World
4
+ $MODULE_HelloWorld.name=Name
5
+
6
+ $MODULE_HelloCard=Hello Card
7
+ $MODULE_HelloCard.title=Title
8
+ $MODULE_HelloCard.illustration=Illustration
9
+ $MODULE_HelloCard.illustration.code=A developer coding
10
+ $MODULE_HelloCard.illustration.coffee=Buying coffee
11
+ $MODULE_HelloCard.illustration.interface=Consulting an interface
12
+ $MODULE_HelloCard.illustration.read=Looking at a bookshelf
13
+ $MODULE_HelloCard.illustration.write=Writing with a typewriter
14
+
15
+ $MODULE_LanguageSwitcher=Language Switcher
@@ -0,0 +1,15 @@
1
+ $MODULE_component=$MODULE - Composants
2
+
3
+ $MODULE_HelloWorld=Bienvenue
4
+ $MODULE_HelloWorld.name=Nom
5
+
6
+ $MODULE_HelloCard=Carte de bienvenue
7
+ $MODULE_HelloCard.title=Titre
8
+ $MODULE_HelloCard.illustration=Illustration
9
+ $MODULE_HelloCard.illustration.code=Un développeur qui code
10
+ $MODULE_HelloCard.illustration.coffee=Acheter un café
11
+ $MODULE_HelloCard.illustration.interface=Observer une interface
12
+ $MODULE_HelloCard.illustration.read=Consulter une bibliothèque
13
+ $MODULE_HelloCard.illustration.write=Écrire avec une machine à écrire
14
+
15
+ $MODULE_LanguageSwitcher=Changeur de langue