Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ae67e2f
Compile changes from wip/framework-rewrite branch
bennothommo Jan 12, 2022
5df9a61
Re-add missing test files
bennothommo Jan 12, 2022
7087020
Re-add missing file, compile extra styles
bennothommo Jan 12, 2022
18d5dd5
Tidy up commands
bennothommo Jan 13, 2022
e254a71
Allow arguments to be passed through to NPM/Webpack
bennothommo Jan 19, 2022
3723884
Remove trailing comma
bennothommo Jan 19, 2022
142d40f
Another trailing comma removed
bennothommo Jan 19, 2022
667894a
Fix list command
bennothommo Jan 19, 2022
4611298
Process flash messages before redirect
bennothommo Jan 19, 2022
c09e070
Add simple cookie utility
bennothommo Jan 19, 2022
aa4ed5a
Fix FakeDom error in tests
bennothommo Jan 19, 2022
3e609ad
Allow fetch options to be modified
bennothommo Jan 19, 2022
195a07a
Remove leftover development block comment
bennothommo Jan 19, 2022
23cceda
Stop Gitpod pre-builds
bennothommo Jan 19, 2022
806ef8e
Provide additional information for the JsonParser Snowboard plugin
LukeTowers Jan 19, 2022
83c076c
Add extensibility to cookie utility
bennothommo Jan 20, 2022
f1fd8af
Merge branch 'develop' into wip/snowboard
bennothommo Jan 20, 2022
48cec05
Don't sanitize partial content
bennothommo Jan 20, 2022
17f77fd
Fix default method definition
bennothommo Jan 20, 2022
104b567
Remove debounce
bennothommo Jan 20, 2022
f98ce67
Fix tests
bennothommo Jan 20, 2022
5bb790f
Add better event handling with getting all cookies
bennothommo Jan 20, 2022
416ba70
Update modules/system/assets/js/snowboard/utilities/JsonParser.js
LukeTowers Jan 20, 2022
5babad9
add docblock for the JS sanitizer
LukeTowers Jan 21, 2022
95c1d9f
Merge branch 'develop' into wip/snowboard
LukeTowers Feb 8, 2022
7631957
Fixed typo
LukeTowers Feb 8, 2022
1085be5
Implement autoregistration of Laravel Mix packages for modules, plugi…
LukeTowers Feb 10, 2022
b2de281
Support installing previously unregistered Mix packages for valid mod…
LukeTowers Feb 11, 2022
1cbbd64
Use relative paths in the MixAssets manager
LukeTowers Feb 11, 2022
236ac39
Add modification of package.json to mix:install and TTY passthrough s…
LukeTowers Feb 11, 2022
cdfae4a
Automatically add laravel-mix as a package.json dependency if desired
LukeTowers Feb 11, 2022
b3dc49f
Remove usage of DIRECTORY_SEPERATOR, Windows supports both separators…
LukeTowers Feb 11, 2022
6808a7a
Fix mix:compile & mix:watch commands
LukeTowers Feb 12, 2022
2ff9ad2
Update modules/system/console/MixCompile.php
LukeTowers Feb 13, 2022
a227601
Update modules/system/classes/MixAssets.php
LukeTowers Feb 14, 2022
5ead84c
Merge pull request #444 from wintercms/wip/mix-changes
LukeTowers Feb 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,24 @@ jobs:
- name: Run code quality checks (on pull request)
if: github.event_name == 'pull_request'
run: ./.github/workflows/utilities/phpcs-pr ${{ github.base_ref }}
codeQualityJS:
runs-on: ubuntu-latest
name: JavaScript
steps:
- name: Checkout changes
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12

- name: Install Node dependencies
working-directory: ./modules/system/assets/js/snowboard
run: npm install

- name: Run code quality checks
working-directory: ./modules/system/assets/js/snowboard
run: npx eslint .
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
node-version: 12

- name: Install Node dependencies
working-directory: ./tests/js
run: npm install

- name: Run tests
working-directory: ./tests/js
run: npm run test
phpUnitTests:
strategy:
Expand Down
6 changes: 3 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ vscode:

github:
prebuilds:
master: true
master: false
branches: false
pullRequests: true
pullRequests: false
pullRequestsFromForks: false
addCheck: true
addCheck: false
addComment: false
addBadge: true
5 changes: 0 additions & 5 deletions .jshintrc

This file was deleted.

