Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 95d8cb1

Browse files
authored
Merge pull request #25 from nordeck/nic/feat/make-repository-more-generic
Refactor the repository to be able to host more element modules
2 parents dc206c8 + 344b7bf commit 95d8cb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+72
-51
lines changed

.changeset/soft-shoes-kiss.md

+6

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
timeout-minutes: 15
4949
defaults:
5050
run:
51-
working-directory: ./synapse-guest-module/
51+
working-directory: ./packages/synapse-guest-module/
5252
env:
5353
DOCKER_IMAGE: ghcr.io/nordeck/synapse-guest-module
5454
steps:
@@ -98,7 +98,7 @@ jobs:
9898
id: dockerBuild
9999
with:
100100
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request' && secrets.GH_APP_OS_APP_ID != '' }}
101-
context: synapse-guest-module
101+
context: packages/synapse-guest-module
102102
tags: ${{ steps.meta.outputs.tags }}
103103
labels: ${{ steps.meta.outputs.labels }}
104104
platforms: linux/amd64,linux/arm64,linux/s390x

README.md

+11-21

e2e/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "e2e",
3-
"description": "End-to-end tests for element-web-guest-module",
3+
"description": "End-to-end tests for element-web-modules",
44
"author": "Nordeck IT + Consulting GmbH",
55
"license": "Apache-2.0",
66
"version": "0.0.0",
@@ -18,7 +18,7 @@
1818
},
1919
"scripts": {
2020
"clean": "echo \"Nothing to clean\"",
21-
"build": "yarn workspace @nordeck/element-web-guest-module build && yarn workspace @nordeck/element-web-guest-module package && shx cp ../element-web-guest-module/*.tgz src/deploy/elementWeb/module.tgz && yarn workspace @nordeck/synapse-guest-module docker:build",
21+
"build": "yarn workspace @nordeck/element-web-guest-module build && yarn workspace @nordeck/element-web-guest-module package && shx rm -rf src/deploy/elementWeb/*.tgz && shx cp ../packages/element-web-guest-module/*.tgz src/deploy/elementWeb/element-web-guest-module.tgz && yarn workspace @nordeck/synapse-guest-module docker:build",
2222
"docker:build": "echo \"Nothing to build\"",
2323
"tsc": "tsc",
2424
"lint": "eslint . --max-warnings=0",

e2e/src/deploy/elementWeb/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN git clone --depth 1 --branch $ELEMENT_VERSION https://github.com/vector-im/e
1010
RUN yarn --network-timeout=200000 install
1111

1212
# Add all configurations
13-
COPY /module.tgz /src
13+
COPY /*.tgz /src
1414
COPY /build_config.yaml /src
1515
COPY /customisations.json /src
1616

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Register the module that was created by `yarn build`
22
modules:
3-
- 'file:module.tgz'
3+
- 'file:element-web-guest-module.tgz'

e2e/src/pages/loginFormPage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export class LoginFormPage {
3636
async continueAsGuest(name: string) {
3737
await this.nameInput.fill(name);
3838
await Promise.all([
39-
this.continueButton.click(),
4039
this.loadingSpinner.waitFor(),
40+
this.continueButton.click(),
4141
]);
4242
await expect(this.loadingSpinner).toBeHidden();
4343
}

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
* running jest from the root directory.
2020
*/
2121
module.exports = {
22-
projects: ['<rootDir>/element-web-guest-module'],
22+
projects: ['<rootDir>/packages/*'],
2323
};

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "root",
33
"private": true,
44
"workspaces": [
5-
"element-web-guest-module",
6-
"synapse-guest-module",
5+
"packages/*",
76
"e2e"
87
],
98
"scripts": {
File renamed without changes.

element-web-guest-module/README.md packages/element-web-guest-module/README.md

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
33

4-
"extends": "../api-extractor.json"
4+
"extends": "../../api-extractor.json"
55
}
File renamed without changes.
File renamed without changes.

element-web-guest-module/package.json packages/element-web-guest-module/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
},
4949
"repository": {
5050
"type": "git",
51-
"url": "https://github.com/nordeck/element-web-guest-module",
52-
"directory": "element-web-guest-module"
51+
"url": "https://github.com/nordeck/element-web-modules",
52+
"directory": "packages/element-web-guest-module"
5353
},
5454
"files": [
5555
"build",

element-web-guest-module/tsconfig.json packages/element-web-guest-module/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../tsconfig.json",
2+
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "lib",
55
"rootDir": "."
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

synapse-guest-module/scripts/run_in_venv.js packages/synapse-guest-module/scripts/run_in_venv.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const path = require('path');
2525
const child_process = require('child_process');
2626

2727
const cwd = path.resolve(__dirname, '..');
28-
const venvPath = path.resolve(__dirname, '../../.venv');
28+
const venvPath = path.resolve(__dirname, '../../../.venv');
2929
const venvRelativeToCwd = path.relative(cwd, venvPath);
3030

3131
function run(command) {
@@ -47,7 +47,7 @@ async function main() {
4747
if (!fs.existsSync(venvPath) || !fs.lstatSync(venvPath).isDirectory()) {
4848
child_process.execSync(`python3 -m venv ${venvRelativeToCwd}`, { cwd });
4949
await run('pip install tox');
50-
await run('pip install -e ."[env]"');
50+
await run('pip install -e ."[dev]"');
5151
}
5252

5353
const command = process.argv.slice(2).join(' ');
File renamed without changes.
File renamed without changes.

scripts/publishAllPackages.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,25 @@ const fs = require('fs');
1818
const path = require('path');
1919
const child_process = require('child_process');
2020

21-
const packages = ['element-web-guest-module'];
21+
const packages = fs.readdirSync('packages');
2222

2323
for (let p of packages) {
24-
const packagePath = path.resolve('./', p);
24+
const packagePath = path.resolve('packages', p);
2525

2626
if (!fs.lstatSync(packagePath).isDirectory()) {
2727
continue;
2828
}
2929

30-
const { name, version } = JSON.parse(
31-
fs.readFileSync(path.resolve(packagePath, 'package.json')),
32-
);
30+
const {
31+
name,
32+
version,
33+
private: isPrivate,
34+
} = JSON.parse(fs.readFileSync(path.resolve(packagePath, 'package.json')));
35+
36+
if (isPrivate) {
37+
console.log(`🆗 Package ${name} is private`);
38+
continue;
39+
}
3340

3441
if (!versionNeedsUpload(name, version)) {
3542
console.log(`✅ Package ${name} already up-to-date`);

scripts/versionAllPackages.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const child_process = require('child_process');
2222
console.log(child_process.execSync('yarn changeset version').toString());
2323

2424
// Updates the new version in the synapse-guest-module/setup.cfg
25-
const packagePath = path.resolve('./', 'synapse-guest-module');
25+
const packagePath = path.resolve('packages', 'synapse-guest-module');
2626

2727
const { version } = JSON.parse(
2828
fs.readFileSync(path.resolve(packagePath, 'package.json')),

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
},
2020
"exclude": ["node_modules"],
2121
// Include all source code for building
22-
"include": ["element-web-guest-module/src", "e2e/src"]
22+
"include": ["packages/*/src", "e2e/src"]
2323
}

0 commit comments

Comments
 (0)