Uswds: [Package]: Politespace caused build to fail on customized standards

Created on 11 Aug 2016  路  4Comments  路  Source: uswds/uswds

Description

We are creating an extension of the USWDS; whereby, we leverage the good work here and the modular approach to extend or override.

  1. It seems Node.js 3.x uses a flat folder structure for dependencies: https://docs.npmjs.com/how-npm-works/npm3 - therefore, we had some problems with includes and requires.
  2. We tried copying just the uswds.min.js and just requiring it into our build. However, ran into issues with JS compiling due to Politespace not being found. Therefore, we copied over /node_modules/uswds/src/js to our /src/js/vendor (following the copy vendor files methodology. Same issue.
  3. We modified the copy of the uswds.min.js to go one folder higher to find the Politespace stored in our /node_modules. The had it be ignored when we do copy-vendor-javascript. This does not seem like a permanent solution.

Thoughts?

Steps to reproduce the issue

  1. Copy the /node_modules/uswds/src/js directory to /src/js/vendor
  2. Create /src/js/start.js with require('./vendor/start.js');
  3. Run $ gulp release
  4. Should fail
  5. Modify the /src/js/vendor/start.js:

From:

var Politespace = require('../../node_modules/politespace/src/politespace').Politespace;

To:

var Politespace = require('../../../node_modules/politespace/src/politespace').Politespace;

  1. Run $ gulp release
  2. Should build.

Additional information

gsa/sam-web-design-standards#45

gsa/sam-web-design-standards#13

screen shot 2016-08-11 at 10 15 24 am

$ gulp copy-vendor-javascript

gulp.task('copy-vendor-javascript', function (done) {

  dutil.logMessage('copy-vendor-javascript', 'Compiling vendor JavaScript');

  var stream = gulp.src([ // TODO: Should we copy the USWDS Sass, as it is a vendor?
      // './node_modules/uswds/dist/js/uswds.min.js'
      './node_modules/uswds/src/js/**/*.js',
      '!./node_modules/uswds/src/js/start.js'
    ])
    .on('error', function (error) {
      dutil.logError('copy-vendor-javascript', error);
    })
    .pipe(gulp.dest('src/js/vendor/'))
    .pipe(gulp.dest('_site-assets/js/vendor/'))

  return stream;
});
front end bug

Most helpful comment

This seems like the last nail on the coffin to remove Politespace and replace it with FieldKit.

All 4 comments

This seems like the last nail on the coffin to remove Politespace and replace it with FieldKit.

Making a note here... check out this comment on how we are moving forward in regards to Politespace removal.

Politespace is still mentioned at: https://standards.usa.gov/form-templates/#02-address-form

Hi @tomberek, that's actually intentional. We removed Politespace as a dependency from the Standards "core", but are still using it on the site for demonstration purposes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maya picture maya  路  4Comments

thisisdano picture thisisdano  路  4Comments

noonkay picture noonkay  路  6Comments

maya picture maya  路  4Comments

yowill picture yowill  路  6Comments