ode-explorer 1.0.0-explorer → 1.0.0-feat-explorer.202212211525

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.
@@ -0,0 +1,15 @@
1
+ name: Google Lighthouse CI
2
+ on: [push]
3
+ jobs:
4
+ lighthouseci:
5
+ runs-on: ubuntu-latest
6
+ steps:
7
+ - uses: actions/checkout@v2
8
+ - uses: actions/setup-node@v1
9
+ with:
10
+ node-version: 16
11
+ - run: yarn install && yarn global add @lhci/cli@0.8.x
12
+ - run: yarn build
13
+ - run: lhci autorun
14
+ env:
15
+ LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
@@ -0,0 +1,19 @@
1
+ name: Publish Package to npmjs
2
+ on: [push]
3
+ # on:
4
+ # release:
5
+ # types: [created]
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ # Setup .npmrc file to publish to npm
12
+ - uses: actions/setup-node@v3
13
+ with:
14
+ node-version: "16.x"
15
+ registry-url: "https://registry.npmjs.org"
16
+ - run: yarn install
17
+ - run: npm publish
18
+ env:
19
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.husky/pre-commit CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env sh
2
2
  . "$(dirname -- "$0")/_/husky.sh"
3
3
 
4
- cd frontend && yarn pre-commit
4
+ yarn pre-commit
package/Jenkinsfile ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env groovy
2
+
3
+ pipeline {
4
+ agent any
5
+ stages {
6
+ stage('Init') {
7
+ steps {
8
+ checkout scm
9
+ sh './build.sh clean init'
10
+ }
11
+ }
12
+ stage('Build') {
13
+ steps {
14
+ sh "./build.sh build"
15
+ }
16
+ }
17
+ // stage('Archive') {
18
+ // steps {
19
+ // sh './build.sh archive'
20
+ // }
21
+ // }
22
+ stage('Publish NPM') {
23
+ steps {
24
+ configFileProvider([configFile(fileId: '.npmrc-infra-front', variable: 'NPMRC')]) {
25
+ sh "cp $NPMRC .npmrc"
26
+ sh "./build.sh publishNPM"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Open Digital Education applications LICENSE
2
+ URL: https://opendigitaleducation.com/
3
+
4
+ This program is published by "Open Digital Education" (SAS “WebServices pour l’Education”). You must indicate the name of the software and the company in any production /contribution using the software and indicate on the home page of the software industry in question, "powered by Open Digital Education" with a reference to the website: https: //opendigitaleducation.com/.
5
+
6
+ This program is free software, licensed under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
7
+
8
+ You can redistribute this application and/or modify it since you respect the terms of the GNU Affero General Public License. If you modify the source code and then use this modified source code in your creation, you must make available the source code of your modifications.
9
+
10
+ You should have received a copy of the GNU Affero General Public License along with the software. If not, please see : <http://www.gnu.org/licenses/>. Full compliance requires reading the terms of this license and following its directives.
11
+
12
+ //////////////////// // French version // ////////////////////
13
+ Cette application est publiée par "Open Digital Education" (SAS “WebServices pour l’Education”). Vous devez ainsi citer le logiciel et le nom de la société dans toute production/contribution utilisant le logiciel et indiquer sur la page d’accueil de la production logicielle en question, « motorisé par Open Digital Education » avec un renvoi vers le site web : https://opendigitaleducation.com/.
14
+
15
+ Cette application est un logiciel libre, diffusé selon les termes de la GNU Affero General Public License telle que publiée par la Free Software Foundation dans sa version 3.
16
+
17
+ Vous ne pouvez redistribuer ou modifier ces fichiers que si vous respectez les termes de la GNU Affero General Public License. Si vous modifiez les codes sources et utilisez les codes sources modifiés dans votre création, vous devez rendre votre création librement utilisable et disponible.
18
+
19
+ Nous vous remercions de bien vouloir prendre connaissance de la GNU Affero General Public License disponible avec le logiciel, ou disponible au lien suivant : <http://www.gnu.org/licenses/> et de bien lire les dispositions et les directives de la licence afin de vous assurer de leur complet respect.
20
+
package/build.sh ADDED
@@ -0,0 +1,182 @@
1
+ #!/bin/bash
2
+
3
+ if [ "$#" -lt 1 ]; then
4
+ echo "Usage: $0 <clean|init|localDep|build|install|watch>"
5
+ echo "Example: $0 clean"
6
+ echo "Example: $0 init"
7
+ echo "Example: $0 localDep Use this option to update the ode-ts-client NPM dependency with a local version"
8
+ echo "Example: $0 build"
9
+ echo "Example: $0 install"
10
+ echo "Example: $0 [--springboard=recette] watch"
11
+ exit 1
12
+ fi
13
+
14
+ MVN_MOD_GROUPID=`grep 'modowner=' gradle.properties | sed 's/modowner=//'`
15
+ MVN_MOD_NAME=`grep 'modname=' gradle.properties | sed 's/modname=//'`
16
+ MVN_MOD_VERSION=`grep 'version=' gradle.properties | sed 's/version=//'`
17
+
18
+ if [ ! -e node_modules ]
19
+ then
20
+ mkdir node_modules
21
+ fi
22
+
23
+ if [ -z ${USER_UID:+x} ]
24
+ then
25
+ export USER_UID=1000
26
+ export GROUP_GID=1000
27
+ fi
28
+
29
+ if [ -e "?/.gradle" ] && [ ! -e "?/.gradle/gradle.properties" ]
30
+ then
31
+ echo "odeUsername=$NEXUS_ODE_USERNAME" > "?/.gradle/gradle.properties"
32
+ echo "odePassword=$NEXUS_ODE_PASSWORD" >> "?/.gradle/gradle.properties"
33
+ echo "sonatypeUsername=$NEXUS_SONATYPE_USERNAME" >> "?/.gradle/gradle.properties"
34
+ echo "sonatypePassword=$NEXUS_SONATYPE_PASSWORD" >> "?/.gradle/gradle.properties"
35
+ fi
36
+
37
+ # options
38
+ SPRINGBOARD="recette"
39
+ for i in "$@"
40
+ do
41
+ case $i in
42
+ -s=*|--springboard=*)
43
+ SPRINGBOARD="${i#*=}"
44
+ shift
45
+ ;;
46
+ *)
47
+ ;;
48
+ esac
49
+ done
50
+
51
+ clean () {
52
+ rm -rf node_modules
53
+ rm -rf dist
54
+ rm -rf build
55
+ rm -rf .gradle
56
+ rm -rf package.json
57
+ rm -rf deployment
58
+ rm -rf yarn.lock
59
+ }
60
+
61
+ doInit () {
62
+ echo "[init] Get branch name from jenkins env..."
63
+ BRANCH_NAME=`echo $GIT_BRANCH | sed -e "s|origin/||g"`
64
+ if [ "$BRANCH_NAME" = "" ]; then
65
+ echo "[init] Get branch name from git..."
66
+ BRANCH_NAME=`git branch | sed -n -e "s/^\* \(.*\)/\1/p"`
67
+ fi
68
+
69
+ echo "[init] Generate deployment file from conf.deployment..."
70
+ mkdir -p deployment/$MVN_MOD_NAME
71
+ cp conf.deployment deployment/$MVN_MOD_NAME/conf.json.template
72
+ sed -i "s/%MODNAME%/${MVN_MOD_NAME}/" deployment/$MVN_MOD_NAME/conf.json.template
73
+ sed -i "s/%VERSION%/${MVN_MOD_VERSION}/" deployment/$MVN_MOD_NAME/conf.json.template
74
+
75
+ echo "[init] Generate package.json from package.json.template..."
76
+ NPM_VERSION_SUFFIX=`date +"%Y%m%d%H%M"`
77
+ cp package.json.template package.json
78
+ sed -i "s/%generateVersion%/${NPM_VERSION_SUFFIX}/" package.json
79
+
80
+ if [ "$1" == "Dev" ]
81
+ then
82
+ sed -i "s/%odeTsClientVersion%/link:..\/ode-ts-client\//" package.json
83
+ else
84
+ sed -i "s/%odeTsClientVersion%/${BRANCH_NAME}/" package.json
85
+ fi
86
+
87
+ docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --production=false"
88
+ }
89
+
90
+ init() {
91
+ doInit
92
+ }
93
+
94
+ initDev () {
95
+ doInit "Dev"
96
+ }
97
+
98
+ # Install local dependencies as tarball (installing as folder creates symlinks which won't resolve in the docker container)
99
+ localDep () {
100
+ if [ -e $PWD/../ode-ts-client ]; then
101
+ rm -rf ode-ts-client.tar ode-ts-client.tar.gz
102
+ mkdir ode-ts-client.tar && mkdir ode-ts-client.tar/dist \
103
+ && cp -R $PWD/../ode-ts-client/dist $PWD/../ode-ts-client/package.json ode-ts-client.tar
104
+ tar cfzh ode-ts-client.tar.gz ode-ts-client.tar
105
+ docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn install --no-save ode-ts-client.tar.gz"
106
+ rm -rf ode-ts-client.tar ode-ts-client.tar.gz
107
+ fi
108
+ }
109
+
110
+ build () {
111
+ docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "yarn build"
112
+ status=$?
113
+ if [ $status != 0 ];
114
+ then
115
+ exit $status
116
+ fi
117
+
118
+ VERSION=`grep "version=" gradle.properties| sed 's/version=//g'`
119
+ echo "ode-explorer=$VERSION `date +'%d/%m/%Y %H:%M:%S'`" >> dist/version.txt
120
+ }
121
+
122
+ # watch () {
123
+ # docker-compose run --rm \
124
+ # -u "$USER_UID:$GROUP_GID" \
125
+ # -v $PWD/../$SPRINGBOARD:/home/node/springboard \
126
+ # node sh -c "npm run watch --watch_springboard=/home/node/springboard"
127
+ # }
128
+
129
+ publishNPM () {
130
+ LOCAL_BRANCH=`echo $GIT_BRANCH | sed -e "s|origin/||g"`
131
+ docker-compose run --rm -u "$USER_UID:$GROUP_GID" node sh -c "npm publish --tag $LOCAL_BRANCH"
132
+ }
133
+
134
+ # archive() {
135
+ # echo "[archive] Archiving dist folder and conf.j2 file..."
136
+ # tar cfzh ${MVN_MOD_NAME}.tar.gz dist/* ode-explorer/conf.j2
137
+ # }
138
+
139
+ publishMavenLocal (){
140
+ mvn install:install-file \
141
+ --batch-mode \
142
+ -DgroupId=$MVN_MOD_GROUPID \
143
+ -DartifactId=$MVN_MOD_NAME \
144
+ -Dversion=$MVN_MOD_VERSION \
145
+ -Dpackaging=tar.gz \
146
+ -Dfile=${MVN_MOD_NAME}.tar.gz
147
+ }
148
+
149
+ for param in "$@"
150
+ do
151
+ case $param in
152
+ clean)
153
+ clean
154
+ ;;
155
+ init)
156
+ init
157
+ ;;
158
+ localDep)
159
+ localDep
160
+ ;;
161
+ build)
162
+ build
163
+ ;;
164
+ install)
165
+ build && archive && publishMavenLocal && rm -rf build
166
+ ;;
167
+ watch)
168
+ watch
169
+ ;;
170
+ archive)
171
+ archive
172
+ ;;
173
+ publishNPM)
174
+ publishNPM
175
+ ;;
176
+ *)
177
+ echo "Invalid argument : $param"
178
+ esac
179
+ if [ ! $? -eq 0 ]; then
180
+ exit 1
181
+ fi
182
+ done
@@ -0,0 +1,12 @@
1
+ maven:
2
+ image: maven:3.5-jdk-8-slim
3
+ volumes:
4
+ - ./:/usr/src
5
+ - ~/.m2:/var/maven/.m2
6
+ node:
7
+ image: opendigitaleducation/node:16-alpine
8
+ working_dir: /home/node/app
9
+ net: host
10
+ volumes:
11
+ - ./:/home/node/app
12
+ - ~/.npm:/.npm
@@ -0,0 +1,3 @@
1
+ modowner=com.opendigitaleducation
2
+ modname=ode-explorer
3
+ version=1.0-feat-explorer-SNAPSHOT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.0.0-explorer",
3
+ "version": "1.0.0-feat-explorer.202212211525",
4
4
  "description": "Open Digital Education Explorer",
5
5
  "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
6
  "bugs": {
@@ -27,7 +27,7 @@
27
27
  "lighthouse": "yarn clean:lighthouse && lhci autorun",
28
28
  "lint": "eslint .",
29
29
  "pre-commit": "lint-staged",
30
- "prepare": "cd .. && husky install frontend/.husky",
30
+ "prepare": "husky install .husky",
31
31
  "preview": "vite preview"
32
32
  },
33
33
  "husky": {
@@ -36,7 +36,6 @@
36
36
  }
37
37
  },
38
38
  "lint-staged": {
39
- "gitDir": "../",
40
39
  "**/*.{js,jsx,ts,tsx}": [
41
40
  "yarn format:write",
42
41
  "yarn fix"
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "ode-explorer",
3
+ "version": "1.0.0-feat-explorer.%generateVersion%",
4
+ "description": "Open Digital Education Explorer",
5
+ "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/opendigitaleducation/explorer/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/opendigitaleducation/explorer.git"
12
+ },
13
+ "license": "GPL-3.0",
14
+ "author": "Open Digital Education",
15
+ "scripts": {
16
+ "build": "tsc && vite build",
17
+ "clean": "concurrently \"yarn:clean:*\"",
18
+ "clean:dist": "rm -rf dist",
19
+ "clean:lighthouse": "rm -rf .lighthouseci",
20
+ "clean:modules": "rm -rf node_modules",
21
+ "clean:package": "rm -rf yarn.lock",
22
+ "dev": "vite",
23
+ "fix": "eslint --fix .",
24
+ "format": "concurrently \"yarn:format:*\"",
25
+ "format:check": "yarn prettier --check .",
26
+ "format:write": "yarn prettier --write .",
27
+ "lighthouse": "yarn clean:lighthouse && lhci autorun",
28
+ "lint": "eslint .",
29
+ "pre-commit": "lint-staged",
30
+ "prepare": "husky install .husky",
31
+ "preview": "vite preview"
32
+ },
33
+ "husky": {
34
+ "hooks": {
35
+ "pre-commit": "lint-staged"
36
+ }
37
+ },
38
+ "lint-staged": {
39
+ "**/*.{js,jsx,ts,tsx}": [
40
+ "yarn format:write",
41
+ "yarn fix"
42
+ ]
43
+ },
44
+ "dependencies": {
45
+ "@ode-react-ui/core": "dev",
46
+ "@ode-react-ui/hooks": "dev",
47
+ "@ode-react-ui/icons": "dev",
48
+ "clsx": "1.2.1",
49
+ "i18next": "21.9.2",
50
+ "i18next-browser-languagedetector": "6.1.5",
51
+ "i18next-http-backend": "1.4.4",
52
+ "ode-ts-client": "%odeTsClientVersion%",
53
+ "react": "18.2.0",
54
+ "react-dom": "18.2.0",
55
+ "react-error-boundary": "3.1.4",
56
+ "react-i18next": "11.18.6",
57
+ "react-router-dom": "6.4.1",
58
+ "swr": "1.3.0"
59
+ },
60
+ "devDependencies": {
61
+ "@types/node": "18.7.23",
62
+ "@types/react": "18.0.21",
63
+ "@types/react-dom": "18.0.6",
64
+ "@typescript-eslint/eslint-plugin": "5.38.1",
65
+ "@typescript-eslint/parser": "5.38.1",
66
+ "@vitejs/plugin-react": "2.1.0",
67
+ "concurrently": "7.4.0",
68
+ "eslint": "8.24.0",
69
+ "eslint-config-airbnb": "19.0.4",
70
+ "eslint-config-airbnb-typescript": "17.0.0",
71
+ "eslint-config-prettier": "8.5.0",
72
+ "eslint-plugin-import": "2.26.0",
73
+ "eslint-plugin-jsx-a11y": "6.6.1",
74
+ "eslint-plugin-prettier": "4.2.1",
75
+ "eslint-plugin-react": "7.31.8",
76
+ "eslint-plugin-react-hooks": "4.6.0",
77
+ "husky": "8.0.1",
78
+ "lint-staged": "13.0.3",
79
+ "prettier": "2.7.1",
80
+ "typescript": "4.8.3",
81
+ "vite": "3.1.3"
82
+ }
83
+ }
package/src/app/App.tsx CHANGED
@@ -23,11 +23,10 @@ import { Plus } from "@ode-react-ui/icons";
23
23
  import libraryIMG from "../assets/images/library.jpg";
