Skip to content

Commit

Permalink
πŸ› Fixing Enmap error with package.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashu11-A committed Jul 7, 2024
1 parent e011c9f commit d0c0c09
Show file tree
Hide file tree
Showing 35 changed files with 29 additions and 9 deletions.
Empty file modified .env.exemple
100644 β†’ 100755
Empty file.
Empty file modified .github/dependabot.yml
100644 β†’ 100755
Empty file.
Empty file modified .github/workflows/build-test.yml
100644 β†’ 100755
Empty file.
Empty file modified .github/workflows/build-tsc.yml
100644 β†’ 100755
Empty file.
Empty file modified .github/workflows/build-tsup.yml
100644 β†’ 100755
Empty file.
Empty file modified .github/workflows/lint.yml
100644 β†’ 100755
Empty file.
Empty file modified .gitignore
100644 β†’ 100755
Empty file.
Empty file modified CODE_OF_CONDUCT.md
100644 β†’ 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 β†’ 100755
Empty file.
Empty file modified LICENSE
100644 β†’ 100755
Empty file.
Empty file modified README.md
100644 β†’ 100755
Empty file.
Empty file modified SECURITY.md
100644 β†’ 100755
Empty file.
Empty file modified babel.config.json
100644 β†’ 100755
Empty file.
Empty file modified eslint.config.js
100644 β†’ 100755
Empty file.
Empty file modified jest.config.ts
100644 β†’ 100755
Empty file.
Empty file modified package-lock.json
100644 β†’ 100755
Empty file.
14 changes: 7 additions & 7 deletions package.json
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"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": {
"url": "https://github.com/Ashu11-A/cloudflare-manager"
},
"exports": {
".": {
"import": "./dist/app.js",
"types": "./dist/app.d.ts"
"import": "./dist/cli.js",
"types": "./dist/cli.d.ts"
}
},
"imports": {
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
100644 β†’ 100755
Original file line number Diff line number Diff line change
@@ -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')}!`)
Expand Down
Empty file modified src/class/pages.ts
100644 β†’ 100755
Empty file.
17 changes: 17 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -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')
Empty file modified src/controller/cloudflare.ts
100644 β†’ 100755
Empty file.
Empty file modified src/index.ts
100644 β†’ 100755
Empty file.
Empty file modified src/lib/exists.ts
100644 β†’ 100755
Empty file.
Empty file modified src/lib/extractTypes.ts
100644 β†’ 100755
Empty file.
Empty file modified src/lib/isGlobal.ts
100644 β†’ 100755
Empty file.
Empty file modified src/lib/linkTables.ts
100644 β†’ 100755
Empty file.
Empty file modified src/pages/dns.ts
100644 β†’ 100755
Empty file.
5 changes: 4 additions & 1 deletion src/pages/dns/create.ts
100644 β†’ 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -55,7 +57,8 @@ new Page({
* Isso converte as tipagens do cloudflare.
* @returns {Record<string, Properties> | 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}`)

/**
Expand Down
Empty file modified src/pages/options.ts
100644 β†’ 100755
Empty file.
Empty file modified src/types/page.ts
100644 β†’ 100755
Empty file.
Empty file modified test/pages/dns.test.ts
100644 β†’ 100755
Empty file.
Empty file modified test/pages/options.test.ts
100644 β†’ 100755
Empty file.
Empty file modified test/pages/zones.test.ts
100644 β†’ 100755
Empty file.
Empty file modified tsconfig.json
100644 β†’ 100755
Empty file.
Empty file modified tsup.config.ts
100644 β†’ 100755
Empty file.

0 comments on commit d0c0c09

Please sign in to comment.