Skip to content

Commit

Permalink
Merge pull request prometheus#25 from promlabs/release/v0.16.0
Browse files Browse the repository at this point in the history
Fixing the way to package the lib & Fix the copyright of the license
  • Loading branch information
juliusv authored Mar 5, 2021
2 parents 6dd0162 + 728998a commit cb1946f
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ jobs:
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/project/.npmrc
- run: cp ~/project/README.md ~/project/dist/README.md
- run: cp ~/project/package.json ~/project/dist/package.json
- run: cp ~/project/LICENSE ~/project/lib/LICENSE
- run: cp ~/project/CHANGELOG.md ~/project/lib/CHANGELOG.md
- run: npm publish ~/project/dist --access public

workflows:
Expand Down
31 changes: 31 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Copyright 2021 PromLabs GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

lezer-generator src/promql.grammar -o src/parser

cat src/parser.terms.js >> src/parser.js

bash ./generate-types.sh

rollup -c

# Finally, copy some useful files into the distribution folder for documentation purposes.
cp ./README.md ./dist/README.md
cp ./CHANGELOG.md ./dist/CHANGELOG.md
cp ./LICENSE ./dist/LICENSE
cp ./package.json ./dist/package.json
31 changes: 31 additions & 0 deletions generate-types.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,42 @@
#!/bin/bash

# Copyright 2021 PromLabs GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -ex

mkdir -p ./dist
indexFile='./dist/index.d.ts'
if [[ -f ${indexFile} ]]; then
rm ${indexFile}
fi

cat <<EOF >> ${indexFile}
// Copyright 2021 PromLabs GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This file was generated by lezer-promql. You probably should not edit it.
import { Parser } from 'lezer'
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"url": "git+https://github.com/promlabs/lezer-promql.git"
},
"scripts": {
"build": "lezer-generator src/promql.grammar -o src/parser && cat src/parser.terms.js >> src/parser.js && bash ./generate-types.sh && rollup -c",
"build-debug": "lezer-generator src/promql.grammar --names -o src/parser && bash ./generate-types.sh && rollup -c",
"build": "bash ./build.sh",
"test": "mocha test/test-*.js"
},
"keywords": [
Expand Down
14 changes: 14 additions & 0 deletions src/promql.grammar
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2021 PromLabs GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

@top PromQL { Expr }

@precedence {
Expand Down
14 changes: 14 additions & 0 deletions src/tokens.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2021 PromLabs GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {Bool, Ignoring, On, GroupLeft, GroupRight, Offset, Avg, Bottomk, Count, CountValues, Group, Max, Min, Quantile, Stddev, Stdvar, Sum, Topk, By, Without, And, Or, Unless} from './parser.terms.js';

const keywordTokens = {
Expand Down

0 comments on commit cb1946f

Please sign in to comment.