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

Pin NPM packages using npm shrinkwrap for repeatable builds #794

Closed
wants to merge 4 commits into from

Conversation

mattbostock
Copy link

Pin NPM packages with npm shrinkwrap --dev.

Adds a minimal package.json created by running npm init and removing some lines; just enough to satistify npm install without it showing warnings. Also, run npm install each time make deps is invoked.

Note that there are changes to the generated drone.css when using Less version 2.2 (the latest) though in my testing I couldn't see any breakages.

I'm not very familiar with NPM or Less, so I'd appreciate any feedback.

As of Less version 2, the `--clean-css` functionality is provided by a
plugin, less-plugin-clean-css. See:

http:https://lesscss.org/usage/#v2-upgrade-guide-clean-css
Run `make lessc` using Less version 2 to update `drone.css`:

    » npm list -g uglify-js less autoprefixer less-plugin-clean-css
    /opt/boxen/homebrew/lib
    ├── [email protected]
    ├─┬ [email protected]
    │ └─┬ [email protected]
    │   ├─┬ [email protected]
    │   │ ├─┬ [email protected]
    │   │ │ └── [email protected]
    │   │ ├─┬ [email protected]
    │   │ │ └── [email protected]
    │   │ └─┬ [email protected]
    │   │   └── [email protected]
    │   └── [email protected]
    ├── [email protected]
    ├── [email protected]
    └── [email protected]
Pin NPM packages with `npm shrinkwrap --dev`.

Adds a minimal `package.json` created by running `npm init` and removing
some lines; just enough to satistify `npm install` without it showing
warnings.

Add the `node_modules/` directory to the `.gitignore` file as we can
probably rely on the NPM registry server and this diverges as little as
possible from the current behaviour (i.e. don't vendor anything). The
decision not to vendor the NPM modules can always be reviewed later.

This commit tells NPM to install the packages in the current directory
rather than globally, which will make it easier to vendor the NPM
packages in future if desired.
The NPM modules, used primarily to render the Less files into CSS, don't
seem any less important than other build dependencies so I don't see the
harm in running this every time `make deps` is invoked.
@mattbostock mattbostock changed the title Pin NPM packages using npm shrinkwrap Pin NPM packages using npm shrinkwrap for repeatable builds Jan 11, 2015
@kzaitsev
Copy link

i think file server/app/styles/drone.css can be add to .gitignore

@mattbostock
Copy link
Author

@Bugagazavr I'm inclined to agree, since it's a generated file.

I think the Makefile would need changing, as we wouldn't want people to build drone without the CSS files. Perhaps the deps and build tasks could be merged into one? Or at least, deps would probably be part of the default talk.

@bradrydzewski, what are your thoughts?

@bradrydzewski
Copy link

Since we only have lessc as a dependency I'd prefer to keep it as a global dependency requirement (autoprefixer is being removed in an upcoming PR, and we can use lessc -x instead of lessc clean-css). If we start to depend more heavily on node this is something I would consider.

@Bugagazavr since the majority of developers are contributing Go code I don't want them to have to install npm or node to test locally. My intention when checking in the CSS file was to minimize barrier to entry for Go developers that wanted to contribute to the project.

bot-harness pushed a commit that referenced this pull request Nov 13, 2023
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.

None yet

3 participants