@jahia/create-module 0.0.10 → 0.5.3
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/LICENSE +1 -1
- package/README.md +3 -2
- package/babel.config.cjs +2 -5
- package/index.js +93 -79
- package/node/node +0 -0
- package/node/npm +65 -0
- package/node/npm.cmd +20 -0
- package/node/npx +65 -0
- package/node/npx.cmd +20 -0
- package/node/yarn/dist/LICENSE +26 -0
- package/node/yarn/dist/README.md +60 -0
- package/node/yarn/dist/bin/yarn +35 -0
- package/node/yarn/dist/bin/yarn.cmd +2 -0
- package/node/yarn/dist/bin/yarn.js +31 -0
- package/node/yarn/dist/bin/yarnpkg +2 -0
- package/node/yarn/dist/bin/yarnpkg.cmd +2 -0
- package/node/yarn/dist/lib/cli.js +154071 -0
- package/node/yarn/dist/lib/v8-compile-cache.js +351 -0
- package/node/yarn/dist/package.json +28 -0
- package/node/yarn/dist/preinstall.js +60 -0
- package/package.json +21 -24
- package/pom.xml +134 -0
- package/sync-version.js +16 -0
- package/template/README.md +18 -10
- package/template/dotgithub/workflows/build.yml +21 -0
- package/template/dotgitignore +3 -9
- package/template/dotidea/jsLinters/eslint.xml +6 -0
- package/template/dotidea/prettier.xml +7 -0
- package/template/dotprettierignore +1 -0
- package/template/dotvscode/settings.json +11 -0
- package/template/dotyarnrc.yml +1 -0
- package/template/eslint.config.js +25 -0
- package/template/package.json +41 -44
- package/template/prettier.config.js +9 -0
- package/template/settings/README.md +3 -1
- package/template/settings/import.xml +5 -1
- package/template/settings/locales/de.json +2 -2
- package/template/settings/locales/en.json +3 -3
- package/template/settings/locales/fr.json +2 -2
- package/template/src/client/index.jsx +1 -5
- package/template/src/server/templates/page/PageHome.tsx +43 -0
- package/template/src/server/views/simpleContent/SimpleContentDefault.tsx +16 -0
- package/template/static/css/styles.css +7 -7
- package/template/tsconfig.json +27 -0
- package/template/vite.config.mjs +33 -0
- package/tests/create-templatesSet-project.test.js +126 -114
- package/.eslintrc.cjs +0 -28
- package/.github/ISSUE_TEMPLATE/bug.yml +0 -45
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/ISSUE_TEMPLATE/epic.md +0 -26
- package/.github/ISSUE_TEMPLATE/other.md +0 -8
- package/.github/ISSUE_TEMPLATE/release.md +0 -74
- package/.github/ISSUE_TEMPLATE/spike.md +0 -19
- package/.github/ISSUE_TEMPLATE/story.md +0 -27
- package/.github/ISSUE_TEMPLATE/support.yml +0 -40
- package/.github/ISSUE_TEMPLATE/tech-day.md +0 -93
- package/.github/dependabot.yml +0 -15
- package/.github/release.yml +0 -24
- package/.github/workflows/delivery-issue-chores.yml +0 -12
- package/.github/workflows/on-code-change.yml +0 -50
- package/.github/workflows/publish-release.yml +0 -22
- package/.yarn/releases/yarn-4.6.0.cjs +0 -934
- package/.yarnrc.yml +0 -3
- package/template/.babelrc +0 -9
- package/template/.yarn/releases/yarn-4.3.1.cjs +0 -894
- package/template/.yarnrc.yml +0 -3
- package/template/doteslintrc.cjs +0 -30
- package/template/dotnpmignore +0 -10
- package/template/src/server/components/index.js +0 -1
- package/template/src/server/index.js +0 -6
- package/template/src/server/templates/index.js +0 -1
- package/template/src/server/templates/page/PageHome.jsx +0 -32
- package/template/src/server/templates/page/index.js +0 -1
- package/template/src/server/views/index.js +0 -1
- package/template/src/server/views/simpleContent/SimpleContentDefault.jsx +0 -19
- package/template/src/server/views/simpleContent/index.js +0 -1
- package/template/webpack.config.js +0 -225
package/template/.yarnrc.yml
DELETED
package/template/doteslintrc.cjs
DELETED
|
@@ -1,30 +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', 'css', 'javascript'],
|
|
27
|
-
rules: {
|
|
28
|
-
'react/prop-types': 'off'
|
|
29
|
-
}
|
|
30
|
-
};
|
package/template/dotnpmignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Export here any components that were added to this directory
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './page';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {AddResources, Area, defineJahiaComponent, useServerContext, useUrlBuilder} from '@jahia/javascript-modules-library';
|
|
3
|
-
import {useTranslation} from 'react-i18next';
|
|
4
|
-
|
|
5
|
-
export const PageHome = () => {
|
|
6
|
-
const {t} = useTranslation();
|
|
7
|
-
const {currentResource} = useServerContext();
|
|
8
|
-
const {buildStaticUrl} = useUrlBuilder();
|
|
9
|
-
const lang = currentResource.getLocale().getLanguage();
|
|
10
|
-
return (
|
|
11
|
-
<html lang={lang}>
|
|
12
|
-
<head>
|
|
13
|
-
<AddResources type="css" resources={buildStaticUrl({assetPath: 'css/styles.css'})}/>
|
|
14
|
-
<title>Home</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<main>
|
|
18
|
-
{/* Using i18next defined in locales */}
|
|
19
|
-
<h1>{t('homeTitle')}</h1>
|
|
20
|
-
<Area name="pagecontent"/>
|
|
21
|
-
</main>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
PageHome.jahiaComponent = defineJahiaComponent({
|
|
28
|
-
nodeType: 'jnt:page',
|
|
29
|
-
name: 'home',
|
|
30
|
-
displayName: 'Home page',
|
|
31
|
-
componentType: 'template'
|
|
32
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './PageHome';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './simpleContent';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {useServerContext, getNodeProps, defineJahiaComponent} from '@jahia/javascript-modules-library';
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './SimpleContentDefault';
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
4
|
-
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
|
|
5
|
-
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
|
|
6
|
-
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
|
|
7
|
-
const TerserPlugin = require('terser-webpack-plugin');
|
|
8
|
-
|
|
9
|
-
const deps = require('./package.json').dependencies;
|
|
10
|
-
|
|
11
|
-
// Read all files in the client components directory in order to expose them with webpack module federation more easily
|
|
12
|
-
// Those components are exposed in order to be hydrate/rendered client side
|
|
13
|
-
const componentsDir = './src/client';
|
|
14
|
-
const exposes = {};
|
|
15
|
-
fs.readdirSync(componentsDir).forEach(file => {
|
|
16
|
-
if (file !== 'index.js') {
|
|
17
|
-
const componentName = path.basename(file, path.extname(file));
|
|
18
|
-
exposes[componentName] = path.resolve(componentsDir, file);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
const moduleName = '$$MODULE_NAME$$';
|
|
22
|
-
|
|
23
|
-
const buildOutput = path.resolve(__dirname, 'dist/build');
|
|
24
|
-
const filesToCopyAsIs = ['static/', 'settings/', 'package.json', 'yarn.lock'];
|
|
25
|
-
const copyAsIsPatterns = filesToCopyAsIs.map(dir => ({
|
|
26
|
-
from: dir,
|
|
27
|
-
to: path.join(buildOutput, dir)
|
|
28
|
-
}));
|
|
29
|
-
|
|
30
|
-
module.exports = (env, argv) => {
|
|
31
|
-
const isDevelopment = argv.mode === 'development';
|
|
32
|
-
const mode = isDevelopment ? 'development' : 'production';
|
|
33
|
-
console.log('Building in', mode, 'mode...');
|
|
34
|
-
let optimization = isDevelopment ? {} : {
|
|
35
|
-
minimizer: [
|
|
36
|
-
// This is required to make hydration working, as its implementation relies on the class name of the React component.
|
|
37
|
-
// See InBrowser.jsx in javascript-modules-library for details
|
|
38
|
-
new TerserPlugin({
|
|
39
|
-
terserOptions: {
|
|
40
|
-
// eslint-disable-next-line camelcase
|
|
41
|
-
keep_classnames: true,
|
|
42
|
-
// eslint-disable-next-line camelcase
|
|
43
|
-
keep_fnames: true
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
]
|
|
47
|
-
};
|
|
48
|
-
let configs = [
|
|
49
|
-
// Config for jahia's client-side components (HydrateInBrowser or RenderInBrowser)
|
|
50
|
-
// This config can be removed if the module doesn't contain client-side components
|
|
51
|
-
// More info here : https://academy.jahia.com/documentation/jahia/jahia-8/developer/javascript-module-development/client-side-javascript
|
|
52
|
-
{
|
|
53
|
-
name: 'client',
|
|
54
|
-
entry: {
|
|
55
|
-
[moduleName]: path.resolve(__dirname, './src/client/index')
|
|
56
|
-
},
|
|
57
|
-
output: {
|
|
58
|
-
path: path.join(buildOutput, 'javascript/client')
|
|
59
|
-
},
|
|
60
|
-
resolve: {
|
|
61
|
-
mainFields: ['module', 'main'],
|
|
62
|
-
extensions: ['.mjs', '.js', '.jsx']
|
|
63
|
-
},
|
|
64
|
-
module: {
|
|
65
|
-
rules: [
|
|
66
|
-
{
|
|
67
|
-
test: /\.jsx$/,
|
|
68
|
-
include: [path.join(__dirname, 'src/client')],
|
|
69
|
-
use: {
|
|
70
|
-
loader: 'babel-loader',
|
|
71
|
-
options: {
|
|
72
|
-
presets: [
|
|
73
|
-
['@babel/preset-env', {modules: false, targets: {safari: '7', ie: '10'}}],
|
|
74
|
-
'@babel/preset-react'
|
|
75
|
-
],
|
|
76
|
-
plugins: [
|
|
77
|
-
'styled-jsx/babel',
|
|
78
|
-
!isDevelopment && 'transform-react-remove-prop-types'
|
|
79
|
-
].filter(Boolean)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
|
|
86
|
-
plugins: [
|
|
87
|
-
// This plugin allows a build to provide or consume modules with other independent builds at runtime.
|
|
88
|
-
new ModuleFederationPlugin({
|
|
89
|
-
name: moduleName,
|
|
90
|
-
library: {type: 'assign', name: `window.appShell = (typeof appShell === "undefined" ? {} : appShell); window.appShell['${moduleName}']`},
|
|
91
|
-
filename: '../client/remote.js',
|
|
92
|
-
exposes: exposes,
|
|
93
|
-
shared: {
|
|
94
|
-
react: {
|
|
95
|
-
requiredVersion: deps.react,
|
|
96
|
-
singleton: true
|
|
97
|
-
},
|
|
98
|
-
'react-i18next': {},
|
|
99
|
-
i18next: {}
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: 'copy-as-is',
|
|
106
|
-
plugins: [
|
|
107
|
-
new CopyWebpackPlugin({
|
|
108
|
-
patterns: copyAsIsPatterns
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
// Config for jahia's server-side components (using SSR) and source code
|
|
113
|
-
// 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)
|
|
114
|
-
{
|
|
115
|
-
name: 'server',
|
|
116
|
-
entry: {
|
|
117
|
-
main: path.resolve(__dirname, 'src/server')
|
|
118
|
-
},
|
|
119
|
-
output: {
|
|
120
|
-
path: buildOutput
|
|
121
|
-
},
|
|
122
|
-
externals: {
|
|
123
|
-
// Those libraries are supplied to webpack at runtime (by the npm-module-engine project), and are not packaged in the output bundle
|
|
124
|
-
'@jahia/javascript-modules-library': 'javascriptModulesLibraryBuilder.getLibrary()',
|
|
125
|
-
react: 'javascriptModulesLibraryBuilder.getSharedLibrary(\'react\')',
|
|
126
|
-
'react-i18next': 'javascriptModulesLibraryBuilder.getSharedLibrary(\'react-i18next\')',
|
|
127
|
-
i18next: 'javascriptModulesLibraryBuilder.getSharedLibrary(\'i18next\')',
|
|
128
|
-
'styled-jsx/style': 'javascriptModulesLibraryBuilder.getSharedLibrary(\'styled-jsx\')'
|
|
129
|
-
},
|
|
130
|
-
resolve: {
|
|
131
|
-
mainFields: ['module', 'main'],
|
|
132
|
-
extensions: ['.mjs', '.js', '.jsx']
|
|
133
|
-
},
|
|
134
|
-
module: {
|
|
135
|
-
rules: [
|
|
136
|
-
{
|
|
137
|
-
test: /\.jsx$/,
|
|
138
|
-
include: [
|
|
139
|
-
path.join(__dirname, 'src/server'),
|
|
140
|
-
path.join(__dirname, 'src/client')
|
|
141
|
-
],
|
|
142
|
-
use: {
|
|
143
|
-
loader: 'babel-loader',
|
|
144
|
-
options: {
|
|
145
|
-
presets: [
|
|
146
|
-
['@babel/preset-env', {modules: false, targets: {safari: '7', ie: '10'}}],
|
|
147
|
-
'@babel/preset-react'
|
|
148
|
-
],
|
|
149
|
-
plugins: [
|
|
150
|
-
'styled-jsx/babel',
|
|
151
|
-
!isDevelopment && 'transform-react-remove-prop-types'
|
|
152
|
-
].filter(Boolean)
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
test: /\.s[ac]ss$/i,
|
|
158
|
-
use: [
|
|
159
|
-
'style-loader',
|
|
160
|
-
{
|
|
161
|
-
loader: 'css-loader',
|
|
162
|
-
options: {
|
|
163
|
-
modules: true
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
'sass-loader'
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
]
|
|
170
|
-
},
|
|
171
|
-
devtool: isDevelopment ? 'inline-source-map' : 'source-map',
|
|
172
|
-
optimization: optimization
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
|
|
176
|
-
// In case of watch we add a final config that will do automatic shell commands to trigger the pack and deploy scripts
|
|
177
|
-
// Also an additional sleep is added to avoid watch triggering too much in a short time
|
|
178
|
-
// (Feel free to adjust the sleep time according to your needs)
|
|
179
|
-
if (argv.watch) {
|
|
180
|
-
// Sleep time in seconds, can be adjusted
|
|
181
|
-
const sleepTime = 5;
|
|
182
|
-
|
|
183
|
-
configs.push({
|
|
184
|
-
name: 'watch',
|
|
185
|
-
dependencies: ['client', 'server', 'copy-as-is'], // Wait for all webpack configs to be done
|
|
186
|
-
entry: {},
|
|
187
|
-
output: {},
|
|
188
|
-
plugins: [
|
|
189
|
-
new ExtraWatchWebpackPlugin({
|
|
190
|
-
// This is an extra list of files to watch for changes,
|
|
191
|
-
// It should include all files that are not already part of any webpack build
|
|
192
|
-
// Also do not watch for webpack generated files places, it can cause infinite loops of watch triggers
|
|
193
|
-
// for example, if your css is generated by webpack compiling scss, then:
|
|
194
|
-
// - do not add extra watch for 'dist/build/static/css/**/*' -> it's the output of webpack scss build
|
|
195
|
-
// - do not add extra watch for 'src/scss/**/*' either, as it's already watched by webpack related config.
|
|
196
|
-
files: [
|
|
197
|
-
]
|
|
198
|
-
}),
|
|
199
|
-
new WebpackShellPluginNext({
|
|
200
|
-
onAfterDone: {
|
|
201
|
-
scripts: [
|
|
202
|
-
'yarn jahia-pack',
|
|
203
|
-
'yarn jahia-deploy',
|
|
204
|
-
process.platform === 'win32' ? 'timeout ' + sleepTime : 'sleep ' + sleepTime
|
|
205
|
-
],
|
|
206
|
-
blocking: true,
|
|
207
|
-
parallel: false
|
|
208
|
-
}
|
|
209
|
-
})
|
|
210
|
-
]
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
configs.forEach(config => {
|
|
215
|
-
// Ensure no default entry points are used
|
|
216
|
-
if (!config.entry) {
|
|
217
|
-
config.entry = {};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Set the mode development/production
|
|
221
|
-
config.mode = mode;
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
return configs;
|
|
225
|
-
};
|