Initiale Veröffentlichung der Vorlage

This commit is contained in:
Dennis Heinrich 2023-11-02 16:38:03 +01:00
commit 6466d8a925
16 changed files with 8057 additions and 0 deletions

27
Bootstrap.php Normal file
View file

@ -0,0 +1,27 @@
<?php declare(strict_types=1);
/**
* @package Plugin\plugin_test
* @author Dennis Heinrich
*/
namespace Plugin\plugin_test;
use JTL\Events\Dispatcher;
use JTL\Plugin\Bootstrapper;
/**
* Class Bootstrap
* @package Plugin\plugin_test
*/
class Bootstrap extends Bootstrapper
{
/**
* Executed on each plugin call (e.g. on each page visit)
* @param Dispatcher $dispatcher
* @return void
*/
public function boot(Dispatcher $dispatcher): void
{
parent::boot($dispatcher);
}
}

32
LICENSE.md Normal file
View file

@ -0,0 +1,32 @@
# BSD 3-Clause License
Copyright (c) 2023, Dennis Heinrich
<https://dennis-heinri.ch>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
4. Links and references to the original author's website may not be removed from the files.
It is not allowed to change it in any ways, nor to hide it. Links must be clearly visible.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

12
README.md Normal file
View file

@ -0,0 +1,12 @@
### Entwicklungsvorlage für den JTL Shop 5
![image](https://user-images.githubusercontent.com/4189795/218418705-000480f5-466c-4840-b2de-e5353e5054d6.png)
### Vorlage richtig benutzen
- In dem gesamten Repository den Text `plugin_test` gegen die neue Plugin-ID ersetzen (Auch in den Namespaces)
- Den Installationsknoten um Teile der `info.xml` ([s. Dokumentation](https://jtl-devguide.readthedocs.io/projects/jtl-shop/de/latest/shop_plugins/infoxml.html)) erweitern
- Anlegen eines neuen GitHub-Repositorys und commiten der Dateien
- Setzen einer Beschreibung des Repositorys
- Setzen der Topics `jtl-shop5`, `jtl` und `jtl-plugin`
- Bearbeiten dieser README.md und ebenfalls commiten

0
frontend/js/.gitkeep Normal file
View file

203
frontend/js/main.js Normal file

File diff suppressed because one or more lines are too long

View file

1
frontend/webpack/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules

View file

@ -0,0 +1,34 @@
{
"name": "plugin_test",
"version": "1.0.0",
"description": "Frontend-Bundle für das Plugin",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode=production --node-env=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production --node-env=production",
"watch": "webpack --watch"
},
"author": "Dennis Heinrich",
"license": "Siehe LICENSE des Plugins",
"devDependencies": {
"@babel/core": "^7.22.19",
"@babel/preset-env": "^7.22.15",
"@webpack-cli/generators": "^3.0.7",
"autoprefixer": "^10.4.15",
"babel-loader": "^9.1.3",
"css-loader": "^6.8.1",
"postcss": "^8.4.29",
"postcss-loader": "^7.3.3",
"postcss-preset-env": "^9.1.3",
"prettier": "^3.0.3",
"style-loader": "^3.3.3",
"tailwindcss": "^3.3.3",
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,4 @@
const tailwindcss = require('tailwindcss');
module.exports = {
plugins: [["autoprefixer"], "postcss-preset-env", tailwindcss],
};

View file

@ -0,0 +1,6 @@
// Load stylesheet and tailwind/css
import "../stylesheets/main.css"
document.addEventListener("DOMContentLoaded", () => {
console.log("Hello from TypeScript!");
});

View file

@ -0,0 +1,9 @@
/* import tailwind */
@tailwind base;
@tailwind components;
@tailwind utilities;
/* If this isn't set, the navigation will be shown (due to a inaccurate css class from the original JTL template) */
#mainNavigation {
@apply visible;
}

View file

@ -0,0 +1,17 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.js",
"./src/**/*.ts",
"../template/**/*.tpl",
"../../source/**/*.php",
],
theme: {
extend: {},
},
plugins: [],
corePlugins: {
preflight: false,
}
}

View file

@ -0,0 +1,10 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"allowJs": true
},
"files": ["src/index.ts"]
}

View file

@ -0,0 +1,41 @@
const path = require('path');
const isProduction = process.env.NODE_ENV == 'production';
const stylesHandler = 'style-loader';
const config = {
entry: './src/index.ts',
output: {
path: path.resolve(__dirname, '../js'),
},
plugins: [],
module: {
rules: [
{
test: /\.(ts|tsx)$/i,
loader: 'ts-loader',
exclude: ['/node_modules/'],
},
{
test: /\.css$/i,
include: path.resolve(__dirname, 'stylesheets'),
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
type: 'asset',
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.jsx', '.js', '...'],
},
};
module.exports = () => {
if (isProduction) {
config.mode = 'production';
} else {
config.mode = 'development';
}
return config;
};

22
info.xml Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<jtlshopplugin>
<Name>Vorlage eines Plugins</Name>
<Description>Hier könnte Ihre Beschreibung stehen.</Description>
<Author>Dennis Heinrich</Author>
<URL>https://dennis-heinri.ch</URL>
<PluginID>plugin_test</PluginID>
<XMLVersion>100</XMLVersion>
<Icon></Icon>
<Version>1.0.0</Version>
<ShopVersion>5.0.0</ShopVersion>
<CreateDate>2023-02-01</CreateDate>
<Install>
<JS>
<file>
<name>main.js</name>
<priority>1</priority>
<position>head</position>
</file>
</JS>
</Install>
</jtlshopplugin>