move to npm workspace

Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
Augustin Husson 2021-09-10 15:38:20 +02:00
parent fa56d1e43b
commit 5c42b04af7
15 changed files with 4098 additions and 12439 deletions

2
.gitignore vendored
View file

@ -25,3 +25,5 @@ npm_licenses.tar.bz2
/vendor
/.build
/**/node_modules

View file

@ -5,7 +5,6 @@
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/camelcase": "warn",
"@typescript-eslint/explicit-function-return-type": ["off"],
"eol-last": [
"error",

View file

@ -16,14 +16,5 @@
set -ex
# build the lib (both ES2015 and CommonJS)
tsc --module ES2015 --target ES2015 --outDir lib/esm
tsc --module commonjs --target es5 --outDir lib/cjs --downlevelIteration
# Finally, copy some useful files into the distribution folder for documentation purposes.
cp ./README.md ./lib/README.md
cp ./CHANGELOG.md ./lib/CHANGELOG.md
cp ./package.json ./lib/package.json
if [ -f "./LICENSE" ]; then
cp ./LICENSE ./lib/LICENSE
fi
tsc --module ES2015 --target ES2015 --outDir dist/esm
tsc --module commonjs --target es5 --outDir dist/cjs --downlevelIteration

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
{
"name": "codemirror-promql",
"version": "0.17.0",
"version": "0.18.0",
"description": "a CodeMirror mode for the PromQL language",
"main": "cjs/index.js",
"module": "esm/index.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"scripts": {
"build": "npm run build:grammar && npm run build:lib",
"build:grammar": "lezer-generator src/grammar/promql.grammar -o src/grammar/parser",
@ -44,25 +44,23 @@
"@types/chai": "^4.2.12",
"@types/lru-cache": "^5.1.0",
"@types/mocha": "^8.0.3",
"@types/node": "^14.0.13",
"@typescript-eslint/eslint-plugin": "^2.22.0",
"@typescript-eslint/parser": "^2.22.0",
"@types/node": "^16.7.6",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"chai": "^4.2.0",
"clean-webpack-plugin": "^3.0.0",
"codecov": "^3.8.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"html-webpack-plugin": "^4.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-flowtype": "^5.9.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier": "^4.0.0",
"isomorphic-fetch": "^3.0.0",
"lezer": "^0.13.1",
"lezer-generator": "^0.13.1",
"mocha": "^8.1.2",
"nock": "^13.0.11",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"prettier": "^2.3.2",
"ts-loader": "^7.0.4",
"ts-mocha": "^8.0.0",
"ts-node": "^9.0.0",

View file

@ -272,10 +272,7 @@ class Cache {
}
const labelValues = currentAssociation.get(key);
if (labelValues === undefined) {
currentAssociation.set(
key,
new Set<string>([value])
);
currentAssociation.set(key, new Set<string>([value]));
} else {
labelValues.add(value);
}

View file

@ -8,19 +8,19 @@
"dom"
],
"declaration": true,
"outDir": "lib",
"outDir": "dist",
"strict": true,
"sourceMap": true,
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowJs": true
"allowJs": true,
"skipLibCheck": true
},
"include": [
"src/"
],
"exclude": [
"node_modules",
"src/**/*.test.ts"
]
}

File diff suppressed because it is too large Load diff

13
web/ui/package.json Normal file
View file

@ -0,0 +1,13 @@
{
"name": "prometheus",
"private": true,
"scripts": {
"lint": "npm run lint --workspaces",
"start": "npm run start -w react-app",
"test": "npm run test --workspaces"
},
"workspaces": [
"react-app",
"module/*"
]
}

View file

@ -0,0 +1,19 @@
const path = require('path');
const { getLoader, loaderByName } = require('@craco/craco');
const packages = [];
packages.push(path.join(__dirname, '../module'));
module.exports = {
webpack: {
configure: (webpackConfig, arg) => {
const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'));
if (isFound) {
const include = Array.isArray(match.loader.include) ? match.loader.include : [match.loader.include];
match.loader.include = include.concat(packages);
}
return webpackConfig;
},
},
};

