Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #80 from pipe-dream/new-core
Browse files Browse the repository at this point in the history
adapted to new `core`
  • Loading branch information
septIO committed Mar 2, 2020
2 parents d007997 + e294b59 commit 9eb964e
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 21,921 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_modules
.vscode
mix-manifest.json
.idea/*
/src/public/css
/src/public/js
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"laravel-mix": "^4.0.14",
"laravel-mix-purgecss": "^4.1",
"laravel-mix-tailwind": "^0.1.0",
"laravel-nova-file-factory": "^0.0.1",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
Expand Down
58 changes: 0 additions & 58 deletions src/Commands/DumpAutoload.php

This file was deleted.

87 changes: 87 additions & 0 deletions src/Commands/PipeDreamBuild.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

namespace PipeDream\LaravelCreate\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Process\Process;

class PipeDreamBuild extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'pipedream:build';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Rebuild PipeDream from source files';

/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$this->info("Rebuilding PipeDream...");

$appJSPath = __DIR__ . "/../resources/js/app.js";
$app = file_get_contents($appJSPath);
$nodeModules = base_path() . DIRECTORY_SEPARATOR . "node_modules";

$level1 = Collect(glob($nodeModules . DIRECTORY_SEPARATOR . "*/package.json"));
$level2 = Collect(glob($nodeModules . DIRECTORY_SEPARATOR . "*/*/package.json"));
$modules = $level1->merge($level2);

$this->info("\nDiscovering PipeDream packages");
$bar = $this->output->createProgressBar();
$bar->start();

$pipeDreamModules = [];
$master = [];
foreach ($modules as $module) {
$bar->advance();
$p = json_decode(file_get_contents($module), true);
if (!array_key_exists('PipeDream', $p)) continue;
if (array_key_exists('PipeDreamMaster', $p) && $p['PipeDreamMaster'] === true) {
$master[rtrim($module, "/package.json")] = $p["PipeDream"];
continue;
}
$pipeDreamModules[rtrim($module, "/package.json")] = $p["PipeDream"];
}

$pipeDreamModules = array_merge($master, $pipeDreamModules);

$bar->finish();
$this->info("\n");
if (count($pipeDreamModules) === 0) {
$this->error("No PipeDream modules found!");
return;
}
foreach ($pipeDreamModules as $pipeDreamModule) {
$this->info("Discovered package: " . $pipeDreamModule);
}
$overwritten = str_replace("/* file factories will be automatically added */", implode(", ", $pipeDreamModules), $app);
array_walk($pipeDreamModules, function (&$v, $path) {
$v = 'import {' . $v . '} from "' . str_replace('\\', '/', $path) . '"';
});
$overwritten = str_replace("/* imports will be automatically added */", implode(";\n", $pipeDreamModules), $overwritten);

file_put_contents($appJSPath, $overwritten);

$this->info("Compiling...");
if(!exec("npm run dev --prefix " . __DIR__ . '/../../')){
$this->warning("Something went wrong when compiling.");
}
$this->info("PipeDream was built successfully, go build something awesome!");
// set app.js back to the template for the next update
file_put_contents($appJSPath, $app);
}
}
4 changes: 2 additions & 2 deletions src/LaravelCreateServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace PipeDream\LaravelCreate;

use Illuminate\Support\ServiceProvider;
use PipeDream\LaravelCreate\Commands\DumpAutoload;
use PipeDream\LaravelCreate\Commands\PipeDreamBuild;

class LaravelCreateServiceProvider extends ServiceProvider
{
Expand All @@ -15,7 +15,7 @@ class LaravelCreateServiceProvider extends ServiceProvider
public function register()
{
$this->commands([
DumpAutoload::class,
PipeDreamBuild::class,
]);
}

Expand Down
4 changes: 0 additions & 4 deletions src/public/css/app.css

This file was deleted.

21,817 changes: 0 additions & 21,817 deletions src/public/js/app.js

This file was deleted.

12 changes: 8 additions & 4 deletions src/resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Vue from 'vue'
import Vuex from 'vuex'
import {PipeDream} from '@pipe-dream/core'
import {Schema} from "@pipe-dream/core/";
import {PipeDreamVueTools} from '@pipe-dream/core'
import LaravelFileFactory from '@pipe-dream/laravel-file-factory';

/* imports will be automatically added */
/* setup Vue to use Vuex and Pipe Dream components */
Vue.use(Vuex)
Vue.use(PipeDreamVueTools)
Expand All @@ -16,7 +16,7 @@ window.Vue = Vue
window.store = new Vuex.Store(
new PipeDream({
fileFactories: [
LaravelFileFactory,
/* file factories will be automatically added */
],
...window.__ENV__
}).defaultStore
Expand All @@ -25,5 +25,9 @@ window.store = new Vuex.Store(
/* Let's go */
new Vue({
el: '#app',
store
store,
mounted(){
//console.log(Schema.refresh(true))
store.dispatch('compileSchema', Schema);
}
})
36 changes: 1 addition & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@
vue-textarea-autosize "^1.0.4"
vuex "^3.1.0"

"@pipe-dream/laravel-file-factory@^1.0.7", "@pipe-dream/laravel-file-factory@^1.0.8":
"@pipe-dream/laravel-file-factory@^1.0.7":
version "1.0.16"
resolved "https://registry.yarnpkg.com/@pipe-dream/laravel-file-factory/-/laravel-file-factory-1.0.16.tgz#69d819eef404e2c6e269aaa4a52a92cf556ae978"
integrity sha512-LICswrY1/A/6QNTaB4CQg3JRQo9Wh76nKuWzGgDMcp3hh3YzdobBbNB6G3HgjM9BQFmMDL/TmSrSdY2mVWX/gw==
Expand Down Expand Up @@ -5546,40 +5546,6 @@ laravel-mix@^4.0.14:
webpack-notifier "^1.5.1"
yargs "^12.0.5"

laravel-nova-file-factory@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/laravel-nova-file-factory/-/laravel-nova-file-factory-0.0.1.tgz#644476e6522eb68a6bd714f83e823875c708eab3"
integrity sha512-YPaesy8TmgrQ7DQMIjmDb/nfKCN3/s+uBlPq/Qax9XF+iRIzuhqqRNTimm4AMBIH5iGFm+2sM2M/V1f+aAPtyw==
dependencies:
"@pipe-dream/core" "^1.0.4"
"@pipe-dream/laravel-file-factory" "^1.0.8"
"@vue/test-utils" "^1.0.0-beta.29"
babel-core "7.0.0-bridge.0"
babel-jest "^23.6.0"
babel-plugin-module-resolver "^3.2.0"
babel-plugin-transform-es2015-modules-commonjs "^6.26.2"
change-case "^3.1.0"
collect.js "^4.6.5"
cross-env "^5.1"
deepmerge "^3.2.0"
expose-loader "^0.7.5"
jest "^24.8.0"
laravel-mix "^4.0.14"
laravel-mix-purgecss "^4.1"
laravel-mix-tailwind "^0.1.0"
pluralize "^7.0.0"
raw-loader "^3.0.0"
resolve-url-loader "^2.3.1"
sass "^1.15.2"
sass-loader "^7.1.0"
tailwindcss "^0.7.4"
vue "^2.5.17"
vue-highlightjs "^1.3.3"
vue-jest "^3.0.4"
vue-template-compiler "^2.6.10"
vue-textarea-autosize "^1.0.4"
vuex "^3.1.0"

last-call-webpack-plugin@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz#9742df0e10e3cf46e5c0381c2de90d3a7a2d7555"
Expand Down

0 comments on commit 9eb964e

Please sign in to comment.