@jahia/create-module 0.0.10 → 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 (91) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -2
  3. package/index.js +82 -130
  4. package/package.json +26 -37
  5. package/template/README.md +19 -11
  6. package/template/{dotenv → dot/env} +1 -1
  7. package/template/dot/github/workflows/build.yml +18 -0
  8. package/template/dot/gitignore +15 -0
  9. package/template/dot/idea/prettier.xml +7 -0
  10. package/template/dot/node-version +1 -0
  11. package/template/dot/prettierignore +1 -0
  12. package/template/dot/vscode/extensions.json +3 -0
  13. package/template/dot/vscode/settings.json +8 -0
  14. package/template/dot/yarnrc.yml +1 -0
  15. package/template/eslint.config.js +25 -0
  16. package/template/package.json +45 -48
  17. package/template/prettier.config.js +8 -0
  18. package/template/settings/README.md +3 -1
  19. package/template/settings/content-types-icons/$MODULE_HelloCard.png +0 -0
  20. package/template/settings/content-types-icons/$MODULE_HelloWorld.png +0 -0
  21. package/template/settings/content-types-icons/$MODULE_LanguageSwitcher.png +0 -0
  22. package/template/settings/content-types-icons/$MODULE_component.png +0 -0
  23. package/template/settings/definitions.cnd +2 -7
  24. package/template/settings/import.xml +104 -8
  25. package/template/settings/locales/en.json +11 -4
  26. package/template/settings/locales/fr.json +11 -4
  27. package/template/settings/resources/$MODULE.properties +15 -0
  28. package/template/settings/resources/$MODULE_fr.properties +15 -0
  29. package/template/src/components/HelloCard/component.module.css +14 -0
  30. package/template/src/components/HelloCard/default.server.tsx +18 -0
  31. package/template/src/components/HelloCard/definition.cnd +3 -0
  32. package/template/src/components/HelloWorld/Celebrate.client.tsx +30 -0
  33. package/template/src/components/HelloWorld/component.module.css +105 -0
  34. package/template/src/components/HelloWorld/default.server.tsx +85 -0
  35. package/template/src/components/HelloWorld/definition.cnd +3 -0
  36. package/template/src/components/LanguageSwitcher/component.module.css +5 -0
  37. package/template/src/components/LanguageSwitcher/default.server.tsx +45 -0
  38. package/template/src/components/LanguageSwitcher/definition.cnd +1 -0
  39. package/template/src/pages/Layout.tsx +24 -0
  40. package/template/src/pages/basic.server.tsx +16 -0
  41. package/template/src/pages/global.css +11 -0
  42. package/template/src/types.d.ts +1 -0
  43. package/template/static/arrows/bottom.svg +1 -0
  44. package/template/static/arrows/left.svg +1 -0
  45. package/template/static/illustrations/code.svg +1 -0
  46. package/template/static/illustrations/coffee.svg +1 -0
  47. package/template/static/illustrations/interface.svg +1 -0
  48. package/template/static/illustrations/read.svg +1 -0
  49. package/template/static/illustrations/write.svg +1 -0
  50. package/template/tsconfig.json +19 -0
  51. package/template/vite.config.mjs +29 -0
  52. package/.eslintrc.cjs +0 -28
  53. package/.github/ISSUE_TEMPLATE/bug.yml +0 -45
  54. package/.github/ISSUE_TEMPLATE/config.yml +0 -8
  55. package/.github/ISSUE_TEMPLATE/epic.md +0 -26
  56. package/.github/ISSUE_TEMPLATE/other.md +0 -8
  57. package/.github/ISSUE_TEMPLATE/release.md +0 -74
  58. package/.github/ISSUE_TEMPLATE/spike.md +0 -19
  59. package/.github/ISSUE_TEMPLATE/story.md +0 -27
  60. package/.github/ISSUE_TEMPLATE/support.yml +0 -40
  61. package/.github/ISSUE_TEMPLATE/tech-day.md +0 -93
  62. package/.github/dependabot.yml +0 -15
  63. package/.github/release.yml +0 -24
  64. package/.github/workflows/delivery-issue-chores.yml +0 -12
  65. package/.github/workflows/on-code-change.yml +0 -50
  66. package/.github/workflows/publish-release.yml +0 -22
  67. package/.yarn/releases/yarn-4.6.0.cjs +0 -934
  68. package/.yarnrc.yml +0 -3
  69. package/babel.config.cjs +0 -6
  70. package/template/.babelrc +0 -9
  71. package/template/.yarn/releases/yarn-4.3.1.cjs +0 -894
  72. package/template/.yarnrc.yml +0 -3
  73. package/template/doteslintrc.cjs +0 -30
  74. package/template/dotgitignore +0 -21
  75. package/template/dotnpmignore +0 -10
  76. package/template/settings/content-types-icons/MODULE_NAMESPACE_simpleContent.png +0 -0
  77. package/template/settings/locales/de.json +0 -5
  78. package/template/settings/resources/MODULE_NAME.properties +0 -3
  79. package/template/settings/resources/MODULE_NAME_fr.properties +0 -3
  80. package/template/src/client/index.jsx +0 -5
  81. package/template/src/server/components/index.js +0 -1
  82. package/template/src/server/index.js +0 -6
  83. package/template/src/server/templates/index.js +0 -1
  84. package/template/src/server/templates/page/PageHome.jsx +0 -32
  85. package/template/src/server/templates/page/index.js +0 -1
  86. package/template/src/server/views/index.js +0 -1
  87. package/template/src/server/views/simpleContent/SimpleContentDefault.jsx +0 -19
  88. package/template/src/server/views/simpleContent/index.js +0 -1
  89. package/template/static/css/styles.css +0 -8
  90. package/template/webpack.config.js +0 -225
  91. package/tests/create-templatesSet-project.test.js +0 -124
