diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a53e9c --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# Ignore generated directories +dist/ +exec/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# next.js build output +.next diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0c86a8a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Khalid Zoabi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4fd669b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Assets Helper + +A helper CLI for the map3xyz/assets repository \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c365fe7 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "assets-helper", + "private": true, + "version": "1.0.0", + "description": "CLI for maintaining the assets repo.", + "author": "pellicceama", + "keywords": [ + "typescript", + "cli", + "starter" + ], + "license": "MIT", + "main": "./dist/index.js", + "bin": "./dist/cli.js", + "files": [ + "dist/**/*", + "!dist/**/*.test.js" + ], + "scripts": { + "dev": "yarn ts-node ./src/cli.ts", + "clean": "rimraf ./dist/ ./exec/", + "build": "yarn clean && tsc", + "test": "yarn build && ava --verbose", + "bundle": "yarn build && pkg . --out-dir ./exec/" + }, + "devDependencies": { + "@types/node": "^18.0.0", + "ava": "^4.3.0", + "pkg": "^5.7.0", + "rimraf": "^3.0.2", + "ts-node": "^10.8.1", + "typescript": "^4.7.4" + }, + "dependencies": { + "commander": "^9.3.0" + }, + "packageManager": "yarn@3.2.1" +} diff --git a/src/cli.ts b/src/cli.ts new file mode 100644 index 0000000..a31ad9c --- /dev/null +++ b/src/cli.ts @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +import { Command } from 'commander' +import { validate } from './validate' + +const program = new Command(); + +program + .option('-v, --validate', 'Validate Repository') + .parse(process.argv) + +program.parse(process.argv); +const options = program.opts(); + + +if (options.validate) { + validate() + .then(result => { + if (result.valid) { + console.log('Repository is valid'); + } else { + console.log(`Repository is invalid. Errors:\n ${result.errors.join('\n')}`); + } + + }).catch(err => { + console.error("Error running validate", err) + }); +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ec2d21d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "module": "commonjs", + "target": "es6", + "esModuleInterop": true + } +} \ No newline at end of file