Skip to content

Conversation

@veve40
Copy link
Contributor

@veve40 veve40 commented Nov 28, 2022

Merging fix/gruntfile-path into main

Changes :

Copy link
Collaborator

@mcaskill mcaskill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we make this path configurable to support framework (charcoal/charcoal) and package (charcoal/admin) installation as well as standalone installation (if package is cloned directly without being a dependency of a project)?

.gitignore:

  # Codebase
  
  /build/docs/
  /build/logs/
  /build/report/
+ /www/

Gruntfile.js:

      var path = require('path');
+     var cwd  = process.cwd();
+ 
+     var basePath = '';
+     if (cwd.includes('/vendor/charcoal/')) {
+         if (cwd.includes('/packages/admin/')) {
+             // Framework installation
+             basePath = '../../../../..';
+         } else {
+             // Package installation
+             basePath = '../../../';
+         }
+     }
  
      require('load-grunt-config')(grunt, {
-         configPath: path.join(process.cwd(), 'build/grunt/config'),
+         configPath: path.join(cwd, 'build/grunt/config'),
          data: {
              paths: {
                  grunt:    'build/grunt',
                  npm:      'node_modules',
                  composer: 'vendor',
                  dist:     'assets/dist',
-                 prod:     '../../../../../www/assets/admin',
+                 prod:     basePath + '/www/assets/admin',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants