mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat: all cjs export (#3189)
* feat: all cjs export * test: fix deno test * style: fix error Expected space or tab before '*/' in comment spaced-comment * fix: deno import map * fix: sneak in a fix for yarn
This commit is contained in:
+6
-1
@@ -15,7 +15,12 @@ node_modules
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
proxies/*/.yarn/
|
||||
proxies/*/.yarn/*
|
||||
!proxies/*/.yarn/patches
|
||||
!proxies/*/.yarn/plugins
|
||||
!proxies/*/.yarn/releases
|
||||
!proxies/*/.yarn/sdks
|
||||
!proxies/*/.yarn/versions
|
||||
site/docs/generated/classes
|
||||
site/docs/generated/enums
|
||||
site/docs/generated/interfaces
|
||||
|
||||
+5
-5
@@ -12,10 +12,10 @@
|
||||
"benchmark": "npm:benchmark",
|
||||
"dotenv": "npm:dotenv",
|
||||
"node:zlib": "https://deno.land/std@0.176.0/node/zlib.ts",
|
||||
"@discordeno/utils": "./packages/utils/dist/index.js",
|
||||
"@discordeno/types": "./packages/types/dist/index.js",
|
||||
"@discordeno/rest": "./packages/rest/dist/index.js",
|
||||
"@discordeno/gateway": "./packages/gateway/dist/index.js",
|
||||
"@discordeno/bot": "./packages/bot/dist/index.js"
|
||||
"@discordeno/utils": "./packages/utils/dist/esm/index.js",
|
||||
"@discordeno/types": "./packages/types/dist/esm/index.js",
|
||||
"@discordeno/rest": "./packages/rest/dist/esm/index.js",
|
||||
"@discordeno/gateway": "./packages/gateway/dist/esm/index.js",
|
||||
"@discordeno/bot": "./packages/bot/dist/esm/index.js"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -21,4 +22,4 @@
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "benchmark",
|
||||
"version": "0.0.0",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,7 +15,7 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@discordeno/bot",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,8 +15,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
{
|
||||
"name": "discordeno",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"bin": "./bin/disocrdeno.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -11,8 +16,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@discordeno/gateway",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,8 +15,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@discordeno/rest",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,8 +15,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@discordeno/types",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.cjs",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,8 +15,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
@@ -636,7 +636,7 @@ export enum BitwisePermissionFlags {
|
||||
VIEW_CREATOR_MONETIZATION_ANALYTICS = 0x0000020000000000,
|
||||
/** Allows for using soundboard in a voice channel. */
|
||||
USE_SOUNDBOARD = 0x0000040000000000,
|
||||
/** Allows the usage of custom soundboards sounds from other servers*/
|
||||
/** Allows the usage of custom soundboards sounds from other servers */
|
||||
USE_EXTERNAL_SOUNDS = 0x0000200000000000,
|
||||
/** Allows sending voice messages */
|
||||
SEND_VOICE_MESSAGES = 0x0000400000000000,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
{
|
||||
"name": "@discordeno/utils",
|
||||
"version": "19.0.0-alpha.1",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./dist/esm/index.js",
|
||||
"require": "./dist/cjs/index.cjs",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
},
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
@@ -10,8 +15,8 @@
|
||||
"url": "https://github.com/discordeno/discordeno.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "swc --delete-dir-on-start src --out-dir dist",
|
||||
"build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist",
|
||||
"build": "swc src --delete-dir-on-start src --out-dir dist/esm && swc --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
|
||||
+3
-2
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/swcrc",
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
@@ -20,5 +21,5 @@
|
||||
"lazy": false,
|
||||
"noInterop": false
|
||||
},
|
||||
"sourceMaps": true
|
||||
}
|
||||
"sourceMaps": "inline"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+873
File diff suppressed because one or more lines are too long
@@ -29,9 +29,10 @@ FROM node:18.16.0-alpine3.18 AS prod-deps
|
||||
WORKDIR /app
|
||||
# copy necessary files for install dependencies
|
||||
COPY package.json yarn.lock .yarnrc.yml ./
|
||||
COPY ./.yarn/plugins ./.yarn/plugins
|
||||
COPY ./.yarn/releases ./.yarn/releases
|
||||
# config yarn to install only prod dependencies
|
||||
RUN yarn set version berry
|
||||
RUN yarn plugin import workspace-tools
|
||||
# install prod dependencies
|
||||
RUN yarn workspaces focus --all --production
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import fs from 'node:fs'
|
||||
|
||||
const dirs = ['']
|
||||
for await (const dir of dirs) {
|
||||
await Promise.all(
|
||||
fs.readdirSync(`dist/cjs${dir}`).map(async (file) => {
|
||||
if (!file.endsWith('.js') && !file.endsWith('.map') && !file.endsWith('.ts') && !file.endsWith('.cjs')) {
|
||||
dirs.push(`${dir}/${file}`)
|
||||
return
|
||||
}
|
||||
const content = await fs.promises.readFile(`dist/cjs${dir}/${file}`, 'utf-8')
|
||||
await fs.promises.rm(`dist/cjs${dir}/${file}`)
|
||||
fs.promises.writeFile(`dist/cjs${dir}/${file.slice(0, -3)}.cjs`, content.replace(/\.js/g, '.cjs'))
|
||||
}),
|
||||
)
|
||||
}
|
||||
@@ -13,7 +13,7 @@ for await (const dir of dirs) {
|
||||
fs.promises.writeFile(
|
||||
`denoTestsDist${dir}/${file.slice(-8) === '.spec.js' ? `${file.slice(0, -7)}test.js` : file}`,
|
||||
content
|
||||
.replace(/src\//g, 'dist/')
|
||||
.replace(/src\//g, 'dist/esm/')
|
||||
.replace(/\.ts/g, '.js')
|
||||
.replace(/describe\.skip/g, 'describe.ignore')
|
||||
.replace(/it\.skip/g, 'it.ignore'),
|
||||
|
||||
Reference in New Issue
Block a user