Browse Source

chore(gui-v2): nc-lib-gui-2 -> nc-lib-gui-v2

pull/3273/head
Wing-Kam Wong 2 years ago
parent
commit
fa13bc2728
  1. 2
      packages/nc-gui-v2/package.json
  2. 4
      packages/nc-lib-gui-v2/package.json
  3. 2
      packages/nocodb/Dockerfile
  4. 2
      packages/nocodb/src/lib/Noco.ts
  5. 4
      scripts/bumpNcGuiVersion.js
  6. 8
      scripts/upgradeNcGui2.js

2
packages/nc-gui-v2/package.json

@ -9,7 +9,7 @@
"test": "vitest -c test/vite.config.ts", "test": "vitest -c test/vite.config.ts",
"test:ui": "vitest -c test/vite.config.ts --ui", "test:ui": "vitest -c test/vite.config.ts --ui",
"coverage": "vitest -c test/vite.config.ts run --coverage", "coverage": "vitest -c test/vite.config.ts run --coverage",
"build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-2/lib/dist/ ; npm publish ../nc-lib-gui-2" "build:copy:publish": "npm run generate; rm -rf ../nc-lib-gui-v2/lib/dist/; rsync -rvzh ./dist/ ../nc-lib-gui-v2/lib/dist/ ; npm publish ../nc-lib-gui-v2"
}, },
"dependencies": { "dependencies": {

4
packages/nc-lib-gui-v2/package.json

@ -1,6 +1,6 @@
{ {
"name": "nc-lib-gui-2", "name": "nc-lib-gui-v2",
"version": "0.0.4", "version": "0.0.0",
"description": "NocoDB GUI", "description": "NocoDB GUI",
"author": { "author": {
"name": "NocoDB", "name": "NocoDB",

2
packages/nocodb/Dockerfile

@ -33,7 +33,7 @@ COPY ./docker/start-litestream.sh /usr/src/appEntry/start.sh
# reduce node_module size with modclean & removing sqlite deps, # reduce node_module size with modclean & removing sqlite deps,
# package built code into app.tar.gz & add execute permission to start.sh # package built code into app.tar.gz & add execute permission to start.sh
RUN npm ci --production --quiet \ RUN npm ci --production --quiet \
&& npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,nc-lib-gui-2/**,dayjs/**,express-status-monitor/**" --run \ && npx modclean --patterns="default:*" --ignore="nc-lib-gui/**,nc-lib-gui-v2/**,dayjs/**,express-status-monitor/**" --run \
&& rm -rf ./node_modules/sqlite3/deps \ && rm -rf ./node_modules/sqlite3/deps \
&& tar -czf ../appEntry/app.tar.gz ./* \ && tar -czf ../appEntry/app.tar.gz ./* \
&& chmod +x /usr/src/appEntry/start.sh && chmod +x /usr/src/appEntry/start.sh

2
packages/nocodb/src/lib/Noco.ts

@ -11,7 +11,7 @@ import * as express from 'express';
import { Router } from 'express'; import { Router } from 'express';
import importFresh from 'import-fresh'; import importFresh from 'import-fresh';
import morgan from 'morgan'; import morgan from 'morgan';
import NcToolGui from 'nc-lib-gui-2'; import NcToolGui from 'nc-lib-gui-v2';
import requestIp from 'request-ip'; import requestIp from 'request-ip';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';

4
scripts/bumpNcGuiVersion.js

@ -1,7 +1,7 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-2', 'package.json'), 'utf8')) const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), 'utf8'))
if (process.env.targetEnv === 'DEV') { if (process.env.targetEnv === 'DEV') {
// nightly build // nightly build
@ -13,4 +13,4 @@ if (process.env.targetEnv === 'DEV') {
} else { } else {
packageJson.version = process.env.targetVersion packageJson.version = process.env.targetVersion
} }
fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-2', 'package.json'), JSON.stringify(packageJson, 0, 2)) fs.writeFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json'), JSON.stringify(packageJson, 0, 2))

8
scripts/upgradeNcGui2.js

@ -4,14 +4,14 @@ const path = require('path')
const execSync = require('child_process').execSync; const execSync = require('child_process').execSync;
// extract latest version from package.json // extract latest version from package.json
const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-2', 'package.json'))) const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui-v2', 'package.json')))
const replacePackageName = (filePath) => { const replacePackageName = (filePath) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
return fs.readFile(filePath, 'utf8', function (err, data) { return fs.readFile(filePath, 'utf8', function (err, data) {
if (err) return reject(err) if (err) return reject(err)
var result = data.replace(/nc-lib-gui-2/g, ncLibPackage.name); var result = data.replace(/nc-lib-gui-v2/g, ncLibPackage.name);
return fs.writeFile(filePath, result, 'utf8', function (err) { return fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) return reject(err) if (err) return reject(err)
return resolve() return resolve()
@ -21,7 +21,7 @@ const replacePackageName = (filePath) => {
} }
const bumbVersionAndSave = () => { const bumbVersionAndSave = () => {
// upgrade nc-lib-gui-2 version in nocodb // upgrade nc-lib-gui-v2 version in nocodb
execSync(`cd packages/nocodb && npm install --save --save-exact ${ncLibPackage.name}@${ncLibPackage.version}`, {}); execSync(`cd packages/nocodb && npm install --save --save-exact ${ncLibPackage.name}@${ncLibPackage.version}`, {});
const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json') const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath)) const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath))
@ -33,7 +33,7 @@ const bumbVersionAndSave = () => {
} }
if (process.env.targetEnv === 'DEV') { if (process.env.targetEnv === 'DEV') {
// replace nc-lib-gui-2 by nc-lib-gui-2-daily if it is nightly build / pr release // replace nc-lib-gui-v2 by nc-lib-gui-v2-daily if it is nightly build / pr release
const filePaths = [ const filePaths = [
path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'), path.join(__dirname, '..', 'packages', 'nocodb', 'Dockerfile'),
path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'), path.join(__dirname, '..', 'packages', 'nocodb', 'litestream', 'Dockerfile'),

Loading…
Cancel
Save