6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,11 @@
"replace": false,
"merge-dev": false
}
},
"config": {
"allow-plugins": {
"composer/installers": true,
"wikimedia/composer-merge-plugin": true
}
}
}
1 change: 1 addition & 0 deletions modules/cms/twig/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getTokenParsers()
new PlaceholderTokenParser,
new DefaultTokenParser,
new FrameworkTokenParser,
new SnowboardTokenParser,
new ComponentTokenParser,
new FlashTokenParser,
new ScriptsTokenParser,
Expand Down
65 changes: 65 additions & 0 deletions modules/cms/twig/SnowboardNode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php namespace Cms\Twig;

use Config;
use Request;
use System\Models\Parameter;
use System\Classes\CombineAssets;
use Twig\Node\Node as TwigNode;
use Twig\Compiler as TwigCompiler;

/**
* Represents a "snowboard" node
*
* @package winter\wn-cms-module
* @author Winter CMS
*/
class SnowboardNode extends TwigNode
{
/**
* @var bool Indicates if the base Snowboard framework is already loaded, in case of multiple uses of this tag.
*/
public static $baseLoaded = false;

public function __construct(array $modules, $lineno, $tag = 'snowboard')
{
parent::__construct([], ['modules' => $modules], $lineno, $tag);
}

/**
* Compiles the node to PHP.
*
* @param TwigCompiler $compiler A TwigCompiler instance
*/
public function compile(TwigCompiler $compiler)
{
$build = Parameter::get('system::core.build', 'winter');
$cacheBust = '?v=' . $build;
$modules = $this->getAttribute('modules');

$compiler
->addDebugInfo($this)
->write("\$_minify = ".CombineAssets::class."::instance()->useMinify;" . PHP_EOL);

$moduleMap = [
'base' => (Config::get('app.debug', false) === true) ? 'snowboard.base.debug' : 'snowboard.base',
'request' => 'snowboard.request',
'attr' => 'snowboard.data-attr',
'extras' => 'snowboard.extras',
];
$basePath = Request::getBasePath() . '/modules/system/assets/js/snowboard/build/';

if (!static::$baseLoaded) {
// Add base script
$baseJs = $moduleMap['base'];
$compiler
->write("echo '<script src=\"${basePath}${baseJs}.js${cacheBust}\"></script>'.PHP_EOL;" . PHP_EOL);
static::$baseLoaded = true;
}

foreach ($modules as $module) {
$moduleJs = $moduleMap[$module];
$compiler
->write("echo '<script src=\"${basePath}${moduleJs}.js${cacheBust}\"></script>'.PHP_EOL;" . PHP_EOL);
}
}
}
60 changes: 60 additions & 0 deletions modules/cms/twig/SnowboardTokenParser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php namespace Cms\Twig;

use Twig\Token as TwigToken;
use Twig\TokenParser\AbstractTokenParser as TwigTokenParser;

/**
* Parser for the `{% snowboard %}` Twig tag.
*
* @package winter\wn-cms-module
* @author Winter CMS
*/
class SnowboardTokenParser extends TwigTokenParser
{
/**
* @inheritDoc
*/
public function parse(TwigToken $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();

$modules = [];

do {
$token = $stream->next();

if ($token->getType() === TwigToken::NAME_TYPE) {
$modules[] = $token->getValue();
}
} while ($token->getType() !== TwigToken::BLOCK_END_TYPE);

// Filter out invalid types
$modules = array_filter(
array_map(function ($item) {
return strtolower($item);
}, $modules),
function ($item) {
return in_array($item, ['request', 'attr', 'extras', 'all']);
}
);

if (in_array('all', $modules)) {
$modules = [
'request',
'attr',
'extras',
];
}

return new SnowboardNode($modules, $lineno, $this->getTag());
}

/**
* @inheritDoc
*/
public function getTag()
{
return 'snowboard';
}
}
63 changes: 37 additions & 26 deletions modules/system/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Winter\Storm\Router\Helper as RouterHelper;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use System\Classes\MixAssets;

