Giter Club home page Giter Club logo

edition-node-grunt's People

Contributors

benhalverson avatar bmuenzenmeyer avatar greenc avatar hjylewis avatar jcarpe avatar simonknittel avatar tburny avatar tommcc avatar u982744 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

edition-node-grunt's Issues

JS files doesn't trigger reload

I am using Edition Node Grunt v1.0.1 on Mac, with Node v6.9.4.

Expected Behavior

If I change a *.js file after running patternlab:serve the page should be updated like if I change a CSS file.

Actual Behavior

Nothing is updated.

Cannot run grunt patternlab:*

I am using Edition Node Grunt v2.12.0 on Linux, with Node v10.6.0.

Expected Behavior

Running grunt patternlab:serve runs pattern lab

Actual Behavior

Error
====[ Pattern Lab / Node - v2.12.0 ]====

Loading "Gruntfile.js" tasks...ERROR

TypeError: Cannot read property 'options' of undefined
at pluginInit (/home/juanfernandes/sites/design-framework/node_modules/plugin-node-tab/index.js:64:66)
at initializePlugins (/home/juanfernandes/sites/design-framework/node_modules/patternlab-node/core/lib/patternlab.js:135:7)
at patternlab_engine (/home/juanfernandes/sites/design-framework/node_modules/patternlab-node/core/lib/patternlab.js:183:3)
at Object.module.exports (/home/juanfernandes/sites/design-framework/Gruntfile.js:24:36)
at loadTask (/home/juanfernandes/sites/design-framework/node_modules/grunt/lib/grunt/task.js:315:10)
at Task.task.init (/home/juanfernandes/sites/design-framework/node_modules/grunt/lib/grunt/task.js:434:5)
at Object.grunt.tasks (/home/juanfernandes/sites/design-framework/node_modules/grunt/lib/grunt.js:111:8)
at Object.module.exports [as cli] (/home/juanfernandes/sites/design-framework/node_modules/grunt/lib/grunt/cli.js:27:9)
at Object. (/usr/local/lib/node_modules/grunt-cli/bin/grunt:44:20)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:236:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:560:3)

Running tasks: patternlab:serve
Warning: Task "patternlab:serve" not found. Use --force to continue.

My gruntfile:

/******************************************************

  • PATTERN LAB NODE
  • EDITION-NODE-GRUNT
  • The grunt wrapper around patternlab-node core, providing tasks to interact with the core library and move supporting frontend assets.
    ******************************************************/

