New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@strapi/generate-new

Package Overview
Dependencies
Maintainers
9
Versions
1246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@strapi/generate-new - npm Package Compare versions

Comparing version 0.0.0-experimental.91cf4ee737dd50a97bd44e64fdeb1c6aa8dc421f to 0.0.0-experimental.93181c8b900e97a04bf10785b368657101ec98d8

dist/resources/files/js/config/plugins.js

4

dist/create-project.d.ts

@@ -1,3 +0,3 @@

import { Configuration, Scope } from './types';
export default function createProject(scope: Scope, { client, connection, dependencies }: Configuration): Promise<void>;
import { Scope } from './types';
export default function createProject(scope: Scope): Promise<void>;
//# sourceMappingURL=create-project.d.ts.map

@@ -6,4 +6,2 @@ "use strict";

const execa = require("execa");
const ora = require("ora");
const _ = require("lodash");
const stopProcess = require("./utils/stop-process.js");

@@ -24,12 +22,14 @@ const usage = require("./utils/usage.js");

const execa__default = /* @__PURE__ */ _interopDefault(execa);
const ora__default = /* @__PURE__ */ _interopDefault(ora);
const ___default = /* @__PURE__ */ _interopDefault(_);
async function createProject(scope, { client, connection, dependencies }) {
var _a, _b;
console.log(`Creating a new Strapi application at ${chalk__default.default.green(scope.rootPath)}.`);
console.log("Creating files.");
const resources = path.join(__dirname, "resources");
async function createProject(scope) {
console.log(`Creating a new Strapi application at ${chalk__default.default.green(scope.rootPath)}.
`);
const { rootPath, useTypescript } = scope;
const resources = path.join(__dirname, "resources");
const language = useTypescript ? "ts" : "js";
if (!scope.isQuickstart) {
await usage.trackUsage({ event: "didChooseCustomDatabase", scope });
} else {
await usage.trackUsage({ event: "didChooseQuickstart", scope });
}
try {
const language = useTypescript ? "ts" : "js";
await fse__default.default.copy(path.join(resources, "files", language), rootPath);

@@ -48,44 +48,24 @@ await fse__default.default.writeFile(path.join(rootPath, ".env"), env());

copyDotFilesFromSubDirectory("common");
if (!useTypescript) {
copyDotFilesFromSubDirectory("js");
}
await usage.trackUsage({ event: "didCopyProjectFiles", scope });
await fse__default.default.writeJSON(
path.join(rootPath, "package.json"),
package_json({
strapiDependencies: scope.strapiDependencies,
additionalsDependencies: dependencies,
strapiVersion: scope.strapiVersion,
projectName: ___default.default.kebabCase(scope.name),
uuid: scope.uuid,
packageJsonStrapi: scope.packageJsonStrapi
}),
{
spaces: 2
}
);
await package_json(scope);
await usage.trackUsage({ event: "didWritePackageJSON", scope });
if (useTypescript) {
const filesMap = {
"tsconfig-admin.json.js": "src/admin",
"tsconfig-server.json.js": "."
};
for (const [fileName, path$1] of Object.entries(filesMap)) {
const destPath = path.join(rootPath, path$1, "tsconfig.json");
if (fileName === "tsconfig-admin.json.js") {
await fse__default.default.writeJSON(destPath, tsconfigAdmin_json(), { spaces: 2 });
const tsConfigs = [
{
path: "src/admin/tsconfig.json",
content: tsconfigAdmin_json()
},
{
path: "tsconfig.json",
content: tsconfigServer_json()
}
if (fileName === "tsconfig-server.json.js") {
await fse__default.default.writeJSON(destPath, tsconfigServer_json(), { spaces: 2 });
}
];
for (const { path: path$1, content } of tsConfigs) {
await fse__default.default.writeJSON(path.join(rootPath, path$1), content, { spaces: 2 });
}
} else {
const filesMap = { "jsconfig.json.js": "." };
for (const [, path$1] of Object.entries(filesMap)) {
const destPath = path.join(rootPath, path$1, "jsconfig.json");
await fse__default.default.writeJSON(destPath, jsconfig_json(), { spaces: 2 });
}
await fse__default.default.writeJSON(path.join(rootPath, "jsconfig.json"), jsconfig_json(), { spaces: 2 });
}
await fse__default.default.ensureDir(path.join(rootPath, "node_modules"));
await fse__default.default.appendFile(path.join(rootPath, ".env"), database.generateDbEnvariables({ client, connection }));
await fse__default.default.appendFile(path.join(rootPath, ".env"), database.generateDbEnvVariables(scope));
await fse__default.default.writeFile(

@@ -112,15 +92,8 @@ path.join(rootPath, `config/database.${language}`),

await usage.trackUsage({ event: "willInstallProjectDependencies", scope });
const installPrefix = chalk__default.default.yellow("Installing dependencies:");
const loader = ora__default.default(installPrefix).start();
const logInstall = (chunk = "") => {
loader.text = `${installPrefix} ${chunk.toString().split("\n").join(" ")}`;
};
console.log(`Installing dependencies with ${chalk__default.default.bold(scope.packageManager)}
`);
try {
if (scope.installDependencies !== false) {
const runner = runInstall(scope);
(_a = runner.stdout) == null ? void 0 : _a.on("data", logInstall);
(_b = runner.stderr) == null ? void 0 : _b.on("data", logInstall);
await runner;
await runInstall(scope);
}
loader.stop();
console.log(`Dependencies installed ${chalk__default.default.green("successfully")}.`);

@@ -130,3 +103,2 @@ await usage.trackUsage({ event: "didInstallProjectDependencies", scope });

const stderr = types.isStderrError(error) ? error.stderr : "";
loader.stop();
await usage.trackUsage({

@@ -137,7 +109,2 @@ event: "didNotInstallProjectDependencies",

});
console.error(`${chalk__default.default.red("Error")} while installing dependencies:`);
console.error(stderr);
await usage.captureStderr("didNotInstallProjectDependencies", error);
console.log(chalk__default.default.black.bgWhite(" Keep trying!"));
console.log();
console.log(

@@ -150,8 +117,6 @@ chalk__default.default.bold(

console.log(
`Fix the issues mentioned in the installation errors and try to run the following command:`
`Fix the issues mentioned in the installation errors and try to run the following command`
);
console.log();
console.log(
`cd ${chalk__default.default.green(rootPath)} && ${chalk__default.default.cyan(scope.useYarn ? "yarn" : "npm")} install`
);
console.log(`cd ${chalk__default.default.green(rootPath)} && ${chalk__default.default.cyan(scope.packageManager)} install`);
console.log();

@@ -168,3 +133,3 @@ stopProcess();

`);
const cmd = chalk__default.default.cyan(scope.useYarn ? "yarn" : "npm run");
const cmd = chalk__default.default.cyan(`${scope.packageManager} run`);
console.log("Available commands in your project:");

@@ -183,2 +148,5 @@ console.log();

console.log();
console.log(` ${cmd} deploy`);
console.log(" Deploy Strapi project.");
console.log();
console.log(` ${cmd} strapi`);

@@ -192,15 +160,46 @@ console.log(` Display all available commands.`);

console.log();
}
const installArguments = ["install", "--production", "--no-optional"];
function runInstall({ rootPath, useYarn }) {
if (useYarn) {
installArguments.push("--network-timeout 1000000");
return execa__default.default("yarnpkg", installArguments, {
cwd: rootPath,
stdin: "ignore"
if (scope.runApp !== true)
return;
console.log(`Running your Strapi application.`);
try {
await usage.trackUsage({ event: "willStartServer", scope });
await execa__default.default("npm", ["run", "develop"], {
stdio: "inherit",
cwd: scope.rootPath,
env: {
FORCE_COLOR: "1"
}
});
} catch (error) {
if (typeof error === "string" || error instanceof Error) {
await usage.trackUsage({
event: "didNotStartServer",
scope,
error
});
}
process.exit(1);
}
return execa__default.default("npm", installArguments, { cwd: rootPath, stdin: "ignore" });
}
const installArguments = ["install"];
const installArgumentsMap = {
npm: ["--legacy-peer-deps"],
yarn: ["--network-timeout 1000000"],
pnpm: []
};
function runInstall({ rootPath, packageManager }) {
const options = {
cwd: rootPath,
stdio: "inherit",
env: {
...process.env,
NODE_ENV: "development"
}
};
if (packageManager in installArgumentsMap) {
installArguments.push(...installArgumentsMap[packageManager] ?? []);
}
return execa__default.default(packageManager, installArguments, options);
}
module.exports = createProject;
//# sourceMappingURL=create-project.js.map

@@ -1,4 +0,6 @@

import type { NewOptions } from './types';
import type { Options } from './types';
export type { Options };
export { default as checkInstallPath } from './utils/check-install-path';
export declare const generateNewApp: (projectDirectory: string, options: Partial<NewOptions>) => Promise<void>;
export { default as checkRequirements } from './utils/check-requirements';
export declare const generateNewApp: (options: Options) => Promise<void>;
//# sourceMappingURL=index.d.ts.map

@@ -8,55 +8,30 @@ "use strict";

const crypto = require("crypto");
const sentry = require("@sentry/node");
const hasYarn = require("./utils/has-yarn.js");
const checkRequirements = require("./utils/check-requirements.js");
const usage = require("./utils/usage.js");
const parseDbArguments = require("./utils/parse-db-arguments.js");
const generateNew = require("./generate-new.js");
const machineId = require("./utils/machine-id.js");
const checkInstallPath = require("./utils/check-install-path.js");
const createProject = require("./create-project.js");
const database = require("./utils/database.js");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
function _interopNamespace(e) {
if (e && e.__esModule)
return e;
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
if (e) {
for (const k in e) {
if (k !== "default") {
const d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: () => e[k]
});
}
}
}
n.default = e;
return Object.freeze(n);
}
const os__default = /* @__PURE__ */ _interopDefault(os);
const readline__default = /* @__PURE__ */ _interopDefault(readline);
const crypto__default = /* @__PURE__ */ _interopDefault(crypto);
const sentry__namespace = /* @__PURE__ */ _interopNamespace(sentry);
const packageJson = JSON.parse(node_fs.readFileSync(node_path.resolve(__dirname, "../package.json"), "utf8"));
const generateNewApp = (projectDirectory, options) => {
sentry__namespace.init({
dsn: "https://841d2b2c9b4d4b43a4cde92794cb705a@sentry.io/1762059"
});
const generateNewApp = async (options) => {
checkRequirements();
const rootPath = node_path.resolve(projectDirectory);
const rootPath = await checkInstallPath(options.directory);
const tmpPath = node_path.join(os__default.default.tmpdir(), `strapi${crypto__default.default.randomBytes(6).toString("hex")}`);
const useNpm = options.useNpm !== void 0;
const scope = {
rootPath,
name: node_path.basename(rootPath),
// disable quickstart run app after creation
runQuickstartApp: options.run !== false,
// use pacakge version as strapiVersion (all packages have the same version);
useTypescript: options.useTypescript,
packageManager: options.packageManager,
database: options.database,
runApp: options.runApp ?? false,
isQuickstart: options.isQuickstart,
// use package version as strapiVersion (all packages have the same version);
strapiVersion: packageJson.version,
debug: options.debug !== void 0,
quick: options.quickstart,
template: options.template,
packageJsonStrapi: {
template: options.template,
starter: options.starter
template: options.template
},

@@ -67,37 +42,40 @@ uuid: (process.env.STRAPI_UUID_PREFIX || "") + crypto__default.default.randomUUID(),

tmpPath,
// use yarn if available and --use-npm isn't true
useYarn: !useNpm && hasYarn(),
installDependencies: true,
strapiDependencies: [
"@strapi/strapi",
"@strapi/plugin-users-permissions",
"@strapi/plugin-i18n"
],
additionalsDependencies: {},
useTypescript: Boolean(options.typescript)
devDependencies: {},
dependencies: {
"@strapi/strapi": packageJson.version,
"@strapi/plugin-users-permissions": packageJson.version,
"@strapi/plugin-cloud": packageJson.version,
// third party
react: "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
"styled-components": "^6.0.0"
}
};
sentry__namespace.configureScope(function configureScope(sentryScope) {
const tags = {
os: os__default.default.type(),
osPlatform: os__default.default.platform(),
osArch: os__default.default.arch(),
osRelease: os__default.default.release(),
version: scope.strapiVersion,
nodeVersion: process.versions.node,
docker: scope.docker
if (scope.useTypescript) {
scope.devDependencies = {
...scope.devDependencies,
typescript: "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18"
};
Object.keys(tags).forEach((tag) => {
sentryScope.setTag(tag, tags[tag]);
});
});
parseDbArguments({ scope, args: options });
}
database.addDatabaseDependencies(scope);
initCancelCatcher();
return generateNew(scope).catch((error) => {
console.error(error);
return usage.captureException(error).then(() => {
return usage.trackError({ scope, error }).then(() => {
process.exit(1);
});
try {
await usage.trackUsage({ event: "willCreateProject", scope });
return await createProject(scope);
} catch (error) {
if (!(error instanceof Error)) {
throw error;
}
console.log(`
${error.message}
`);
return usage.trackError({ scope, error }).then(() => {
process.exit(1);
});
});
}
};

@@ -118,4 +96,5 @@ function initCancelCatcher() {

}
exports.checkRequirements = checkRequirements;
exports.checkInstallPath = checkInstallPath;
exports.generateNewApp = generateNewApp;
//# sourceMappingURL=index.js.map

@@ -15,3 +15,4 @@ module.exports = ({ env }) => ({

nps: env.bool('FLAG_NPS', true),
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
},
});
module.exports = [
'strapi::logger',
'strapi::errors',

@@ -6,3 +7,2 @@ 'strapi::security',

'strapi::poweredBy',
'strapi::logger',
'strapi::query',

@@ -9,0 +9,0 @@ 'strapi::body',

@@ -39,2 +39,6 @@ # 🚀 Getting started with Strapi

```
yarn strapi deploy
```
## 📚 Learn more

@@ -41,0 +45,0 @@

@@ -15,3 +15,4 @@ export default ({ env }) => ({

nps: env.bool('FLAG_NPS', true),
promoteEE: env.bool('FLAG_PROMOTE_EE', true),
},
});
export default [
'strapi::logger',
'strapi::errors',

@@ -6,3 +7,2 @@ 'strapi::security',

'strapi::poweredBy',
'strapi::logger',
'strapi::query',

@@ -9,0 +9,0 @@ 'strapi::body',

@@ -7,5 +7,2 @@ export default ({ env }) => ({

},
webhooks: {
populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
},
});

@@ -39,2 +39,6 @@ # 🚀 Getting started with Strapi

```
yarn strapi deploy
```
## 📚 Learn more

@@ -41,0 +45,0 @@

@@ -0,1 +1,3 @@

// import type { Core } from '@strapi/strapi';
export default {

@@ -8,3 +10,3 @@ /**

*/
register(/*{ strapi }*/) {},
register(/* { strapi }: { strapi: Core.Strapi } */) {},

@@ -18,3 +20,3 @@ /**

*/
bootstrap(/*{ strapi }*/) {},
bootstrap(/* { strapi }: { strapi: Core.Strapi } */) {},
};
"use strict";
const engines = {
node: ">=16.0.0 <=20.x.x",
node: ">=18.0.0 <=20.x.x",
npm: ">=6.0.0"

@@ -5,0 +5,0 @@ };

@@ -1,34 +0,4 @@

import { Scope } from '../../../types';
type OptsScope = Pick<Scope, 'strapiDependencies' | 'additionalsDependencies' | 'strapiVersion' | 'uuid' | 'packageJsonStrapi'>;
interface Opts extends OptsScope {
projectName: string;
}
declare const _default: (opts: Opts) => {
name: string;
private: boolean;
version: string;
description: string;
scripts: {
develop: string;
start: string;
build: string;
strapi: string;
};
devDependencies: {};
dependencies: {
[x: string]: string;
};
author: {
name: string;
};
strapi: {
uuid: string | undefined;
};
engines: {
node: string;
npm: string;
};
license: string;
};
import type { Scope } from '../../../types';
declare const _default: (scope: Scope) => Promise<void>;
export default _default;
//# sourceMappingURL=package.json.d.ts.map
"use strict";
const path = require("path");
const _ = require("lodash");
const fse = require("fs-extra");
const engines = require("./engines.js");
const packageJSON = (opts) => {
const {
strapiDependencies,
additionalsDependencies,
strapiVersion,
projectName,
uuid,
packageJsonStrapi
} = opts;
return {
name: projectName,
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const fse__default = /* @__PURE__ */ _interopDefault(fse);
const createPackageJSON = async (scope) => {
const pkg = {
name: _.kebabCase(scope.name),
private: true,

@@ -21,12 +18,7 @@ version: "0.1.0",

build: "strapi build",
strapi: "strapi"
strapi: "strapi",
deploy: "strapi deploy"
},
devDependencies: {},
dependencies: {
...strapiDependencies.reduce((acc, key) => {
acc[key] = strapiVersion;
return acc;
}, {}),
...additionalsDependencies
},
devDependencies: scope.devDependencies,
dependencies: scope.dependencies,
author: {

@@ -36,4 +28,4 @@ name: "A Strapi developer"

strapi: {
uuid,
...packageJsonStrapi
...scope.packageJsonStrapi,
uuid: scope.uuid
},

@@ -43,4 +35,7 @@ engines,

};
await fse__default.default.writeJSON(path.join(scope.rootPath, "package.json"), pkg, {
spaces: 2
});
};
module.exports = packageJSON;
module.exports = createPackageJSON;
//# sourceMappingURL=package.json.js.map
declare const _default: () => {
extends: string;
compilerOptions: {
target: string;
module: string;
moduleResolution: string;
useDefineForClassFields: boolean;
lib: string[];
allowJs: boolean;
skipLibCheck: boolean;
esModuleInterop: boolean;
allowSyntheticDefaultImports: boolean;
strict: boolean;
forceConsistentCasingInFileNames: boolean;
resolveJsonModule: boolean;
noEmit: boolean;
jsx: string;
};
include: string[];

@@ -4,0 +19,0 @@ exclude: string[];

"use strict";
const adminTsconfig = () => ({
extends: "@strapi/typescript-utils/tsconfigs/admin",
compilerOptions: {
target: "ESNext",
module: "ESNext",
moduleResolution: "Bundler",
useDefineForClassFields: true,
lib: ["DOM", "DOM.Iterable", "ESNext"],
allowJs: false,
skipLibCheck: true,
esModuleInterop: true,
allowSyntheticDefaultImports: true,
strict: true,
forceConsistentCasingInFileNames: true,
resolveJsonModule: true,
noEmit: true,
jsx: "react-jsx"
},
include: ["../plugins/**/admin/src/**/*", "./"],

@@ -5,0 +20,0 @@ exclude: ["node_modules/", "build/", "dist/", "**/*.test.ts"]

declare const _default: () => {
extends: string;
compilerOptions: {
module: string;
moduleResolution: string;
lib: string[];
target: string;
strict: boolean;
skipLibCheck: boolean;
forceConsistentCasingInFileNames: boolean;
incremental: boolean;
esModuleInterop: boolean;
resolveJsonModule: boolean;
noEmitOnError: boolean;
noImplicitThis: boolean;
outDir: string;

@@ -5,0 +16,0 @@ rootDir: string;

"use strict";
const serverTsconfig = () => ({
extends: "@strapi/typescript-utils/tsconfigs/server",
compilerOptions: {
module: "CommonJS",
moduleResolution: "Node",
lib: ["ES2020"],
target: "ES2019",
strict: false,
skipLibCheck: true,
forceConsistentCasingInFileNames: true,
incremental: true,
esModuleInterop: true,
resolveJsonModule: true,
noEmitOnError: true,
noImplicitThis: true,
outDir: "dist",

@@ -6,0 +17,0 @@ rootDir: "."

@@ -1,9 +0,6 @@

import type { DatabaseInfo } from '../../types';
import type { Scope } from '../../types';
export declare const createDatabaseConfig: ({ useTypescript }: {
useTypescript: boolean;
}) => string;
export declare const generateDbEnvariables: ({ connection, client, }: {
connection: DatabaseInfo;
client: string;
}) => string;
export declare const generateDbEnvVariables: (scope: Scope) => string;
//# sourceMappingURL=database.d.ts.map

@@ -18,13 +18,12 @@ "use strict";

};
const generateDbEnvariables = ({
connection,
client
}) => {
const tmpl = fs__default.default.readFileSync(path__default.default.join(__dirname, "database-templates", `${client}.template`));
const generateDbEnvVariables = (scope) => {
const tmpl = fs__default.default.readFileSync(
path__default.default.join(__dirname, "database-templates", `${scope.database.client}.template`)
);
const compile = ___default.default.template(tmpl.toString());
return compile({
client,
client: scope.database.client,
connection: {
...connection.connection,
ssl: connection.connection.ssl || false
...scope.database.connection,
ssl: scope.database.connection?.ssl || false
}

@@ -34,3 +33,3 @@ });

exports.createDatabaseConfig = createDatabaseConfig;
exports.generateDbEnvariables = generateDbEnvariables;
exports.generateDbEnvVariables = generateDbEnvVariables;
//# sourceMappingURL=database.js.map

@@ -0,1 +1,2 @@

export type PackageManager = 'npm' | 'yarn' | 'pnpm';
export interface Scope {

@@ -6,45 +7,40 @@ name?: string;

strapiVersion: string;
strapiDependencies: Array<string>;
installDependencies?: boolean;
additionalsDependencies: Record<string, string>;
devDependencies: Record<string, string>;
dependencies: Record<string, string>;
docker: boolean;
useYarn: boolean;
useTypescript: boolean;
runQuickstartApp: boolean;
quick?: boolean;
packageManager: PackageManager;
runApp: boolean;
isQuickstart?: boolean;
uuid?: string;
deviceId?: string;
dbforce?: boolean;
database?: DatabaseInfo;
debug?: boolean;
database: DatabaseInfo;
tmpPath: string;
packageJsonStrapi: Record<string, unknown>;
useTypescript: boolean;
}
export interface NewOptions {
useNpm: boolean;
run: boolean;
debug: boolean;
quickstart: boolean;
template: string;
starter: string;
typescript: boolean;
dbforce: boolean;
dbssl: string;
dbclient: string;
dbhost: string;
dbport: string;
dbname: string;
dbusername: string;
dbpassword: string;
dbfile: string;
export interface Options {
directory: string;
packageManager: PackageManager;
runApp?: boolean;
template?: string;
isQuickstart?: boolean;
useTypescript: boolean;
database: {
client: ClientName;
connection?: {
host?: string;
port?: string;
database?: string;
username?: string;
password?: string;
filename?: string;
ssl?: boolean;
};
};
}
export interface Configuration {
client: string;
connection: DatabaseInfo;
dependencies: Record<string, string>;
}
export type ClientName = 'mysql' | 'mysql2' | 'postgres' | 'sqlite' | 'sqlite-legacy';
export type ClientName = 'mysql' | 'postgres' | 'sqlite';
export interface DatabaseInfo {
client?: string;
connection: {
client: ClientName;
connection?: {
host?: string;

@@ -58,3 +54,2 @@ port?: string;

};
useNullAsDefault?: boolean;
}

@@ -61,0 +56,0 @@ export interface PackageInfo {

@@ -1,3 +0,3 @@

declare const _default: (rootPath: string) => Promise<void>;
declare const _default: (directory: string) => Promise<string>;
export default _default;
//# sourceMappingURL=check-install-path.d.ts.map
"use strict";
const node_path = require("node:path");
const chalk = require("chalk");

@@ -8,3 +9,7 @@ const fse = require("fs-extra");

const fse__default = /* @__PURE__ */ _interopDefault(fse);
const checkInstallPath = async (rootPath) => {
const checkInstallPath = async (directory) => {
if (!directory) {
stopProcess(`⛔️ Please provide a project name.`);
}
const rootPath = node_path.resolve(directory);
if (await fse__default.default.pathExists(rootPath)) {

@@ -29,4 +34,5 @@ const stat = await fse__default.default.stat(rootPath);

}
return rootPath;
};
module.exports = checkInstallPath;
//# sourceMappingURL=check-install-path.js.map

@@ -8,4 +8,2 @@ import type { ClientName } from '../types';

}) => {
mysql: string;
} | {
mysql2: string;

@@ -16,6 +14,4 @@ } | {

'better-sqlite3': string;
} | {
sqlite3: string;
};
export default _default;
//# sourceMappingURL=db-client-dependencies.d.ts.map

@@ -28,4 +28,10 @@ "use strict";

await execa__default.default("git", ["init"], { stdio: "ignore", cwd: rootDir });
await execa__default.default("git", ["add", "."], { stdio: "ignore", cwd: rootDir });
await execa__default.default("git", ["commit", "-m", "Initial commit from Strapi"], {
stdio: "ignore",
cwd: rootDir
});
return true;
} catch (_) {
} catch (e) {
console.error("Error while trying to initialize git:", e);
return false;

@@ -32,0 +38,0 @@ }

@@ -34,6 +34,3 @@ "use strict";

const isLocalTemplate = ["./", "../", "/"].some(
(filePrefix) => {
var _a;
return (_a = scope.template) == null ? void 0 : _a.startsWith(filePrefix);
}
(filePrefix) => scope.template?.startsWith(filePrefix)
);

@@ -132,3 +129,3 @@ if (isLocalTemplate) {

const mergedConfig = ___default.default.merge(templateConfig.package, packageJSON);
if (templatePackageInfo == null ? void 0 : templatePackageInfo.name) {
if (templatePackageInfo?.name) {
___default.default.set("strapi.template", templatePackageInfo.name, mergedConfig);

@@ -141,5 +138,5 @@ }

const templateDir = path__default.default.join(templatePath, "template");
await fse__default.default.copy(templateDir, rootPath, { overwrite: true, recursive: true });
await fse__default.default.copy(templateDir, rootPath, { overwrite: true });
}
module.exports = mergeTemplate;
//# sourceMappingURL=merge-template.js.map
import { Scope, StderrError } from '../types';
type TrackError = Error | string | StderrError;
export declare function captureException(error: Error): Promise<void>;
export declare function captureStderr(name: string, error: unknown): Promise<void>;
export declare function trackError({ scope, error }: {
scope: Scope;
error?: TrackError;
}): Promise<void | import("node-fetch").Response>;
}): Promise<void | Response>;
export declare function trackUsage({ event, scope, error, }: {

@@ -13,4 +11,4 @@ event: string;

error?: TrackError;
}): Promise<void | import("node-fetch").Response>;
}): Promise<void | Response>;
export {};
//# sourceMappingURL=usage.d.ts.map

@@ -5,10 +5,5 @@ "use strict";

const _ = require("lodash");
const fetch = require("node-fetch");
const sentry = require("@sentry/node");
const types = require("../types.js");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const os__default = /* @__PURE__ */ _interopDefault(os);
const ___default = /* @__PURE__ */ _interopDefault(_);
const fetch__default = /* @__PURE__ */ _interopDefault(fetch);
const sentry__default = /* @__PURE__ */ _interopDefault(sentry);
function addPackageJsonStrapiMetadata(metadata, scope) {

@@ -18,30 +13,2 @@ const { packageJsonStrapi = {} } = scope;

}
async function captureException(error) {
try {
sentry__default.default.captureException(error);
await sentry__default.default.flush();
} catch (err) {
return Promise.resolve();
}
}
async function captureError(message) {
try {
sentry__default.default.captureMessage(message, sentry.Severity.Error);
await sentry__default.default.flush();
} catch (err) {
return Promise.resolve();
}
}
function captureStderr(name, error) {
if (types.isStderrError(error) && error.stderr.trim() !== "") {
error.stderr.trim().split("\n").forEach((line) => {
sentry__default.default.addBreadcrumb({
category: "stderr",
message: line,
level: sentry.Severity.Error
});
});
}
return captureError(name);
}
const getProperties = (scope, error) => {

@@ -61,7 +28,7 @@ const eventProperties = {

docker: scope.docker,
useYarn: scope.useYarn,
// useYarn: scope.useYarn,
useTypescriptOnServer: scope.useTypescript,
useTypescriptOnAdmin: scope.useTypescript,
isHostedOnStrapiCloud: process.env.STRAPI_HOSTING === "strapi.cloud",
noRun: (scope.runQuickstartApp !== true).toString(),
noRun: (scope.runApp !== true).toString(),
projectId: scope.uuid

@@ -80,3 +47,3 @@ };

try {
return fetch__default.default("https://analytics.strapi.io/api/v2/track", {
return fetch("https://analytics.strapi.io/api/v2/track", {
method: "POST",

@@ -87,3 +54,3 @@ body: JSON.stringify({

}),
timeout: 1e3,
signal: AbortSignal.timeout(1e3),
headers: {

@@ -125,6 +92,4 @@ "Content-Type": "application/json",

}
exports.captureException = captureException;
exports.captureStderr = captureStderr;
exports.trackError = trackError;
exports.trackUsage = trackUsage;
//# sourceMappingURL=usage.js.map
{
"name": "@strapi/generate-new",
"version": "0.0.0-experimental.91cf4ee737dd50a97bd44e64fdeb1c6aa8dc421f",
"version": "0.0.0-experimental.93181c8b900e97a04bf10785b368657101ec98d8",
"description": "Generate a new Strapi application.",

@@ -36,3 +36,3 @@ "keywords": [

"files": [
"./dist"
"dist/"
],

@@ -44,3 +44,2 @@ "scripts": {

"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"test:ts": "run -T tsc --noEmit",

@@ -50,9 +49,7 @@ "watch": "pack-up watch"

"dependencies": {
"@sentry/node": "6.19.7",
"chalk": "^4.1.2",
"execa": "5.1.1",
"fs-extra": "10.0.0",
"fs-extra": "11.2.0",
"inquirer": "8.2.5",
"lodash": "4.17.21",
"node-fetch": "2.7.0",
"node-machine-id": "^1.1.10",

@@ -64,10 +61,12 @@ "ora": "^5.4.1",

"devDependencies": {
"@strapi/pack-up": "0.0.0-experimental.91cf4ee737dd50a97bd44e64fdeb1c6aa8dc421f",
"@strapi/pack-up": "5.0.0",
"@types/fs-extra": "11.0.4",
"@types/inquirer": "8.2.5",
"copyfiles": "2.4.1"
},
"engines": {
"node": ">=16.0.0 <=20.x.x",
"node": ">=18.0.0 <=20.x.x",
"npm": ">=6.0.0"
},
"gitHead": "91cf4ee737dd50a97bd44e64fdeb1c6aa8dc421f"
"gitHead": "93181c8b900e97a04bf10785b368657101ec98d8"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc