question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow running the kit either as a project or as an npm package

See original GitHub issue

What

Make changes to the code in this repo so that if the user installs it as a node module into another project using npm install /path/to/govuk-prototype-kit, they can run the kit using node node_modules/govuk-prototype-kit/start.js.

At the same time we still want the kit to work as it currently does, however, as its own project. This ticket does not include changing any documentation for users, or how we distribute the kit.

Also out of scope is anything to do with the v6 compatibility mode or docs app.

Why

We want to be able to distribute the prototype kit as an npm package, so we need to support the kit running from the node modules folder. We haven’t decided yet on how exactly it will work as an npm package, so we can’t do much more than lay the groundwork, which why this ticket is tightly limited in scope, but we might as well do the groundwork now, as we know it is necessary.

Who needs to work on this

Developer

Who needs to review this

Developer, Tech lead (@natcarey)

Further details

@natcarey did a spike on this,

Done when

  • govuk-prototype-kit can run when installed as a node modules
  • We have tests successfully running govuk-prototype kit as a node module
  • govuk-prototype-kit can still be run from project folder

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
lfdebruxcommented, May 27, 2022

I am in favour of the direction of kit as a module:

  • more clearly and safely separates user code from kit code
  • this theoretically makes updating much smoother, which is one of our user’s biggest problems

However, I’m unsure about offering 2 approaches to users, it complicates things for them. I would prefer to investigate kit as a module as a private beta with invited users, and when ready move to kit as a module for all users. There are key questions to resolve including:

  • what is the API we offer users? Currently some users need to customise ‘kit code’ - in a module this will not be possible. therefore we need to offer more hooks and document them
  • how do users get the ‘scaffolding’ - the folders they need to work in. @lfdebrux has suggested one approach above but I think we can develop these ideas to something more straightforward as he says
  • what if at some point even the ‘scaffolding’ needs updating?

Sorry, I should have been clearer in the ticket, this is not about actually suggesting to users that they follow this method. This is about making changes to the code that are necessary to allow us to make our code into a package, however we do it. If we want to have a private beta, we will still need to do this work. I agree with your key questions, but we won’t be able to explore them unless we do this work.


I’ve updated the ticket now to make it clearer that this is only about code changes.

0reactions
joelanmancommented, May 31, 2022

on looking for extensions, I think it makes sense to only look at the user’s package.json (then they’re in control as @natcarey says) … but then that brings up the initial user experience and how they get useful ‘starter’ extensions like Frontend, etc

Read more comments on GitHub >

github_iconTop Results From Across the Web

package.json - npm Docs
This file contains the dependencies renderized and super-streams which can be installed in a new project by executing npm install awesome-web-framework-1.0.0.
Read more >
'npm start' returns error: "There might be a problem with the ...
Try running npm ls webpack in your project folder. This will tell you which other package (apart from the expected react-scripts) installed ...
Read more >
npm packages in the Package Registry - GitLab Documentation
Watch a video demo of how to publish npm packages to the GitLab Package ... Project-level: Use when you have few npm packages...
Read more >
Working with the npm registry - GitHub Docs
The GitHub Packages registry stores npm packages within your organization or personal account, and allows you to associate a package with a repository....
Read more >
How To Use Node.js Modules with npm and package.json
Note: If your code will use Git for version control, create the Git repository first and then run npm init . The command...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found