Initial commit: ERP system with advance verification fixes

This commit is contained in:
System Administrator
2026-03-25 23:55:36 +07:00
commit 563ca12d76
5920 changed files with 828689 additions and 0 deletions
@@ -0,0 +1,5 @@
parserOptions:
sourceType: script
rules:
no-console: 0
no-empty: [2, allowEmptyCatch: true]
+48
View File
@@ -0,0 +1,48 @@
"use strict"
const fs = require("fs")
const path = require("path")
const browserify = require("browserify")
const {minify} = require("terser")
const [sourceFile, outFile, globalName] = process.argv.slice(2)
const json = require(path.join(__dirname, "..", "package.json"))
const bundleDir = path.join(__dirname, "..", "bundle")
if (!fs.existsSync(bundleDir)) fs.mkdirSync(bundleDir)
browserify({standalone: globalName})
.require(path.join(__dirname, "../dist", sourceFile), {expose: sourceFile})
.bundle(saveAndMinify)
async function saveAndMinify(err, buf) {
if (err) {
console.error("browserify error:", err)
process.exit(1)
}
const bundlePath = path.join(bundleDir, outFile)
const opts = {
ecma: 2018,
warnings: true,
compress: {
pure_getters: true,
keep_infinity: true,
unsafe_methods: true,
},
format: {
preamble: `/* ${json.name} ${json.version} (${globalName}): ${json.description} */`,
},
sourceMap: {
filename: outFile + ".min.js",
url: outFile + ".min.js.map",
},
}
const result = await minify(buf.toString(), opts)
fs.writeFileSync(bundlePath + ".bundle.js", buf)
fs.writeFileSync(bundlePath + ".min.js", result.code)
fs.writeFileSync(bundlePath + ".min.js.map", result.map)
if (result.warnings) result.warnings.forEach((msg) => console.warn("terser.minify warning:", msg))
}
@@ -0,0 +1,57 @@
// Credit for the script goes to svelte:
// https://github.com/sveltejs/svelte/blob/ce3a5791258ec6ecf8c1ea022cb871afe805a45c/site/scripts/get-contributors.js
const fs = require("fs")
const fetch = require("node-fetch")
const Jimp = require("jimp")
process.chdir(__dirname)
const base = `https://api.github.com/repos/ajv-validator/ajv/contributors`
const {GH_TOKEN_PUBLIC} = process.env
const SIZE = 64
async function main() {
const contributors = []
let page = 1
// eslint-disable-next-line no-constant-condition
while (true) {
const res = await fetch(`${base}?per_page=100&page=${page++}`, {
headers: {Authorization: `token ${GH_TOKEN_PUBLIC}`},
})
const list = await res.json()
if (list.length === 0) break
contributors.push(...list)
}
const bots = ["dependabot-preview[bot]", "greenkeeper[bot]", "greenkeeperio-bot"]
const authors = contributors
.filter((a) => !bots.includes(a.login))
.sort((a, b) => b.contributions - a.contributions)
const sprite = new Jimp(SIZE * authors.length, SIZE)
for (let i = 0; i < authors.length; i += 1) {
const author = authors[i]
console.log(`${i + 1} / ${authors.length}: ${author.login}`)
const image_data = await fetch(author.avatar_url)
const buffer = await image_data.arrayBuffer()
const image = await Jimp.read(buffer)
image.resize(SIZE, SIZE)
sprite.composite(image, i * SIZE, 0)
}
await sprite.quality(80).write(`../docs/.vuepress/components/Contributors/contributors.jpg`)
const str = `[\n\t${authors.map((a) => `'${a.login}'`).join(",\n\t")}\n]`
fs.writeFileSync(
`../docs/.vuepress/components/Contributors/_contributors.js`,
`export default ${str};`
)
}
main()
+31
View File
@@ -0,0 +1,31 @@
"use strict"
const testSuitePaths = {
draft6: "spec/JSON-Schema-Test-Suite/tests/draft6/",
draft7: "spec/JSON-Schema-Test-Suite/tests/draft7/",
draft2019: "spec/JSON-Schema-Test-Suite/tests/draft2019-09/",
tests: "spec/tests/",
security: "spec/security/",
extras: "spec/extras/",
async: "spec/async/",
}
const glob = require("glob")
const fs = require("fs")
for (const suite in testSuitePaths) {
const p = testSuitePaths[suite]
const files = glob.sync(`${p}{**/,}*.json`)
if (files.length === 0) {
console.error(`Missing folder ${p}\nTry: git submodule update --init\n`)
process.exit(1)
}
const code = files
.map((f) => {
const name = f.replace(p, "").replace(/\.json$/, "")
const testPath = f.replace(/^spec/, "..")
return `\n {name: "${name}", test: require("${testPath}")},`
})
.reduce((list, f) => list + f)
fs.writeFileSync(`./spec/_json/${suite}.js`, `module.exports = [${code}\n]\n`)
}
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
function copyReplace {
sed "s/](.\/docs\//](.\//g" $1 > $2
}
copyReplace README.md docs/README.md
copyReplace CODE_OF_CONDUCT.md docs/code_of_conduct.md
copyReplace CONTRIBUTING.md docs/contributing.md
copyReplace LICENSE docs/license.md
echo "preparing contributors..."
node scripts/get-contributors.js
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
set -e
mkdir -p .browser
echo
echo Preparing browser tests:
find spec -type f -name '*.spec.*s' | \
xargs -I {} sh -c \
'export f="{}"; echo $f; ./node_modules/.bin/browserify $f -p [ tsify -p ./spec/tsconfig.json ] -x ajv -u buffer -o $(echo $f | sed -e "s/spec/.browser/" | sed -e "s/.spec.ts/.spec.js/");'
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
if [[ $GITHUB_REF == refs/tags/v* ]]; then
npm run bundle
echo "About to publish $GITHUB_REF to ajv-dist..."
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
git clone https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv-dist.git ../ajv-dist
rm -rf ../ajv-dist/dist
mkdir ../ajv-dist/dist
cp ./bundle/*.* ../ajv-dist/dist
cd ../ajv-dist
VERSION=${GITHUB_REF#refs/tags/v}
sed -E "s/\"version\": \"([^\"]*)\"/\"version\": \"$VERSION\"/" package.json > new_package.json
mv new_package.json package.json
if [[ $(git status --porcelain) ]]; then
echo "Changes detected. Updating master branch..."
git add -A
git commit -m "$VERSION: updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
git push --quiet origin master > /dev/null 2>&1
fi
echo "Publishing tag..."
git tag "v$VERSION"
git push --tags > /dev/null 2>&1
echo "Done"
fi
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -ex
echo "About to publish $GITHUB_REF to gh-pages..."
rm -rf ../gh-pages
npm run docs:build
git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
git clone -b gh-pages --single-branch https://"${GH_TOKEN_PUBLIC}"@github.com/ajv-validator/ajv.git ../gh-pages
rsync -a ./docs/.vuepress/dist/ ../gh-pages
cd ../gh-pages
if [[ $(git status --porcelain) ]]; then
echo "Changes detected. Updating gh-pages branch..."
git add -A
git commit -m "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
git push --quiet origin gh-pages > /dev/null 2>&1
fi
echo "Done"