dev/core#2197 Deploy monaco-editor using composer.json / composer downloads method
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 18 Nov 2020 08:53:49 +0000 (19:53 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Thu, 19 Nov 2020 01:04:32 +0000 (12:04 +1100)
Remove setup.sh as no longer needed and npm related package files

composer.json
composer.lock
ext/afform/html/afform_html.php
ext/afform/html/bin/setup.sh [deleted file]
ext/afform/html/package-lock.json [deleted file]
ext/afform/html/package.json [deleted file]

index 8f4edd6c055693abe14b9750f73a326105fef0ed..867a641f2edc6697dd708eb59f6ebbb44351cb4c 100644 (file)
         "url": "https://github.com/markedjs/marked/archive/v0.8.0.zip",
         "ignore": [".*", "*.json", "*.md", "Makefile", "*/*"]
       },
+      "monaco-editor": {
+        "url": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.16.2.tgz",
+        "path": "ext/afform/html/bower_components/monaco-editor"
+      },
       "google-code-prettify": {
         "url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip",
         "ignore": ["closure-compiler", "js-modules", "tests", "yui-compressor", "Makefile", "examples", "*.html", "run_prettify*js"]
index 8a7b77d823597dfe3b658ceacbf0b97396d17885..0d077a8513f6131e3fcf0e686d4f9eb6868c8815 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "7e6ef8d4248bce0f976048cabc185289",
+    "content-hash": "0a477e3a819cc7555e2993da4e8e1754",
     "packages": [
         {
             "name": "adrienrn/php-mimetyper",
                 }
             ],
             "description": "Composer plugin for downloading additional files within any composer package.",
-            "time": "2020-11-02T04:00:42+00:00"
+            "time": "2020-11-02T05:26:23+00:00"
         },
         {
             "name": "cweagans/composer-patches",
index 8b45581d59a0d1bf5b7bd7f6b9cebe5f346484b3..c7dd357d7ab2a8add95b4737bb0de94d558763d9 100644 (file)
@@ -4,7 +4,7 @@ require_once 'afform_html.civix.php';
 use CRM_AfformHtml_ExtensionUtil as E;
 
 if (!defined('AFFORM_HTML_MONACO')) {
-  define('AFFORM_HTML_MONACO', 'node_modules/monaco-editor/min/vs');
+  define('AFFORM_HTML_MONACO', 'bower_components/monaco-editor/min/vs');
 }
 
 /**
@@ -153,7 +153,7 @@ function afform_html_civicrm_check(&$messages) {
   if (!file_exists($dir)) {
     $messages[] = new CRM_Utils_Check_Message(
       'afform_html_monaco',
-      ts('Afform HTML is missing its "node_modules" folder. Please consult the README.md for current installation instructions.'),
+      ts('Afform HTML is missing its "bower_components" folder. Please consult the README.md for current installation instructions.'),
       ts('Afform HTML: Packages are missing'),
       \Psr\Log\LogLevel::CRITICAL,
       'fa-chain-broken'
diff --git a/ext/afform/html/bin/setup.sh b/ext/afform/html/bin/setup.sh
deleted file mode 100755 (executable)
index ed1e89b..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-EXTROOT=$(cd `dirname $0`/..; pwd)
-EXTKEY="org.civicrm.afform-html"
-
-##############################
-function do_help() {
-  echo "usage: $0 [options]"
-  echo "example: $0"
-  echo "  -h     (Help)           Show this help screen"
-  echo "  -D     (Download)       Download dependencies"
-  echo "  -z     (Zip)            Build installable ZIP file"
-}
-
-##############################
-function use_civiroot() {
-  if [ -z "$CIVIROOT" ]; then
-    CIVIROOT=$(cv ev 'echo $GLOBALS["civicrm_root"];')
-    if [ -z "$CIVIROOT" -o ! -d "$CIVIROOT" ]; then
-      do_help
-      echo ""
-      echo "ERROR: invalid civicrm-dir: [$CIVIROOT]"
-      exit
-    fi
-  fi
-}
-
-##############################
-function cleanup() {
-  use_civiroot
-  ## No DAOs or XML build to cleanup
-}
-
-##############################
-function do_download() {
-  pushd "$EXTROOT" >> /dev/null
-    npm install
-  popd >> /dev/null
-}
-
-##############################
-## Build installable ZIP file
-function do_zipfile() {
-  local canary="$EXTROOT/node_modules/monaco-editor/package.json"
-  if [ ! -f "$canary" ]; then
-    echo "Error: File $canary missing. Are you sure the build is ready?"
-    exit 1
-  fi
-
-  local zipfile="$EXTROOT/build/$EXTKEY.zip"
-  [ -f "$zipfile" ] && rm -f "$zipfile"
-  [ ! -d "$EXTROOT/build" ] && mkdir "$EXTROOT/build"
-  pushd "$EXTROOT" >> /dev/null
-    ## Build a list of files to include.
-    ## Put the files into the *.zip, using a $EXTKEY as a prefix.
-    {
-       ## Get any files in the project root, except for dotfiles.
-       find . -mindepth 1 -maxdepth 1 -type f -o -type d | grep -v '^\./\.'
-       ## Get any files in the main subfolders.
-       #find CRM/ ang/ api/ bin/ css/ js/ sql/ sass/ settings/ templates/ tests/ xml/ -type f -o -type d
-       find bin/ xml/ -type f -o -type d
-       ## Get the distributable files for Monaco.
-       find node_modules/monaco-editor/LICENSE node_modules/monaco-editor/min -type f -o -type d
-    } \
-      | grep -v '~$' \
-      | php bin/add-zip-regex.php "$zipfile" ":^:" "$EXTKEY/"
-  popd >> /dev/null
-  echo "Created: $zipfile"
-}
-
-##############################
-## Main
-HAS_ACTION=
-
-while getopts "aDghz" opt; do
-  case $opt in
-    h)
-      do_help
-      HAS_ACTION=1
-      ;;
-    D)
-      do_download
-      HAS_ACTION=1
-      ;;
-    z)
-      do_zipfile
-      HAS_ACTION=1
-      ;;
-    \?)
-      do_help
-      echo "Invalid option: -$OPTARG" >&2
-      exit 1
-      ;;
-    :)
-      echo "Option -$OPTARG requires an argument." >&2
-      exit 1
-      ;;
-  esac
-done
-
-if [ -z "$HAS_ACTION" ]; then
-  do_help
-  exit 2
-fi
diff --git a/ext/afform/html/package-lock.json b/ext/afform/html/package-lock.json
deleted file mode 100644 (file)
index 7a3ea02..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "name": "afform_html",
-  "version": "0.0.1",
-  "lockfileVersion": 1,
-  "requires": true,
-  "dependencies": {
-    "monaco-editor": {
-      "version": "0.16.2",
-      "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.16.2.tgz",
-      "integrity": "sha512-NtGrFzf54jADe7qsWh3lazhS7Kj0XHkJUGBq9fA/Jbwc+sgVcyfsYF6z2AQ7hPqDC+JmdOt/OwFjBnRwqXtx6w=="
-    }
-  }
-}
diff --git a/ext/afform/html/package.json b/ext/afform/html/package.json
deleted file mode 100644 (file)
index d7e8a1b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "name": "afform_html",
-  "version": "0.0.1",
-  "description": "![Screenshot](/images/screenshot.png)",
-  "main": "index.js",
-  "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
-  },
-  "author": "",
-  "repository": "https://github.com/totten/afform",
-  "license": "AGPL-3.0",
-  "dependencies": {
-    "monaco-editor": "^0.16.2"
-  }
-}