automated node script for tsc library building

This commit is contained in:
Bill D 2021-03-16 14:34:34 +04:00
parent 0663ed34a4
commit f2bb16a929
4 changed files with 24 additions and 4 deletions

View File

@ -11,7 +11,7 @@ const fetch = require("node-fetch");
const path = require("path"); const path = require("path");
const collectionPath = path.join(".", "verbs"); const collectionPath = path.join(".", "verbs");
const verbTsFiles = fs.readdirSync(collectionPath); const verbTsFiles = fs.readdirSync(collectionPath);
const protoModels = require("./dictionary-models.js"); const protoModels = require("./src/lib/dictionary-models.js");
const Pbf = require("pbf"); const Pbf = require("pbf");
const allTsS = [...new Set(verbTsFiles.reduce((arr, fileName) => { const allTsS = [...new Set(verbTsFiles.reduce((arr, fileName) => {

18
library-post-build.js Normal file
View File

@ -0,0 +1,18 @@
const pkg = require("./package.json");
const glob = require("glob");
const fs = require("fs-extra");
const path = require("path");
fs.mkdir("dist/node_modules", {}, (err) => {
if (err) throw err;
const required = Object.keys(pkg.dependencies);
required.forEach((m) => {
fs.copySync(`node_modules/${m}`, `dist/node_modules/${m}`);
});
glob("src/components/verb-info/*.svg", (err, files) => {
if (err) throw err;
files.forEach((file) => {
fs.copySync(file, `dist/components/verb-info/${path.basename(file)}`);
});
});
});

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "0.2.6", "version": "0.2.7",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",
@ -40,6 +40,8 @@
"@types/react": "^17.0.3", "@types/react": "^17.0.3",
"@types/react-dom": "^17.0.2", "@types/react-dom": "^17.0.2",
"bootstrap": "^4.6.0", "bootstrap": "^4.6.0",
"fs-extra": "^9.1.0",
"glob": "^7.1.6",
"node-fetch": "^2.6.1", "node-fetch": "^2.6.1",
"react": "^17.0.1", "react": "^17.0.1",
"react-bootstrap": "^1.5.1", "react-bootstrap": "^1.5.1",
@ -61,7 +63,7 @@
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject", "eject": "react-scripts eject",
"build-website": "node get-verbs.js && npm run build", "build-website": "node get-verbs.js && npm run build",
"build-library": "node get-verbs.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && mkdir dist/node_modules && cp -r node_modules/classnames dist/node_modules && cp -r node_modules/pbf dist/node_modules && cp src/components/verb-info/*.svg dist/components/verb-info && rollup -c", "build-library": "node get-verbs.js && rimraf dist && rimraf dist-cjs && tsc --project library-tsconfig.json && node library-post-build.js && rollup -c",
"test-ci": "npm run test -- --watchAll=false" "test-ci": "npm run test -- --watchAll=false"
}, },
"eslintConfig": { "eslintConfig": {

View File

@ -5235,7 +5235,7 @@ fs-extra@^8.1.0:
jsonfile "^4.0.0" jsonfile "^4.0.0"
universalify "^0.1.0" universalify "^0.1.0"
fs-extra@^9.0.1: fs-extra@^9.0.1, fs-extra@^9.1.0:
version "9.1.0" version "9.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==