diff --git a/.circleci/config.yml b/.circleci/config.yml index 2138ce63dcd..3eb422fce59 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -623,6 +623,21 @@ jobs: echo "-- no changes to docs files --" fi + release-next-packages: + docker: + - image: circleci/node:10 + steps: + - checkout + - run: + name: Boostrap lerna + command: 'npx lerna bootstrap' + - run: + name: npm - Prepare auth token + command: 'echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc' + - run: + name: Release next packages + command: './scripts/circle-release-next-packages.sh' + workflows: version: 2 build-master: @@ -694,6 +709,11 @@ workflows: requires: - end-to-end-test filters: *filter-only-master + - release-next-packages: + requires: + - build-all + - test-frontend + filters: *filter-only-master release: jobs: - build-all: @@ -803,3 +823,4 @@ workflows: - postgres-integration-test - cache-server-test filters: *filter-not-release-or-master + diff --git a/package.json b/package.json index f11453499d9..bf7bb807a8b 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,8 @@ "themes:generate": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/generateSassVariableFiles.ts", "packages:prepare": "lerna run clean && npm run test && lerna version --tag-version-prefix=\"packages@\" -m \"Packages: publish %s\" --no-push", "packages:build": "lerna run clean && lerna run build", - "packages:publish": "lerna publish from-package --contents dist --dist-tag next --tag-version-prefix=\"packages@\"" + "packages:publish": "lerna publish from-package --contents dist", + "packages:publishNext": "lerna publish from-package --contents dist --dist-tag next --yes" }, "husky": { "hooks": { diff --git a/packages/grafana-data/package.json b/packages/grafana-data/package.json index 7163c62f4f9..c42aeb8f25f 100644 --- a/packages/grafana-data/package.json +++ b/packages/grafana-data/package.json @@ -11,8 +11,7 @@ "typecheck": "tsc --noEmit", "clean": "rimraf ./dist ./compiled", "bundle": "rollup -c rollup.config.ts", - "build": "grafana-toolkit package:build --scope=data", - "postpublish": "npm run clean" + "build": "grafana-toolkit package:build --scope=data" }, "author": "Grafana Labs", "license": "Apache-2.0", @@ -37,8 +36,5 @@ "rollup-plugin-visualizer": "0.9.2", "sinon": "1.17.6", "typescript": "3.4.1" - }, - "resolutions": { - "@types/lodash": "4.14.119" } } diff --git a/packages/grafana-runtime/package.json b/packages/grafana-runtime/package.json index d3ef30c938f..a73858a9b09 100644 --- a/packages/grafana-runtime/package.json +++ b/packages/grafana-runtime/package.json @@ -11,8 +11,7 @@ "typecheck": "tsc --noEmit", "clean": "rimraf ./dist ./compiled", "bundle": "rollup -c rollup.config.ts", - "build": "grafana-toolkit package:build --scope=runtime", - "postpublish": "npm run clean" + "build": "grafana-toolkit package:build --scope=runtime" }, "author": "Grafana Labs", "license": "Apache-2.0", @@ -33,8 +32,5 @@ "rollup-plugin-typescript2": "0.19.3", "rollup-plugin-visualizer": "0.9.2", "typescript": "3.4.1" - }, - "resolutions": { - "@types/lodash": "4.14.119" } } diff --git a/packages/grafana-toolkit/package.json b/packages/grafana-toolkit/package.json index d28e3b4d41f..08331102a4f 100644 --- a/packages/grafana-toolkit/package.json +++ b/packages/grafana-toolkit/package.json @@ -15,8 +15,7 @@ "typecheck": "tsc --noEmit", "precommit": "npm run tslint & npm run typecheck", "clean": "rimraf ./dist ./compiled", - "build": "grafana-toolkit toolkit:build", - "postpublish": "npm run clean" + "build": "grafana-toolkit toolkit:build" }, "author": "Grafana Labs", "license": "Apache-2.0", @@ -75,9 +74,6 @@ "url-loader": "^2.0.1", "webpack": "4.35.0" }, - "resolutions": { - "@types/lodash": "4.14.119" - }, "devDependencies": { "@types/glob": "^7.1.1", "@types/prettier": "^1.16.4" diff --git a/packages/grafana-toolkit/src/cli/tasks/package.build.ts b/packages/grafana-toolkit/src/cli/tasks/package.build.ts index c52c098c32f..c0d65f9c39e 100644 --- a/packages/grafana-toolkit/src/cli/tasks/package.build.ts +++ b/packages/grafana-toolkit/src/cli/tasks/package.build.ts @@ -99,4 +99,4 @@ const buildTaskRunner: TaskRunner = async ({ scope }) => { await Promise.all(scopes.map(s => s())); }; -export const buildPackageTask = new Task('@grafana/ui build', buildTaskRunner); +export const buildPackageTask = new Task('Package build', buildTaskRunner); diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 884f799b5af..6b8879a6dcd 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -15,12 +15,12 @@ "storybook:build": "build-storybook -o ./dist/storybook -c .storybook", "clean": "rimraf ./dist ./compiled", "bundle": "rollup -c rollup.config.ts", - "build": "grafana-toolkit package:build --scope=ui", - "postpublish": "npm run clean" + "build": "grafana-toolkit package:build --scope=ui" }, "author": "Grafana Labs", "license": "Apache-2.0", "dependencies": { + "@grafana/data": "^6.4.0-alpha.8", "@torkelo/react-select": "2.1.1", "@types/react-color": "2.17.0", "classnames": "2.2.6", @@ -77,8 +77,5 @@ "rollup-plugin-typescript2": "0.19.3", "rollup-plugin-visualizer": "0.9.2", "typescript": "3.4.1" - }, - "resolutions": { - "@types/lodash": "4.14.119" } } diff --git a/packages/grafana-ui/src/components/Table/TableInputCSV.tsx b/packages/grafana-ui/src/components/Table/TableInputCSV.tsx index a7d5afdc621..3b399c1f64e 100644 --- a/packages/grafana-ui/src/components/Table/TableInputCSV.tsx +++ b/packages/grafana-ui/src/components/Table/TableInputCSV.tsx @@ -29,7 +29,7 @@ export class TableInputCSV extends React.PureComponent { }; } - readCSV = debounce(() => { + readCSV: any = debounce(() => { const { config } = this.props; const { text } = this.state; diff --git a/scripts/circle-release-next-packages.sh b/scripts/circle-release-next-packages.sh new file mode 100755 index 00000000000..ad15078f49f --- /dev/null +++ b/scripts/circle-release-next-packages.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +function parse_git_hash() { + git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/" +} + +function prapare_version_commit () { + echo $'\nCommiting version changes. This commit will not be checked-in!' + git config --global user.email "circleci@grafana.com" + git config --global user.name "CirceCI" + git commit -am "Version commit" +} + +#Get current version from lerna.json +PACKAGE_VERSION=`grep '"version"' lerna.json | cut -d '"' -f 4` +# Get short current commit's has +GIT_SHA=$(parse_git_hash) + +echo "Commit: ${GIT_SHA}" +echo "Current lerna.json version: ${PACKAGE_VERSION}" + +# count packages that changed +count=`npx lerna changed --loglevel silent | awk '{c++} END {print c}'` + +if [ -z $count ]; then + echo "No changes in packages, skipping packages publishing" +else + echo "Changes detected in ${count} packages" + echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_SHA}" + npx lerna version ${PACKAGE_VERSION}-${GIT_SHA} --no-git-tag-version --no-push --force-publish -y + echo $'\nGit status:' + git status -s + + echo $'\nBuilding packages' + yarn packages:build + + prapare_version_commit + + echo $'\nPublishing packages' + yarn packages:publishNext +fi +