mirror of https://github.com/nocodb/nocodb
navi
2 years ago
committed by
GitHub
33 changed files with 1883 additions and 108 deletions
@ -0,0 +1,144 @@ |
|||||||
|
name: "Release : Docker (v2)" |
||||||
|
|
||||||
|
on: |
||||||
|
# Triggered manually |
||||||
|
workflow_dispatch: |
||||||
|
inputs: |
||||||
|
tag: |
||||||
|
description: "Docker image tag" |
||||||
|
required: true |
||||||
|
targetEnv: |
||||||
|
description: "Target Environment" |
||||||
|
required: true |
||||||
|
type: choice |
||||||
|
options: |
||||||
|
- DEV |
||||||
|
- PROD |
||||||
|
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml |
||||||
|
workflow_call: |
||||||
|
inputs: |
||||||
|
tag: |
||||||
|
description: "Docker image tag" |
||||||
|
required: true |
||||||
|
type: string |
||||||
|
targetEnv: |
||||||
|
description: "Target Environment" |
||||||
|
required: true |
||||||
|
type: string |
||||||
|
isDaily: |
||||||
|
description: "Is it triggered by daily schedule" |
||||||
|
required: false |
||||||
|
type: string |
||||||
|
currentVersion: |
||||||
|
description: "The current NocoDB version" |
||||||
|
required: false |
||||||
|
type: string |
||||||
|
secrets: |
||||||
|
DOCKERHUB_USERNAME: |
||||||
|
required: true |
||||||
|
DOCKERHUB_TOKEN: |
||||||
|
required: true |
||||||
|
|
||||||
|
jobs: |
||||||
|
buildx: |
||||||
|
runs-on: ubuntu-latest |
||||||
|
env: |
||||||
|
working-directory: ./packages/nocodb |
||||||
|
steps: |
||||||
|
- name: Get Docker Repository |
||||||
|
id: get-docker-repository |
||||||
|
run: | |
||||||
|
DOCKER_REPOSITORY=nocodb |
||||||
|
DOCKER_BUILD_TAG=${{ github.event.inputs.tag || inputs.tag }} |
||||||
|
if [[ ${{ github.event.inputs.targetEnv || inputs.targetEnv }} == 'DEV' ]]; then |
||||||
|
if [[ ${{ github.event.inputs.currentVersion || inputs.currentVersion || 'N/A' }} != 'N/A' ]]; then |
||||||
|
DOCKER_BUILD_TAG=${{ github.event.inputs.currentVersion || inputs.currentVersion }}-${{ github.event.inputs.tag || inputs.tag }} |
||||||
|
fi |
||||||
|
if [[ ${{ inputs.isDaily || 'N' }} == 'Y' ]]; then |
||||||
|
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-daily |
||||||
|
else |
||||||
|
DOCKER_REPOSITORY=${DOCKER_REPOSITORY}-timely |
||||||
|
fi |
||||||
|
fi |
||||||
|
echo "::set-output name=DOCKER_REPOSITORY::${DOCKER_REPOSITORY}" |
||||||
|
echo "::set-output name=DOCKER_BUILD_TAG::${DOCKER_BUILD_TAG}" |
||||||
|
echo ${DOCKER_REPOSITORY} |
||||||
|
echo ${DOCKER_BUILD_TAG} |
||||||
|
|
||||||
|
- name: Checkout |
||||||
|
uses: actions/checkout@v2 |
||||||
|
with: |
||||||
|
fetch-depth: 0 |
||||||
|
ref: ${{ github.ref }} |
||||||
|
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }} |
||||||
|
uses: actions/setup-node@v2 |
||||||
|
with: |
||||||
|
node-version: 16.15.0 |
||||||
|
|
||||||
|
- name: upgrade packages for nightly build or pr build |
||||||
|
if: ${{ github.event.inputs.targetEnv == 'DEV' || inputs.targetEnv == 'DEV' }} |
||||||
|
run: | |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js |
||||||
|
cd packages/nocodb-sdk |
||||||
|
npm install && npm run build |
||||||
|
cd ../.. |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js && |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && |
||||||
|
cd packages/nc-gui-v2 |
||||||
|
npm install |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy |
||||||
|
cd ../.. |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js |
||||||
|
|
||||||
|
- uses: bahmutov/npm-install@v1 |
||||||
|
with: |
||||||
|
working-directory: ${{ env.working-directory }} |
||||||
|
|
||||||
|
- name: Build nocodb and docker files |
||||||
|
run: | |
||||||
|
npm run build |
||||||
|
npm run docker:build |
||||||
|
working-directory: ${{ env.working-directory }} |
||||||
|
|
||||||
|
- name: Set up QEMU |
||||||
|
uses: docker/setup-qemu-action@v1 |
||||||
|
|
||||||
|
- name: Set up Docker Buildx |
||||||
|
id: buildx |
||||||
|
uses: docker/setup-buildx-action@v1 |
||||||
|
|
||||||
|
- name: Cache Docker layers |
||||||
|
uses: actions/cache@v2 |
||||||
|
with: |
||||||
|
path: /tmp/.buildx-cache |
||||||
|
key: ${{ runner.os }}-buildx-${{ github.sha }} |
||||||
|
restore-keys: | |
||||||
|
${{ runner.os }}-buildx- |
||||||
|
|
||||||
|
- name: Login to DockerHub |
||||||
|
uses: docker/login-action@v1 |
||||||
|
with: |
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }} |
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }} |
||||||
|
|
||||||
|
- name: Build and push |
||||||
|
uses: docker/build-push-action@v2 |
||||||
|
with: |
||||||
|
context: ${{ env.working-directory }} |
||||||
|
build-args: NC_VERSION=${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} |
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7 |
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache |
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new |
||||||
|
push: true |
||||||
|
tags: | |
||||||
|
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:${{ steps.get-docker-repository.outputs.DOCKER_BUILD_TAG }} |
||||||
|
nocodb/${{ steps.get-docker-repository.outputs.DOCKER_REPOSITORY }}:latest |
||||||
|
|
||||||
|
# Temp fix |
||||||
|
# https://github.com/docker/build-push-action/issues/252 |
||||||
|
# https://github.com/moby/buildkit/issues/1896 |
||||||
|
- name: Move cache |
||||||
|
run: | |
||||||
|
rm -rf /tmp/.buildx-cache |
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
@ -0,0 +1,93 @@ |
|||||||
|
name: "Release : NPM packages (v2)" |
||||||
|
|
||||||
|
on: |
||||||
|
# Triggered manually |
||||||
|
workflow_dispatch: |
||||||
|
inputs: |
||||||
|
tag: |
||||||
|
description: "Tag" |
||||||
|
required: true |
||||||
|
targetEnv: |
||||||
|
description: "Target Environment" |
||||||
|
required: true |
||||||
|
type: choice |
||||||
|
options: |
||||||
|
- DEV |
||||||
|
- PROD |
||||||
|
# Triggered by release-nocodb.yml / release-nightly-dev.yml / release-pr.yml |
||||||
|
workflow_call: |
||||||
|
inputs: |
||||||
|
tag: |
||||||
|
description: "Tag" |
||||||
|
required: true |
||||||
|
type: string |
||||||
|
targetEnv: |
||||||
|
description: "Target Environment" |
||||||
|
required: true |
||||||
|
type: string |
||||||
|
secrets: |
||||||
|
NPM_TOKEN: |
||||||
|
required: true |
||||||
|
# GITHUB_TOKEN: |
||||||
|
# required: true |
||||||
|
|
||||||
|
jobs: |
||||||
|
release: |
||||||
|
runs-on: ubuntu-latest |
||||||
|
env: |
||||||
|
working-directory: ./packages/nocodb |
||||||
|
steps: |
||||||
|
- name: Checkout |
||||||
|
uses: actions/checkout@v2 |
||||||
|
with: |
||||||
|
fetch-depth: 0 |
||||||
|
ref: ${{ github.ref }} |
||||||
|
- name: NPM Setup and Publish with 16.15.0 |
||||||
|
# Setup .npmrc file to publish to npm |
||||||
|
uses: actions/setup-node@v2 |
||||||
|
with: |
||||||
|
node-version: 16.15.0 |
||||||
|
registry-url: 'https://registry.npmjs.org' |
||||||
|
- run: | |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNocodbSdkVersion.js && |
||||||
|
cd packages/nocodb-sdk && |
||||||
|
npm ci && npm run build && npm publish && |
||||||
|
cd ../.. && |
||||||
|
sleep 60 && |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNocodbSdk2.js && |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} node scripts/bumpNcGuiVersion.js && |
||||||
|
cd packages/nc-gui-v2 && |
||||||
|
npm ci && |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} targetVersion=${{ github.event.inputs.tag || inputs.tag }} npm run build:copy:publish && |
||||||
|
cd ../.. && |
||||||
|
sleep 60 && |
||||||
|
targetEnv=${{ github.event.inputs.targetEnv || inputs.targetEnv }} node scripts/upgradeNcGui2.js && cd packages/nocodb && npm install && npm run obfuscate:build:publish |
||||||
|
env: |
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
||||||
|
- name: Create Pull Request |
||||||
|
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} |
||||||
|
id: cpr |
||||||
|
uses: peter-evans/create-pull-request@v3 |
||||||
|
env: |
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
||||||
|
with: |
||||||
|
# commit-message: Update report |
||||||
|
# committer: GitHub <noreply@github.com> |
||||||
|
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> |
||||||
|
signoff: true |
||||||
|
branch: 'release/${{ github.event.inputs.tag || inputs.tag }}' |
||||||
|
delete-branch: true |
||||||
|
title: 'Release ${{ github.event.inputs.tag || inputs.tag }}' |
||||||
|
labels: 'Bot: Automerge' |
||||||
|
- name: Check outputs |
||||||
|
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} |
||||||
|
run: | |
||||||
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
||||||
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
||||||
|
- name: automerge |
||||||
|
if: ${{ github.event.inputs.targetEnv == 'PROD' || inputs.targetEnv == 'PROD' }} |
||||||
|
uses: "pascalgn/automerge-action@v0.14.3" |
||||||
|
env: |
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
||||||
|
PULL_REQUEST: "${{ steps.cpr.outputs.pull-request-number }}" |
||||||
|
MERGE_LABELS: "Bot: Automerge" |
@ -0,0 +1,126 @@ |
|||||||
|
name: 'PR Release (v2)' |
||||||
|
|
||||||
|
on: |
||||||
|
pull_request: |
||||||
|
# opened: pull request is created |
||||||
|
# reopened: closed pull request is reopened |
||||||
|
# synchronize: commit(s) pushed to the pull request |
||||||
|
# ready_for_review: non PR release |
||||||
|
types: [opened, reopened, synchronize, ready_for_review] |
||||||
|
paths: |
||||||
|
# - "packages/nocodb-sdk/**" |
||||||
|
- "packages/nc-gui-v2/**" |
||||||
|
# - "packages/nc-plugin/**" |
||||||
|
# - "packages/nocodb/**" |
||||||
|
jobs: |
||||||
|
# enrich tag for pr release |
||||||
|
set-tag: |
||||||
|
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
runs-on: 'ubuntu-latest' |
||||||
|
steps: |
||||||
|
- name: set-tag |
||||||
|
id: tag-step |
||||||
|
run: | |
||||||
|
# Get current date |
||||||
|
CURRENT_DATE=$(date +"%Y%m%d") |
||||||
|
CURRENT_TIME=$(date +"%H%M") |
||||||
|
# Get current PR number |
||||||
|
PR_NUMBER=${{github.event.number}} |
||||||
|
# Get current version |
||||||
|
CURRENT_VERSION=$(basename $(curl -fs -o/dev/null -w %{redirect_url} https://github.com/nocodb/nocodb/releases/latest)) |
||||||
|
# Construct tag name |
||||||
|
TAG_NAME=pr-${PR_NUMBER}-${CURRENT_DATE}-${CURRENT_TIME} |
||||||
|
echo "::set-output name=TARGET_TAG::${TAG_NAME}" |
||||||
|
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" |
||||||
|
- name: verify-tag |
||||||
|
run: | |
||||||
|
echo ${{ steps.tag-step.outputs.TARGET_TAG }} |
||||||
|
echo ${{ steps.tag-step.outputs.CURRENT_VERSION }} |
||||||
|
outputs: |
||||||
|
target_tag: ${{ steps.tag-step.outputs.TARGET_TAG }} |
||||||
|
current_version: ${{ steps.tag-step.outputs.CURRENT_VERSION }} |
||||||
|
|
||||||
|
# Build, install, publish frontend and backend to npm |
||||||
|
release-npm: |
||||||
|
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
needs: [set-tag] |
||||||
|
uses: ./.github/workflows/release-npm-v2.yml |
||||||
|
with: |
||||||
|
tag: ${{ needs.set-tag.outputs.target_tag }} |
||||||
|
targetEnv: 'DEV' |
||||||
|
secrets: |
||||||
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" |
||||||
|
|
||||||
|
# Build docker image and push to docker hub |
||||||
|
release-docker: |
||||||
|
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
needs: [release-npm, set-tag] |
||||||
|
uses: ./.github/workflows/release-docker-v2.yml |
||||||
|
with: |
||||||
|
currentVersion: ${{ needs.set-tag.outputs.current_version }} |
||||||
|
tag: ${{ needs.set-tag.outputs.target_tag }} |
||||||
|
targetEnv: 'DEV' |
||||||
|
isDaily: 'N' |
||||||
|
secrets: |
||||||
|
DOCKERHUB_USERNAME: "${{ secrets.DOCKERHUB_USERNAME }}" |
||||||
|
DOCKERHUB_TOKEN: "${{ secrets.DOCKERHUB_TOKEN }}" |
||||||
|
|
||||||
|
# Build executables and publish to GitHub |
||||||
|
# release-executables: |
||||||
|
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
# needs: [set-tag, release-npm] |
||||||
|
# uses: ./.github/workflows/release-timely-executables.yml |
||||||
|
# with: |
||||||
|
# tag: ${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} |
||||||
|
# secrets: |
||||||
|
# NC_GITHUB_TOKEN: "${{ secrets.NC_GITHUB_TOKEN }}" |
||||||
|
|
||||||
|
# Add a comment for PR docker build |
||||||
|
leave-comment: |
||||||
|
if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
runs-on: 'ubuntu-latest' |
||||||
|
needs: [release-docker, set-tag] |
||||||
|
steps: |
||||||
|
- uses: peter-evans/commit-comment@v2 |
||||||
|
with: |
||||||
|
body: | |
||||||
|
The PR changes have been deployed. Please run the following command to verify: |
||||||
|
``` |
||||||
|
docker run -d -p 8888:8080 nocodb/nocodb-timely:${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }} |
||||||
|
``` |
||||||
|
|
||||||
|
# Add a comment for PR executable build |
||||||
|
# leave-executable-comment: |
||||||
|
# if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.draft == false && github.base_ref == 'develop' }} |
||||||
|
# runs-on: 'ubuntu-latest' |
||||||
|
# needs: [release-executables, set-tag] |
||||||
|
# steps: |
||||||
|
# - uses: peter-evans/commit-comment@v2 |
||||||
|
# with: |
||||||
|
# body: | |
||||||
|
# ### Run Executables |
||||||
|
|
||||||
|
# #### MacOS |
||||||
|
|
||||||
|
# ```bash |
||||||
|
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ |
||||||
|
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-macos-arm64 -o noco -L \ |
||||||
|
# && chmod +x noco \ |
||||||
|
# && ./noco |
||||||
|
# ``` |
||||||
|
# #### Linux |
||||||
|
|
||||||
|
# ```bash |
||||||
|
# mkdir -p ./${{ needs.set-tag.outputs.current_version }}/${{ needs.set-tag.outputs.target_tag }} && cd "$_" \ |
||||||
|
# && curl http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-linux-x64 -o noco -L \ |
||||||
|
# && chmod +x noco \ |
||||||
|
# && ./noco |
||||||
|
# ``` |
||||||
|
# #### Windows |
||||||
|
|
||||||
|
# ```bash |
||||||
|
# iwp http://dl.nocodb.com/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}/Noco-win-arm64.exe |
||||||
|
# .\Noco-win-arm64.exe |
||||||
|
# ``` |
||||||
|
|
||||||
|
# For executables visit [here](https://github.com/nocodb/nocodb-timely/releases/tag/${{ needs.set-tag.outputs.current_version }}-${{ needs.set-tag.outputs.target_tag }}) |
@ -0,0 +1,11 @@ |
|||||||
|
/node_modules/ |
||||||
|
#build |
||||||
|
src/**.js |
||||||
|
.idea/* |
||||||
|
|
||||||
|
coverage |
||||||
|
.nyc_output |
||||||
|
*.log |
||||||
|
|
||||||
|
yarn.lock |
||||||
|
/lib/dist/ |
@ -0,0 +1,5 @@ |
|||||||
|
# nc-lib-gui |
||||||
|
|
||||||
|
This package is the build version of ``nc-gui`` which will be used in ``packages/nocodb``. The built files should be located in ``packages/nc-lib-gui/lib/dist/``. |
||||||
|
|
||||||
|
To build the frontend and copy the built files to dist directory, run ``npm run build:copy`` under ``packages/nc-gui/``. |
@ -0,0 +1,30 @@ |
|||||||
|
'use strict'; |
||||||
|
|
||||||
|
const xcToolWeb = require('..'); |
||||||
|
|
||||||
|
describe('xc-tool-web', () => { |
||||||
|
it('needs tests'); |
||||||
|
}); |
||||||
|
|
||||||
|
/** |
||||||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
||||||
|
* |
||||||
|
* @author Naveen MR <oof1lab@gmail.com> |
||||||
|
* @author Pranav C Balan <pranavxc@gmail.com> |
||||||
|
* |
||||||
|
* @license GNU AGPL version 3 or any later version |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as |
||||||
|
* published by the Free Software Foundation, either version 3 of the |
||||||
|
* License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
@ -0,0 +1,45 @@ |
|||||||
|
const express = require('express'); |
||||||
|
const path = require('path'); |
||||||
|
|
||||||
|
|
||||||
|
class XcLibGui { |
||||||
|
|
||||||
|
static expressMiddleware(dashboardPath) { |
||||||
|
|
||||||
|
const router = express.Router(); |
||||||
|
// Express will serve up production assets i.e. main.js
|
||||||
|
router.use(dashboardPath, express.static(path.join(__dirname, 'dist'))); |
||||||
|
|
||||||
|
// If Express doesn't recognize route serve index.html
|
||||||
|
router.get(`${dashboardPath}/*`, (_req, res) => { |
||||||
|
res.sendFile(path.join(__dirname, 'dist', 'index.html')); |
||||||
|
}); |
||||||
|
|
||||||
|
return router; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
module.exports = XcLibGui; |
||||||
|
|
||||||
|
/** |
||||||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
||||||
|
* |
||||||
|
* @author Naveen MR <oof1lab@gmail.com> |
||||||
|
* @author Pranav C Balan <pranavxc@gmail.com> |
||||||
|
* |
||||||
|
* @license GNU AGPL version 3 or any later version |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as |
||||||
|
* published by the Free Software Foundation, either version 3 of the |
||||||
|
* License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
@ -0,0 +1,22 @@ |
|||||||
|
/** |
||||||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd |
||||||
|
* |
||||||
|
* @author Naveen MR <oof1lab@gmail.com> |
||||||
|
* @author Pranav C Balan <pranavxc@gmail.com> |
||||||
|
* |
||||||
|
* @license GNU AGPL version 3 or any later version |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as |
||||||
|
* published by the Free Software Foundation, either version 3 of the |
||||||
|
* License, or (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,37 @@ |
|||||||
|
{ |
||||||
|
"name": "nc-lib-gui-v2", |
||||||
|
"version": "0.0.0", |
||||||
|
"description": "NocoDB GUI", |
||||||
|
"author": { |
||||||
|
"name": "NocoDB", |
||||||
|
"url": "https://nocodb.com/" |
||||||
|
}, |
||||||
|
"homepage": "https://github.com/nocodb/nocodb", |
||||||
|
"license": "AGPL-3.0-or-later", |
||||||
|
"main": "lib/XcLibGui.js", |
||||||
|
"directories": { |
||||||
|
"lib": "lib", |
||||||
|
"test": "__tests__" |
||||||
|
}, |
||||||
|
"files": [ |
||||||
|
"lib" |
||||||
|
], |
||||||
|
"repository": { |
||||||
|
"type": "git", |
||||||
|
"url": "git+ssh://git@github.com:nocodb/nocodb.git" |
||||||
|
}, |
||||||
|
"scripts": { |
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1" |
||||||
|
}, |
||||||
|
"bugs": { |
||||||
|
"url": "https://github.com/nocodb/nocodb/issues" |
||||||
|
}, |
||||||
|
"dependencies": { |
||||||
|
"axios": "^0.19.2", |
||||||
|
"body-parser": "^1.19.0", |
||||||
|
"dayjs": "^1.10.4", |
||||||
|
"express": "^4.17.1", |
||||||
|
"serve-static": "^1.15.0", |
||||||
|
"vuedraggable": "^2.24.3" |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
const fs = require('fs') |
||||||
|
const path = require('path') |
||||||
|
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), 'utf8')) |
||||||
|
|
||||||
|
if (process.env.targetEnv === 'DEV') { |
||||||
|
// nightly build
|
||||||
|
// e.g. 0.84.2-20220220-1250
|
||||||
|
// pr build
|
||||||
|
// e.g. 0.84.2-pr-1234-20220220-1250
|
||||||
|
packageJson.version = `${packageJson.version}-${process.env.targetVersion}` |
||||||
|
packageJson.name += '-daily' |
||||||
|
} else { |
||||||
|
packageJson.version = process.env.targetVersion |
||||||
|
} |
||||||
|
fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), JSON.stringify(packageJson, 0, 2)) |
@ -0,0 +1,49 @@ |
|||||||
|
const fs = require('fs') |
||||||
|
const path = require('path') |
||||||
|
|
||||||
|
const execSync = require('child_process').execSync; |
||||||
|
|
||||||
|
// extract latest version from package.json
|
||||||
|
const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'))) |
||||||
|
|
||||||
|
|
||||||
|
const replacePackageName = (filePath) => { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
return fs.readFile(filePath, 'utf8', function (err, data) { |
||||||
|
if (err) return reject(err) |
||||||
|
var result = data.replace(/nc-lib-gui-v2/g, ncLibPackage.name); |
||||||
|
return fs.writeFile(filePath, result, 'utf8', function (err) { |
||||||
|
if (err) return reject(err) |
||||||
|
return resolve() |
||||||
|
}); |
||||||
|
}); |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const bumbVersionAndSave = () => { |
||||||
|
// upgrade nc-lib-gui-v2 version in nocodb
|
||||||
|
execSync(`cd packages/nocodb && npm install --save --save-exact ${ncLibPackage.name}@${ncLibPackage.version}`, {}); |
||||||
|
const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json') |
||||||
|
const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath)) |
||||||
|
if (process.env.targetEnv === 'DEV') { |
||||||
|
nocoLibPackage.name = `${nocoLibPackage.name}-daily` |
||||||
|
} |
||||||
|
nocoLibPackage.version = ncLibPackage.version |
||||||
|
fs.writeFileSync(nocodbPackageFilePath, JSON.stringify(nocoLibPackage, null, 2)); |
||||||
|
} |
||||||
|
|
||||||
|
if (process.env.targetEnv === 'DEV') { |
||||||
|
// replace nc-lib-gui-v2 by nc-lib-gui-v2-daily if it is nightly build / pr release
|
||||||
|
const filePaths = [ |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'), |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'), |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json'), |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'README.md'), |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'src', 'lib', 'Noco.ts'), |
||||||
|
] |
||||||
|
Promise.all(filePaths.map(filePath => { return replacePackageName(filePath) })).then(() => { |
||||||
|
bumbVersionAndSave(); |
||||||
|
}) |
||||||
|
} else { |
||||||
|
bumbVersionAndSave(); |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
const fs = require('fs') |
||||||
|
const path = require('path'); |
||||||
|
const execSync = require('child_process').execSync; |
||||||
|
|
||||||
|
// extract latest version from package.json
|
||||||
|
const nocodbSdkPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nocodb-sdk', 'package.json'), 'utf8')) |
||||||
|
|
||||||
|
const replacePackageName = (filePath) => { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
return fs.readFile(filePath, 'utf8', function (err, data) { |
||||||
|
if (err) return reject(err) |
||||||
|
var result = data.replace(/nocodb-sdk/g, nocodbSdkPackage.name); |
||||||
|
return fs.writeFile(filePath, result, 'utf8', function (err) { |
||||||
|
if (err) return reject(err) |
||||||
|
return resolve() |
||||||
|
}); |
||||||
|
}); |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
const bumbVersionAndSave = () => { |
||||||
|
// upgrade nocodb-sdk version in nocodb
|
||||||
|
execSync(`cd packages/nocodb && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {}); |
||||||
|
// upgrade nocodb-sdk version in nc-gui-v2
|
||||||
|
execSync(`cd packages/nc-gui-v2 && npm install --save --save-exact ${nocodbSdkPackage.name}@${nocodbSdkPackage.version}`, {}); |
||||||
|
} |
||||||
|
|
||||||
|
const dfs = function(dir) { |
||||||
|
var res = []; |
||||||
|
var list = fs.readdirSync(dir); |
||||||
|
list.forEach(function(file) { |
||||||
|
if (['node_modules', 'build'].includes(file)) return; |
||||||
|
file = dir + '/' + file; |
||||||
|
var stat = fs.statSync(file); |
||||||
|
if (stat && stat.isDirectory()) { |
||||||
|
res = res.concat(dfs(file)); |
||||||
|
} else { |
||||||
|
const ext = path.extname(file).toLowerCase() |
||||||
|
if (ext == '.vue' || ext == '.ts' || ext == '.js') { |
||||||
|
res.push(file); |
||||||
|
} |
||||||
|
} |
||||||
|
}) |
||||||
|
return res; |
||||||
|
} |
||||||
|
|
||||||
|
const searchAndReplace = (target) => { |
||||||
|
let list = [ |
||||||
|
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nc-gui-v2'))), |
||||||
|
...dfs(path.resolve(path.join(__dirname, '..', 'packages', 'nocodb'))), |
||||||
|
path.join(__dirname, '..', 'packages', 'nc-gui-v2', 'package.json'), |
||||||
|
path.join(__dirname, '..', 'packages', 'nocodb', 'package.json') |
||||||
|
] |
||||||
|
return Promise.all(list.map(d => { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
fs.readFile(d, function(err, content) { |
||||||
|
if (err) reject(err) |
||||||
|
if (content.indexOf(target) > -1) { |
||||||
|
resolve(replacePackageName(d)) |
||||||
|
} else { |
||||||
|
resolve() |
||||||
|
} |
||||||
|
}) |
||||||
|
}) |
||||||
|
})) |
||||||
|
} |
||||||
|
|
||||||
|
if (process.env.targetEnv === 'DEV') { |
||||||
|
// replace nocodb-sdk by nocodb-sdk-daily if it is nightly build / pr build
|
||||||
|
searchAndReplace('nocodb-sdk') |
||||||
|
.then(() => { |
||||||
|
bumbVersionAndSave() |
||||||
|
}) |
||||||
|
} else { |
||||||
|
bumbVersionAndSave() |
||||||
|
} |
Loading…
Reference in new issue