try publish with cjs for pashto-inflector as well

This commit is contained in:
adueck 2024-08-14 14:38:00 -04:00
parent db2749bd0a
commit e95116e1b2
9 changed files with 8847 additions and 829 deletions

7888
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
{
"name": "pashto-inflector-website",
"version": "7.6.3",
"version": "7.6.5",
"type": "module",
"scripts": {
"patch": "npm version patch --no-git-tag-version && cd src/lib && npm version patch --no-git-tag-version && cd ../components && npm version patch --no-git-tag-version",
"minor": "npm version minor --no-git-tag-version && cd src/lib && npm version minor --no-git-tag-version && cd ../components && npm version minor --no-git-tag-version",
"major": "npm version major --no-git-tag-version && cd src/lib && npm version major --no-git-tag-version && cd ../components && npm version major --no-git-tag-version",
"preinstall": "echo '*** Be sure to use 'yarn install-all' not 'yarn install' ***!'",
"dev": "vite",
"lint": "eslint .",
"test": "jest",
@ -14,16 +13,17 @@
"install-all": "yarn install && node get-words.cjs && cd src/lib && yarn install && cd ../components && yarn install",
"build-website": "tsc -b && vite build",
"build-components": "rm -rf src/components/dist && tsc --project src/components/tsconfig.json && cd src/components && node post-build.cjs",
"build-lib": "rm -rf src/lib/dist && tsc --project src/lib/tsconfig.json",
"build-lib": "rm -rf src/lib/dist && tsc --project src/lib/tsconfig.json && tsup src/lib/library.ts --format cjs && mv dist/library.cjs src/lib/dist/lib",
"get-words": "node get-words.cjs",
"check-all-inflections": "tsx check-all-inflections.ts"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"@fortawesome/fontawesome-free": "^5.15.2",
"bootstrap": "4.6.1",
"react": "^18.3.1",
"react-bootstrap": "1.5.1",
"@fortawesome/fontawesome-free": "^5.15.2"
"react-dom": "^18.3.1",
"tsup": "^8.2.4"
},
"devDependencies": {
"@eslint/js": "^9.8.0",
@ -39,6 +39,7 @@
"jest-environment-jsdom": "^29.7.0",
"jest-extended": "^4.0.2",
"ts-jest": "^29.2.4",
"tsc-alias": "^1.8.10",
"tsx": "^4.17.0",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.0",

View File

@ -7,7 +7,7 @@
*/
import { useEffect, useState } from "react";
import { dictionary } from "./lib/src/dictionary/dictionary";
import ButtonSelect from "./components/src/selects/ButtonSelect";
import { Modal } from "react-bootstrap";
import * as T from "./types";
@ -31,12 +31,24 @@ function App() {
defualtTextOptions,
"textOpts1"
);
const [dictionaryReady, setDictionaryIsReady] = useState<boolean>(false);
const [theme, setTheme] = useStickyState<"light" | "dark">("light", "theme1");
const [showing, setShowing] = useState<string>("");
function handleHiderClick(label: string) {
setShowing((os) => (os === label ? "" : label));
}
useEffect(() => {
console.log("WILL INIT");
dictionary
.initialize()
.then(() => {
console.log("DONE INIT");
setDictionaryIsReady(true);
})
.catch(console.error);
}, []);
useEffect(() => {
document.documentElement.setAttribute("data-theme", theme);
}, [theme]);
@ -87,6 +99,7 @@ function App() {
<h1 className="display-4 mt-2">
<code>Pashto Inflector</code>
</h1>
{dictionaryReady && <div>READY</div>}
<p
className="lead my-3"
style={{ maxWidth: "600px", margin: "0 auto" }}

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
"version": "7.6.3",
"version": "7.6.5",
"description": "Pashto inflector library module with React components",
"main": "dist/components/library.js",
"module": "dist/components/library.js",

View File

@ -1,8 +1,9 @@
{
"name": "@lingdocs/inflect",
"version": "7.6.3",
"version": "7.6.5",
"description": "Pashto inflector library",
"main": "dist/lib/library.js",
"main": "dist/lib/library.cjs",
"module": "dist/lib/library.js",
"types": "dist/lib/library.d.ts",
"repository": {
"type": "git",

View File

@ -16,7 +16,7 @@ export class DictionaryDb {
// state
private ready = false;
// @ts-expect-error because
// eslint-disable-next-line
public collection: Collection<any>;
constructor(options: {
@ -76,7 +76,7 @@ export class DictionaryDb {
}
private async downloadDictionaryInfo(): Promise<T.DictionaryInfo> {
const res = await fetch(this.dictionaryInfoUrl);
const res = await fetch(this.dictionaryInfoUrl + ".json");
return (await res.json()) as T.DictionaryInfo;
}
@ -93,7 +93,7 @@ export class DictionaryDb {
}
);
this.collection.insert(dictionary.entries);
this.lokidb.saveDatabase((err: any) => {
this.lokidb.saveDatabase((err) => {
/* istanbul ignore next */
if (err) {
console.error("error saving database: " + err);

View File

@ -9,8 +9,8 @@ const dictionaryInfoUrl = `${dictionaryBaseUrl}/dictionary-info`;
const dictDb = new DictionaryDb({
url: dictionaryUrl,
infoUrl: dictionaryInfoUrl,
collectionName: "inflector-dict",
infoLocalStorageKey: "inflector-dict",
collectionName: "inflector-dict5",
infoLocalStorageKey: "inflector-dict5",
});
function queryP(p: string): T.DictionaryEntry[] {

View File

@ -1,10 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ES2020",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ES2022",
"skipLibCheck": true,
"esModuleInterop": true,
/* Bundler mode */
"moduleResolution": "Bundler",

1736
yarn.lock

File diff suppressed because it is too large Load Diff