commandkit 0.1.10-dev.20240128075116 → 0.1.10-dev.20240202061201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.cjs +3 -0
- package/dist/CommandKit--SA9LcIq.d.mts +452 -0
- package/dist/CommandKit-GIHMEeqf.d.ts +452 -0
- package/dist/CommandKit.d.mts +5 -0
- package/dist/CommandKit.d.ts +5 -0
- package/dist/CommandKit.js +11 -0
- package/dist/CommandKit.js.map +1 -0
- package/dist/CommandKit.mjs +2 -0
- package/dist/CommandKit.mjs.map +1 -0
- package/dist/bootstrap/client.d.mts +13 -0
- package/dist/bootstrap/client.d.ts +13 -0
- package/dist/bootstrap/client.js +2 -0
- package/dist/bootstrap/client.js.map +1 -0
- package/dist/bootstrap/client.mjs +2 -0
- package/dist/bootstrap/client.mjs.map +1 -0
- package/dist/bootstrap/loadEnv.d.mts +3 -0
- package/dist/bootstrap/loadEnv.d.ts +3 -0
- package/dist/bootstrap/loadEnv.js +2 -0
- package/dist/bootstrap/loadEnv.js.map +1 -0
- package/dist/bootstrap/loadEnv.mjs +2 -0
- package/dist/bootstrap/loadEnv.mjs.map +1 -0
- package/dist/chunk-5AIBE2QR.mjs +2 -0
- package/dist/chunk-5AIBE2QR.mjs.map +1 -0
- package/dist/chunk-6CLMSPNA.mjs +2 -0
- package/dist/chunk-6CLMSPNA.mjs.map +1 -0
- package/dist/chunk-77LPS2WP.mjs +2 -0
- package/dist/chunk-77LPS2WP.mjs.map +1 -0
- package/dist/chunk-7KD7ZCH6.mjs +2 -0
- package/dist/chunk-7KD7ZCH6.mjs.map +1 -0
- package/dist/chunk-BCQP4DZP.mjs +2 -0
- package/dist/chunk-BCQP4DZP.mjs.map +1 -0
- package/dist/chunk-BJCWVCAY.mjs +2 -0
- package/dist/chunk-BJCWVCAY.mjs.map +1 -0
- package/dist/chunk-BXBLPEWT.mjs +7 -0
- package/dist/chunk-BXBLPEWT.mjs.map +1 -0
- package/dist/chunk-CHI4NRSH.mjs +2 -0
- package/dist/chunk-CHI4NRSH.mjs.map +1 -0
- package/dist/chunk-DEB7FLUS.mjs +2 -0
- package/dist/chunk-DEB7FLUS.mjs.map +1 -0
- package/dist/chunk-FQGSVSCT.mjs +2 -0
- package/dist/chunk-FQGSVSCT.mjs.map +1 -0
- package/dist/chunk-KATLDJ7Z.mjs +2 -0
- package/dist/chunk-KATLDJ7Z.mjs.map +1 -0
- package/dist/chunk-KUU3KDAE.mjs +2 -0
- package/dist/chunk-KUU3KDAE.mjs.map +1 -0
- package/dist/chunk-M5FMJETI.mjs +1 -0
- package/dist/chunk-M5FMJETI.mjs.map +1 -0
- package/dist/chunk-PFU3PH6M.mjs +1 -0
- package/dist/chunk-PFU3PH6M.mjs.map +1 -0
- package/dist/chunk-Q7UFCVZL.mjs +2 -0
- package/dist/chunk-Q7UFCVZL.mjs.map +1 -0
- package/dist/chunk-QC2F7O3S.mjs +2 -0
- package/dist/chunk-QC2F7O3S.mjs.map +1 -0
- package/dist/chunk-QYJ4DE3N.mjs +2 -0
- package/dist/chunk-QYJ4DE3N.mjs.map +1 -0
- package/dist/chunk-R6PIHRXD.mjs +2 -0
- package/dist/chunk-R6PIHRXD.mjs.map +1 -0
- package/dist/chunk-RQQKHSL6.mjs +4 -0
- package/dist/chunk-RQQKHSL6.mjs.map +1 -0
- package/dist/chunk-S4LYVMED.mjs +2 -0
- package/dist/chunk-S4LYVMED.mjs.map +1 -0
- package/dist/chunk-SXUJOOQY.mjs +4 -0
- package/dist/chunk-SXUJOOQY.mjs.map +1 -0
- package/dist/chunk-SYOEMO4R.mjs +2 -0
- package/dist/chunk-SYOEMO4R.mjs.map +1 -0
- package/dist/chunk-TZXZ3UZS.mjs +2 -0
- package/dist/chunk-TZXZ3UZS.mjs.map +1 -0
- package/dist/chunk-UV2LVAQV.mjs +2 -0
- package/dist/chunk-UV2LVAQV.mjs.map +1 -0
- package/dist/chunk-VURGPMLB.mjs +2 -0
- package/dist/chunk-VURGPMLB.mjs.map +1 -0
- package/dist/chunk-WXW36EYF.mjs +2 -0
- package/dist/chunk-WXW36EYF.mjs.map +1 -0
- package/dist/chunk-ZJRAI4W5.mjs +2 -0
- package/dist/chunk-ZJRAI4W5.mjs.map +1 -0
- package/dist/components/ButtonKit.d.mts +55 -0
- package/dist/components/ButtonKit.d.ts +55 -0
- package/dist/components/ButtonKit.js +2 -0
- package/dist/components/ButtonKit.js.map +1 -0
- package/dist/components/ButtonKit.mjs +2 -0
- package/dist/components/ButtonKit.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +2 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config.d.mts +55 -0
- package/dist/config.d.ts +55 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/config.mjs +2 -0
- package/dist/config.mjs.map +1 -0
- package/dist/environment/actions/development.d.mts +8 -0
- package/dist/environment/actions/development.d.ts +8 -0
- package/dist/environment/actions/development.js +2 -0
- package/dist/environment/actions/development.js.map +1 -0
- package/dist/environment/actions/development.mjs +2 -0
- package/dist/environment/actions/development.mjs.map +1 -0
- package/dist/environment/bundler/bundle.d.mts +3 -0
- package/dist/environment/bundler/bundle.d.ts +3 -0
- package/dist/environment/bundler/bundle.js +2 -0
- package/dist/environment/bundler/bundle.js.map +1 -0
- package/dist/environment/bundler/bundle.mjs +2 -0
- package/dist/environment/bundler/bundle.mjs.map +1 -0
- package/dist/environment/bundler/shims.d.mts +3 -0
- package/dist/environment/bundler/shims.d.ts +3 -0
- package/dist/environment/bundler/shims.js +11 -0
- package/dist/environment/bundler/shims.js.map +1 -0
- package/dist/environment/bundler/shims.mjs +11 -0
- package/dist/environment/bundler/shims.mjs.map +1 -0
- package/dist/environment/cli.d.mts +2 -0
- package/dist/environment/cli.d.ts +2 -0
- package/dist/environment/cli.js +2 -0
- package/dist/environment/cli.js.map +1 -0
- package/dist/environment/cli.mjs +2 -0
- package/dist/environment/cli.mjs.map +1 -0
- package/dist/environment/common/config.d.mts +7 -0
- package/dist/environment/common/config.d.ts +7 -0
- package/dist/environment/common/config.js +2 -0
- package/dist/environment/common/config.js.map +1 -0
- package/dist/environment/common/config.mjs +2 -0
- package/dist/environment/common/config.mjs.map +1 -0
- package/dist/environment/common/logger.d.mts +9 -0
- package/dist/environment/common/logger.d.ts +9 -0
- package/dist/environment/common/logger.js +2 -0
- package/dist/environment/common/logger.js.map +1 -0
- package/dist/environment/common/logger.mjs +2 -0
- package/dist/environment/common/logger.mjs.map +1 -0
- package/dist/handlers/command-handler/CommandHandler.d.mts +5 -0
- package/dist/handlers/command-handler/CommandHandler.d.ts +5 -0
- package/dist/handlers/command-handler/CommandHandler.js +11 -0
- package/dist/handlers/command-handler/CommandHandler.js.map +1 -0
- package/dist/handlers/command-handler/CommandHandler.mjs +2 -0
- package/dist/handlers/command-handler/CommandHandler.mjs.map +1 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.mts +35 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.ts +35 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.js +4 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.js.map +1 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs +2 -0
- package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs.map +1 -0
- package/dist/handlers/command-handler/functions/registerCommands.d.mts +20 -0
- package/dist/handlers/command-handler/functions/registerCommands.d.ts +20 -0
- package/dist/handlers/command-handler/functions/registerCommands.js +7 -0
- package/dist/handlers/command-handler/functions/registerCommands.js.map +1 -0
- package/dist/handlers/command-handler/functions/registerCommands.mjs +2 -0
- package/dist/handlers/command-handler/functions/registerCommands.mjs.map +1 -0
- package/dist/handlers/command-handler/typings.d.mts +5 -0
- package/dist/handlers/command-handler/typings.d.ts +5 -0
- package/dist/handlers/command-handler/typings.js +2 -0
- package/dist/handlers/command-handler/typings.js.map +1 -0
- package/dist/handlers/command-handler/typings.mjs +1 -0
- package/dist/handlers/command-handler/typings.mjs.map +1 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.mts +9 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.ts +9 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js +2 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js.map +1 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs +2 -0
- package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs.map +1 -0
- package/dist/handlers/command-handler/validations/devOnly.d.mts +9 -0
- package/dist/handlers/command-handler/validations/devOnly.d.ts +9 -0
- package/dist/handlers/command-handler/validations/devOnly.js +2 -0
- package/dist/handlers/command-handler/validations/devOnly.js.map +1 -0
- package/dist/handlers/command-handler/validations/devOnly.mjs +2 -0
- package/dist/handlers/command-handler/validations/devOnly.mjs.map +1 -0
- package/dist/handlers/command-handler/validations/index.d.mts +10 -0
- package/dist/handlers/command-handler/validations/index.d.ts +10 -0
- package/dist/handlers/command-handler/validations/index.js +4 -0
- package/dist/handlers/command-handler/validations/index.js.map +1 -0
- package/dist/handlers/command-handler/validations/index.mjs +2 -0
- package/dist/handlers/command-handler/validations/index.mjs.map +1 -0
- package/dist/handlers/command-handler/validations/permissions.d.mts +9 -0
- package/dist/handlers/command-handler/validations/permissions.d.ts +9 -0
- package/dist/handlers/command-handler/validations/permissions.js +4 -0
- package/dist/handlers/command-handler/validations/permissions.js.map +1 -0
- package/dist/handlers/command-handler/validations/permissions.mjs +2 -0
- package/dist/handlers/command-handler/validations/permissions.mjs.map +1 -0
- package/dist/handlers/event-handler/EventHandler.d.mts +5 -0
- package/dist/handlers/event-handler/EventHandler.d.ts +5 -0
- package/dist/handlers/event-handler/EventHandler.js +2 -0
- package/dist/handlers/event-handler/EventHandler.js.map +1 -0
- package/dist/handlers/event-handler/EventHandler.mjs +2 -0
- package/dist/handlers/event-handler/EventHandler.mjs.map +1 -0
- package/dist/handlers/event-handler/typings.d.mts +5 -0
- package/dist/handlers/event-handler/typings.d.ts +5 -0
- package/dist/handlers/event-handler/typings.js +2 -0
- package/dist/handlers/event-handler/typings.js.map +1 -0
- package/dist/handlers/event-handler/typings.mjs +1 -0
- package/dist/handlers/event-handler/typings.mjs.map +1 -0
- package/dist/handlers/index.d.mts +5 -0
- package/dist/handlers/index.d.ts +5 -0
- package/dist/handlers/index.js +11 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/index.mjs +2 -0
- package/dist/handlers/index.mjs.map +1 -0
- package/dist/handlers/validation-handler/ValidationHandler.d.mts +14 -0
- package/dist/handlers/validation-handler/ValidationHandler.d.ts +14 -0
- package/dist/handlers/validation-handler/ValidationHandler.js +2 -0
- package/dist/handlers/validation-handler/ValidationHandler.js.map +1 -0
- package/dist/handlers/validation-handler/ValidationHandler.mjs +2 -0
- package/dist/handlers/validation-handler/ValidationHandler.mjs.map +1 -0
- package/dist/handlers/validation-handler/typings.d.mts +14 -0
- package/dist/handlers/validation-handler/typings.d.ts +14 -0
- package/dist/handlers/validation-handler/typings.js +2 -0
- package/dist/handlers/validation-handler/typings.js.map +1 -0
- package/dist/handlers/validation-handler/typings.mjs +1 -0
- package/dist/handlers/validation-handler/typings.mjs.map +1 -0
- package/dist/hooks/common.d.mts +12 -0
- package/dist/hooks/common.d.ts +12 -0
- package/dist/hooks/common.js +11 -0
- package/dist/hooks/common.js.map +1 -0
- package/dist/hooks/common.mjs +2 -0
- package/dist/hooks/common.mjs.map +1 -0
- package/dist/hooks/index.d.mts +14 -0
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +11 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/response.d.mts +7 -0
- package/dist/hooks/response.d.ts +7 -0
- package/dist/hooks/response.js +11 -0
- package/dist/hooks/response.js.map +1 -0
- package/dist/hooks/response.mjs +2 -0
- package/dist/hooks/response.mjs.map +1 -0
- package/dist/hooks/useChannel.d.mts +5 -0
- package/dist/hooks/useChannel.d.ts +5 -0
- package/dist/hooks/useChannel.js +11 -0
- package/dist/hooks/useChannel.js.map +1 -0
- package/dist/hooks/useChannel.mjs +2 -0
- package/dist/hooks/useChannel.mjs.map +1 -0
- package/dist/hooks/useClient.d.mts +5 -0
- package/dist/hooks/useClient.d.ts +5 -0
- package/dist/hooks/useClient.js +11 -0
- package/dist/hooks/useClient.js.map +1 -0
- package/dist/hooks/useClient.mjs +2 -0
- package/dist/hooks/useClient.mjs.map +1 -0
- package/dist/hooks/useCommandData.d.mts +5 -0
- package/dist/hooks/useCommandData.d.ts +5 -0
- package/dist/hooks/useCommandData.js +11 -0
- package/dist/hooks/useCommandData.js.map +1 -0
- package/dist/hooks/useCommandData.mjs +2 -0
- package/dist/hooks/useCommandData.mjs.map +1 -0
- package/dist/hooks/useCommandKit.d.mts +9 -0
- package/dist/hooks/useCommandKit.d.ts +9 -0
- package/dist/hooks/useCommandKit.js +11 -0
- package/dist/hooks/useCommandKit.js.map +1 -0
- package/dist/hooks/useCommandKit.mjs +2 -0
- package/dist/hooks/useCommandKit.mjs.map +1 -0
- package/dist/hooks/useGuild.d.mts +5 -0
- package/dist/hooks/useGuild.d.ts +5 -0
- package/dist/hooks/useGuild.js +11 -0
- package/dist/hooks/useGuild.js.map +1 -0
- package/dist/hooks/useGuild.mjs +2 -0
- package/dist/hooks/useGuild.mjs.map +1 -0
- package/dist/hooks/useInteraction.d.mts +9 -0
- package/dist/hooks/useInteraction.d.ts +9 -0
- package/dist/hooks/useInteraction.js +11 -0
- package/dist/hooks/useInteraction.js.map +1 -0
- package/dist/hooks/useInteraction.mjs +2 -0
- package/dist/hooks/useInteraction.mjs.map +1 -0
- package/dist/hooks/useMember.d.mts +5 -0
- package/dist/hooks/useMember.d.ts +5 -0
- package/dist/hooks/useMember.js +11 -0
- package/dist/hooks/useMember.js.map +1 -0
- package/dist/hooks/useMember.mjs +2 -0
- package/dist/hooks/useMember.mjs.map +1 -0
- package/dist/hooks/useUser.d.mts +5 -0
- package/dist/hooks/useUser.d.ts +5 -0
- package/dist/hooks/useUser.js +11 -0
- package/dist/hooks/useUser.js.map +1 -0
- package/dist/hooks/useUser.mjs +2 -0
- package/dist/hooks/useUser.mjs.map +1 -0
- package/dist/index.d.mts +25 -535
- package/dist/index.d.ts +25 -535
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -10
- package/dist/index.mjs.map +1 -0
- package/dist/types/index.d.mts +5 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/typings.d.mts +5 -0
- package/dist/typings.d.ts +5 -0
- package/dist/typings.js +2 -0
- package/dist/typings.js.map +1 -0
- package/dist/typings.mjs +1 -0
- package/dist/typings.mjs.map +1 -0
- package/dist/utils/clone.d.mts +3 -0
- package/dist/utils/clone.d.ts +3 -0
- package/dist/utils/clone.js +2 -0
- package/dist/utils/clone.js.map +1 -0
- package/dist/utils/clone.mjs +2 -0
- package/dist/utils/clone.mjs.map +1 -0
- package/dist/utils/colors.d.mts +27 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +2 -0
- package/dist/utils/colors.js.map +1 -0
- package/dist/utils/colors.mjs +2 -0
- package/dist/utils/colors.mjs.map +1 -0
- package/dist/utils/get-paths.d.mts +4 -0
- package/dist/utils/get-paths.d.ts +4 -0
- package/dist/utils/get-paths.js +2 -0
- package/dist/utils/get-paths.js.map +1 -0
- package/dist/utils/get-paths.mjs +2 -0
- package/dist/utils/get-paths.mjs.map +1 -0
- package/dist/utils/resolve-file-url.d.mts +8 -0
- package/dist/utils/resolve-file-url.d.ts +8 -0
- package/dist/utils/resolve-file-url.js +2 -0
- package/dist/utils/resolve-file-url.js.map +1 -0
- package/dist/utils/resolve-file-url.mjs +2 -0
- package/dist/utils/resolve-file-url.mjs.map +1 -0
- package/dist/utils/signal.d.mts +21 -0
- package/dist/utils/signal.d.ts +21 -0
- package/dist/utils/signal.js +2 -0
- package/dist/utils/signal.js.map +1 -0
- package/dist/utils/signal.mjs +2 -0
- package/dist/utils/signal.mjs.map +1 -0
- package/package.json +17 -7
- package/bin/build.mjs +0 -107
- package/bin/common.mjs +0 -102
- package/bin/development.mjs +0 -168
- package/bin/index.mjs +0 -39
- package/bin/parse-env.mjs +0 -61
- package/bin/production.mjs +0 -83
package/bin/index.mjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// @ts-check
|
|
4
|
-
|
|
5
|
-
import { Command } from 'commander';
|
|
6
|
-
import { bootstrapDevelopmentServer } from './development.mjs';
|
|
7
|
-
import { bootstrapProductionServer } from './production.mjs';
|
|
8
|
-
import { bootstrapProductionBuild } from './build.mjs';
|
|
9
|
-
|
|
10
|
-
const program = new Command('commandkit');
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.command('dev')
|
|
14
|
-
.description('Start your bot in development mode.')
|
|
15
|
-
.option('-c, --config <path>', 'Path to your commandkit config file.', './commandkit.js')
|
|
16
|
-
.action(() => {
|
|
17
|
-
const options = program.opts();
|
|
18
|
-
bootstrapDevelopmentServer(options);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
program
|
|
22
|
-
.command('start')
|
|
23
|
-
.description('Start your bot in production mode after running the build command.')
|
|
24
|
-
.option('-c, --config <path>', 'Path to your commandkit.json file.', './commandkit.js')
|
|
25
|
-
.action(() => {
|
|
26
|
-
const options = program.opts();
|
|
27
|
-
bootstrapProductionServer(options.config);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
program
|
|
31
|
-
.command('build')
|
|
32
|
-
.description('Build your project for production usage.')
|
|
33
|
-
.option('-c, --config <path>', 'Path to your commandkit.json file.', './commandkit.json')
|
|
34
|
-
.action(() => {
|
|
35
|
-
const options = program.opts();
|
|
36
|
-
bootstrapProductionBuild(options.config);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
program.parse();
|
package/bin/parse-env.mjs
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import { randomUUID } from 'node:crypto';
|
|
4
|
-
|
|
5
|
-
const valuesMap = {
|
|
6
|
-
true: true,
|
|
7
|
-
false: false,
|
|
8
|
-
null: null,
|
|
9
|
-
undefined: undefined,
|
|
10
|
-
__UUIDv4__: () => randomUUID(),
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const VALUE_PREFIXES = {
|
|
14
|
-
JSON: 'JSON::',
|
|
15
|
-
DATE: 'DATE::',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function catcher(fn) {
|
|
19
|
-
try {
|
|
20
|
-
fn();
|
|
21
|
-
return true;
|
|
22
|
-
} catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function parseEnv(src) {
|
|
28
|
-
for (const key in src) {
|
|
29
|
-
const value = src[key];
|
|
30
|
-
|
|
31
|
-
if (typeof value !== 'string') continue;
|
|
32
|
-
|
|
33
|
-
if (value.startsWith(VALUE_PREFIXES.JSON)) {
|
|
34
|
-
catcher(() => (src[key] = JSON.parse(value.replace(VALUE_PREFIXES.JSON, ''))));
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (value.startsWith(VALUE_PREFIXES.DATE)) {
|
|
39
|
-
src[key] = new Date(value.replace(VALUE_PREFIXES.DATE, ''));
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (value.includes(',')) {
|
|
44
|
-
src[key] = value.split(',').map((v) => v.trim());
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (/^[0-9]+n$/.test(value)) {
|
|
49
|
-
src[key] = BigInt(value);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (value in valuesMap) {
|
|
54
|
-
src[key] =
|
|
55
|
-
typeof valuesMap[value] === 'function' ? valuesMap[value]() : valuesMap[value];
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return src;
|
|
61
|
-
}
|
package/bin/production.mjs
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { config as dotenv } from 'dotenv';
|
|
3
|
-
import { existsSync } from 'node:fs';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
import { Colors, findCommandKitConfig, panic, write } from './common.mjs';
|
|
6
|
-
import { parseEnv } from './parse-env.mjs';
|
|
7
|
-
import child_process from 'node:child_process';
|
|
8
|
-
|
|
9
|
-
export async function bootstrapProductionServer(config) {
|
|
10
|
-
const {
|
|
11
|
-
main,
|
|
12
|
-
outDir = 'dist',
|
|
13
|
-
envExtra = true,
|
|
14
|
-
sourcemap,
|
|
15
|
-
} = await findCommandKitConfig(config);
|
|
16
|
-
|
|
17
|
-
if (!existsSync(join(process.cwd(), outDir, main))) {
|
|
18
|
-
panic('Could not find production build, maybe run `commandkit build` first?');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const processEnv = {};
|
|
23
|
-
|
|
24
|
-
const env = dotenv({
|
|
25
|
-
path: join(process.cwd(), '.env'),
|
|
26
|
-
// @ts-expect-error
|
|
27
|
-
processEnv,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
if (envExtra) {
|
|
31
|
-
parseEnv(processEnv);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (env.error) {
|
|
35
|
-
write(Colors.yellow(`[DOTENV] Warning: ${env.error.message}`));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (env.parsed) {
|
|
39
|
-
write(Colors.blue('[DOTENV] Loaded .env file!'));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @type {child_process.ChildProcessWithoutNullStreams}
|
|
44
|
-
*/
|
|
45
|
-
const ps = child_process.spawn(
|
|
46
|
-
'node',
|
|
47
|
-
[sourcemap ? '--enable-source-maps' : '', join(process.cwd(), outDir, main)].filter(
|
|
48
|
-
Boolean,
|
|
49
|
-
),
|
|
50
|
-
{
|
|
51
|
-
env: {
|
|
52
|
-
...process.env,
|
|
53
|
-
...processEnv,
|
|
54
|
-
NODE_ENV: 'production',
|
|
55
|
-
// @ts-expect-error
|
|
56
|
-
COMMANDKIT_DEV: false,
|
|
57
|
-
// @ts-expect-error
|
|
58
|
-
COMMANDKIT_PROD: true,
|
|
59
|
-
},
|
|
60
|
-
cwd: process.cwd(),
|
|
61
|
-
},
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
ps.stdout.on('data', (data) => {
|
|
65
|
-
write(data.toString());
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
ps.stderr.on('data', (data) => {
|
|
69
|
-
write(Colors.red(data.toString()));
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
ps.on('close', (code) => {
|
|
73
|
-
write('\n');
|
|
74
|
-
process.exit(code ?? 0);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
ps.on('error', (err) => {
|
|
78
|
-
panic(err);
|
|
79
|
-
});
|
|
80
|
-
} catch (e) {
|
|
81
|
-
panic(e);
|
|
82
|
-
}
|
|
83
|
-
}
|