publishing adjustment
This commit is contained in:
parent
a06d66f2ad
commit
190b8b7a21
|
@ -9,7 +9,7 @@
|
|||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@lingdocs/inflect": "5.3.2",
|
||||
"@lingdocs/inflect": "5.4.2",
|
||||
"base64url": "^3.0.1",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"connect-redis": "^6.0.0",
|
||||
|
@ -124,9 +124,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@lingdocs/inflect": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.3.2.tgz",
|
||||
"integrity": "sha512-5P/N+kKcbtcNv4bqAG+xGdaZAzVyPYvmudTZ614SaaN4lJraTrG81FtlUsqeDLMf+yW5IJcfgE31a1mr6t7gGQ==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.4.2.tgz",
|
||||
"integrity": "sha512-AV/RwKPRtWJ+eRL7r/50LvfZJyjK0H425j5IBkObYsr9wCHNHiEewZtSm+T4NWME3YEYZVt7O58dqQBxlumefw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pbf": "^3.2.1",
|
||||
|
@ -2741,9 +2741,9 @@
|
|||
}
|
||||
},
|
||||
"@lingdocs/inflect": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.3.2.tgz",
|
||||
"integrity": "sha512-5P/N+kKcbtcNv4bqAG+xGdaZAzVyPYvmudTZ614SaaN4lJraTrG81FtlUsqeDLMf+yW5IJcfgE31a1mr6t7gGQ==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.4.2.tgz",
|
||||
"integrity": "sha512-AV/RwKPRtWJ+eRL7r/50LvfZJyjK0H425j5IBkObYsr9wCHNHiEewZtSm+T4NWME3YEYZVt7O58dqQBxlumefw==",
|
||||
"requires": {
|
||||
"pbf": "^3.2.1",
|
||||
"rambda": "^7.3.0"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@lingdocs/inflect": "5.3.2",
|
||||
"@lingdocs/inflect": "5.4.2",
|
||||
"base64url": "^3.0.1",
|
||||
"bcryptjs": "^2.4.3",
|
||||
"connect-redis": "^6.0.0",
|
||||
|
|
|
@ -45,10 +45,10 @@
|
|||
"@jridgewell/resolve-uri" "^3.0.3"
|
||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||
|
||||
"@lingdocs/inflect@5.3.2":
|
||||
"integrity" "sha512-5P/N+kKcbtcNv4bqAG+xGdaZAzVyPYvmudTZ614SaaN4lJraTrG81FtlUsqeDLMf+yW5IJcfgE31a1mr6t7gGQ=="
|
||||
"resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.3.2.tgz"
|
||||
"version" "5.3.2"
|
||||
"@lingdocs/inflect@5.4.2":
|
||||
"integrity" "sha512-AV/RwKPRtWJ+eRL7r/50LvfZJyjK0H425j5IBkObYsr9wCHNHiEewZtSm+T4NWME3YEYZVt7O58dqQBxlumefw=="
|
||||
"resolved" "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.4.2.tgz"
|
||||
"version" "5.4.2"
|
||||
dependencies:
|
||||
"pbf" "^3.2.1"
|
||||
"rambda" "^7.3.0"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"name": "functions",
|
||||
"dependencies": {
|
||||
"@google-cloud/storage": "^5.8.1",
|
||||
"@lingdocs/inflect": "5.3.2",
|
||||
"@lingdocs/inflect": "5.4.2",
|
||||
"@types/cors": "^2.8.10",
|
||||
"@types/google-spreadsheet": "^3.0.2",
|
||||
"@types/react": "^18.0.21",
|
||||
|
@ -1468,9 +1468,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@lingdocs/inflect": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.3.2.tgz",
|
||||
"integrity": "sha512-5P/N+kKcbtcNv4bqAG+xGdaZAzVyPYvmudTZ614SaaN4lJraTrG81FtlUsqeDLMf+yW5IJcfgE31a1mr6t7gGQ==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.4.2.tgz",
|
||||
"integrity": "sha512-AV/RwKPRtWJ+eRL7r/50LvfZJyjK0H425j5IBkObYsr9wCHNHiEewZtSm+T4NWME3YEYZVt7O58dqQBxlumefw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pbf": "^3.2.1",
|
||||
|
@ -8050,9 +8050,9 @@
|
|||
}
|
||||
},
|
||||
"@lingdocs/inflect": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.3.2.tgz",
|
||||
"integrity": "sha512-5P/N+kKcbtcNv4bqAG+xGdaZAzVyPYvmudTZ614SaaN4lJraTrG81FtlUsqeDLMf+yW5IJcfgE31a1mr6t7gGQ==",
|
||||
"version": "5.4.2",
|
||||
"resolved": "https://npm.lingdocs.com/@lingdocs%2finflect/-/inflect-5.4.2.tgz",
|
||||
"integrity": "sha512-AV/RwKPRtWJ+eRL7r/50LvfZJyjK0H425j5IBkObYsr9wCHNHiEewZtSm+T4NWME3YEYZVt7O58dqQBxlumefw==",
|
||||
"requires": {
|
||||
"pbf": "^3.2.1",
|
||||
"rambda": "^7.3.0"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"main": "lib/functions/src/index.js",
|
||||
"dependencies": {
|
||||
"@google-cloud/storage": "^5.8.1",
|
||||
"@lingdocs/inflect": "5.3.2",
|
||||
"@lingdocs/inflect": "5.4.2",
|
||||
"@types/cors": "^2.8.10",
|
||||
"@types/google-spreadsheet": "^3.0.2",
|
||||
"@types/react": "^18.0.21",
|
||||
|
|
|
@ -31,6 +31,7 @@ const dictionaryInfoFilename = "dict-info";
|
|||
// const hunspellAffFileFilename = "ps_AFF.aff";
|
||||
// const hunspellDicFileFilename = "ps_AFF.dic";
|
||||
const allWordsJsonFilename = "all-words.json";
|
||||
const allWordsInfoFilename = "all-words-info.json";
|
||||
const url = `${baseUrl}${dictionaryFilename}`;
|
||||
const infoUrl = `${baseUrl}${dictionaryInfoFilename}`;
|
||||
|
||||
|
@ -61,23 +62,21 @@ export default async function publish(): Promise<PublishDictionaryResponse> {
|
|||
}
|
||||
uploadDictionaryToStorage(dictionary).catch(console.error);
|
||||
// TODO: make this async and run after publish response
|
||||
doHunspellEtc(entries).catch(console.error);
|
||||
doHunspellEtc(dictionary.info, entries).catch(console.error);
|
||||
return {
|
||||
ok: true,
|
||||
info: dictionary.info
|
||||
};
|
||||
}
|
||||
|
||||
async function doHunspellEtc(entries: T.DictionaryEntry[]) {
|
||||
console.log("getting word list");
|
||||
async function doHunspellEtc(info: T.DictionaryInfo, entries: T.DictionaryEntry[]) {
|
||||
const wordlistResponse = getWordList(entries);
|
||||
console.log("got word list length", wordlistResponse.ok && wordlistResponse.wordlist.length);
|
||||
if (!wordlistResponse.ok) {
|
||||
throw new Error(JSON.stringify(wordlistResponse.errors));
|
||||
}
|
||||
// const hunspell = makeHunspell(wordlistResponse.wordlist);
|
||||
// await uploadHunspellToStorage(hunspell);
|
||||
await uploadAllWordsToStoarage(wordlistResponse.wordlist)
|
||||
await uploadAllWordsToStoarage(info, wordlistResponse.wordlist)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,8 +235,9 @@ async function upload(content: Buffer | string, filename: string) {
|
|||
// ]);
|
||||
// }
|
||||
|
||||
async function uploadAllWordsToStoarage(words: T.PsString[]) {
|
||||
await upload(JSON.stringify(words), allWordsJsonFilename)
|
||||
async function uploadAllWordsToStoarage(info: T.DictionaryInfo, words: T.PsString[]) {
|
||||
await upload(JSON.stringify({ info, words }), allWordsJsonFilename);
|
||||
await upload(JSON.stringify(info), allWordsInfoFilename);
|
||||
}
|
||||
|
||||
async function uploadDictionaryToStorage(dictionary: T.Dictionary) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.15.2",
|
||||
"@lingdocs/ps-react": "5.3.2",
|
||||
"@lingdocs/ps-react": "5.4.2",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
|
|
|
@ -2349,10 +2349,10 @@
|
|||
"@jridgewell/resolve-uri" "^3.0.3"
|
||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||
|
||||
"@lingdocs/ps-react@5.3.2":
|
||||
version "5.3.2"
|
||||
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.3.2.tgz#ef0385df5463cd90b8a991f9bc2b4f132474c070"
|
||||
integrity sha512-A9tuVZfSSjiS2tdFy/1w9lFo3g8Lgq3kMDzYIb6NuoGRcVVgAXhFihHY7U9RBiLrTmg65R8PIxiKYvjHUtEEKg==
|
||||
"@lingdocs/ps-react@5.4.2":
|
||||
version "5.4.2"
|
||||
resolved "https://npm.lingdocs.com/@lingdocs%2fps-react/-/ps-react-5.4.2.tgz#cb6b7e665568f4c5d20d8ace032c87ac5baab1ff"
|
||||
integrity sha512-P0gMe8GG5DKM5xGbXP1zt+J1Gga+Lzm27K75VEc07IiBwJ5l2CKtc5freqv02/qUPAwVauRNAoK68VTMm5TrLA==
|
||||
dependencies:
|
||||
"@formkit/auto-animate" "^1.0.0-beta.3"
|
||||
classnames "^2.2.6"
|
||||
|
|
Loading…
Reference in New Issue