Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
CordlessWool committed Apr 7, 2020
2 parents bd85019 + ee4ac7a commit aeba088
Show file tree
Hide file tree
Showing 184 changed files with 16,762 additions and 8,380 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github
.git
dist
.cache
node_modules
12 changes: 10 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@
"plugins": ["standard", "react-hooks"],
"rules": {
"linebreak-style": [2, "unix"],
"semi": [2, "never"],
"indent": ["error", "tab"],
"no-unused-vars": [0],
"unicode-bom": ["error", "never"],
"react-hooks/rules-of-hooks": 2,
"react-hooks/exhaustive-deps": 0,
"no-console": 1,
"react/prop-types": 0,
"no-case-declarations": 0
}
},
"overrides": [
{
"files": ["build/**/*.js"],
"env": {
"node": true
}
}
]
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Fix end-of-lines in Git versions older than 2.10
# https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248
* text=auto eol=lf
37 changes: 0 additions & 37 deletions .github/CODEOWNERS

This file was deleted.

13 changes: 0 additions & 13 deletions .github/pull_request_template.md

This file was deleted.

5 changes: 0 additions & 5 deletions .github/release-drafter.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ yarn.lock
# production
**/*/build


# misc
.DS_Store
.env.local
Expand Down
2 changes: 1 addition & 1 deletion .parcelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"url-loader": {
"exts": ["jpg", "jpeg", "png", "gif", "svg"],
"exts": ["jpg", "jpeg", "png", "gif"],
"limit": 1024000
}
}
20 changes: 14 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"singleQuote": false,
"trailingComma": "all",
"semi": false,
"tabWidth": 4,
"jsxBracketSameLine": true,
"bracketSpacing": true,
"arrowParens": "avoid"
"printWidth": 80,
"useTabs": true,
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"proseWrap": "never",
"htmlWhitespaceSensitivity": "strict",
"endOfLine": "lf",
"semi": true,
"singleQuote": false
}



10 changes: 5 additions & 5 deletions .storybook/stories/Action.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stories
disabled={boolean("disabled", false)}
block={boolean("block", false)}
noMargin={boolean("noMargin", false)}
onClick={() => console.log("Yess!")}>
onClick={() => console.info("Yess!")}>
Interactive Action
</Action>
<Text style={{ backgroundColor: "#DDBDD5" }}>Placeholder</Text>
Expand All @@ -47,7 +47,7 @@ stories
This will only trigger an event, not change the browser
location.
</Text>
<Action clickable onClick={() => console.log("clicked")}>
<Action clickable onClick={() => console.info("clicked")}>
Click me
</Action>
</Container>
Expand All @@ -59,7 +59,7 @@ stories
</Text>
<Action
clickable
onClick={() => console.log("clicked")}
onClick={() => console.info("clicked")}
style={{ backgroundColor: "#DDBDD5" }}>
default inline Action
</Action>
Expand All @@ -76,7 +76,7 @@ stories
<Action
block
clickable
onClick={() => console.log("clicked")}
onClick={() => console.info("clicked")}
style={{ backgroundColor: "#DDBDD5" }}>
block Action
</Action>
Expand All @@ -94,7 +94,7 @@ stories
block
noMargin
clickable
onClick={() => console.log("clicked")}
onClick={() => console.info("clicked")}
style={{ backgroundColor: "#DDBDD5" }}>
block Action without Margin
</Action>
Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stories.add("Interactive", () => {
block={boolean("block", false)}
full={boolean("full", false)}
noMargin={boolean("noMargin", false)}
onClick={() => console.log("Yess!")}>
onClick={() => console.info("Yess!")}>
Click me!
</Button>
<Text>
Expand Down
50 changes: 50 additions & 0 deletions .svgo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
multipass: true

plugins:
- addAttributesToSVGElement: false
- addClassesToSVGElement: false
- cleanupAttrs: true
- cleanupEnableBackground: true
- cleanupIDs: true
- cleanupListOfValues: true
- cleanupNumericValues:
floatPrecision: 2
- collapseGroups: true
- convertColors: true
- convertPathData: true
- convertShapeToPath: true
- convertStyleToAttrs: true
- convertTransform: true
- mergePaths: true
- minifyStyles: true
- moveElemsAttrsToGroup: true
- moveGroupAttrsToElems: true
- removeAttrs: true
- removeComments: true
- removeDesc: true
- removeDimensions: true
- removeDoctype: true
- removeEditorsNSData: true
- removeElementsByAttr: true
- removeEmptyAttrs: true
- removeEmptyContainers: true
- removeEmptyText: true
- removeHiddenElems: true
- removeMetadata: true
- removeNonInheritableGroupAttrs: true
- removeRasterImages
- removeStyleElement: true
- removeTitle: true
- removeUnknownsAndDefaults: true
- removeUnusedNS: true
- removeUselessDefs: true
- removeUselessStrokeAndFill: true
- removeViewBox: true
- removeXMLNS: false
- removeXMLProcInst: true
- sortAttrs: true
- transformsWithOnePath: true

js2svg:
pretty: false
indent: ' '
58 changes: 58 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
branches:
only:
- develop
- master
- /^(?i:release|hotfix).*$/
language: node_js
node_js:
- lts/*
dist: xenial

env:
global:
- TZ=Europe/Berlin
- GIT_SHA=$( git rev-parse HEAD )
- DOCKERTAG="$( echo $TRAVIS_BRANCH | tr -s '[:punct:]' '-' | tr -s '[:upper:]' '[:lower:]' )_v$( jq -r '.version' package.json )_$TRAVIS_COMMIT"

# do not run on develop if it is just a dependency update from dependabot to preserve resources
if: (not branch = develop) or (branch = develop and not commit_message ~= /^Bump.*from.*to.*$/)

stages:
- test
- name: build
if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/)
- name: deploy
if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/)

jobs:
include:
# Build & Test
- stage: test
script: npm run build:standalone
name: "build:react:standalone"
- script: npm run build
name: "build:react"
- script: npm run test
name: "mocha"
services:
- mongodb

# Build Docker Images
- stage: build
name: build
language: generic
script: bash ./deploy/build.sh

# Deploy
- stage: deploy
name: deploy
language: generic
script: bash ./deploy/deploy.sh


cache: npm
before_cache:
# delete all .cache folders before actually storing the cache.
# nuxt, storybook and vuepress stores some build artefacts here which invalidates the cache.
- cd node_modules && find . -name .cache -type d -exec rm -rf {} + && cd ..
- cd node_modules && find . -name .temp -type d -exec rm -rf {} + && cd ..
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ Internal plugins will lie in `src/plugins` and should be mostly isolated, althou

To build the editor, simply run `npm run build`.

##### ENV variables

there exist a script called `deploy/env.sh` which you can run to build a file which makes all used process.env variables available in the window object. This allows you to change configuration parameters without rebuilding the Docker Container.
**If you want to use this feature, you need to import the `dist/env.js` before `dist/index.js` in your HTML code.**

`bash ./deploy/env.sh dist/env.js` (`dist/env.js` is the output file)

The generated file will look like similar to this:

```js
window.EDITOR_API_URL = "Content of process.env.EDITOR_API_URL";
window.SERVER_API_URL = "Content of process.env.SERVER_API_URL";
// ...
```

#### Integration in schulcloud-client

Once built, push your build to github. Then, copy the commit hash and use jsdelivr to generate a static link to the script, for example: `https://cdn.jsdelivr.net/gh/schul-cloud/edtrio@COMMIT_HASH/dist/index.js`. You can then pass this url to the schulcloud-editor as `process.env.EDTR_SOURCE`. When you go to the current topic editor, you can now add the query `?edtr=true` to load the new editor.
Expand Down
7 changes: 0 additions & 7 deletions build/index.js

This file was deleted.

21 changes: 21 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:lts as builder

WORKDIR '/app'
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
RUN cd dist && gzip -k index.js

FROM nginx:alpine
RUN apk update && apk add bash
COPY --from=builder /app/dist /usr/share/nginx/html/
COPY --from=builder /app/deploy/env.sh ./
COPY --from=builder /app/deploy/nginx.conf.template /etc/nginx/
COPY --from=builder /app/deploy/docker-entrypoint.sh ./
RUN chmod 550 docker-entrypoint.sh
EXPOSE 80

# read envs and start nginx
CMD ./docker-entrypoint.sh
Loading

0 comments on commit aeba088

Please sign in to comment.