module.exports = function (grunt) {

var path = require('path'),
argv = require('minimist')(process.argv.slice(2));

// load all grunt tasks
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.loadNpmTasks('grunt-contrib-sass');

/******************************************************

  • PATTERN LAB CONFIGURATION
    ******************************************************/

//read all paths from our namespaced config file
var config = require('./patternlab-config.json'),
pl = require('patternlab-node')(config);

function paths() {
return config.paths;
}

function getConfiguredCleanOption() {
return config.cleanPublic;
}

grunt.registerTask('patternlab', 'create design systems with atomic design', function (arg) {

if (arguments.length === 0) {
  pl.build(function(){}, getConfiguredCleanOption());
}

if (arg && arg === 'version') {
  pl.version();
}

if (arg && arg === "patternsonly") {
  pl.patternsonly(function(){},getConfiguredCleanOption());
}

if (arg && arg === "help") {
  pl.help();
}

if (arg && arg === "liststarterkits") {
  pl.liststarterkits();
}

if (arg && arg === "loadstarterkit") {
  pl.loadstarterkit(argv.kit, argv.clean);
}

if (arg && (arg !== "version" && arg !== "patternsonly" && arg !== "help" && arg !== "starterkit-list" && arg !== "starterkit-load")) {
  pl.help();
}

});

grunt.initConfig({

/******************************************************
 * COPY TASKS
******************************************************/
copy: {
  main: {
    files: [
      { expand: true, cwd: path.resolve(paths().source.js), src: '**/*.js', dest: path.resolve(paths().public.js) },
      { expand: true, cwd: path.resolve(paths().source.js), src: '**/*.js.map', dest: path.resolve(paths().public.js) },
      { expand: true, cwd: path.resolve(paths().source.css), src: '**/*.css', dest: path.resolve(paths().public.css) },
      { expand: true, cwd: path.resolve(paths().source.css), src: '**/*.css.map', dest: path.resolve(paths().public.css) },
      { expand: true, cwd: path.resolve(paths().source.images), src: '**/*', dest: path.resolve(paths().public.images) },
      { expand: true, cwd: path.resolve(paths().source.fonts), src: '**/*', dest: path.resolve(paths().public.fonts) },
      { expand: true, cwd: path.resolve(paths().source.root), src: 'favicon.ico', dest: path.resolve(paths().public.root) },
      { expand: true, cwd: path.resolve(paths().source.styleguide), src: ['*', '**'], dest: path.resolve(paths().public.root) },
      // slightly inefficient to do this again - I am not a grunt glob master. someone fix
      { expand: true, flatten: true, cwd: path.resolve(paths().source.styleguide, 'styleguide', 'css', 'custom'), src: '*.css)', dest: path.resolve(paths().public.styleguide, 'css') }
    ]
  }
},
/******************************************************
 * SERVER AND WATCH TASKS
******************************************************/
watch: {
  all: {
    files: [
      path.resolve(paths().source.scss + '**/*.scss'),
      // path.resolve(paths().source.css + '**/*.css'),
      path.resolve(paths().source.styleguide + 'css/*.css'),
      path.resolve(paths().source.patterns + '**/*'),
      path.resolve(paths().source.fonts + '/*'),
      path.resolve(paths().source.images + '/*'),
      path.resolve(paths().source.data + '*.json'),
      path.resolve(paths().source.js + '/*.js'),
      path.resolve(paths().source.root + '/*.ico')
    ],
    tasks: ['default', 'bsReload:css']
  }
},
sass: {
  options: {
    style: 'expanded'
  },
  dist: {
    files: {
      'source/css/style.css': 'source/scss/style.scss'
    }
  }
},
browserSync: {
  dev: {
    options: {
      server:  path.resolve(paths().public.root),
      watchTask: true,
      watchOptions: {
        ignoreInitial: true,
        ignored: '*.html'
      },
      snippetOptions: {
        // Ignore all HTML files within the templates folder
        blacklist: ['/index.html', '/', '/?*']
      },
      plugins: [
        {
          module: 'bs-html-injector',
          options: {
            files: [path.resolve(paths().public.root + '/index.html'), path.resolve(paths().public.styleguide + '/styleguide.html')]
          }
        }
      ],
      notify: {
        styles: [
          'display: none',
          'padding: 15px',
          'font-family: sans-serif',
          'position: fixed',
          'font-size: 1em',
          'z-index: 9999',
          'bottom: 0px',
          'right: 0px',
          'border-top-left-radius: 5px',
          'background-color: #1B2032',
          'opacity: 0.4',
          'margin: 0',
          'color: white',
          'text-align: center'
        ]
      }
    }
  }
},
bsReload: {
  css: path.resolve(paths().public.root + '**/*.css')
}

});

/******************************************************

  • COMPOUND TASKS
    ******************************************************/

grunt.registerTask('default', ['patternlab', 'sass', 'copy:main']);
grunt.registerTask('patternlab:build', ['patternlab', 'sass', 'copy:main']);
grunt.registerTask('patternlab:watch', ['patternlab', 'sass', 'copy:main', 'watch:all']);
grunt.registerTask('patternlab:serve', ['patternlab', 'sass', 'copy:main', 'browserSync', 'watch:all']);
};

Steps to Reproduce

I cd into my sites/design-framework folder and run: grunt patternlab:serve

Regression for 1.2.0: Loading a starterkit still shows help

I am using Edition Node Grunt v1.2.0 on Linux, with Node v2.7.2.

Expected Behavior

Using grunt patternlab:loadstarterkit --kit=[kit] yields

Running "patternlab:loadstarterkit" (patternlab) task
Attempting to load starterkit from edition-node-grunt/node_modules/starterkit/dist
Overwriting contents of ./source/ during starterkit load.

Done.
Actual Behavior

It does the above but also shows the help. Still, loadstarterkit is executed, which could irritate users.

Steps to Reproduce

Execute grunt patternlab:loadstarterkit --kit=[kit] on Version 1.2.0.

Installation as dependency doesn't work

I am using Edition Node Grunt v1.1.0 on Windows, with Node v6.5.0.

Expected Behavior

Installation as dependecy works

Actual Behavior

postinstall script throws Exception after installation

Steps to Reproduce
mkdir test
cd test
npm init
npm install --save edition-node-grunt
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN prefer global [email protected] should be installed with -g

> [email protected] postinstall C:\Users\schleuse\Desktop\test\node_modules\edition-node-grunt
> node node_modules/patternlab-node/core/scripts/postinstall.js

module.js:457
    throw err;
    ^

