Skip to content

Commit

Permalink
adding back aliases, updating publish script, updating vite react config
Browse files Browse the repository at this point in the history
  • Loading branch information
tnrich committed Jul 20, 2023
1 parent 9078f64 commit 3bbba62
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"root": true,
"plugins": ["@nx"],
"extends": ["plugin:@nx/react"],
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": true
},
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"vite-plugin-dts": "~3.0.2",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-libcss": "^1.1.1",
"vite-plugin-static-copy": "^0.17.0",
"vite-plugin-virtual-html": "^1.1.10",
"vite-tsconfig-paths": "^4.0.2",
"vitest": "^0.32.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/ove/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ove",
"version": "0.0.9",
"version": "0.0.14",
"main": "./index.js",
"types": "./index.d.ts",
"type": "commonjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teselagen/ui",
"version": "0.0.9",
"version": "0.0.11",
"main": "./index.js",
"types": "./index.d.ts",
"type": "commonjs",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/DataTable/utils/queryParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ export function getQueryParams({
}

const { model } = schema;
if (!window.QueryBuilder) return toReturn;
const qb = new window.QueryBuilder(model);
// qb = qb.filter('user')
// qb = qb.whereAny({
Expand Down
35 changes: 13 additions & 22 deletions tools/scripts/publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
* You might need to authenticate with NPM before running this script.
*/

import { execSync } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
import chalk from 'chalk';

import devkit from '@nx/devkit';
import path from 'path';
import { execSync } from "child_process";
import { readFileSync, writeFileSync } from "fs";
import chalk from "chalk";
import devkit from "@nx/devkit";
import path from "path";

const { readCachedProjectGraph } = devkit;

Expand All @@ -25,7 +24,7 @@ function invariant(condition, message) {

// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag}
// Default "tag" to "next" so we won't publish the "latest" tag by accident.
let [, , name, version, tag = 'next'] = process.argv;
let [, , name, version, tag = "next"] = process.argv;

// A simple SemVer validation to validate the version
const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/;
Expand All @@ -39,27 +38,19 @@ invariant(
);
const outputPath = project.data?.targets?.build?.options?.outputPath;
const packagePath = project.data?.root;
invariant(
outputPath,
`Could not find "build.options.outputPath" of project "${name}". Is project.json configured correctly?`
);
invariant(
outputPath,
`Could not find "packagePath" of project "${name}". Is project.json configured correctly?`
);

if (!tag || tag === 'undefined') {
tag = 'latest';
if (!tag || tag === "undefined") {
tag = "latest";
}
if (!version || version === 'undefined') {
if (!version || version === "undefined") {
process.chdir(packagePath);
let json = JSON.parse(readFileSync(`package.json`).toString());
version = json.version;

// Bump the version
let versionParts = version.split('.');
const versionParts = version.split(".");
versionParts[2] = Number(versionParts[2]) + 1; // increase patch version
version = versionParts.join('.');
version = versionParts.join(".");

// Updating the version in "package.json" before publishing
try {
Expand All @@ -72,7 +63,7 @@ if (!version || version === 'undefined') {
)
);
}
process.chdir(path.resolve('../../', outputPath));
process.chdir(path.resolve(`../../dist/${name}`));
json = JSON.parse(readFileSync(`package.json`).toString());
try {
json.version = version;
Expand All @@ -85,7 +76,7 @@ if (!version || version === 'undefined') {
);
}
} else {
process.chdir(outputPath);
process.chdir(path.resolve("../../", `dist/${name}`));
}

invariant(
Expand Down
56 changes: 33 additions & 23 deletions vite.react.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import vitePluginVirtualHtml from "vite-plugin-virtual-html";
import libCss from "vite-plugin-libcss";
import { camelCase } from "lodash";
import { getPort } from "./getPort";
import { viteStaticCopy } from "vite-plugin-static-copy";
import path from "node:path";

const justSrc = [
/\/src\/.*\.js$/,
Expand Down Expand Up @@ -50,7 +52,7 @@ export default ({ name }: { name: string; dir: string }) =>
server: {
port
},

base: "./",
plugins: [
// dts({
// entryRoot: 'src',
Expand All @@ -62,8 +64,17 @@ export default ({ name }: { name: string; dir: string }) =>
viteTsConfigPaths({
root: "../../"
}),
...(command === "build" && mode !== "demo"
? []
...(command === "build" && !isDemo
? [
viteStaticCopy({
targets: [
{
src: "./package.json",
dest: "."
}
]
})
]
: [
vitePluginVirtualHtml({
pages: {
Expand Down Expand Up @@ -110,14 +121,13 @@ export default ({ name }: { name: string; dir: string }) =>
minify: false,
target: "es2015",
outDir: `../../${isDemo ? "demo-dist" : "dist"}/${name}`,
...(mode === "demo"
...(isDemo
? {}
: {
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: "src/index.js",
name,

fileName: "index"
// Change this to the formats you want to support.
// Don't forgot to update your package.json as well.
Expand Down Expand Up @@ -146,24 +156,24 @@ export default ({ name }: { name: string; dir: string }) =>
}
},
resolve: {
// alias: {
// // react: path.join(__dirname, "node_modules/react"),
// // "@blueprintjs/core": path.join(
// // __dirname,
// // "node_modules/@blueprintjs/core"
// // ),
// // "@blueprintjs/datetime": path.join(
// // __dirname,
// // "node_modules/@blueprintjs/datetime"
// // ),
// // "react-dom": path.join(__dirname, "node_modules/react-dom"),
// // "react-redux": path.join(__dirname, "node_modules/react-redux"),
// // "redux-form": path.join(__dirname, "node_modules/redux-form"),
// // redux: path.join(__dirname, "node_modules/redux")
// // "@teselagen/range-utils": path.resolve(__dirname, "../tg-oss/packages/range-utils/src"),
// // "@teselagen/sequence-utils": path.resolve(__dirname, "../tg-oss/packages/sequence-utils/src"),
// // "@teselagen/bio-parsers": path.resolve(__dirname, "../tg-oss/packages/bio-parsers/src"),
// }
alias: {
react: path.join(__dirname, "node_modules/react"),
"@blueprintjs/core": path.join(
__dirname,
"node_modules/@blueprintjs/core"
),
"@blueprintjs/datetime": path.join(
__dirname,
"node_modules/@blueprintjs/datetime"
),
"react-dom": path.join(__dirname, "node_modules/react-dom"),
"react-redux": path.join(__dirname, "node_modules/react-redux"),
"redux-form": path.join(__dirname, "node_modules/redux-form"),
redux: path.join(__dirname, "node_modules/redux")
// "@teselagen/range-utils": path.resolve(__dirname, "../tg-oss/packages/range-utils/src"),
// "@teselagen/sequence-utils": path.resolve(__dirname, "../tg-oss/packages/sequence-utils/src"),
// "@teselagen/bio-parsers": path.resolve(__dirname, "../tg-oss/packages/bio-parsers/src"),
}
},
test: {
globals: true,
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12343,6 +12343,16 @@ vite-plugin-libcss@^1.1.1:
dependencies:
minimatch "^9.0.1"

vite-plugin-static-copy@^0.17.0:
version "0.17.0"
resolved "https://registry.yarnpkg.com/vite-plugin-static-copy/-/vite-plugin-static-copy-0.17.0.tgz#e45527da186c4a3818d09635797b6fc7cc9e035f"
integrity sha512-2HpNbHfDt8SDy393AGXh9llHkc8FJMQkI8s3T5WsH3SWLMO+f5cFIyPErl4yGKU9Uh3Vaqsd4lHZYTf042fQ2A==
dependencies:
chokidar "^3.5.3"
fast-glob "^3.2.11"
fs-extra "^11.1.0"
picocolors "^1.0.0"

vite-plugin-virtual-html@^1.1.10:
version "1.1.10"
resolved "https://registry.yarnpkg.com/vite-plugin-virtual-html/-/vite-plugin-virtual-html-1.1.10.tgz#63e331b355910dd014b069254a4bbc75694ea2c2"
Expand Down

0 comments on commit 3bbba62

Please sign in to comment.