diff --git a/.dockerignore b/.dockerignore index 9b552d7..f392415 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ vendor -public_html/php \ No newline at end of file +public_html/php +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7c29e19..8243b72 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ vendor public_html/php -classes \ No newline at end of file +classes +node_modules/ +dist/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 9c962bd..ed95c3b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,21 @@ +FROM node:12 as npm + +WORKDIR /installing +COPY ./ /installing +RUN npm ci --only=production + FROM composer@sha256:d374b2e1f715621e9d9929575d6b35b11cf4a6dc237d4a08f2e6d1611f534675 as composer # composer is pinned at a PHP 7 version WORKDIR /installing COPY ./ /installing -RUN composer install --no-dev --no-progress && rm -rf vendor/wbstack/magnustools +## 1. composer install +## 2. move magnus tools resources to a temp fold to select from (some are selected at the very end) +## 3. finally remove magnustools because it contains so much stuff +RUN composer install --no-dev --no-progress \ + && mv vendor/wbstack/magnustools /installing/magnustools \ + && rm -rf vendor/wbstack/magnustools FROM php:7.2-apache @@ -27,5 +38,9 @@ COPY --from=composer /installing /var/www/html/quickstatements COPY --from=composer /installing/classes /var/www/html/magnustools/classes COPY --from=composer /installing/public_html/php /var/www/html/magnustools/public_html/php +## TODO make some kind of sane magnus tools js lib to be included in the bundle +COPY --from=composer /installing/magnustools/public_html/resources /var/www/html/quickstatements/public_html/magnustools/resources +COPY --from=npm /installing/node_modules /var/www/html/quickstatements/public_html/resources + ENTRYPOINT ["/bin/bash"] CMD ["/entrypoint.sh"] \ No newline at end of file diff --git a/README b/README index 6065138..bb9a721 100644 --- a/README +++ b/README @@ -2,3 +2,24 @@ Using addwiki: https://github.com/addwiki/mediawiki-api Copy public_html/config.json.template to config.json and modify for your needs + +## NPM Dependencies + +Currently the external dependencies are managed by npm, they are installed during the building of the Dockerfile by running the following command + +``` +npm ci --only=production +``` + +and then moving the installed libraries to the public_html/ folder. + +## TODO +### Add some kind of offline version of https://bitbucket.org/magnusmanske/tooltranslate.git + +This could potentially be some kind of homebrew thing that looks at the toolinfo.json and pulls the all the translations when the Dockerfile builds and puts these in the `public_html/` folder + +``` +https://tools-static.wmflabs.org/tooltranslate/data/quickstatements/toolinfo.json +``` + +This would also require a rewrite of https://tools-static.wmflabs.org/tooltranslate/tt.js \ No newline at end of file diff --git a/composer.lock b/composer.lock index e19a307..02e9890 100644 --- a/composer.lock +++ b/composer.lock @@ -779,13 +779,13 @@ "version": "dev-main", "source": { "type": "git", - "url": "https://github.com/wbstack/magnustools.git", - "reference": "e0fadb9a7149f0b06ee419e554c2f78341c4f5b7" + "url": "https://github.com/wbstack/magnustools.git", + "reference": "5199914627c7c356c49bbf6552f100d6890b18ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wbstack/magnustools/zipball/e0fadb9a7149f0b06ee419e554c2f78341c4f5b7", - "reference": "e0fadb9a7149f0b06ee419e554c2f78341c4f5b7", + "url": "https://api.github.com/repos/wbstack/magnustools/zipball/5199914627c7c356c49bbf6552f100d6890b18ae", + "reference": "5199914627c7c356c49bbf6552f100d6890b18ae", "shasum": "" }, "require": { diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4d5b21c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,33 @@ +{ + "name": "quickstatements", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "bootstrap": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.0.0.tgz", + "integrity": "sha512-gulJE5dGFo6Q61V/whS6VM4WIyrlydXfCgkE+Gxe5hjrJ8rXLLZlALq7zq2RPhOc45PSwQpJkrTnc2KgD6cvmA==" + }, + "jquery": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz", + "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg==" + }, + "leaflet": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.3.1.tgz", + "integrity": "sha512-adQOIzh+bfdridLM1xIgJ9VnJbAUY3wqs/ueF+ITla+PLQ1z47USdBKUf+iD9FuUA8RtlT6j6hZBfZoA6mW+XQ==" + }, + "vue": { + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.5.13.tgz", + "integrity": "sha512-3D+lY7HTkKbtswDM4BBHgqyq+qo8IAEE8lz8va1dz3LLmttjgo0FxairO4r1iN2OBqk8o1FyL4hvzzTFEdQSEw==" + }, + "vue-router": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.0.1.tgz", + "integrity": "sha512-vLLoY452L+JBpALMP5UHum9+7nzR9PeIBCghU9ZtJ1eWm6ieUI8Zb/DI3MYxH32bxkjzYV1LRjNv4qr8d+uX/w==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..41ceaf5 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "quickstatements", + "version": "0.0.1", + "description": "", + "main": "quickstatements.js", + "private": true, + "keywords": [], + "author": "", + "license": "MIT", + "dependencies": { + "leaflet": "1.3.1", + "vue-router": "3.0.1", + "vue": "2.5.13", + "bootstrap": "4.0.0", + "jquery": "3.3.1" + } +} diff --git a/public_html/index.html b/public_html/index.html index 10f40b6..f35f7b0 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -3,17 +3,18 @@ - - - - - - - - - - - + + + + + + + + + + + +