24
24
 
25
25
  function App() {
26
- const { session, currentApp } = useOdeContext();
27
26
  const { i18n } = useI18n();
28
27
  const { context, onOpen, onCreate } = useExplorerContext();
28
+ const { session, currentApp } = useOdeContext();
29
29
  const { treeData, listData } = useExplorerAdapter();
30
- // const { is1d } = useThemeContext();
31
30
 
32
31
  useEffect(() => {
33
32
  // TODO initialize search parameters. Here and/or in the dedicated React component
@@ -68,9 +67,6 @@ function App() {
68
67
  return (
69
68
  <div className="App">
70
69
  <Header />
71
- {/* <button type="button" onClick={handleSwitchTheme}>
72
- Switch theme
73
- </button> */}
74
70
  <main className="container-fluid bg-white">
75
71
  <AppHeader>
76
72
  <AppCard app={currentApp} isHeading headingStyle="h3" level="h1">
@@ -88,7 +84,7 @@ function App() {
88
84
  {i18n("blog.create.title")}
89
85
  </Button>
90
86
  </AppHeader>
91
- <Grid style={{ minHeight: "calc(100vh - 14rem)" }}>
87
+ <Grid>
92
88
  <Grid.Col
93
89
  sm="3"
94
90
  className="border-end pt-16 pe-16 d-none d-lg-block"
@@ -153,19 +149,6 @@ function App() {
153
149
  </Button>
154
150
  </div>
155
151
  </Grid.Col>
156
- {/* <Grid.Col sm="3" className="g-start-7">
157
- <div className="d-grid">
158
- <Button
159
- type="button"
160
- color="secondary"
161
- variant="filled"
162
- // eslint-disable-next-line react/jsx-no-bind
163
- onClick={handleViewMore}
164
- >
165
- Voir plus
166
- </Button>
167
- </div>
168
- </Grid.Col> */}
169
152
  </Grid>
170
153
  </main>
171
154
  </div>
@@ -1,15 +1,10 @@
1
+ import { useOdeContext } from "@contexts/OdeContext";
1
2
  import { AppCard } from "@ode-react-ui/core";
2
3
  import { Users } from "@ode-react-ui/icons";
3
4
  import { OneProfile } from "@ode-react-ui/icons/nav";
4
5
 
5
- function FakeCard({
6
- currentApp,
7
- name,
8
- updatedAt,
9
- creatorName,
10
- onClick,
11
- onKeyDown,
12
- }: any) {
6
+ function FakeCard({ name, updatedAt, creatorName, onClick, onKeyDown }: any) {
7
+ const { currentApp } = useOdeContext();
13
8
  return (
14
9
  <div
15
10
  className="card g-col-4 shadow border-0"
package/vite.config.ts CHANGED
@@ -27,6 +27,13 @@ export default defineConfig({
27
27
  },
28
28
  build: {
29
29
  assetsDir: "assets/js/explorer/",
30
+ rollupOptions: {
31
+ output: {
32
+ entryFileNames: `assets/js/explorer/[name].js`,
33
+ chunkFileNames: `assets/js/explorer/[name].js`,
34
+ assetFileNames: `assets/js/explorer/[name].[ext]`,
35
+ },
36
+ },
30
37
  },
31
38
  plugins: [react()],
32
39
  /* server: {