mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Merge pull request #107 from prymitive/yarn
chore(ui): migrate from npm to yarn
This commit is contained in:
10
.travis.yml
10
.travis.yml
@@ -7,11 +7,11 @@ defaults_go: &DEFAULTS_GO
|
||||
|
||||
defaults_js: &DEFAULTS_JS
|
||||
language: node_js
|
||||
# install defaults to "npm install", which is done via make
|
||||
node_js: "8.12.0"
|
||||
# we run make to install everything
|
||||
install: []
|
||||
cache:
|
||||
directories:
|
||||
- ui/node_modules
|
||||
yarn: true
|
||||
|
||||
jobs:
|
||||
include:
|
||||
@@ -63,10 +63,6 @@ jobs:
|
||||
cache:
|
||||
# disable cache so we always build from scratch
|
||||
directories: []
|
||||
before_script:
|
||||
# this stage needs to build everything including assets file and that
|
||||
# requires running webpack, so we need nodejs here
|
||||
- nvm install $(< .nvmrc)
|
||||
script:
|
||||
# compile assets via webpack and build those into bindata_assetfs.go file
|
||||
- make bindata_assetfs.go
|
||||
|
||||
@@ -36,20 +36,11 @@ To update specific vendor package run `dep` manually:
|
||||
|
||||
See [dep](https://github.com/golang/dep) documentation for details.
|
||||
|
||||
## Javascript & CSS assets and HTML templates
|
||||
## Javascript & CSS assets
|
||||
|
||||
JS and CSS assets are managed via [npm](https://www.npmjs.com/) and compiled
|
||||
into bundle files using [webpack](https://webpack.js.org/).
|
||||
|
||||
To add a new JS asset install it using npm with the `--save` flag, this will
|
||||
add it to the `package.json`. Now you can `require()` it in javascript code.
|
||||
JS modules are written using [CommonJS](http://www.commonjs.org/specs/modules/1.0/)
|
||||
syntax. Webpack will use [babel](https://babeljs.io/) to transform JS code to
|
||||
[ES2015](https://babeljs.io/docs/plugins/preset-es2015/).
|
||||
|
||||
During development you can set `NODE_ENV=test` before running any make targets,
|
||||
this will prevent webpack from using expensive optimizations only needed when
|
||||
generating production assets.
|
||||
UI is written using [React](https://reactjs.org), follow user guide for
|
||||
[create-react-app](https://github.com/facebook/create-react-app) to make
|
||||
changes to the UI code.
|
||||
|
||||
## Running
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:8.11.4-alpine as nodejs-builder
|
||||
FROM node:8.12.0-alpine as nodejs-builder
|
||||
RUN apk add --update make git
|
||||
COPY . /karma
|
||||
RUN make -C /karma ui
|
||||
|
||||
10
Makefile
10
Makefile
@@ -34,9 +34,9 @@ endif
|
||||
go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
touch $@
|
||||
|
||||
.build/deps-build-node.ok: ui/package.json ui/package-lock.json
|
||||
.build/deps-build-node.ok: ui/package.json ui/yarn.lock
|
||||
@mkdir -p .build
|
||||
cd ui && npm install
|
||||
cd ui && yarn install
|
||||
touch $@
|
||||
|
||||
.build/artifacts-bindata_assetfs.%:
|
||||
@@ -46,8 +46,8 @@ endif
|
||||
|
||||
.build/artifacts-ui.ok: .build/deps-build-node.ok $(ASSET_SOURCES)
|
||||
@mkdir -p .build
|
||||
cd ui && npm run-script build-css
|
||||
cd ui && npm run build
|
||||
cd ui && yarn build-css
|
||||
cd ui && yarn build
|
||||
touch $@
|
||||
|
||||
bindata_assetfs.go: .build/deps-build-go.ok .build/artifacts-bindata_assetfs.$(GO_BINDATA_MODE) .build/vendor.ok .build/artifacts-ui.ok
|
||||
@@ -131,7 +131,7 @@ test-go: .build/vendor.ok
|
||||
|
||||
.PHONY: test-js
|
||||
test-js: .build/deps-build-node.ok
|
||||
cd ui && CI=true npm test -- --coverage
|
||||
cd ui && CI=true yarn test --coverage
|
||||
|
||||
.PHONY: test
|
||||
test: lint test-go test-js
|
||||
|
||||
@@ -88,7 +88,7 @@ To finally compile `karma` the binary run:
|
||||
|
||||
make
|
||||
|
||||
Note that building locally from sources requires Go, nodejs and npm.
|
||||
Note that building locally from sources requires Go, nodejs and yarn.
|
||||
See Docker build options below for instructions on building from withing docker
|
||||
container.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:8.11.4-alpine as nodejs-builder
|
||||
FROM node:8.12.0-alpine as nodejs-builder
|
||||
RUN apk add --update make git
|
||||
COPY . /karma
|
||||
RUN make -C /karma ui
|
||||
|
||||
13897
ui/package-lock.json
generated
13897
ui/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10008
ui/yarn.lock
Normal file
10008
ui/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user