Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
joshbruce opened this issue Aug 11, 2016 · 4 comments
Closed

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

joshbruce opened this issue Aug 11, 2016 · 4 comments
Labels
Type: Bug A problem in the code

Comments

@joshbruce
Copy link

joshbruce commented Aug 11, 2016

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-design-system-site#45

GSA/sam-design-system-site#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;
});
@rogeruiz
Copy link
Contributor

rogeruiz commented Aug 15, 2016

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

@juliaelman
Copy link
Contributor

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

@tomberek
Copy link

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

@shawnbot
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug A problem in the code
Projects
None yet
Development

No branches or pull requests

6 participants