@strapi/strapi 4.15.0 → 4.15.1
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/dist/commands/actions/watch-admin/action.d.ts +4 -2
- package/dist/commands/actions/watch-admin/action.d.ts.map +1 -1
- package/dist/commands/actions/watch-admin/action.js +5 -30
- package/dist/commands/actions/watch-admin/action.js.map +1 -1
- package/dist/commands/actions/watch-admin/command.d.ts.map +1 -1
- package/dist/commands/actions/watch-admin/command.js.map +1 -1
- package/dist/commands/index.d.ts +4 -3
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +75 -57
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/types.d.ts +8 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/utils/logger.d.ts +2 -0
- package/dist/commands/utils/logger.d.ts.map +1 -1
- package/dist/commands/utils/logger.js +20 -0
- package/dist/commands/utils/logger.js.map +1 -1
- package/dist/commands/utils/tsconfig.d.ts +19 -0
- package/dist/commands/utils/tsconfig.d.ts.map +1 -0
- package/dist/commands/utils/tsconfig.js +26 -0
- package/dist/commands/utils/tsconfig.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +19 -24
- package/dist/commands/actions/build-command/action.d.ts +0 -10
- package/dist/commands/actions/build-command/action.d.ts.map +0 -1
- package/dist/commands/actions/build-command/action.js +0 -17
- package/dist/commands/actions/build-command/action.js.map +0 -1
- package/dist/commands/actions/build-command/command.d.ts +0 -7
- package/dist/commands/actions/build-command/command.d.ts.map +0 -1
- package/dist/commands/actions/build-command/command.js +0 -8
- package/dist/commands/actions/build-command/command.js.map +0 -1
- package/dist/commands/actions/develop/action.d.ts +0 -13
- package/dist/commands/actions/develop/action.d.ts.map +0 -1
- package/dist/commands/actions/develop/action.js +0 -197
- package/dist/commands/actions/develop/action.js.map +0 -1
- package/dist/commands/actions/develop/command.d.ts +0 -7
- package/dist/commands/actions/develop/command.d.ts.map +0 -1
- package/dist/commands/actions/develop/command.js +0 -8
- package/dist/commands/actions/develop/command.js.map +0 -1
- package/dist/commands/builders/admin.d.ts +0 -9
- package/dist/commands/builders/admin.d.ts.map +0 -1
- package/dist/commands/builders/admin.js +0 -48
- package/dist/commands/builders/admin.js.map +0 -1
- package/dist/commands/builders/index.d.ts +0 -4
- package/dist/commands/builders/index.d.ts.map +0 -1
- package/dist/commands/builders/typescript.d.ts +0 -7
- package/dist/commands/builders/typescript.d.ts.map +0 -1
- package/dist/commands/builders/typescript.js +0 -32
- package/dist/commands/builders/typescript.js.map +0 -1
- package/dist/utils/addSlash.js +0 -15
- package/dist/utils/addSlash.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { CLIContext } from '../../types';
|
|
2
|
+
interface WatchAdminOptions extends CLIContext {
|
|
2
3
|
browser: boolean;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
5
|
+
declare const _default: ({ browser, logger }: WatchAdminOptions) => Promise<void>;
|
|
4
6
|
export default _default;
|
|
5
7
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,UAAU,iBAAkB,SAAQ,UAAU;IAC5C,OAAO,EAAE,OAAO,CAAC;CAClB;8CAE0C,iBAAiB;AAA5D,wBAME"}
|
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
8
|
-
const strapiAdmin__default = /* @__PURE__ */ _interopDefault(strapiAdmin);
|
|
9
|
-
const action = async ({ browser }) => {
|
|
10
|
-
const appContext = await Strapi.compile();
|
|
11
|
-
const strapiInstance = Strapi({
|
|
12
|
-
...appContext,
|
|
13
|
-
autoReload: true,
|
|
14
|
-
serveAdminPanel: false
|
|
15
|
-
});
|
|
16
|
-
const plugins = await getEnabledPlugins.getEnabledPlugins(strapiInstance, { client: true });
|
|
17
|
-
const { adminPath } = strapiUtils.getConfigUrls(strapiInstance.config, true);
|
|
18
|
-
const adminPort = strapiInstance.config.get("admin.port", 8e3);
|
|
19
|
-
const adminHost = strapiInstance.config.get("admin.host", "localhost");
|
|
20
|
-
const backendURL = strapiUtils.getAbsoluteServerUrl(strapiInstance.config, true);
|
|
21
|
-
strapiAdmin__default.default.watchAdmin({
|
|
22
|
-
appDir: appContext.appDir,
|
|
23
|
-
buildDestDir: appContext.distDir,
|
|
24
|
-
plugins,
|
|
25
|
-
port: adminPort,
|
|
26
|
-
host: adminHost,
|
|
27
|
-
browser,
|
|
28
|
-
options: {
|
|
29
|
-
backend: backendURL,
|
|
30
|
-
adminPath: addSlash(adminPath)
|
|
31
|
-
}
|
|
2
|
+
const admin = require("@strapi/admin");
|
|
3
|
+
const action = async ({ browser, logger }) => {
|
|
4
|
+
logger.warn("[@strapi/strapi]: watch-admin is deprecated, please use strapi develop instead");
|
|
5
|
+
await admin.watchAdmin({
|
|
6
|
+
browser
|
|
32
7
|
});
|
|
33
8
|
};
|
|
34
9
|
module.exports = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/watch-admin/action.ts"],"sourcesContent":["import { watchAdmin } from '@strapi/admin';\nimport { CLIContext } from '../../types';\n\ninterface WatchAdminOptions extends CLIContext {\n browser: boolean;\n}\n\nexport default async ({ browser, logger }: WatchAdminOptions) => {\n logger.warn('[@strapi/strapi]: watch-admin is deprecated, please use strapi develop instead');\n\n await watchAdmin({\n browser,\n });\n};\n"],"names":["watchAdmin"],"mappings":";;AAOA,MAAA,SAAe,OAAO,EAAE,SAAS,aAAgC;AAC/D,SAAO,KAAK,gFAAgF;AAE5F,QAAMA,iBAAW;AAAA,IACf;AAAA,EAAA,CACD;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAMd,CAAC;AACF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/watch-admin/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n/**\n * `$ strapi watch-admin`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('watch-admin')\n .option('--browser <name>', 'Open the browser', true)\n .description('Start the admin development server')\n .action(runAction('watch-admin', action));\n};\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAMA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,aAAa,EACrB,OAAO,oBAAoB,oBAAoB,IAAI,EACnD,YAAY,oCAAoC,EAChD,OAAOC,QAAU,UAAA,eAAe,MAAM,CAAC;AAC5C;;"}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -2,14 +2,12 @@ import { Command } from 'commander';
|
|
|
2
2
|
declare const strapiCommands: {
|
|
3
3
|
readonly createAdminUser: import("./types").StrapiCommand;
|
|
4
4
|
readonly resetAdminUserPassword: import("./types").StrapiCommand;
|
|
5
|
-
readonly buildCommand: import("./types").StrapiCommand;
|
|
6
5
|
readonly listComponents: import("./types").StrapiCommand;
|
|
7
6
|
readonly configurationDump: import("./types").StrapiCommand;
|
|
8
7
|
readonly configurationRestore: import("./types").StrapiCommand;
|
|
9
8
|
readonly consoleCommand: import("./types").StrapiCommand;
|
|
10
9
|
readonly listContentTypes: import("./types").StrapiCommand;
|
|
11
10
|
readonly listControllers: import("./types").StrapiCommand;
|
|
12
|
-
readonly developCommand: import("./types").StrapiCommand;
|
|
13
11
|
readonly generateCommand: import("./types").StrapiCommand;
|
|
14
12
|
readonly listHooks: import("./types").StrapiCommand;
|
|
15
13
|
readonly installCommand: import("./types").StrapiCommand;
|
|
@@ -27,10 +25,13 @@ declare const strapiCommands: {
|
|
|
27
25
|
readonly uninstallCommand: import("./types").StrapiCommand;
|
|
28
26
|
readonly versionCommand: import("./types").StrapiCommand;
|
|
29
27
|
readonly watchAdminCommand: import("./types").StrapiCommand;
|
|
28
|
+
/**
|
|
29
|
+
* Plugins
|
|
30
|
+
*/
|
|
30
31
|
readonly buildPluginCommand: import("./types").StrapiCommand;
|
|
31
32
|
readonly watchPluginCommand: import("./types").StrapiCommand;
|
|
32
33
|
};
|
|
33
|
-
declare const buildStrapiCommand: (argv: string[], command?: Command) => Command
|
|
34
|
+
declare const buildStrapiCommand: (argv: string[], command?: Command) => Promise<Command>;
|
|
34
35
|
declare const runStrapiCommand: (argv?: string[], command?: Command) => Promise<void>;
|
|
35
36
|
export { runStrapiCommand, buildStrapiCommand, strapiCommands };
|
|
36
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BlB;;OAEG;;;CAGK,CAAC;AAEX,QAAA,MAAM,kBAAkB,SAAgB,MAAM,EAAE,wCAoD/C,CAAC;AAEF,QAAA,MAAM,gBAAgB,uDAGrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/commands/index.js
CHANGED
|
@@ -25,77 +25,94 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
25
25
|
const commander = require("commander");
|
|
26
26
|
const command = require("./actions/admin/create-user/command.js");
|
|
27
27
|
const command$1 = require("./actions/admin/reset-user-password/command.js");
|
|
28
|
-
const command$2 = require("./actions/
|
|
29
|
-
const command$3 = require("./actions/
|
|
30
|
-
const command$4 = require("./actions/configuration/
|
|
31
|
-
const command$5 = require("./actions/
|
|
32
|
-
const command$6 = require("./actions/
|
|
33
|
-
const command$7 = require("./actions/
|
|
34
|
-
const command$8 = require("./actions/
|
|
35
|
-
const command$9 = require("./actions/
|
|
36
|
-
const command$a = require("./actions/
|
|
37
|
-
const command$b = require("./actions/
|
|
38
|
-
const command$c = require("./actions/
|
|
39
|
-
const command$d = require("./actions/
|
|
40
|
-
const command$e = require("./actions/
|
|
41
|
-
const command$f = require("./actions/
|
|
42
|
-
const command$g = require("./actions/
|
|
43
|
-
const command$h = require("./actions/
|
|
44
|
-
const command$i = require("./actions/
|
|
45
|
-
const command$j = require("./actions/
|
|
46
|
-
const command$k = require("./actions/
|
|
47
|
-
const command$l = require("./actions/
|
|
48
|
-
const command$m = require("./actions/
|
|
49
|
-
const command$n = require("./actions/
|
|
50
|
-
const command$o = require("./actions/
|
|
51
|
-
const command$p = require("./actions/
|
|
52
|
-
const command$q = require("./actions/watch
|
|
53
|
-
const
|
|
54
|
-
const
|
|
28
|
+
const command$2 = require("./actions/components/list/command.js");
|
|
29
|
+
const command$3 = require("./actions/configuration/dump/command.js");
|
|
30
|
+
const command$4 = require("./actions/configuration/restore/command.js");
|
|
31
|
+
const command$5 = require("./actions/console/command.js");
|
|
32
|
+
const command$6 = require("./actions/content-types/list/command.js");
|
|
33
|
+
const command$7 = require("./actions/controllers/list/command.js");
|
|
34
|
+
const command$8 = require("./actions/generate/command.js");
|
|
35
|
+
const command$9 = require("./actions/hooks/list/command.js");
|
|
36
|
+
const command$a = require("./actions/install/command.js");
|
|
37
|
+
const command$b = require("./actions/middlewares/list/command.js");
|
|
38
|
+
const command$c = require("./actions/new/command.js");
|
|
39
|
+
const command$d = require("./actions/policies/list/command.js");
|
|
40
|
+
const command$e = require("./actions/report/command.js");
|
|
41
|
+
const command$f = require("./actions/routes/list/command.js");
|
|
42
|
+
const command$g = require("./actions/services/list/command.js");
|
|
43
|
+
const command$h = require("./actions/start/command.js");
|
|
44
|
+
const command$i = require("./actions/telemetry/disable/command.js");
|
|
45
|
+
const command$j = require("./actions/telemetry/enable/command.js");
|
|
46
|
+
const command$k = require("./actions/templates/generate/command.js");
|
|
47
|
+
const command$l = require("./actions/ts/generate-types/command.js");
|
|
48
|
+
const command$m = require("./actions/uninstall/command.js");
|
|
49
|
+
const command$n = require("./actions/version/command.js");
|
|
50
|
+
const command$o = require("./actions/watch-admin/command.js");
|
|
51
|
+
const command$p = require("./actions/plugin/build-command/command.js");
|
|
52
|
+
const command$q = require("./actions/plugin/watch/command.js");
|
|
53
|
+
const logger = require("./utils/logger.js");
|
|
54
|
+
const tsconfig = require("./utils/tsconfig.js");
|
|
55
55
|
const strapiCommands = {
|
|
56
56
|
createAdminUser: command,
|
|
57
57
|
resetAdminUserPassword: command$1,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
listComponents: command$2,
|
|
59
|
+
configurationDump: command$3,
|
|
60
|
+
configurationRestore: command$4,
|
|
61
|
+
consoleCommand: command$5,
|
|
62
|
+
listContentTypes: command$6,
|
|
63
|
+
listControllers: command$7,
|
|
64
|
+
generateCommand: command$8,
|
|
65
|
+
listHooks: command$9,
|
|
66
|
+
installCommand: command$a,
|
|
67
|
+
listMiddlewares: command$b,
|
|
68
|
+
newCommand: command$c,
|
|
69
|
+
listPolicies: command$d,
|
|
70
|
+
reportCommand: command$e,
|
|
71
|
+
listRoutes: command$f,
|
|
72
|
+
listServices: command$g,
|
|
73
|
+
startCommand: command$h,
|
|
74
|
+
disableTelemetry: command$i,
|
|
75
|
+
enableTelemetry: command$j,
|
|
76
|
+
generateTemplates: command$k,
|
|
77
|
+
generateTsTypes: command$l,
|
|
78
|
+
uninstallCommand: command$m,
|
|
79
|
+
versionCommand: command$n,
|
|
80
|
+
watchAdminCommand: command$o,
|
|
81
|
+
/**
|
|
82
|
+
* Plugins
|
|
83
|
+
*/
|
|
84
|
+
buildPluginCommand: command$p,
|
|
85
|
+
watchPluginCommand: command$q
|
|
85
86
|
};
|
|
86
|
-
const buildStrapiCommand = (argv, command2 = new commander.Command()) => {
|
|
87
|
+
const buildStrapiCommand = async (argv, command2 = new commander.Command()) => {
|
|
87
88
|
try {
|
|
88
89
|
const dtsCommands = require(require.resolve("@strapi/data-transfer")).commands;
|
|
89
90
|
Object.assign(strapiCommands, dtsCommands);
|
|
91
|
+
const adminCommands = require(require.resolve("@strapi/admin/cli")).commands;
|
|
92
|
+
Object.assign(strapiCommands, adminCommands);
|
|
90
93
|
} catch (e) {
|
|
91
94
|
}
|
|
92
95
|
command2.storeOptionsAsProperties(false).allowUnknownOption(true);
|
|
93
96
|
command2.helpOption("-h, --help", "Display help for command");
|
|
94
97
|
command2.addHelpCommand("help [command]", "Display help for command");
|
|
95
98
|
const keys = Object.keys(strapiCommands);
|
|
99
|
+
const cwd = process.cwd();
|
|
100
|
+
const hasDebug = argv.includes("--debug");
|
|
101
|
+
const hasSilent = argv.includes("--silent");
|
|
102
|
+
const logger$1 = logger.createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });
|
|
103
|
+
const tsconfig$1 = tsconfig.loadTsConfig({
|
|
104
|
+
cwd,
|
|
105
|
+
path: "tsconfig.json",
|
|
106
|
+
logger: logger$1
|
|
107
|
+
});
|
|
108
|
+
const ctx = {
|
|
109
|
+
cwd,
|
|
110
|
+
logger: logger$1,
|
|
111
|
+
tsconfig: tsconfig$1
|
|
112
|
+
};
|
|
96
113
|
keys.forEach((name) => {
|
|
97
114
|
try {
|
|
98
|
-
strapiCommands[name]({ command: command2, argv });
|
|
115
|
+
strapiCommands[name]({ command: command2, argv, ctx });
|
|
99
116
|
} catch (e) {
|
|
100
117
|
console.error(`Failed to load command ${name}`, e);
|
|
101
118
|
}
|
|
@@ -103,7 +120,8 @@ const buildStrapiCommand = (argv, command2 = new commander.Command()) => {
|
|
|
103
120
|
return command2;
|
|
104
121
|
};
|
|
105
122
|
const runStrapiCommand = async (argv = process.argv, command2 = new commander.Command()) => {
|
|
106
|
-
await buildStrapiCommand(argv, command2)
|
|
123
|
+
const commands = await buildStrapiCommand(argv, command2);
|
|
124
|
+
await commands.parseAsync(argv);
|
|
107
125
|
};
|
|
108
126
|
exports.buildStrapiCommand = buildStrapiCommand;
|
|
109
127
|
exports.runStrapiCommand = runStrapiCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/commands/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport createAdminUser from './actions/admin/create-user/command';\nimport resetAdminUserPassword from './actions/admin/reset-user-password/command';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/commands/index.ts"],"sourcesContent":["import { Command } from 'commander';\n\nimport createAdminUser from './actions/admin/create-user/command';\nimport resetAdminUserPassword from './actions/admin/reset-user-password/command';\nimport listComponents from './actions/components/list/command';\nimport configurationDump from './actions/configuration/dump/command';\nimport configurationRestore from './actions/configuration/restore/command';\nimport consoleCommand from './actions/console/command';\nimport listContentTypes from './actions/content-types/list/command';\nimport listControllers from './actions/controllers/list/command';\nimport generateCommand from './actions/generate/command';\nimport listHooks from './actions/hooks/list/command';\nimport installCommand from './actions/install/command';\nimport listMiddlewares from './actions/middlewares/list/command';\nimport newCommand from './actions/new/command';\nimport listPolicies from './actions/policies/list/command';\nimport reportCommand from './actions/report/command';\nimport listRoutes from './actions/routes/list/command';\nimport listServices from './actions/services/list/command';\nimport startCommand from './actions/start/command';\nimport disableTelemetry from './actions/telemetry/disable/command';\nimport enableTelemetry from './actions/telemetry/enable/command';\nimport generateTemplates from './actions/templates/generate/command';\nimport generateTsTypes from './actions/ts/generate-types/command';\nimport uninstallCommand from './actions/uninstall/command';\nimport versionCommand from './actions/version/command';\nimport watchAdminCommand from './actions/watch-admin/command';\n\nimport buildPluginCommand from './actions/plugin/build-command/command';\nimport watchPluginCommand from './actions/plugin/watch/command';\n\nimport { createLogger } from './utils/logger';\nimport { loadTsConfig } from './utils/tsconfig';\nimport { CLIContext } from './types';\n\nconst strapiCommands = {\n createAdminUser,\n resetAdminUserPassword,\n listComponents,\n configurationDump,\n configurationRestore,\n consoleCommand,\n listContentTypes,\n listControllers,\n generateCommand,\n listHooks,\n installCommand,\n listMiddlewares,\n newCommand,\n listPolicies,\n reportCommand,\n listRoutes,\n listServices,\n startCommand,\n disableTelemetry,\n enableTelemetry,\n generateTemplates,\n generateTsTypes,\n uninstallCommand,\n versionCommand,\n watchAdminCommand,\n /**\n * Plugins\n */\n buildPluginCommand,\n watchPluginCommand,\n} as const;\n\nconst buildStrapiCommand = async (argv: string[], command = new Command()) => {\n try {\n // NOTE: this is a hack to allow loading dts commands without make dts a dependency of strapi and thus avoiding circular dependencies\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const dtsCommands = require(require.resolve('@strapi/data-transfer')).commands;\n Object.assign(strapiCommands, dtsCommands);\n // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require\n const adminCommands = require(require.resolve('@strapi/admin/cli')).commands;\n Object.assign(strapiCommands, adminCommands);\n } catch (e) {\n // noop\n }\n\n // Initial program setup\n command.storeOptionsAsProperties(false).allowUnknownOption(true);\n\n // Help command\n command.helpOption('-h, --help', 'Display help for command');\n command.addHelpCommand('help [command]', 'Display help for command');\n\n const keys = Object.keys(strapiCommands) as (keyof typeof strapiCommands)[];\n\n const cwd = process.cwd();\n\n const hasDebug = argv.includes('--debug');\n const hasSilent = argv.includes('--silent');\n\n const logger = createLogger({ debug: hasDebug, silent: hasSilent, timestamp: false });\n\n const tsconfig = loadTsConfig({\n cwd,\n path: 'tsconfig.json',\n logger,\n });\n\n const ctx = {\n cwd,\n logger,\n tsconfig,\n } satisfies CLIContext;\n\n // Load all commands\n keys.forEach((name) => {\n try {\n // Add this command to the Commander command object\n strapiCommands[name]({ command, argv, ctx });\n } catch (e) {\n console.error(`Failed to load command ${name}`, e);\n }\n });\n\n return command;\n};\n\nconst runStrapiCommand = async (argv = process.argv, command = new Command()) => {\n const commands = await buildStrapiCommand(argv, command);\n await commands.parseAsync(argv);\n};\n\nexport { runStrapiCommand, buildStrapiCommand, strapiCommands };\n"],"names":["createAdminUser","resetAdminUserPassword","listComponents","configurationDump","configurationRestore","consoleCommand","listContentTypes","listControllers","generateCommand","listHooks","installCommand","listMiddlewares","newCommand","listPolicies","reportCommand","listRoutes","listServices","startCommand","disableTelemetry","enableTelemetry","generateTemplates","generateTsTypes","uninstallCommand","versionCommand","watchAdminCommand","buildPluginCommand","watchPluginCommand","command","Command","logger","createLogger","tsconfig","loadTsConfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,iBAAiB;AAAA,EAAA,iBACrBA;AAAAA,EAAA,wBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,mBACAC;AAAAA,EAAA,sBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,WACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,eACAC;AAAAA,EAAA,YACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,cACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,mBACAC;AAAAA,EAAA,iBACAC;AAAAA,EAAA,kBACAC;AAAAA,EAAA,gBACAC;AAAAA,EAAA,mBACAC;AAAAA;AAAAA;AAAAA;AAAAA,EAAA,oBAIAC;AAAAA,EAAA,oBACAC;AACF;AAEA,MAAM,qBAAqB,OAAO,MAAgBC,WAAU,IAAIC,wBAAc;AACxE,MAAA;AAGF,UAAM,cAAc,QAAQ,gBAAgB,uBAAuB,CAAC,EAAE;AAC/D,WAAA,OAAO,gBAAgB,WAAW;AAEzC,UAAM,gBAAgB,QAAQ,gBAAgB,mBAAmB,CAAC,EAAE;AAC7D,WAAA,OAAO,gBAAgB,aAAa;AAAA,WACpC,GAAG;AAAA,EAEZ;AAGA,EAAAD,SAAQ,yBAAyB,KAAK,EAAE,mBAAmB,IAAI;AAGvD,EAAAA,SAAA,WAAW,cAAc,0BAA0B;AACnD,EAAAA,SAAA,eAAe,kBAAkB,0BAA0B;AAE7D,QAAA,OAAO,OAAO,KAAK,cAAc;AAEjC,QAAA,MAAM,QAAQ;AAEd,QAAA,WAAW,KAAK,SAAS,SAAS;AAClC,QAAA,YAAY,KAAK,SAAS,UAAU;AAEpC,QAAAE,WAASC,oBAAa,EAAE,OAAO,UAAU,QAAQ,WAAW,WAAW,MAAA,CAAO;AAEpF,QAAMC,aAAWC,SAAAA,aAAa;AAAA,IAC5B;AAAA,IACA,MAAM;AAAA,IAAA,QACNH;AAAAA,EAAA,CACD;AAED,QAAM,MAAM;AAAA,IACV;AAAA,IAAA,QACAA;AAAAA,IAAA,UACAE;AAAAA,EAAA;AAIG,OAAA,QAAQ,CAAC,SAAS;AACjB,QAAA;AAEF,qBAAe,IAAI,EAAE,EAAE,SAAAJ,UAAS,MAAM,KAAK;AAAA,aACpC,GAAG;AACV,cAAQ,MAAM,0BAA0B,IAAI,IAAI,CAAC;AAAA,IACnD;AAAA,EAAA,CACD;AAEM,SAAAA;AACT;AAEM,MAAA,mBAAmB,OAAO,OAAO,QAAQ,MAAMA,WAAU,IAAIC,UAAAA,cAAc;AAC/E,QAAM,WAAW,MAAM,mBAAmB,MAAMD,QAAO;AACjD,QAAA,SAAS,WAAW,IAAI;AAChC;;;;"}
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { Command } from 'commander';
|
|
2
|
+
import { Logger } from './utils/logger';
|
|
3
|
+
import { TsConfig } from './utils/tsconfig';
|
|
4
|
+
export interface CLIContext {
|
|
5
|
+
cwd: string;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
tsconfig?: TsConfig;
|
|
8
|
+
}
|
|
2
9
|
export type StrapiCommand = (params: {
|
|
3
10
|
command: Command;
|
|
4
11
|
argv: string[];
|
|
12
|
+
ctx: CLIContext;
|
|
5
13
|
}) => void;
|
|
6
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,UAAU,CAAA;CAAE,KAAK,IAAI,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
1
2
|
export interface LoggerOptions {
|
|
2
3
|
silent?: boolean;
|
|
3
4
|
debug?: boolean;
|
|
@@ -11,6 +12,7 @@ export interface Logger {
|
|
|
11
12
|
warn: (...args: unknown[]) => void;
|
|
12
13
|
error: (...args: unknown[]) => void;
|
|
13
14
|
log: (...args: unknown[]) => void;
|
|
15
|
+
spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;
|
|
14
16
|
}
|
|
15
17
|
declare const createLogger: (options?: LoggerOptions) => Logger;
|
|
16
18
|
export { createLogger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IACpC,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;CACjF;AAED,QAAA,MAAM,YAAY,aAAa,aAAa,KAAQ,MA0FnD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const chalk = require("chalk");
|
|
4
|
+
const ora = require("ora");
|
|
4
5
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
5
6
|
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
7
|
+
const ora__default = /* @__PURE__ */ _interopDefault(ora);
|
|
6
8
|
const createLogger = (options = {}) => {
|
|
7
9
|
const { silent = false, debug = false, timestamp = true } = options;
|
|
8
10
|
const state = { errors: 0, warning: 0 };
|
|
@@ -56,6 +58,24 @@ const createLogger = (options = {}) => {
|
|
|
56
58
|
chalk__default.default.red(`[ERROR]${timestamp ? ` [${(/* @__PURE__ */ new Date()).toISOString()}]` : ""}`),
|
|
57
59
|
...args
|
|
58
60
|
);
|
|
61
|
+
},
|
|
62
|
+
// @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.
|
|
63
|
+
spinner(text) {
|
|
64
|
+
if (silent) {
|
|
65
|
+
return {
|
|
66
|
+
succeed() {
|
|
67
|
+
return this;
|
|
68
|
+
},
|
|
69
|
+
fail() {
|
|
70
|
+
return this;
|
|
71
|
+
},
|
|
72
|
+
start() {
|
|
73
|
+
return this;
|
|
74
|
+
},
|
|
75
|
+
text: ""
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return ora__default.default(text);
|
|
59
79
|
}
|
|
60
80
|
};
|
|
61
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sources":["../../../src/commands/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk"],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.js","sources":["../../../src/commands/utils/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport ora from 'ora';\n\nexport interface LoggerOptions {\n silent?: boolean;\n debug?: boolean;\n timestamp?: boolean;\n}\n\nexport interface Logger {\n warnings: number;\n errors: number;\n debug: (...args: unknown[]) => void;\n info: (...args: unknown[]) => void;\n warn: (...args: unknown[]) => void;\n error: (...args: unknown[]) => void;\n log: (...args: unknown[]) => void;\n spinner: (text: string) => Pick<ora.Ora, 'succeed' | 'fail' | 'start' | 'text'>;\n}\n\nconst createLogger = (options: LoggerOptions = {}): Logger => {\n const { silent = false, debug = false, timestamp = true } = options;\n\n const state = { errors: 0, warning: 0 };\n\n return {\n get warnings() {\n return state.warning;\n },\n\n get errors() {\n return state.errors;\n },\n\n debug(...args) {\n if (silent || !debug) {\n return;\n }\n\n console.log(\n chalk.cyan(`[DEBUG]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n info(...args) {\n if (silent) {\n return;\n }\n\n console.info(\n chalk.blue(`[INFO]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n log(...args) {\n if (silent) {\n return;\n }\n\n console.info(chalk.blue(`${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`), ...args);\n },\n\n warn(...args) {\n state.warning += 1;\n\n if (silent) {\n return;\n }\n\n console.warn(\n chalk.yellow(`[WARN]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n error(...args) {\n state.errors += 1;\n\n if (silent) {\n return;\n }\n\n console.error(\n chalk.red(`[ERROR]${timestamp ? `\\t[${new Date().toISOString()}]` : ''}`),\n ...args\n );\n },\n\n // @ts-expect-error – returning a subpart of ora is fine because the types tell us what is what.\n spinner(text: string) {\n if (silent) {\n return {\n succeed() {\n return this;\n },\n fail() {\n return this;\n },\n start() {\n return this;\n },\n text: '',\n };\n }\n\n return ora(text);\n },\n };\n};\n\nexport { createLogger };\n"],"names":["chalk","ora"],"mappings":";;;;;;;AAoBA,MAAM,eAAe,CAAC,UAAyB,OAAe;AAC5D,QAAM,EAAE,SAAS,OAAO,QAAQ,OAAO,YAAY,KAAS,IAAA;AAE5D,QAAM,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE;AAE/B,SAAA;AAAA,IACL,IAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,IAAI,SAAS;AACX,aAAO,MAAM;AAAA,IACf;AAAA,IAEA,SAAS,MAAM;AACT,UAAA,UAAU,CAAC,OAAO;AACpB;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,KAAK,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACzE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,QAAQ,MAAM;AACZ,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,KAAK,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,OAAO,MAAM;AACX,UAAI,QAAQ;AACV;AAAA,MACF;AAEA,cAAQ,KAAKA,uBAAM,KAAK,GAAG,YAAY,MAAU,oBAAA,QAAO,YAAa,CAAA,MAAM,EAAE,EAAE,GAAG,GAAG,IAAI;AAAA,IAC3F;AAAA,IAEA,QAAQ,MAAM;AACZ,YAAM,WAAW;AAEjB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,OAAO,SAAS,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QAC1E,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA,IAEA,SAAS,MAAM;AACb,YAAM,UAAU;AAEhB,UAAI,QAAQ;AACV;AAAA,MACF;AAEQ,cAAA;AAAA,QACNA,eAAAA,QAAM,IAAI,UAAU,YAAY,MAAM,oBAAI,KAAK,GAAE,YAAa,CAAA,MAAM,EAAE,EAAE;AAAA,QACxE,GAAG;AAAA,MAAA;AAAA,IAEP;AAAA;AAAA,IAGA,QAAQ,MAAc;AACpB,UAAI,QAAQ;AACH,eAAA;AAAA,UACL,UAAU;AACD,mBAAA;AAAA,UACT;AAAA,UACA,OAAO;AACE,mBAAA;AAAA,UACT;AAAA,UACA,QAAQ;AACC,mBAAA;AAAA,UACT;AAAA,UACA,MAAM;AAAA,QAAA;AAAA,MAEV;AAEA,aAAOC,aAAAA,QAAI,IAAI;AAAA,IACjB;AAAA,EAAA;AAEJ;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import type { Logger } from './logger';
|
|
3
|
+
interface TsConfig {
|
|
4
|
+
config: ts.ParsedCommandLine;
|
|
5
|
+
path: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @description Load a tsconfig.json file and return the parsed config.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
declare const loadTsConfig: ({ cwd, path, logger, }: {
|
|
13
|
+
cwd: string;
|
|
14
|
+
path: string;
|
|
15
|
+
logger: Logger;
|
|
16
|
+
}) => TsConfig | undefined;
|
|
17
|
+
export { loadTsConfig };
|
|
18
|
+
export type { TsConfig };
|
|
19
|
+
//# sourceMappingURL=tsconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../../src/commands/utils/tsconfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,UAAU,QAAQ;IAChB,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,QAAA,MAAM,YAAY;SAKX,MAAM;UACL,MAAM;YACJ,MAAM;MACZ,QAAQ,GAAG,SAiBd,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
+
const os__default = /* @__PURE__ */ _interopDefault(os);
|
|
7
|
+
const ts__default = /* @__PURE__ */ _interopDefault(ts);
|
|
8
|
+
const loadTsConfig = ({
|
|
9
|
+
cwd,
|
|
10
|
+
path,
|
|
11
|
+
logger
|
|
12
|
+
}) => {
|
|
13
|
+
const configPath = ts__default.default.findConfigFile(cwd, ts__default.default.sys.fileExists, path);
|
|
14
|
+
if (!configPath) {
|
|
15
|
+
return void 0;
|
|
16
|
+
}
|
|
17
|
+
const configFile = ts__default.default.readConfigFile(configPath, ts__default.default.sys.readFile);
|
|
18
|
+
const parsedConfig = ts__default.default.parseJsonConfigFileContent(configFile.config, ts__default.default.sys, cwd);
|
|
19
|
+
logger.debug(`Loaded user TS config:`, os__default.default.EOL, parsedConfig);
|
|
20
|
+
return {
|
|
21
|
+
config: parsedConfig,
|
|
22
|
+
path: configPath
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.loadTsConfig = loadTsConfig;
|
|
26
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.js","sources":["../../../src/commands/utils/tsconfig.ts"],"sourcesContent":["import os from 'os';\nimport ts from 'typescript';\nimport type { Logger } from './logger';\n\ninterface TsConfig {\n config: ts.ParsedCommandLine;\n path: string;\n}\n\n/**\n * @description Load a tsconfig.json file and return the parsed config.\n *\n * @internal\n */\nconst loadTsConfig = ({\n cwd,\n path,\n logger,\n}: {\n cwd: string;\n path: string;\n logger: Logger;\n}): TsConfig | undefined => {\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, path);\n\n if (!configPath) {\n return undefined;\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile);\n\n const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd);\n\n logger.debug(`Loaded user TS config:`, os.EOL, parsedConfig);\n\n return {\n config: parsedConfig,\n path: configPath,\n };\n};\n\nexport { loadTsConfig };\nexport type { TsConfig };\n"],"names":["ts","os"],"mappings":";;;;;;;AAcA,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AACF,MAI4B;AAC1B,QAAM,aAAaA,YAAG,QAAA,eAAe,KAAKA,YAAAA,QAAG,IAAI,YAAY,IAAI;AAEjE,MAAI,CAAC,YAAY;AACR,WAAA;AAAA,EACT;AAEA,QAAM,aAAaA,YAAAA,QAAG,eAAe,YAAYA,oBAAG,IAAI,QAAQ;AAEhE,QAAM,eAAeA,YAAG,QAAA,2BAA2B,WAAW,QAAQA,YAAA,QAAG,KAAK,GAAG;AAEjF,SAAO,MAAM,0BAA0BC,YAAAA,QAAG,KAAK,YAAY;AAEpD,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,EAAA;AAEV;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,UAAU,CAAC;AAErC,mBAAmB,eAAe,CAAC;AAEnC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,eAAe,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,aAAa,MAAM,UAAU,CAAC;AAErC,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,eAAe,aAAa,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport type { StrapiCommand, CLIContext } from './commands/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;;;AAcA,OAAO,UAAU,UAAUA;;;"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable no-multi-assign */\n/* eslint-disable node/exports-style */\n/* eslint-disable import/no-import-module-exports */\nimport strapiFactory from './Strapi';\n\nexport type * from '@strapi/types';\n\nexport type { StrapiCommand, CLIContext } from './commands/types';\n\nexport * as factories from './factories';\n\nexport default strapiFactory;\n\n// TODO: drop in v5 – see https://github.com/rollup/rollup/issues/1961 for more info on this decision\nmodule.exports = exports = strapiFactory;\n"],"names":["strapiFactory"],"mappings":";;AAcA,OAAO,UAAU,UAAUA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/strapi",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.1",
|
|
4
4
|
"description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -90,27 +90,24 @@
|
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@koa/cors": "3.4.3",
|
|
92
92
|
"@koa/router": "10.1.1",
|
|
93
|
-
"@strapi/admin": "4.15.
|
|
94
|
-
"@strapi/data-transfer": "4.15.
|
|
95
|
-
"@strapi/database": "4.15.
|
|
96
|
-
"@strapi/generate-new": "4.15.
|
|
97
|
-
"@strapi/generators": "4.15.
|
|
98
|
-
"@strapi/logger": "4.15.
|
|
99
|
-
"@strapi/pack-up": "4.15.
|
|
100
|
-
"@strapi/permissions": "4.15.
|
|
101
|
-
"@strapi/plugin-content-manager": "4.15.
|
|
102
|
-
"@strapi/plugin-content-type-builder": "4.15.
|
|
103
|
-
"@strapi/plugin-email": "4.15.
|
|
104
|
-
"@strapi/plugin-upload": "4.15.
|
|
105
|
-
"@strapi/types": "4.15.
|
|
106
|
-
"@strapi/typescript-utils": "4.15.
|
|
107
|
-
"@strapi/utils": "4.15.
|
|
108
|
-
"@vitejs/plugin-react": "4.1.0",
|
|
93
|
+
"@strapi/admin": "4.15.1",
|
|
94
|
+
"@strapi/data-transfer": "4.15.1",
|
|
95
|
+
"@strapi/database": "4.15.1",
|
|
96
|
+
"@strapi/generate-new": "4.15.1",
|
|
97
|
+
"@strapi/generators": "4.15.1",
|
|
98
|
+
"@strapi/logger": "4.15.1",
|
|
99
|
+
"@strapi/pack-up": "4.15.1",
|
|
100
|
+
"@strapi/permissions": "4.15.1",
|
|
101
|
+
"@strapi/plugin-content-manager": "4.15.1",
|
|
102
|
+
"@strapi/plugin-content-type-builder": "4.15.1",
|
|
103
|
+
"@strapi/plugin-email": "4.15.1",
|
|
104
|
+
"@strapi/plugin-upload": "4.15.1",
|
|
105
|
+
"@strapi/types": "4.15.1",
|
|
106
|
+
"@strapi/typescript-utils": "4.15.1",
|
|
107
|
+
"@strapi/utils": "4.15.1",
|
|
109
108
|
"bcryptjs": "2.4.3",
|
|
110
109
|
"boxen": "5.1.2",
|
|
111
|
-
"browserslist-to-esbuild": "1.2.0",
|
|
112
110
|
"chalk": "4.1.2",
|
|
113
|
-
"chokidar": "3.5.3",
|
|
114
111
|
"ci-info": "3.8.0",
|
|
115
112
|
"cli-table3": "0.6.2",
|
|
116
113
|
"commander": "8.3.0",
|
|
@@ -148,7 +145,6 @@
|
|
|
148
145
|
"semver": "7.5.4",
|
|
149
146
|
"statuses": "2.0.1",
|
|
150
147
|
"typescript": "5.2.2",
|
|
151
|
-
"vite": "4.4.9",
|
|
152
148
|
"yup": "0.32.9"
|
|
153
149
|
},
|
|
154
150
|
"devDependencies": {
|
|
@@ -168,10 +164,9 @@
|
|
|
168
164
|
"@types/node": "18.18.4",
|
|
169
165
|
"@types/node-schedule": "2.1.0",
|
|
170
166
|
"@types/statuses": "2.0.1",
|
|
171
|
-
"eslint-config-custom": "4.15.
|
|
167
|
+
"eslint-config-custom": "4.15.1",
|
|
172
168
|
"supertest": "6.3.3",
|
|
173
|
-
"tsconfig": "4.15.
|
|
174
|
-
"typescript": "5.2.2"
|
|
169
|
+
"tsconfig": "4.15.1"
|
|
175
170
|
},
|
|
176
171
|
"engines": {
|
|
177
172
|
"node": ">=18.0.0 <=20.x.x",
|
|
@@ -183,5 +178,5 @@
|
|
|
183
178
|
"!@strapi/admin"
|
|
184
179
|
]
|
|
185
180
|
},
|
|
186
|
-
"gitHead": "
|
|
181
|
+
"gitHead": "b6c085052f108fcfe47d22972a664dfa85aa0358"
|
|
187
182
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface CmdOptions {
|
|
2
|
-
forceBuild?: boolean;
|
|
3
|
-
optimization?: boolean;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* `$ strapi build`
|
|
7
|
-
*/
|
|
8
|
-
declare const _default: ({ optimization, forceBuild }: CmdOptions) => Promise<void>;
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/build-command/action.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;uDACwD,UAAU;AAArE,wBASE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const Strapi = require("../../../Strapi.js");
|
|
3
|
-
const admin = require("../../builders/admin.js");
|
|
4
|
-
require("path");
|
|
5
|
-
require("fs-extra");
|
|
6
|
-
require("@strapi/typescript-utils");
|
|
7
|
-
const action = async ({ optimization, forceBuild = true }) => {
|
|
8
|
-
const { appDir, distDir } = await Strapi.compile();
|
|
9
|
-
await admin({
|
|
10
|
-
forceBuild,
|
|
11
|
-
optimization,
|
|
12
|
-
buildDestDir: distDir,
|
|
13
|
-
srcDir: appDir
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
module.exports = action;
|
|
17
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/build-command/action.ts"],"sourcesContent":["import strapi from '../../../Strapi';\nimport { buildAdmin } from '../../builders';\n\ninterface CmdOptions {\n forceBuild?: boolean;\n optimization?: boolean;\n}\n\n/**\n * `$ strapi build`\n */\nexport default async ({ optimization, forceBuild = true }: CmdOptions) => {\n const { appDir, distDir } = await strapi.compile();\n\n await buildAdmin({\n forceBuild,\n optimization,\n buildDestDir: distDir,\n srcDir: appDir,\n });\n};\n"],"names":["strapi","buildAdmin"],"mappings":";;;;;;AAWA,MAAe,SAAA,OAAO,EAAE,cAAc,aAAa,WAAuB;AACxE,QAAM,EAAE,QAAQ,QAAA,IAAY,MAAMA,OAAO,QAAQ;AAEjD,QAAMC,MAAW;AAAA,IACf;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,QAAQ;AAAA,EAAA,CACT;AACH;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/build-command/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAMd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const helpers = require("../../utils/helpers.js");
|
|
3
|
-
const action = require("./action.js");
|
|
4
|
-
const command = ({ command: command2 }) => {
|
|
5
|
-
command2.command("build").option("--no-optimization", "Build the admin app without optimizing assets").description("Build the strapi admin app").action(helpers.runAction("build", action));
|
|
6
|
-
};
|
|
7
|
-
module.exports = command;
|
|
8
|
-
//# sourceMappingURL=command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/build-command/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi build`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('build')\n .option('--no-optimization', 'Build the admin app without optimizing assets')\n .description('Build the strapi admin app')\n .action(runAction('build', action)); // build-command dir to avoid problems with 'build' being commonly ignored\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,OAAO,EACf,OAAO,qBAAqB,+CAA+C,EAC3E,YAAY,4BAA4B,EACxC,OAAOC,QAAAA,UAAU,SAAS,MAAM,CAAC;AACtC;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface CmdOptions {
|
|
2
|
-
build?: boolean;
|
|
3
|
-
watchAdmin?: boolean;
|
|
4
|
-
polling?: boolean;
|
|
5
|
-
browser?: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* `$ strapi develop`
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
declare const _default: ({ build, watchAdmin, polling, browser }: CmdOptions) => Promise<void>;
|
|
12
|
-
export default _default;
|
|
13
|
-
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/develop/action.ts"],"names":[],"mappings":"AAcA,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;kEAC4D,UAAU,KAAG,QAAQ,IAAI,CAAC;AAAzF,wBA0BE"}
|
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const cluster = require("cluster");
|
|
4
|
-
const fse = require("fs-extra");
|
|
5
|
-
const chokidar = require("chokidar");
|
|
6
|
-
const execa = require("execa");
|
|
7
|
-
const _ = require("lodash/fp");
|
|
8
|
-
const strapiUtils = require("@strapi/utils");
|
|
9
|
-
const tsUtils = require("@strapi/typescript-utils");
|
|
10
|
-
const index = require("../../../core/app-configuration/index.js");
|
|
11
|
-
const Strapi = require("../../../Strapi.js");
|
|
12
|
-
const admin = require("../../builders/admin.js");
|
|
13
|
-
const typescript = require("../../builders/typescript.js");
|
|
14
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
16
|
-
const cluster__default = /* @__PURE__ */ _interopDefault(cluster);
|
|
17
|
-
const fse__default = /* @__PURE__ */ _interopDefault(fse);
|
|
18
|
-
const chokidar__default = /* @__PURE__ */ _interopDefault(chokidar);
|
|
19
|
-
const execa__default = /* @__PURE__ */ _interopDefault(execa);
|
|
20
|
-
const tsUtils__default = /* @__PURE__ */ _interopDefault(tsUtils);
|
|
21
|
-
const action = async ({ build, watchAdmin, polling, browser }) => {
|
|
22
|
-
const appDir = process.cwd();
|
|
23
|
-
const isTSProject = await tsUtils__default.default.isUsingTypeScript(appDir);
|
|
24
|
-
const outDir = await tsUtils__default.default.resolveOutDir(appDir);
|
|
25
|
-
const distDir = isTSProject ? outDir : appDir;
|
|
26
|
-
try {
|
|
27
|
-
if (cluster__default.default.isMaster || cluster__default.default.isPrimary) {
|
|
28
|
-
return await primaryProcess({
|
|
29
|
-
distDir,
|
|
30
|
-
appDir,
|
|
31
|
-
build,
|
|
32
|
-
browser,
|
|
33
|
-
isTSProject,
|
|
34
|
-
watchAdmin
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (cluster__default.default.isWorker) {
|
|
38
|
-
return await workerProcess({ appDir, distDir, watchAdmin, polling, isTSProject });
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error(e);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const primaryProcess = async ({
|
|
46
|
-
distDir,
|
|
47
|
-
appDir,
|
|
48
|
-
build,
|
|
49
|
-
isTSProject,
|
|
50
|
-
watchAdmin,
|
|
51
|
-
browser
|
|
52
|
-
}) => {
|
|
53
|
-
if (isTSProject) {
|
|
54
|
-
await typescript({ srcDir: appDir, distDir, ignoreDiagnostics: true });
|
|
55
|
-
}
|
|
56
|
-
const config = index({ app: appDir, dist: distDir });
|
|
57
|
-
const serveAdminPanel = _.getOr(true, "admin.serveAdminPanel", config);
|
|
58
|
-
const buildExists = fse__default.default.existsSync(path__default.default.join(distDir, "build"));
|
|
59
|
-
if (build && !watchAdmin && serveAdminPanel && !buildExists) {
|
|
60
|
-
try {
|
|
61
|
-
await admin({
|
|
62
|
-
buildDestDir: distDir,
|
|
63
|
-
forceBuild: false,
|
|
64
|
-
optimization: false,
|
|
65
|
-
srcDir: appDir
|
|
66
|
-
});
|
|
67
|
-
} catch (err) {
|
|
68
|
-
process.exit(1);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (watchAdmin) {
|
|
72
|
-
try {
|
|
73
|
-
execa__default.default(
|
|
74
|
-
"npm",
|
|
75
|
-
["run", "-s", "strapi", "watch-admin", "--", "--browser", browser ? "true" : "false"],
|
|
76
|
-
{
|
|
77
|
-
stdio: "inherit"
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
} catch (err) {
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
cluster__default.default.on("message", async (worker, message) => {
|
|
85
|
-
switch (message) {
|
|
86
|
-
case "reload":
|
|
87
|
-
if (isTSProject) {
|
|
88
|
-
await typescript({ srcDir: appDir, distDir, ignoreDiagnostics: true });
|
|
89
|
-
}
|
|
90
|
-
console.info("The server is restarting\n");
|
|
91
|
-
worker.send("kill");
|
|
92
|
-
break;
|
|
93
|
-
case "killed":
|
|
94
|
-
cluster__default.default.fork();
|
|
95
|
-
break;
|
|
96
|
-
case "stop":
|
|
97
|
-
process.exit(1);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
cluster__default.default.fork();
|
|
102
|
-
};
|
|
103
|
-
const workerProcess = async ({
|
|
104
|
-
appDir,
|
|
105
|
-
distDir,
|
|
106
|
-
watchAdmin,
|
|
107
|
-
polling,
|
|
108
|
-
isTSProject
|
|
109
|
-
}) => {
|
|
110
|
-
const strapiInstance = await Strapi({
|
|
111
|
-
distDir,
|
|
112
|
-
autoReload: true,
|
|
113
|
-
serveAdminPanel: !watchAdmin
|
|
114
|
-
}).load();
|
|
115
|
-
await tsUtils__default.default.generators.generate({
|
|
116
|
-
strapi: strapiInstance,
|
|
117
|
-
pwd: appDir,
|
|
118
|
-
rootDir: void 0,
|
|
119
|
-
logger: { silent: true, debug: false },
|
|
120
|
-
artifacts: { contentTypes: true, components: true }
|
|
121
|
-
});
|
|
122
|
-
if (isTSProject) {
|
|
123
|
-
await typescript({ srcDir: appDir, distDir, ignoreDiagnostics: false });
|
|
124
|
-
}
|
|
125
|
-
const adminWatchIgnoreFiles = strapiInstance.config.get("admin.watchIgnoreFiles", []);
|
|
126
|
-
watchFileChanges({
|
|
127
|
-
appDir,
|
|
128
|
-
strapiInstance,
|
|
129
|
-
watchIgnoreFiles: adminWatchIgnoreFiles,
|
|
130
|
-
polling
|
|
131
|
-
});
|
|
132
|
-
process.on("message", async (message) => {
|
|
133
|
-
switch (message) {
|
|
134
|
-
case "kill": {
|
|
135
|
-
await strapiInstance.destroy();
|
|
136
|
-
process.send?.("killed");
|
|
137
|
-
process.exit();
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
strapiInstance.start();
|
|
143
|
-
};
|
|
144
|
-
function watchFileChanges({
|
|
145
|
-
appDir,
|
|
146
|
-
strapiInstance,
|
|
147
|
-
watchIgnoreFiles,
|
|
148
|
-
polling
|
|
149
|
-
}) {
|
|
150
|
-
const restart = async () => {
|
|
151
|
-
if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {
|
|
152
|
-
strapiInstance.reload.isReloading = true;
|
|
153
|
-
strapiInstance.reload();
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const watcher = chokidar__default.default.watch(appDir, {
|
|
157
|
-
ignoreInitial: true,
|
|
158
|
-
usePolling: polling,
|
|
159
|
-
ignored: [
|
|
160
|
-
/(^|[/\\])\../,
|
|
161
|
-
// dot files
|
|
162
|
-
/tmp/,
|
|
163
|
-
"**/src/admin/**",
|
|
164
|
-
"**/src/plugins/**/admin/**",
|
|
165
|
-
"**/dist/src/plugins/test/admin/**",
|
|
166
|
-
"**/documentation",
|
|
167
|
-
"**/documentation/**",
|
|
168
|
-
"**/node_modules",
|
|
169
|
-
"**/node_modules/**",
|
|
170
|
-
"**/plugins.json",
|
|
171
|
-
"**/build",
|
|
172
|
-
"**/build/**",
|
|
173
|
-
"**/index.html",
|
|
174
|
-
"**/public",
|
|
175
|
-
"**/public/**",
|
|
176
|
-
strapiInstance.dirs.static.public,
|
|
177
|
-
strapiUtils.joinBy("/", strapiInstance.dirs.static.public, "**"),
|
|
178
|
-
"**/*.db*",
|
|
179
|
-
"**/exports/**",
|
|
180
|
-
"**/dist/**",
|
|
181
|
-
"**/*.d.ts",
|
|
182
|
-
...watchIgnoreFiles
|
|
183
|
-
]
|
|
184
|
-
});
|
|
185
|
-
watcher.on("add", (path2) => {
|
|
186
|
-
strapiInstance.log.info(`File created: ${path2}`);
|
|
187
|
-
restart();
|
|
188
|
-
}).on("change", (path2) => {
|
|
189
|
-
strapiInstance.log.info(`File changed: ${path2}`);
|
|
190
|
-
restart();
|
|
191
|
-
}).on("unlink", (path2) => {
|
|
192
|
-
strapiInstance.log.info(`File deleted: ${path2}`);
|
|
193
|
-
restart();
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
module.exports = action;
|
|
197
|
-
//# sourceMappingURL=action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../../../src/commands/actions/develop/action.ts"],"sourcesContent":["import path from 'path';\nimport cluster from 'cluster';\nimport fs from 'fs-extra';\nimport chokidar from 'chokidar';\nimport execa from 'execa';\nimport { getOr } from 'lodash/fp';\nimport { joinBy } from '@strapi/utils';\nimport tsUtils from '@strapi/typescript-utils';\nimport type { Strapi } from '@strapi/types';\n\nimport loadConfiguration from '../../../core/app-configuration';\nimport strapi from '../../../Strapi';\nimport { buildTypeScript, buildAdmin } from '../../builders';\n\ninterface CmdOptions {\n build?: boolean;\n watchAdmin?: boolean;\n polling?: boolean;\n browser?: boolean;\n}\n\n/**\n * `$ strapi develop`\n *\n */\nexport default async ({ build, watchAdmin, polling, browser }: CmdOptions): Promise<void> => {\n const appDir = process.cwd();\n\n const isTSProject = await tsUtils.isUsingTypeScript(appDir);\n const outDir = await tsUtils.resolveOutDir(appDir);\n const distDir = isTSProject ? outDir : appDir;\n\n try {\n if (cluster.isMaster || cluster.isPrimary) {\n return await primaryProcess({\n distDir,\n appDir,\n build,\n browser,\n isTSProject,\n watchAdmin,\n });\n }\n\n if (cluster.isWorker) {\n return await workerProcess({ appDir, distDir, watchAdmin, polling, isTSProject });\n }\n } catch (e) {\n console.error(e);\n process.exit(1);\n }\n};\n\nconst primaryProcess = async ({\n distDir,\n appDir,\n build,\n isTSProject,\n watchAdmin,\n browser,\n}: {\n distDir: string;\n appDir: string;\n build?: boolean;\n isTSProject: boolean;\n watchAdmin?: boolean;\n browser?: boolean;\n}) => {\n if (isTSProject) {\n await buildTypeScript({ srcDir: appDir, distDir, ignoreDiagnostics: true });\n }\n\n const config = loadConfiguration({ app: appDir, dist: distDir });\n const serveAdminPanel = getOr(true, 'admin.serveAdminPanel', config);\n\n const buildExists = fs.existsSync(path.join(distDir, 'build'));\n\n // Don't run the build process if the admin is in watch mode\n if (build && !watchAdmin && serveAdminPanel && !buildExists) {\n try {\n await buildAdmin({\n buildDestDir: distDir,\n forceBuild: false,\n optimization: false,\n srcDir: appDir,\n });\n } catch (err) {\n process.exit(1);\n }\n }\n\n if (watchAdmin) {\n try {\n execa(\n 'npm',\n ['run', '-s', 'strapi', 'watch-admin', '--', '--browser', browser ? 'true' : 'false'],\n {\n stdio: 'inherit',\n }\n );\n } catch (err) {\n process.exit(1);\n }\n }\n\n cluster.on('message', async (worker, message) => {\n switch (message) {\n case 'reload':\n if (isTSProject) {\n await buildTypeScript({ srcDir: appDir, distDir, ignoreDiagnostics: true });\n }\n\n console.info('The server is restarting\\n');\n\n worker.send('kill');\n break;\n case 'killed':\n cluster.fork();\n break;\n case 'stop':\n process.exit(1);\n break;\n default: {\n break;\n }\n }\n });\n\n cluster.fork();\n};\n\nconst workerProcess = async ({\n appDir,\n distDir,\n watchAdmin,\n polling,\n isTSProject,\n}: {\n appDir: string;\n distDir: string;\n watchAdmin?: boolean;\n polling?: boolean;\n isTSProject: boolean;\n}) => {\n const strapiInstance = await strapi({\n distDir,\n autoReload: true,\n serveAdminPanel: !watchAdmin,\n }).load();\n\n await tsUtils.generators.generate({\n strapi: strapiInstance,\n pwd: appDir,\n rootDir: undefined,\n logger: { silent: true, debug: false },\n artifacts: { contentTypes: true, components: true },\n });\n\n if (isTSProject) {\n await buildTypeScript({ srcDir: appDir, distDir, ignoreDiagnostics: false });\n }\n\n const adminWatchIgnoreFiles = strapiInstance.config.get('admin.watchIgnoreFiles', []);\n watchFileChanges({\n appDir,\n strapiInstance,\n watchIgnoreFiles: adminWatchIgnoreFiles,\n polling,\n });\n\n process.on('message', async (message) => {\n switch (message) {\n case 'kill': {\n await strapiInstance.destroy();\n process.send?.('killed');\n process.exit();\n break;\n }\n default: {\n break;\n }\n // Do nothing.\n }\n });\n\n strapiInstance.start();\n};\n\n/**\n * Init file watching to auto restart strapi app\n */\nfunction watchFileChanges({\n appDir,\n strapiInstance,\n watchIgnoreFiles,\n polling,\n}: {\n appDir: string;\n strapiInstance: Strapi;\n watchIgnoreFiles: string[];\n polling?: boolean;\n}) {\n const restart = async () => {\n if (strapiInstance.reload.isWatching && !strapiInstance.reload.isReloading) {\n strapiInstance.reload.isReloading = true;\n strapiInstance.reload();\n }\n };\n\n const watcher = chokidar.watch(appDir, {\n ignoreInitial: true,\n usePolling: polling,\n ignored: [\n /(^|[/\\\\])\\../, // dot files\n /tmp/,\n '**/src/admin/**',\n '**/src/plugins/**/admin/**',\n '**/dist/src/plugins/test/admin/**',\n '**/documentation',\n '**/documentation/**',\n '**/node_modules',\n '**/node_modules/**',\n '**/plugins.json',\n '**/build',\n '**/build/**',\n '**/index.html',\n '**/public',\n '**/public/**',\n strapiInstance.dirs.static.public,\n joinBy('/', strapiInstance.dirs.static.public, '**'),\n '**/*.db*',\n '**/exports/**',\n '**/dist/**',\n '**/*.d.ts',\n ...watchIgnoreFiles,\n ],\n });\n\n watcher\n .on('add', (path) => {\n strapiInstance.log.info(`File created: ${path}`);\n restart();\n })\n .on('change', (path) => {\n strapiInstance.log.info(`File changed: ${path}`);\n restart();\n })\n .on('unlink', (path) => {\n strapiInstance.log.info(`File deleted: ${path}`);\n restart();\n });\n}\n"],"names":["tsUtils","cluster","buildTypeScript","loadConfiguration","getOr","fs","path","buildAdmin","execa","strapi","chokidar","joinBy"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/commands/actions/develop/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;GAEG;AACH,QAAA,MAAM,OAAO,EAAE,aAUd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const helpers = require("../../utils/helpers.js");
|
|
3
|
-
const action = require("./action.js");
|
|
4
|
-
const command = ({ command: command2 }) => {
|
|
5
|
-
command2.command("develop").alias("dev").option("--no-build", "Disable build").option("--watch-admin", "Enable watch", false).option("--polling", "Watch for file changes in network directories", false).option("--browser <name>", "Open the browser", true).description("Start your Strapi application in development mode").action(helpers.runAction("develop", action));
|
|
6
|
-
};
|
|
7
|
-
module.exports = command;
|
|
8
|
-
//# sourceMappingURL=command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../src/commands/actions/develop/command.ts"],"sourcesContent":["import type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\nimport action from './action';\n\n/**\n * `$ strapi develop`\n */\nconst command: StrapiCommand = ({ command }) => {\n command\n .command('develop')\n .alias('dev')\n .option('--no-build', 'Disable build')\n .option('--watch-admin', 'Enable watch', false)\n .option('--polling', 'Watch for file changes in network directories', false)\n .option('--browser <name>', 'Open the browser', true)\n .description('Start your Strapi application in development mode')\n .action(runAction('develop', action));\n};\n\nexport default command;\n"],"names":["command","runAction"],"mappings":";;;AAOA,MAAM,UAAyB,CAAC,EAAE,SAAAA,eAAc;AAC9CA,WACG,QAAQ,SAAS,EACjB,MAAM,KAAK,EACX,OAAO,cAAc,eAAe,EACpC,OAAO,iBAAiB,gBAAgB,KAAK,EAC7C,OAAO,aAAa,iDAAiD,KAAK,EAC1E,OAAO,oBAAoB,oBAAoB,IAAI,EACnD,YAAY,mDAAmD,EAC/D,OAAOC,QAAAA,UAAU,WAAW,MAAM,CAAC;AACxC;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
buildDestDir: string;
|
|
3
|
-
forceBuild?: boolean;
|
|
4
|
-
optimization?: boolean;
|
|
5
|
-
srcDir: string;
|
|
6
|
-
}
|
|
7
|
-
declare const _default: ({ buildDestDir, forceBuild, optimization, srcDir }: Options) => Promise<any>;
|
|
8
|
-
export default _default;
|
|
9
|
-
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/commands/builders/admin.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;6EAEgF,OAAO;AAAxF,wBA4CE"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const chalk = require("chalk");
|
|
3
|
-
const strapiAdmin = require("@strapi/admin");
|
|
4
|
-
const strapiUtils = require("@strapi/utils");
|
|
5
|
-
const index = require("../../ee/index.js");
|
|
6
|
-
const addSlash = require("../../utils/addSlash.js");
|
|
7
|
-
const Strapi = require("../../Strapi.js");
|
|
8
|
-
const getEnabledPlugins = require("../../core/loaders/plugins/get-enabled-plugins.js");
|
|
9
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
-
const chalk__default = /* @__PURE__ */ _interopDefault(chalk);
|
|
11
|
-
const strapiAdmin__default = /* @__PURE__ */ _interopDefault(strapiAdmin);
|
|
12
|
-
const buildAdmin = async ({ buildDestDir, forceBuild = true, optimization, srcDir }) => {
|
|
13
|
-
const strapiInstance = Strapi({
|
|
14
|
-
// Directories
|
|
15
|
-
appDir: srcDir,
|
|
16
|
-
distDir: buildDestDir,
|
|
17
|
-
// Options
|
|
18
|
-
autoReload: true,
|
|
19
|
-
serveAdminPanel: false
|
|
20
|
-
});
|
|
21
|
-
const plugins = await getEnabledPlugins.getEnabledPlugins(strapiInstance, { client: true });
|
|
22
|
-
const env = strapiInstance.config.get("environment");
|
|
23
|
-
const { serverUrl, adminPath } = strapiUtils.getConfigUrls(strapiInstance.config, true);
|
|
24
|
-
console.log(`Building your admin UI with ${chalk__default.default.green(env)} configuration...`);
|
|
25
|
-
await strapiAdmin__default.default.clean({ appDir: srcDir, buildDestDir });
|
|
26
|
-
index.init(srcDir);
|
|
27
|
-
return strapiAdmin__default.default.build({
|
|
28
|
-
appDir: srcDir,
|
|
29
|
-
buildDestDir,
|
|
30
|
-
// front end build env is always production for now
|
|
31
|
-
env: "production",
|
|
32
|
-
forceBuild,
|
|
33
|
-
plugins,
|
|
34
|
-
optimize: optimization,
|
|
35
|
-
options: {
|
|
36
|
-
backend: serverUrl,
|
|
37
|
-
adminPath: addSlash(adminPath),
|
|
38
|
-
telemetryIsDisabled: strapiInstance.telemetry.isDisabled
|
|
39
|
-
}
|
|
40
|
-
}).then(() => {
|
|
41
|
-
console.log("Admin UI built successfully");
|
|
42
|
-
}).catch((err) => {
|
|
43
|
-
console.error(err);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
module.exports = buildAdmin;
|
|
48
|
-
//# sourceMappingURL=admin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sources":["../../../src/commands/builders/admin.ts"],"sourcesContent":["import chalk from 'chalk';\n\nimport strapiAdmin from '@strapi/admin';\nimport { getConfigUrls } from '@strapi/utils';\n\nimport ee from '../../utils/ee';\nimport addSlash from '../../utils/addSlash';\nimport strapi from '../../Strapi';\nimport { getEnabledPlugins } from '../../core/loaders/plugins/get-enabled-plugins';\n\nexport interface Options {\n buildDestDir: string;\n forceBuild?: boolean;\n optimization?: boolean;\n srcDir: string;\n}\n\nexport default async ({ buildDestDir, forceBuild = true, optimization, srcDir }: Options) => {\n const strapiInstance = strapi({\n // Directories\n appDir: srcDir,\n distDir: buildDestDir,\n // Options\n autoReload: true,\n serveAdminPanel: false,\n });\n\n const plugins = await getEnabledPlugins(strapiInstance, { client: true });\n\n const env = strapiInstance.config.get('environment');\n const { serverUrl, adminPath } = getConfigUrls(strapiInstance.config, true);\n\n console.log(`Building your admin UI with ${chalk.green(env)} configuration...`);\n\n // Always remove the .cache and build folders\n await strapiAdmin.clean({ appDir: srcDir, buildDestDir });\n\n ee.init(srcDir);\n\n return strapiAdmin\n .build({\n appDir: srcDir,\n buildDestDir,\n // front end build env is always production for now\n env: 'production',\n forceBuild,\n plugins,\n optimize: optimization,\n options: {\n backend: serverUrl,\n adminPath: addSlash(adminPath),\n telemetryIsDisabled: strapiInstance.telemetry.isDisabled,\n },\n })\n .then(() => {\n console.log('Admin UI built successfully');\n })\n .catch((err: NodeJS.ErrnoException) => {\n console.error(err);\n process.exit(1);\n });\n};\n"],"names":["strapi","getEnabledPlugins","getConfigUrls","chalk","strapiAdmin","ee"],"mappings":";;;;;;;;;;;AAiBA,MAAA,aAAe,OAAO,EAAE,cAAc,aAAa,MAAM,cAAc,aAAsB;AAC3F,QAAM,iBAAiBA,OAAO;AAAA;AAAA,IAE5B,QAAQ;AAAA,IACR,SAAS;AAAA;AAAA,IAET,YAAY;AAAA,IACZ,iBAAiB;AAAA,EAAA,CAClB;AAED,QAAM,UAAU,MAAMC,oCAAkB,gBAAgB,EAAE,QAAQ,MAAM;AAExE,QAAM,MAAM,eAAe,OAAO,IAAI,aAAa;AACnD,QAAM,EAAE,WAAW,cAAcC,YAAc,cAAA,eAAe,QAAQ,IAAI;AAE1E,UAAQ,IAAI,+BAA+BC,eAAAA,QAAM,MAAM,GAAG,CAAC,mBAAmB;AAG9E,QAAMC,qBAAAA,QAAY,MAAM,EAAE,QAAQ,QAAQ,cAAc;AAExDC,QAAG,KAAK,MAAM;AAEd,SAAOD,qBAAAA,QACJ,MAAM;AAAA,IACL,QAAQ;AAAA,IACR;AAAA;AAAA,IAEA,KAAK;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,SAAS;AAAA,MACP,SAAS;AAAA,MACT,WAAW,SAAS,SAAS;AAAA,MAC7B,qBAAqB,eAAe,UAAU;AAAA,IAChD;AAAA,EAAA,CACD,EACA,KAAK,MAAM;AACV,YAAQ,IAAI,6BAA6B;AAAA,EAAA,CAC1C,EACA,MAAM,CAAC,QAA+B;AACrC,YAAQ,MAAM,GAAG;AACjB,YAAQ,KAAK,CAAC;AAAA,EAAA,CACf;AACL;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/builders/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,eAAe,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/commands/builders/typescript.ts"],"names":[],"mappings":";YAwBU,MAAM;aACL,MAAM;uBACI,OAAO;;AAP5B,wBAkBE"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const fse = require("fs-extra");
|
|
4
|
-
const tsUtils = require("@strapi/typescript-utils");
|
|
5
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
-
const path__default = /* @__PURE__ */ _interopDefault(path);
|
|
7
|
-
const fse__default = /* @__PURE__ */ _interopDefault(fse);
|
|
8
|
-
const tsUtils__default = /* @__PURE__ */ _interopDefault(tsUtils);
|
|
9
|
-
const cleanupDistDirectory = async (distDir) => {
|
|
10
|
-
if (!await fse__default.default.pathExists(distDir)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const dirContent = await fse__default.default.readdir(distDir);
|
|
14
|
-
const validFilenames = dirContent.filter((filename) => filename !== "build");
|
|
15
|
-
for (const filename of validFilenames) {
|
|
16
|
-
await fse__default.default.remove(path__default.default.resolve(distDir, filename));
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
const buildTypeScript = async ({
|
|
20
|
-
srcDir,
|
|
21
|
-
distDir,
|
|
22
|
-
ignoreDiagnostics = false
|
|
23
|
-
}) => {
|
|
24
|
-
const isTSProject = await tsUtils__default.default.isUsingTypeScript(srcDir);
|
|
25
|
-
if (!isTSProject) {
|
|
26
|
-
throw new Error(`tsconfig file not found in ${srcDir}`);
|
|
27
|
-
}
|
|
28
|
-
await cleanupDistDirectory(distDir);
|
|
29
|
-
return tsUtils__default.default.compile(srcDir, { configOptions: { ignoreDiagnostics } });
|
|
30
|
-
};
|
|
31
|
-
module.exports = buildTypeScript;
|
|
32
|
-
//# sourceMappingURL=typescript.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sources":["../../../src/commands/builders/typescript.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport tsUtils from '@strapi/typescript-utils';\n\nconst cleanupDistDirectory = async (distDir: string) => {\n if (!(await fs.pathExists(distDir))) {\n return;\n }\n\n const dirContent = await fs.readdir(distDir);\n const validFilenames = dirContent\n // Ignore the admin build folder\n .filter((filename) => filename !== 'build');\n\n for (const filename of validFilenames) {\n await fs.remove(path.resolve(distDir, filename));\n }\n};\n\nexport default async ({\n srcDir,\n distDir,\n ignoreDiagnostics = false,\n}: {\n srcDir: string;\n distDir: string;\n ignoreDiagnostics: boolean;\n}) => {\n const isTSProject = await tsUtils.isUsingTypeScript(srcDir);\n\n if (!isTSProject) {\n throw new Error(`tsconfig file not found in ${srcDir}`);\n }\n\n await cleanupDistDirectory(distDir);\n\n return tsUtils.compile(srcDir, { configOptions: { ignoreDiagnostics } });\n};\n"],"names":["fs","path","tsUtils"],"mappings":";;;;;;;;AAIA,MAAM,uBAAuB,OAAO,YAAoB;AACtD,MAAI,CAAE,MAAMA,aAAAA,QAAG,WAAW,OAAO,GAAI;AACnC;AAAA,EACF;AAEA,QAAM,aAAa,MAAMA,aAAAA,QAAG,QAAQ,OAAO;AAC3C,QAAM,iBAAiB,WAEpB,OAAO,CAAC,aAAa,aAAa,OAAO;AAE5C,aAAW,YAAY,gBAAgB;AACrC,UAAMA,aAAAA,QAAG,OAAOC,cAAA,QAAK,QAAQ,SAAS,QAAQ,CAAC;AAAA,EACjD;AACF;AAEA,MAAA,kBAAe,OAAO;AAAA,EACpB;AAAA,EACA;AAAA,EACA,oBAAoB;AACtB,MAIM;AACJ,QAAM,cAAc,MAAMC,iBAAAA,QAAQ,kBAAkB,MAAM;AAE1D,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,8BAA8B,MAAM,EAAE;AAAA,EACxD;AAEA,QAAM,qBAAqB,OAAO;AAE3B,SAAAA,iBAAAA,QAAQ,QAAQ,QAAQ,EAAE,eAAe,EAAE,qBAAqB;AACzE;;"}
|
package/dist/utils/addSlash.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const addSlash = (path) => {
|
|
3
|
-
let tmpPath = path;
|
|
4
|
-
if (typeof tmpPath !== "string")
|
|
5
|
-
throw new Error("admin.url must be a string");
|
|
6
|
-
if (tmpPath === "" || tmpPath === "/")
|
|
7
|
-
return "/";
|
|
8
|
-
if (tmpPath[0] !== "/")
|
|
9
|
-
tmpPath = `/${tmpPath}`;
|
|
10
|
-
if (tmpPath[tmpPath.length - 1] !== "/")
|
|
11
|
-
tmpPath += "/";
|
|
12
|
-
return tmpPath;
|
|
13
|
-
};
|
|
14
|
-
module.exports = addSlash;
|
|
15
|
-
//# sourceMappingURL=addSlash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addSlash.js","sources":["../../src/utils/addSlash.ts"],"sourcesContent":["export default (path: string) => {\n let tmpPath = path;\n if (typeof tmpPath !== 'string') throw new Error('admin.url must be a string');\n if (tmpPath === '' || tmpPath === '/') return '/';\n\n if (tmpPath[0] !== '/') tmpPath = `/${tmpPath}`;\n if (tmpPath[tmpPath.length - 1] !== '/') tmpPath += '/';\n return tmpPath;\n};\n"],"names":[],"mappings":";AAAA,MAAe,WAAA,CAAC,SAAiB;AAC/B,MAAI,UAAU;AACd,MAAI,OAAO,YAAY;AAAgB,UAAA,IAAI,MAAM,4BAA4B;AACzE,MAAA,YAAY,MAAM,YAAY;AAAY,WAAA;AAE1C,MAAA,QAAQ,CAAC,MAAM;AAAK,cAAU,IAAI,OAAO;AAC7C,MAAI,QAAQ,QAAQ,SAAS,CAAC,MAAM;AAAgB,eAAA;AAC7C,SAAA;AACT;;"}
|