Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
remove package script update now that laravel uses Mix 6 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
pktharindu committed Jan 6, 2021
1 parent 068629d commit 02af183
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 37 deletions.
16 changes: 16 additions & 0 deletions src/HandlesGeneralScaffolding.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ protected static function updateComposerPackageArray(array $composer, string $de
], $composer);
}

protected static function updatePackagesScripts(): void
{
if (!file_exists(base_path('package.json'))) {
return;
}

$packages = json_decode(file_get_contents(base_path('package.json')), true);

ksort($packages['scripts']);

file_put_contents(
base_path('package.json'),
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL
);
}

protected static function scaffoldDefaults(): void
{
$filesystem = new Filesystem();
Expand Down
37 changes: 0 additions & 37 deletions src/TtallPreset.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ class TtallPreset extends Preset
'lodash',
];

const SCRIPTS_TO_ADD = [
'development' => 'mix',
'watch' => 'mix watch',
'watch-poll' => 'mix watch -- --watch-options-poll=1000',
'hot' => 'mix watch --hot',
'production' => 'mix --production',
];

const SCRIPTS_TO_REMOVE = [
'development',
'watch',
'watch-poll',
'hot',
'production',
];

public static function install(): void
{
static::updatePackages();
Expand Down Expand Up @@ -94,25 +78,4 @@ protected static function updatePackageArray(array $packages, string $dev): arra
Arr::except($packages, static::NPM_PACKAGES_TO_REMOVE)
);
}

protected static function updatePackagesScripts(): void
{
if (! file_exists(base_path('package.json'))) {
return;
}

$packages = json_decode(file_get_contents(base_path('package.json')), true);

$packages['scripts'] = array_merge(
static::SCRIPTS_TO_ADD,
Arr::except($packages['scripts'], static::SCRIPTS_TO_REMOVE)
);

ksort($packages['scripts']);

file_put_contents(
base_path('package.json'),
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
);
}
}

0 comments on commit 02af183

Please sign in to comment.