Error: Cannot find module 'C:\Users\schleuse\Desktop\test\node_modules\edition-node-grunt\node_modules\patternlab-node\core\scripts\postinstall.js'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\schleuse\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "edition-node-grunt"
npm ERR! node v6.5.0
npm ERR! npm  v3.10.6
npm ERR! code ELIFECYCLE

npm ERR! [email protected] postinstall: `node node_modules/patternlab-node/core/scripts/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'node node_modules/patternlab-node/core/scripts/postinstall.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the edition-node-grunt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/patternlab-node/core/scripts/postinstall.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs edition-node-grunt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls edition-node-grunt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\schleuse\Desktop\test\npm-debug.log

npm-debug.txt

Investigate Compatability with Node 6.X

During WDD 2016 one user reported errors in what appeared to be core Node code. The only difference between his rig and mine that I could tell was the Node version, me being on 5.5.X and him being on 6.X.X

Wrong names for starterkit tasks

I am using Edition Node Grunt v2.3.0 on Mac, with Node v4.4.7.

Expected Behavior

According to grunt patternlab:help, grunt patternlab:liststarterkits should list the available starterkits. grunt patternlab:loadstarterkit --kit=[starterkit-name] should copy the starterkit files to ./source/.

Actual Behavior

Both commands/tasks just show the Pattern Lab Node Help.

Steps to Reproduce

Enter either grunt patternlab:liststarterkits or grunt patternlab:loadstarterkit --kit=[starterkit-name]. (Tested in master and dev.)

Apparently, the proper commands are grunt patternlab:starterkit-list and grunt patternlab:starterkit-load --kit=[starterkit-name] (figured that out looking at the Gruntfile.js). Probably just “legacy documentation” (in the README and patternlab:help)?

Loading starterkit does not copy files

I am using Edition Node Grunt v2.3.0 on Mac, with Node v4.4.7.

Expected Behavior

grunt patternlab:starterkit-load --kit=[starterkit-name] should copy the files from node_modules/[starterkit-name]/dist to ./source/.

Actual Behavior

Task runs with proper output/path names etc., but does not actually copy any files (tested with starterkit-mustache-demo in master and dev).

Steps to Reproduce
  1. npm install starterkit-mustache-demo
  2. grunt patternlab:starterkit-load --kit=starterkit-mustache-demo

Here's a gist of the output that I get for this. ./source/_patterns/ remains empty.

Grunt plugin

Is there a reason this isn't set up as a grunt plugin for easy installation and configuration using grunt.loadNpmTasks('edition-node-grunt') and grunt.initConfig instead of the config.json file?

This would avoid the mess that occurs if one wanted to run patternlab node as a npm dependency.

Having the ability to include patterns without a prefixed patterntType

Summary
When linking patterns in other patterns it requires the patternType to be prefixed before the pattern.
E.g. {{> promos-promo-1 }}
It'd be great if there were a way around this.

Use Case
I'm using the _patterns folder as a central source for handlebars files to be used in Pattern Lab and in my Yeoman generator. Pattern Lab serves as my documentation and patterns source, while the Yeoman generator is my scaffolding for projects that utilizes the handlebars files in Pattern Lab.

Issue
The issue I'm running into is including patterns in other patterns causes errors in my generator because a linked pattern like {{> promos-promo-1 }} only works in Pattern Lab.

My current solution is utilizing regex to remove all the prefixes, allowing the original (unprefixed) handlebars file {{> promo-1 }} to work.

Watcher doesn't catch new files

I am using Edition Node Grunt v2.3.0 on Windows, with Node v6.3.1.

Expected Behavior

The Creation of new patterns should trigger the watcher to rebuild patternlab.

Actual Behavior

Nothing happens when new patterns are created. I have to restart my watch-task to trigger a rebuild.

Steps to Reproduce

Start the Watcher.
Create a new pattern.
See nothing happen.

Seems to be a general issue with grunt-contrib-watch or more specifically fs.watch (gruntjs/grunt-contrib-watch#282)

My current workaround is to remove the call of path.resolve(...) around the paths that should be watched. Absolute paths seem to mess with grunt-contrib-watch

"grunt patternlab:build" task does not do anything

Expected Behavior

Running grunt patternlab:build generates the front-end of Pattern Lab

Actual Behavior

Running grunt patternlab:build does nothing (except output the help text)

Steps to Reproduce
  • Delete the public/ directory
  • Run grunt patternlab:build task
  • Verify that public/ directory has not been created/populated
Steps to Fix

Should just be a case of adding the task alias to Grunt. PR incoming.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.