View file

@ -21,7 +21,7 @@
"@fortawesome/react-fontawesome": "^0.1.4",
"@nexucis/fuzzy": "^0.3.0",
"bootstrap": "^4.6.0",
"codemirror-promql": "^0.17.0",
"codemirror-promql": "0.18.0",
"css.escape": "^1.5.1",
"downshift": "^3.4.8",
"i": "^0.3.6",
@ -43,11 +43,11 @@
"tempusdominus-core": "^5.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --runInBand --resetMocks=false",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"eject": "react-scripts eject",
"start": "craco start",
"build": "craco build",
"test": "craco test --runInBand --resetMocks=false",
"test:debug": "craco --inspect-brk test --runInBand --no-cache",
"eject": "craco eject",
"lint:ci": "eslint --quiet \"src/**/*.{ts,tsx}\"",
"lint": "eslint --fix \"src/**/*.{ts,tsx}\""
},
@ -63,6 +63,7 @@
"not op_mini all"
],
"devDependencies": {
"@craco/craco": "^6.2.0",
"@testing-library/react-hooks": "^7.0.1",
"@types/enzyme": "^3.10.9",
"@types/flot": "0.0.32",

View file

@ -11,7 +11,6 @@ import { closeBrackets, closeBracketsKeymap } from '@codemirror/closebrackets';
import { highlightSelectionMatches } from '@codemirror/search';
import { commentKeymap } from '@codemirror/comment';
import { lintKeymap } from '@codemirror/lint';
import { PromQLExtension, CompleteStrategy } from 'codemirror-promql';
import { autocompletion, completionKeymap, CompletionContext, CompletionResult } from '@codemirror/autocomplete';
import { baseTheme, lightTheme, darkTheme, promqlHighlighter } from './CMTheme';
@ -19,8 +18,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faSearch, faSpinner, faGlobeEurope } from '@fortawesome/free-solid-svg-icons';
import MetricsExplorer from './MetricsExplorer';
import { usePathPrefix } from '../../contexts/PathPrefixContext';
import { newCompleteStrategy } from 'codemirror-promql/cjs/complete';
import { useTheme } from '../../contexts/ThemeContext';
import { CompleteStrategy, PromQLExtension } from 'codemirror-promql';
import { newCompleteStrategy } from 'codemirror-promql/dist/cjs/complete';
const promqlExtension = new PromQLExtension();

View file

@ -6,7 +6,7 @@ import moment from 'moment-timezone';
import 'tempusdominus-core';
import 'tempusdominus-bootstrap-4';
import '../../../node_modules/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';
import 'tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';
import { dom, library } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

View file