@@ -1,3 +0,0 @@
1
- nodeLinker: node-modules
2
-
3
- yarnPath: .yarn/releases/yarn-4.3.1.cjs
@@ -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
- };
@@ -1,21 +0,0 @@
1
- # Intellij
2
- .idea
3
- *.iml
4
- *.ipr
5
-
6
- # Node
7
- dist
8
- node_modules
9
-
10
- #Yarn
11
- .yarn/*
12
- !.yarn/cache
13
- !.yarn/patches
14
- !.yarn/plugins
15
- !.yarn/releases
16
- !.yarn/sdks
17
- !.yarn/versions
18
- yarn-error.log
19
-
20
- # generated .tgz file
21
- $$MODULE_NAME$$-*.tgz
@@ -1,10 +0,0 @@
1
- .env
2
- .eslintrc.cjs
3
- .idea
4
- *.tgz
5
- .yarn
6
- .vscode
7
- webpack.config.js
8
- README.md
9
- settings/README.md
10
- src
@@ -1,5 +0,0 @@
1
- {
2
- "greeting": "Hallo !",
3
- "welcomeTitle" : "Willkommen bei Jahia!",
4
- "homeTitle": "Startvorlage"
5
- }
@@ -1,3 +0,0 @@
1
- $$MODULE_NAMESPACE$$mix_$$MODULE_NAMESPACE$$Components = $$MODULE_NAMESPACE$$ Components
2
- $$MODULE_NAMESPACE$$_simpleContent=Simple Content
3
- $$MODULE_NAMESPACE$$_simpleContent.title=Title
@@ -1,3 +0,0 @@
1
- $$MODULE_NAMESPACE$$mix_$$MODULE_NAMESPACE$$Components = Composants $$MODULE_NAMESPACE$$
2
- $$MODULE_NAMESPACE$$_simpleContent=Contenu simple
3
- $$MODULE_NAMESPACE$$_simpleContent.title=Titre
@@ -1,5 +0,0 @@
1
- // PublicPath is used to make webpack able to download the chunks and assets from the correct location
2
- // Since JS can be aggregated by Jahia on live, the path of the original file is lost
3
- // Also the context of the server should be handled properly
4
- // eslint-disable-next-line camelcase, no-undef
5
- __webpack_public_path__ = `${window.__APPSHELL_INIT_DATA__.moduleBaseUrl}/$$MODULE_NAME$$/javascript/client/`;
@@ -1 +0,0 @@
1
- // Export here any components that were added to this directory
@@ -1,6 +0,0 @@
1
- import * as jahiaTemplates from './templates';
2
- import * as jahiaViews from './views';
3
- import {registerJahiaComponents} from '@jahia/javascript-modules-library';
4
-
5
- registerJahiaComponents(jahiaTemplates);
6
- registerJahiaComponents(jahiaViews);
@@ -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,8 +0,0 @@
1
- body {
2
- font-family: 'Helvetica Neue', Arial, sans-serif;
3
- margin: 0;
4
- padding: 40px;
5
- background-color: #f5f5f5;
6
- color: #333;
7
- line-height: 1.6;
8
- }
@@ -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
- };
@@ -1,124 +0,0 @@
1
- import {execSync} from 'child_process';
2
- import fs from 'fs';
3
- import os from 'os';
4
- import path from 'path';
5
- import * as tar from 'tar';
6
- import each from 'jest-each';
7
-
8
- let tempFolder;
9
-
10
- beforeAll(() => {
11
- // Create a temporary directory
12
- tempFolder = fs.mkdtempSync(os.tmpdir());
13
- console.log('Using temp folder ', tempFolder);
14
- });
15
-
16
- afterAll(() => {
17
- // Remove the temporary directory
18
- fs.rmSync(tempFolder, {recursive: true, force: true});
19
- console.log(`Temp folder ${tempFolder} removed.`);
20
- });
21
-
22
- describe('npx @jahia/create-module', () => {
23
- each([
24
- ['test-project', 'testProject', 'templatesSet'],
25
- ['otherSampleProject', 'otherSampleProject', 'module'],
26
- ['foo', 'foo', '']
27
- ]).it('Project creation using archetype (\'%s\'/\'%s\' with moduleType \'%s\')', async (projectName, projectNameSanitized, moduleType) => {
28
- // Create a temporary directory
29
- const tempDir = fs.mkdtempSync(path.join(tempFolder, projectNameSanitized));
30
- console.log('tempDir', tempDir);
31
-
32
- const parentFolder = path.dirname(__dirname);
33
- const indexFile = path.join(parentFolder, 'index.js');
34
- const isTemplatesSet = moduleType === 'templatesSet';
35
-
36
- // Create a new test-project from within the temp directory
37
- process.chdir(tempDir);
38
- console.log(execSync(`node ${indexFile} ${projectName} ${moduleType}`).toString());
39
- const projectPath = path.join(tempDir, projectName);
40
- expect(fs.existsSync(projectPath)).toBe(true);
41
-
42
- // TODO check the replacement of the markers in the files
43
-
44
- // Validate the generated project structure
45
- const expectedFiles = [
46
- // Make sure the dot files have been renamed
47
- '.gitignore',
48
- '.npmignore',
49
- '.env',
50
- '.eslintrc.cjs',
51
- // Make sure the renaming with MODULE_NAME is correct
52
- `settings/resources/${projectName}.properties`,
53
- `settings/resources/${projectName}_fr.properties`,
54
- `settings/content-types-icons/${projectNameSanitized}_simpleContent.png`,
55
- // Make sure the static and config folders exist
56
- 'static/css',
57
- 'static/images',
58
- 'static/javascript',
59
- 'settings/configurations',
60
- 'settings/content-editor-forms/forms',
61
- 'settings/content-editor-forms/fieldsets',
62
- 'yarn.lock'
63
- ];
64
- if (moduleType === 'templatesSet') {
65
- // This file should only exist for templates set
66
- expectedFiles.push('settings/template-thumbnail.png');
67
- }
68
-
69
- expectedFiles.forEach(file => {
70
- console.log(`Testing that ${file} exists...`);
71
- expect(fs.existsSync(path.join(projectPath, file))).toBe(true);
72
- });
73
-
74
- // Install & build the project
75
- process.chdir(projectPath);
76
- // YARN_ENABLE_IMMUTABLE_INSTALLS=false is used as the yarn.lock file gets updated
77
- // Without this flag, the following error is encountered: "The lockfile would have been created by this install, which is explicitly forbidden."
78
- console.log(execSync('YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install').toString());
79
- console.log(execSync('yarn build').toString());
80
-
81
- // Make sure the tgz file is created in the dist/ folder
82
- const tgzFilePath = path.join(projectPath, 'dist', `${projectName}-v0.1.0-SNAPSHOT.tgz`);
83
- expect(fs.existsSync(tgzFilePath)).toBe(true);
84
-
85
- // Check the contents of the tgz file
86
- const expectedFilesInArchive = [
87
- 'javascript/client/remote.js',
88
- 'javascript/client/remote.js.map',
89
- `settings/content-types-icons/${projectNameSanitized}_simpleContent.png`,
90
- 'settings/locales/de.json',
91
- 'settings/locales/en.json',
92
- 'settings/locales/fr.json',
93
- `settings/resources/${projectName}.properties`,
94
- `settings/resources/${projectName}_fr.properties`,
95
- 'settings/definitions.cnd',
96
- 'settings/import.xml',
97
- 'settings/README.md',
98
- isTemplatesSet && 'settings/template-thumbnail.png',
99
- 'static/css/styles.css',
100
- 'main.js',
101
- 'main.js.map',
102
- 'package.json'
103
- ].filter(Boolean);
104
-
105
- const entries = [];
106
- await tar.list({
107
- file: tgzFilePath,
108
- onReadEntry: entry => {
109
- entries.push(entry.path);
110
- }
111
- }).then(() => {
112
- expectedFilesInArchive.forEach(file => {
113
- console.log(`Testing that ${file} exists in the archive...`);
114
- expect(entries.includes(`package/${file}`)).toBe(true);
115
- });
116
- expect(entries.length).toBe(expectedFilesInArchive.length);
117
- });
118
-
119
- // Make sure the package.json contains the dependency @jahia/javascript-modules-library
120
- const packageJson = JSON.parse(fs.readFileSync(path.join(projectPath, 'package.json'), 'utf8'));
121
- expect(packageJson.dependencies['@jahia/javascript-modules-library']).toBeDefined();
122
- }
123
- );
124
- });