build: switch to npm

We have little reason to use Yarn now. Moreover, Yarn requires to
embed itself into the repository and that's something I'd like to
avoid.

Fix #2
This commit is contained in:
Vincent Bernat
2022-07-14 15:01:42 +02:00
parent a3017a5907
commit 2eee9bd6cd
11 changed files with 5640 additions and 1972 deletions

View File

@@ -49,14 +49,11 @@ jobs:
cache: true
# Cache
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
id: yarn-cache
id: npm-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('console/frontend/yarn.lock') }}
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('console/frontend/package-lock.json') }}
- uses: actions/cache@v3
id: gobin-cache
with:

3
.gitignore vendored
View File

@@ -5,10 +5,9 @@
/orchestrator/clickhouse/data/asns.csv
/console/filter/parser.go
/console/frontend/node_modules/
/console/frontend/data/fields.json
/console/data/frontend/
*~
/.go-cache
/.yarn-cache
/.npm-cache

View File

@@ -16,9 +16,9 @@ run tests:
- bin/
- key:
files:
- yarn.lock
- console/frontend/package-lock.json
paths:
- .yarn-cache
- .npm-cache
variables:
FF_NETWORK_PER_BUILD: "true"
CI_AKVORADO_FUNCTIONAL_TESTS: "true"
@@ -36,9 +36,9 @@ run tests:
- name: clickhouse/clickhouse-server:22.3
alias: clickhouse
script:
- time apk add --no-cache git make gcc musl-dev protoc shared-mime-info yarn curl
- time apk add --no-cache git make gcc musl-dev protoc shared-mime-info npm curl
- export GOMODCACHE=$PWD/.go-cache
- yarn config set cacheFolder $PWD/.yarn-cache
- npm config --user set cache $PWD/.npm-cache
- time go mod download
- time make test
- time make test-race || make test-race

View File

@@ -1,5 +1,5 @@
FROM golang:1.18-alpine AS build
RUN apk add --no-cache git make gcc musl-dev protoc shared-mime-info yarn curl
RUN apk add --no-cache git make gcc musl-dev protoc shared-mime-info npm curl
WORKDIR /app
COPY go.mod ./
COPY go.sum ./

View File

@@ -80,9 +80,9 @@ common/clickhousedb/mocks/mock_driver.go: Makefile | $(MOCKGEN) ; $(info $(M) ge
console/filter/parser.go: console/filter/parser.peg | $(PIGEON) ; $(info $(M) generate PEG parser for filters)
$Q $(PIGEON) -optimize-basic-latin $< > $@
console/frontend/node_modules: console/frontend/package.json console/frontend/yarn.lock
console/frontend/node_modules: console/frontend/package.json console/frontend/package-lock.json
console/frontend/node_modules: ; $(info $(M) fetching node modules)
$Q yarn install --silent --frozen-lockfile --cwd console/frontend && touch $@
$Q (cd console/frontend ; npm ci --quiet --no-audit --no-fund) && touch $@
console/frontend/data/fields.json: console/query.go ; $(info $(M) generate list of selectable fields)
$Q sed -En -e 's/^\tqueryColumn([a-zA-Z]+)( .*|$$)/ "\1"/p' $< \
| sed -E -e '1i [' -e '$$ ! s/$$/,/' -e '$$a ]'> $@
@@ -91,7 +91,7 @@ console/data/frontend: Makefile console/frontend/node_modules
console/data/frontend: console/frontend/data/fields.json
console/data/frontend: $(shell $(LSFILES) console/frontend 2> /dev/null)
console/data/frontend: ; $(info $(M) building console frontend)
$Q cd console/frontend && yarn --silent build
$Q cd console/frontend && npm run --silent build
orchestrator/clickhouse/data/asns.csv: ; $(info $(M) generate ASN map)
$Q curl -sL https://vincentbernat.github.io/asn2org/asns.csv | sed 's|,[^,]*$$||' > $@
@@ -136,7 +136,7 @@ lint: .lint-go~ .lint-js~ ; $(info $(M) running lint…) @ ## Run linting
$Q $(REVIVE) -formatter friendly -set_exit_status $?
$Q touch $@
.lint-js~: console/frontend/node_modules
$Q cd console/frontend && yarn --silent lint
$Q cd console/frontend && npm run --silent lint
$Q touch $@
.PHONY: fmt
@@ -145,7 +145,7 @@ fmt: .fmt-go~ .fmt-js~ ; $(info $(M) formatting code…) @ ## Format all source
$Q $(GOIMPORTS) -local $(MODULE) -w $? < /dev/null
$Q touch $@
.fmt-js~: console/frontend/node_modules
$Q cd console/frontend && yarn --silent format
$Q cd console/frontend && npm run --silent format
$Q touch $@
# Misc
@@ -153,7 +153,7 @@ fmt: .fmt-go~ .fmt-js~ ; $(info $(M) formatting code…) @ ## Format all source
.PHONY: licensecheck
licensecheck: console/frontend/node_modules | $(WWHRD) ; $(info $(M) check dependency licenses) @ ## Check licenses
$Q err=0 ; go mod vendor && $(WWHRD) --quiet check || err=$$? ; rm -rf vendor/ ; exit $$err
$Q cd console/frontend ; yarn run --silent license-compliance \
$Q cd console/frontend ; npm run --silent license-compliance \
--production \
--allow "MIT;ISC;Apache-2.0;BSD-3-Clause;WTFPL;0BSD" \
--report detailed

View File

@@ -6,9 +6,8 @@ single binary or Docker image.
## Compilation from source
You need a proper installation of [Go](https://go.dev/doc/install)
(1.17+) as well as
[Yarn](https://yarnpkg.com/getting-started/install). Then, simply
type:
(1.17+) as well as [NodeJS](https://nodejs.org/en/download/). Then,
simply type:
```console
# make

View File

@@ -160,7 +160,6 @@ rich.
The SPA is built using mostly the following components:
- [Yarn](https://yarnpkg.com/) as a package manager,
- [Vite](https://vitejs.dev/) as a builder,
- [Vue](https://vuejs.org/) as the reactive JavaScript framework,
- [TailwindCSS](https://tailwindcss.com/) for styling pages directly inside HTML,

View File

@@ -1,24 +1 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/node_modules

5620
console/frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -35,9 +35,9 @@
"@tailwindcss/typography": "^0.5.2",
"@vitejs/plugin-vue": "^3.0.0",
"autoprefixer": "^10.4.7",
"eslint": "^8.17.0",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-vue": "^9.1.1",
"eslint-plugin-vue": "^9.2.0",
"license-compliance": "^1.2.3",
"postcss": "^8.4.14",
"prettier": "^2.7.0",

File diff suppressed because it is too large Load Diff