diff --git a/.env.exemple b/.env.exemple old mode 100644 new mode 100755 diff --git a/.github/dependabot.yml b/.github/dependabot.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/build-tsc.yml b/.github/workflows/build-tsc.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/build-tsup.yml b/.github/workflows/build-tsup.yml old mode 100644 new mode 100755 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md old mode 100644 new mode 100755 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/SECURITY.md b/SECURITY.md old mode 100644 new mode 100755 diff --git a/babel.config.json b/babel.config.json old mode 100644 new mode 100755 diff --git a/eslint.config.js b/eslint.config.js old mode 100644 new mode 100755 diff --git a/jest.config.ts b/jest.config.ts old mode 100644 new mode 100755 diff --git a/package-lock.json b/package-lock.json old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 63ca02d..750e168 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "cloudflare-manager", "version": "1.0.0", "description": "Gerenciador de fácil uso para cloudflare", - "main": "dist/app.js", - "module": "dist/app.js", + "main": "dist/cli.js", + "module": "dist/cli.js", "type": "module", "homepage": "https://github.com/Ashu11-A/cloudflare-manager", "repository": { @@ -11,8 +11,8 @@ }, "exports": { ".": { - "import": "./dist/app.js", - "types": "./dist/app.d.ts" + "import": "./dist/cli.js", + "types": "./dist/cli.d.ts" } }, "imports": { @@ -24,9 +24,9 @@ "node": ">=20" }, "bin": { - "cloudflare-manager": "dist/app.js", - "cfm": "dist/app.js", - "cm": "dist/app.js" + "cloudflare-manager": "dist/cli.js", + "cfm": "dist/cli.js", + "cm": "dist/cli.js" }, "scripts": { "build": "rimraf dist && tsc && tsc-alias", diff --git a/src/app.ts b/src/app.ts old mode 100644 new mode 100755 index 42ce561..924892e --- a/src/app.ts +++ b/src/app.ts @@ -1,7 +1,7 @@ +import c from 'chalk' import { Page } from './class/pages.js' import { page } from './index.js' import { isGlobal } from './lib/isGlobal.js' -import c from 'chalk' if (!(await isGlobal())) { console.log(`⚠️ ${c.red('Warning')}!`) diff --git a/src/class/pages.ts b/src/class/pages.ts old mode 100644 new mode 100755 diff --git a/src/cli.ts b/src/cli.ts new file mode 100755 index 0000000..a55a1d2 --- /dev/null +++ b/src/cli.ts @@ -0,0 +1,17 @@ +#!/usr/bin/env node +import { writeFile } from 'fs/promises' +import { join } from 'path' +import { exists } from './lib/exists.js' + +const pkgPath = join(process.cwd(), 'package.json') + +if (!(await exists(pkgPath))) { + await writeFile(pkgPath, JSON.stringify({ + version: '1.0.0', + description: 'Generated by cloudflare-manager, for the enmap to work!' + }, null, 2), { + encoding: 'utf-8' + }) +} + +await import('./app.js') \ No newline at end of file diff --git a/src/controller/cloudflare.ts b/src/controller/cloudflare.ts old mode 100644 new mode 100755 diff --git a/src/index.ts b/src/index.ts old mode 100644 new mode 100755 diff --git a/src/lib/exists.ts b/src/lib/exists.ts old mode 100644 new mode 100755 diff --git a/src/lib/extractTypes.ts b/src/lib/extractTypes.ts old mode 100644 new mode 100755 diff --git a/src/lib/isGlobal.ts b/src/lib/isGlobal.ts old mode 100644 new mode 100755 diff --git a/src/lib/linkTables.ts b/src/lib/linkTables.ts old mode 100644 new mode 100755 diff --git a/src/pages/dns.ts b/src/pages/dns.ts old mode 100644 new mode 100755 diff --git a/src/pages/dns/create.ts b/src/pages/dns/create.ts old mode 100644 new mode 100755 index 1eff5cc..9f74c7d --- a/src/pages/dns/create.ts +++ b/src/pages/dns/create.ts @@ -4,6 +4,8 @@ import { client, zone } from '@/index.js' import { extractTypes, Properties } from '@/lib/extractTypes.js' import { PageTypes } from '@/types/page.js' import chalk from 'chalk' +import { __dirname } from '@/index.js' +import { join } from 'path' enum RecordsType { ARecord = 'A', @@ -55,7 +57,8 @@ new Page({ * Isso converte as tipagens do cloudflare. * @returns {Record | undefined} */ - const properties = extractTypes('node_modules/cloudflare/src/resources/dns/records.ts', record) + const pathToCloudflare = join(__dirname, '../', 'node_modules/cloudflare/src/resources/dns/records.ts') + const properties = extractTypes(pathToCloudflare, record) if (properties === undefined) throw new Error(`Não foi possivel achar os types de ${record}`) /** diff --git a/src/pages/options.ts b/src/pages/options.ts old mode 100644 new mode 100755 diff --git a/src/types/page.ts b/src/types/page.ts old mode 100644 new mode 100755 diff --git a/test/pages/dns.test.ts b/test/pages/dns.test.ts old mode 100644 new mode 100755 diff --git a/test/pages/options.test.ts b/test/pages/options.test.ts old mode 100644 new mode 100755 diff --git a/test/pages/zones.test.ts b/test/pages/zones.test.ts old mode 100644 new mode 100755 diff --git a/tsconfig.json b/tsconfig.json old mode 100644 new mode 100755 diff --git a/tsup.config.ts b/tsup.config.ts old mode 100644 new mode 100755