You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2021/11/13 16:16:33 UTC

[cordova-ios] branch master updated: refactor(create)!: move apple_* binaries & cleanup copyScripts (#1194)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-ios.git


The following commit(s) were added to refs/heads/master by this push:
     new 8710228  refactor(create)!: move apple_* binaries & cleanup copyScripts (#1194)
8710228 is described below

commit 8710228dc62324898c0c482f5a72d128baf8a012
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Sat Nov 13 17:16:27 2021 +0100

    refactor(create)!: move apple_* binaries & cleanup copyScripts (#1194)
    
    Since we no longer support the platform-centric process, the
    `apple_*_version` binaries can now be moved into the scripts template
    directory. That also means the copyScripts method can be radically
    simplified.
    
    Co-authored-by: Erisu <er...@apache.org>
---
 bin/lib/create.js                                       | 16 ----------------
 bin/{ => templates/scripts/cordova}/apple_ios_version   |  2 +-
 bin/{ => templates/scripts/cordova}/apple_osx_version   |  2 +-
 bin/{ => templates/scripts/cordova}/apple_xcode_version |  2 +-
 4 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/bin/lib/create.js b/bin/lib/create.js
index 1e46a3a..08c4fb8 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -65,27 +65,11 @@ function copyScripts (projectPath, projectName) {
     fs.removeSync(destScriptsDir);
 
     // Copy in the new ones.
-    const binDir = path.join(ROOT, 'bin');
     fs.copySync(srcScriptsDir, destScriptsDir);
 
     const nodeModulesDir = path.join(ROOT, 'node_modules');
     if (fs.existsSync(nodeModulesDir)) fs.copySync(nodeModulesDir, path.join(destScriptsDir, 'node_modules'));
 
-    // Copy the version scripts
-    fs.copySync(path.join(binDir, 'apple_ios_version'), path.join(destScriptsDir, 'apple_ios_version'));
-    fs.copySync(path.join(binDir, 'apple_osx_version'), path.join(destScriptsDir, 'apple_osx_version'));
-    fs.copySync(path.join(binDir, 'apple_xcode_version'), path.join(destScriptsDir, 'apple_xcode_version'));
-
-    // TODO: the two files being edited on-the-fly here are shared between
-    // platform and project-level commands. the below `sed` is updating the
-    // `require` path for the two libraries. if there's a better way to share
-    // modules across both the repo and generated projects, we should make sure
-    // to remove/update this.
-    const path_regex = /templates\/scripts\/cordova\//;
-    utils.replaceFileContents(path.join(destScriptsDir, 'apple_ios_version'), path_regex, '');
-    utils.replaceFileContents(path.join(destScriptsDir, 'apple_osx_version'), path_regex, '');
-    utils.replaceFileContents(path.join(destScriptsDir, 'apple_xcode_version'), path_regex, '');
-
     // CB-11792 do a token replace for __PROJECT_NAME__ in .xcconfig
     const project_name_esc = projectName.replace(/&/g, '\\&');
     utils.replaceFileContents(path.join(destScriptsDir, 'build-debug.xcconfig'), /__PROJECT_NAME__/g, project_name_esc);
diff --git a/bin/apple_ios_version b/bin/templates/scripts/cordova/apple_ios_version
similarity index 92%
rename from bin/apple_ios_version
rename to bin/templates/scripts/cordova/apple_ios_version
index 91fbb0a..cf1bf35 100755
--- a/bin/apple_ios_version
+++ b/bin/templates/scripts/cordova/apple_ios_version
@@ -19,6 +19,6 @@
     under the License.
 */
 
-const versions = require('./templates/scripts/cordova/lib/versions.js');
+const versions = require('./lib/versions.js');
 
 versions.printOrDie('apple_ios');
diff --git a/bin/apple_osx_version b/bin/templates/scripts/cordova/apple_osx_version
similarity index 92%
rename from bin/apple_osx_version
rename to bin/templates/scripts/cordova/apple_osx_version
index fa02db1..434d1ea 100755
--- a/bin/apple_osx_version
+++ b/bin/templates/scripts/cordova/apple_osx_version
@@ -19,6 +19,6 @@
     under the License.
 */
 
-const versions = require('./templates/scripts/cordova/lib/versions.js');
+const versions = require('./lib/versions.js');
 
 versions.printOrDie('apple_osx');
diff --git a/bin/apple_xcode_version b/bin/templates/scripts/cordova/apple_xcode_version
similarity index 92%
rename from bin/apple_xcode_version
rename to bin/templates/scripts/cordova/apple_xcode_version
index a2e752b..18af513 100755
--- a/bin/apple_xcode_version
+++ b/bin/templates/scripts/cordova/apple_xcode_version
@@ -19,6 +19,6 @@
     under the License.
 */
 
-const versions = require('./templates/scripts/cordova/lib/versions.js');
+const versions = require('./lib/versions.js');
 
 versions.printOrDie('apple_xcode');

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org