class ServiceProvider extends ModuleServiceProvider
{
Expand Down Expand Up @@ -251,32 +252,37 @@ protected function registerConsole()
/*
* Register console commands
*/
$this->registerConsoleCommand('winter.up', 'System\Console\WinterUp');
$this->registerConsoleCommand('winter.down', 'System\Console\WinterDown');
$this->registerConsoleCommand('winter.update', 'System\Console\WinterUpdate');
$this->registerConsoleCommand('winter.util', 'System\Console\WinterUtil');
$this->registerConsoleCommand('winter.mirror', 'System\Console\WinterMirror');
$this->registerConsoleCommand('winter.fresh', 'System\Console\WinterFresh');
$this->registerConsoleCommand('winter.env', 'System\Console\WinterEnv');
$this->registerConsoleCommand('winter.install', 'System\Console\WinterInstall');
$this->registerConsoleCommand('winter.passwd', 'System\Console\WinterPasswd');
$this->registerConsoleCommand('winter.version', 'System\Console\WinterVersion');
$this->registerConsoleCommand('winter.manifest', 'System\Console\WinterManifest');
$this->registerConsoleCommand('winter.test', 'System\Console\WinterTest');

$this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall');
$this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
$this->registerConsoleCommand('plugin.disable', 'System\Console\PluginDisable');
$this->registerConsoleCommand('plugin.enable', 'System\Console\PluginEnable');
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');
$this->registerConsoleCommand('plugin.rollback', 'System\Console\PluginRollback');
$this->registerConsoleCommand('plugin.list', 'System\Console\PluginList');

$this->registerConsoleCommand('theme.install', 'System\Console\ThemeInstall');
$this->registerConsoleCommand('theme.remove', 'System\Console\ThemeRemove');
$this->registerConsoleCommand('theme.list', 'System\Console\ThemeList');
$this->registerConsoleCommand('theme.use', 'System\Console\ThemeUse');
$this->registerConsoleCommand('theme.sync', 'System\Console\ThemeSync');
$this->registerConsoleCommand('winter.up', \System\Console\WinterUp::class);
$this->registerConsoleCommand('winter.down', \System\Console\WinterDown::class);
$this->registerConsoleCommand('winter.update', \System\Console\WinterUpdate::class);
$this->registerConsoleCommand('winter.util', \System\Console\WinterUtil::class);
$this->registerConsoleCommand('winter.mirror', \System\Console\WinterMirror::class);
$this->registerConsoleCommand('winter.fresh', \System\Console\WinterFresh::class);
$this->registerConsoleCommand('winter.env', \System\Console\WinterEnv::class);
$this->registerConsoleCommand('winter.install', \System\Console\WinterInstall::class);
$this->registerConsoleCommand('winter.passwd', \System\Console\WinterPasswd::class);
$this->registerConsoleCommand('winter.version', \System\Console\WinterVersion::class);
$this->registerConsoleCommand('winter.manifest', \System\Console\WinterManifest::class);
$this->registerConsoleCommand('winter.test', \System\Console\WinterTest::class);

$this->registerConsoleCommand('plugin.install', \System\Console\PluginInstall::class);
$this->registerConsoleCommand('plugin.remove', \System\Console\PluginRemove::class);
$this->registerConsoleCommand('plugin.disable', \System\Console\PluginDisable::class);
$this->registerConsoleCommand('plugin.enable', \System\Console\PluginEnable::class);
$this->registerConsoleCommand('plugin.refresh', \System\Console\PluginRefresh::class);
$this->registerConsoleCommand('plugin.rollback', \System\Console\PluginRollback::class);
$this->registerConsoleCommand('plugin.list', \System\Console\PluginList::class);

$this->registerConsoleCommand('theme.install', \System\Console\ThemeInstall::class);
$this->registerConsoleCommand('theme.remove', \System\Console\ThemeRemove::class);
$this->registerConsoleCommand('theme.list', \System\Console\ThemeList::class);
$this->registerConsoleCommand('theme.use', \System\Console\ThemeUse::class);
$this->registerConsoleCommand('theme.sync', \System\Console\ThemeSync::class);

$this->registerConsoleCommand('mix.install', \System\Console\MixInstall::class);
$this->registerConsoleCommand('mix.list', \System\Console\MixList::class);
$this->registerConsoleCommand('mix.compile', \System\Console\MixCompile::class);
$this->registerConsoleCommand('mix.watch', \System\Console\MixWatch::class);
}

/*
Expand Down Expand Up @@ -560,6 +566,11 @@ protected function registerAssetBundles()
$combiner->registerBundle('~/modules/system/assets/js/framework.js');
$combiner->registerBundle('~/modules/system/assets/js/framework.combined.js');
$combiner->registerBundle('~/modules/system/assets/less/framework.extras.less');
$combiner->registerBundle('~/modules/system/assets/less/snowboard.extras.less');
});

MixAssets::registerCallback(function ($mix) {
$mix->registerPackage('snowboard', '~/modules/system/assets/js/snowboard/winter.mix.js');
});
}

Expand Down
57 changes: 57 additions & 0 deletions modules/system/assets/css/snowboard.extras.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions modules/system/assets/js/snowboard/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules/**
build/*.js
Loading