@ -5,14 +5,14 @@
and https://github.com/ForEvolve/bootstrap-dark/issues/49
*/
@import 'node_modules/bootstrap/scss/functions';
@import 'node_modules/bootstrap/scss/variables';
@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import 'node_modules/@forevolve/bootstrap-dark/scss/dark-variables';
@import '~@forevolve/bootstrap-dark/scss/dark-variables';
@import 'node_modules/bootstrap/scss/mixins';
@import 'node_modules/@forevolve/bootstrap-dark/scss/mixins-overrides';
@import 'node_modules/@forevolve/bootstrap-dark/scss/dark-mixins';
@import '~bootstrap/scss/mixins';
@import '~@forevolve/bootstrap-dark/scss/mixins-overrides';
@import '~@forevolve/bootstrap-dark/scss/dark-mixins';
html {
font-family: sans-serif; // 2
@ -33,51 +33,51 @@ body.bootstrap-dark {
}
.bootstrap-dark {
@import 'node_modules/bootstrap/scss/root';
@import 'node_modules/bootstrap/scss/type';
@import 'node_modules/bootstrap/scss/images';
@import 'node_modules/bootstrap/scss/code';
@import 'node_modules/bootstrap/scss/grid';
@import '~bootstrap/scss/root';
@import '~bootstrap/scss/type';
@import '~bootstrap/scss/images';
@import '~bootstrap/scss/code';
@import '~bootstrap/scss/grid';
@import 'node_modules/bootstrap/scss/tables';
@import 'node_modules/@forevolve/bootstrap-dark/scss/dark-tables';
@import '~bootstrap/scss/tables';
@import '~@forevolve/bootstrap-dark/scss/dark-tables';
@import 'node_modules/bootstrap/scss/forms';
@import 'node_modules/@forevolve/bootstrap-dark/scss/form-overrides';
@import '~bootstrap/scss/forms';
@import '~@forevolve/bootstrap-dark/scss/form-overrides';
@import 'node_modules/bootstrap/scss/buttons';
@import 'node_modules/bootstrap/scss/transitions';
@import 'node_modules/bootstrap/scss/dropdown';
@import 'node_modules/bootstrap/scss/button-group';
@import '~bootstrap/scss/buttons';
@import '~bootstrap/scss/transitions';
@import '~bootstrap/scss/dropdown';
@import '~bootstrap/scss/button-group';
@import 'node_modules/bootstrap/scss/input-group';
@import 'node_modules/@forevolve/bootstrap-dark/scss/dark-input-group';
@import '~bootstrap/scss/input-group';
@import '~@forevolve/bootstrap-dark/scss/dark-input-group';
@import 'node_modules/bootstrap/scss/custom-forms';
@import 'node_modules/bootstrap/scss/nav';
@import 'node_modules/bootstrap/scss/navbar';
@import 'node_modules/bootstrap/scss/card';
@import 'node_modules/bootstrap/scss/breadcrumb';
@import 'node_modules/bootstrap/scss/pagination';
@import 'node_modules/bootstrap/scss/badge';
@import 'node_modules/bootstrap/scss/jumbotron';
@import 'node_modules/bootstrap/scss/alert';
@import 'node_modules/bootstrap/scss/progress';
@import 'node_modules/bootstrap/scss/media';
@import 'node_modules/bootstrap/scss/list-group';
@import 'node_modules/bootstrap/scss/close';
@import 'node_modules/bootstrap/scss/toasts';
@import 'node_modules/bootstrap/scss/modal';
@import 'node_modules/bootstrap/scss/tooltip';
@import 'node_modules/bootstrap/scss/popover';
@import 'node_modules/bootstrap/scss/carousel';
@import 'node_modules/bootstrap/scss/spinners';
@import 'node_modules/bootstrap/scss/utilities';
@import '~bootstrap/scss/custom-forms';
@import '~bootstrap/scss/nav';
@import '~bootstrap/scss/navbar';
@import '~bootstrap/scss/card';
@import '~bootstrap/scss/breadcrumb';
@import '~bootstrap/scss/pagination';
@import '~bootstrap/scss/badge';
@import '~bootstrap/scss/jumbotron';
@import '~bootstrap/scss/alert';
@import '~bootstrap/scss/progress';
@import '~bootstrap/scss/media';
@import '~bootstrap/scss/list-group';
@import '~bootstrap/scss/close';
@import '~bootstrap/scss/toasts';
@import '~bootstrap/scss/modal';
@import '~bootstrap/scss/tooltip';
@import '~bootstrap/scss/popover';
@import '~bootstrap/scss/carousel';
@import '~bootstrap/scss/spinners';
@import '~bootstrap/scss/utilities';
.navbar-themed {
@extend .bg-dark;
@extend .navbar-dark;
}
@import 'node_modules/@forevolve/bootstrap-dark/scss/dark-styles';
@import '~@forevolve/bootstrap-dark/scss/dark-styles';
}

View file

@ -6,14 +6,14 @@
and https://github.com/ForEvolve/bootstrap-dark/issues/49
*/
@import 'node_modules/bootstrap/scss/functions';
@import 'node_modules/bootstrap/scss/variables';
@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import 'node_modules/bootstrap/scss/mixins';
@import 'node_modules/@forevolve/bootstrap-dark/scss/mixins-overrides';
@import '~bootstrap/scss/mixins';
@import '~@forevolve/bootstrap-dark/scss/mixins-overrides';
/* Add reboot styles using light theme variables */
@import 'node_modules/bootstrap/scss/reboot';
@import '~bootstrap/scss/reboot';
body.bootstrap {
margin: 0; // 1
@ -27,41 +27,41 @@ body.bootstrap {
}
.bootstrap {
@import 'node_modules/bootstrap/scss/root';
@import 'node_modules/bootstrap/scss/type';
@import 'node_modules/bootstrap/scss/images';
@import 'node_modules/bootstrap/scss/code';
@import 'node_modules/bootstrap/scss/grid';
@import 'node_modules/bootstrap/scss/tables';
@import '~bootstrap/scss/root';
@import '~bootstrap/scss/type';
@import '~bootstrap/scss/images';
@import '~bootstrap/scss/code';
@import '~bootstrap/scss/grid';
@import '~bootstrap/scss/tables';
@import 'node_modules/bootstrap/scss/forms';
@import 'node_modules/@forevolve/bootstrap-dark/scss/form-overrides';
@import '~bootstrap/scss/forms';
@import '~@forevolve/bootstrap-dark/scss/form-overrides';
@import 'node_modules/bootstrap/scss/buttons';
@import 'node_modules/bootstrap/scss/transitions';
@import 'node_modules/bootstrap/scss/dropdown';
@import 'node_modules/bootstrap/scss/button-group';
@import 'node_modules/bootstrap/scss/input-group';
@import 'node_modules/bootstrap/scss/custom-forms';
@import 'node_modules/bootstrap/scss/nav';
@import 'node_modules/bootstrap/scss/navbar';
@import 'node_modules/bootstrap/scss/card';
@import 'node_modules/bootstrap/scss/breadcrumb';
@import 'node_modules/bootstrap/scss/pagination';
@import 'node_modules/bootstrap/scss/badge';
@import 'node_modules/bootstrap/scss/jumbotron';
@import 'node_modules/bootstrap/scss/alert';
@import 'node_modules/bootstrap/scss/progress';
@import 'node_modules/bootstrap/scss/media';
@import 'node_modules/bootstrap/scss/list-group';
@import 'node_modules/bootstrap/scss/close';
@import 'node_modules/bootstrap/scss/toasts';
@import 'node_modules/bootstrap/scss/modal';
@import 'node_modules/bootstrap/scss/tooltip';
@import 'node_modules/bootstrap/scss/popover';
@import 'node_modules/bootstrap/scss/carousel';
@import 'node_modules/bootstrap/scss/spinners';
@import 'node_modules/bootstrap/scss/utilities';
@import '~bootstrap/scss/buttons';
@import '~bootstrap/scss/transitions';
@import '~bootstrap/scss/dropdown';
@import '~bootstrap/scss/button-group';
@import '~bootstrap/scss/input-group';
@import '~bootstrap/scss/custom-forms';
@import '~bootstrap/scss/nav';
@import '~bootstrap/scss/navbar';
@import '~bootstrap/scss/card';
@import '~bootstrap/scss/breadcrumb';
@import '~bootstrap/scss/pagination';
@import '~bootstrap/scss/badge';
@import '~bootstrap/scss/jumbotron';
@import '~bootstrap/scss/alert';
@import '~bootstrap/scss/progress';
@import '~bootstrap/scss/media';
@import '~bootstrap/scss/list-group';
@import '~bootstrap/scss/close';
@import '~bootstrap/scss/toasts';
@import '~bootstrap/scss/modal';
@import '~bootstrap/scss/tooltip';
@import '~bootstrap/scss/popover';
@import '~bootstrap/scss/carousel';
@import '~bootstrap/scss/spinners';
@import '~bootstrap/scss/utilities';
.navbar-themed {
@extend .bg-light;