create-payload-app 3.8.0 → 3.9.0
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/lib/manage-env-files.d.ts.map +1 -1
- package/dist/lib/manage-env-files.js +37 -17
- package/dist/lib/manage-env-files.js.map +1 -1
- package/dist/lib/select-db.d.ts +9 -1
- package/dist/lib/select-db.d.ts.map +1 -1
- package/dist/lib/select-db.js +1 -1
- package/dist/lib/select-db.js.map +1 -1
- package/dist/utils/copy-recursive-sync.d.ts.map +1 -1
- package/dist/utils/copy-recursive-sync.js +5 -2
- package/dist/utils/copy-recursive-sync.js.map +1 -1
- package/package.json +1 -1
- package/dist/lib/create-project.spec.d.ts +0 -2
- package/dist/lib/create-project.spec.d.ts.map +0 -1
- package/dist/lib/wrap-next-config.spec.d.ts +0 -2
- package/dist/lib/wrap-next-config.spec.d.ts.map +0 -1
- /package/{license.md → LICENSE.md} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"manage-env-files.d.ts","sourceRoot":"","sources":["../../src/lib/manage-env-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
1
|
+
{"version":3,"file":"manage-env-files.d.ts","sourceRoot":"","sources":["../../src/lib/manage-env-files.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAkEnE,wDAAwD;AACxD,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDhB"}
|
@@ -1,25 +1,42 @@
|
|
1
1
|
import fs from 'fs-extra';
|
2
2
|
import path from 'path';
|
3
3
|
import { debug, error } from '../utils/log.js';
|
4
|
-
|
5
|
-
|
4
|
+
import { dbChoiceRecord } from './select-db.js';
|
5
|
+
const updateEnvExampleVariables = (contents, databaseType)=>{
|
6
|
+
return contents.split('\n').map((line)=>{
|
6
7
|
if (line.startsWith('#') || !line.includes('=')) {
|
7
|
-
return line
|
8
|
+
return line // Preserve comments and unrelated lines
|
9
|
+
;
|
8
10
|
}
|
9
|
-
const [key
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
const [key] = line.split('=');
|
12
|
+
if (key === 'DATABASE_URI' || key === 'POSTGRES_URL' || key === 'MONGODB_URI') {
|
13
|
+
const dbChoice = databaseType ? dbChoiceRecord[databaseType] : null;
|
14
|
+
if (dbChoice) {
|
15
|
+
const placeholderUri = `${dbChoice.dbConnectionPrefix}your-database-name${dbChoice.dbConnectionSuffix || ''}`;
|
16
|
+
return databaseType === 'vercel-postgres' ? `POSTGRES_URL=${placeholderUri}` : `DATABASE_URI=${placeholderUri}`;
|
15
17
|
}
|
18
|
+
return `DATABASE_URI=your-database-connection-here` // Fallback
|
19
|
+
;
|
16
20
|
}
|
17
21
|
if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {
|
18
|
-
|
22
|
+
return `PAYLOAD_SECRET=YOUR_SECRET_HERE`;
|
19
23
|
}
|
20
|
-
return
|
24
|
+
return line;
|
21
25
|
}).join('\n');
|
22
26
|
};
|
27
|
+
const generateEnvContent = (existingEnv, databaseType, databaseUri, payloadSecret)=>{
|
28
|
+
const dbKey = databaseType === 'vercel-postgres' ? 'POSTGRES_URL' : 'DATABASE_URI';
|
29
|
+
const envVars = {};
|
30
|
+
existingEnv.split('\n').filter((line)=>line.includes('=') && !line.startsWith('#')).forEach((line)=>{
|
31
|
+
const [key, value] = line.split('=');
|
32
|
+
envVars[key] = value;
|
33
|
+
});
|
34
|
+
// Override specific keys
|
35
|
+
envVars[dbKey] = databaseUri;
|
36
|
+
envVars['PAYLOAD_SECRET'] = payloadSecret;
|
37
|
+
// Rebuild content
|
38
|
+
return Object.entries(envVars).map(([key, value])=>`${key}=${value}`).join('\n');
|
39
|
+
};
|
23
40
|
/** Parse and swap .env.example values and write .env */ export async function manageEnvFiles(args) {
|
24
41
|
const { cliArgs, databaseType, databaseUri, payloadSecret, projectDir, template } = args;
|
25
42
|
if (cliArgs['--dry-run']) {
|
@@ -30,21 +47,24 @@ const updateEnvVariables = (contents, databaseType, databaseUri, payloadSecret)=
|
|
30
47
|
const envPath = path.join(projectDir, '.env');
|
31
48
|
try {
|
32
49
|
let updatedExampleContents;
|
50
|
+
// Update .env.example
|
33
51
|
if (template?.type === 'starter') {
|
34
52
|
if (!fs.existsSync(envExamplePath)) {
|
35
53
|
error(`.env.example file not found at ${envExamplePath}`);
|
36
54
|
process.exit(1);
|
37
55
|
}
|
38
56
|
const envExampleContents = await fs.readFile(envExamplePath, 'utf8');
|
39
|
-
updatedExampleContents =
|
40
|
-
await fs.writeFile(envExamplePath, updatedExampleContents);
|
57
|
+
updatedExampleContents = updateEnvExampleVariables(envExampleContents, databaseType);
|
58
|
+
await fs.writeFile(envExamplePath, updatedExampleContents.trimEnd() + '\n');
|
41
59
|
debug(`.env.example file successfully updated`);
|
42
60
|
} else {
|
43
|
-
updatedExampleContents = `# Added by Payload\nDATABASE_URI
|
61
|
+
updatedExampleContents = `# Added by Payload\nDATABASE_URI=your-connection-string-here\nPAYLOAD_SECRET=YOUR_SECRET_HERE\n`;
|
62
|
+
await fs.writeFile(envExamplePath, updatedExampleContents.trimEnd() + '\n');
|
44
63
|
}
|
45
|
-
|
46
|
-
const
|
47
|
-
|
64
|
+
// Merge existing variables and create or update .env
|
65
|
+
const envExampleContents = await fs.readFile(envExamplePath, 'utf8');
|
66
|
+
const envContent = generateEnvContent(envExampleContents, databaseType, databaseUri, payloadSecret);
|
67
|
+
await fs.writeFile(envPath, `# Added by Payload\n${envContent.trimEnd()}\n`);
|
48
68
|
debug(`.env file successfully created or updated`);
|
49
69
|
} catch (err) {
|
50
70
|
error('Unable to manage environment files');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/lib/manage-env-files.ts"],"sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\n\nimport type { CliArgs, DbType, ProjectTemplate } from '../types.js'\n\nimport { debug, error } from '../utils/log.js'\n\nconst
|
1
|
+
{"version":3,"sources":["../../src/lib/manage-env-files.ts"],"sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\n\nimport type { CliArgs, DbType, ProjectTemplate } from '../types.js'\n\nimport { debug, error } from '../utils/log.js'\nimport { dbChoiceRecord } from './select-db.js'\n\nconst updateEnvExampleVariables = (contents: string, databaseType: DbType | undefined): string => {\n return contents\n .split('\\n')\n .map((line) => {\n if (line.startsWith('#') || !line.includes('=')) {\n return line // Preserve comments and unrelated lines\n }\n\n const [key] = line.split('=')\n\n if (key === 'DATABASE_URI' || key === 'POSTGRES_URL' || key === 'MONGODB_URI') {\n const dbChoice = databaseType ? dbChoiceRecord[databaseType] : null\n\n if (dbChoice) {\n const placeholderUri = `${dbChoice.dbConnectionPrefix}your-database-name${\n dbChoice.dbConnectionSuffix || ''\n }`\n return databaseType === 'vercel-postgres'\n ? `POSTGRES_URL=${placeholderUri}`\n : `DATABASE_URI=${placeholderUri}`\n }\n\n return `DATABASE_URI=your-database-connection-here` // Fallback\n }\n\n if (key === 'PAYLOAD_SECRET' || key === 'PAYLOAD_SECRET_KEY') {\n return `PAYLOAD_SECRET=YOUR_SECRET_HERE`\n }\n\n return line\n })\n .join('\\n')\n}\n\nconst generateEnvContent = (\n existingEnv: string,\n databaseType: DbType | undefined,\n databaseUri: string,\n payloadSecret: string,\n): string => {\n const dbKey = databaseType === 'vercel-postgres' ? 'POSTGRES_URL' : 'DATABASE_URI'\n\n const envVars: Record<string, string> = {}\n existingEnv\n .split('\\n')\n .filter((line) => line.includes('=') && !line.startsWith('#'))\n .forEach((line) => {\n const [key, value] = line.split('=')\n envVars[key] = value\n })\n\n // Override specific keys\n envVars[dbKey] = databaseUri\n envVars['PAYLOAD_SECRET'] = payloadSecret\n\n // Rebuild content\n return Object.entries(envVars)\n .map(([key, value]) => `${key}=${value}`)\n .join('\\n')\n}\n\n/** Parse and swap .env.example values and write .env */\nexport async function manageEnvFiles(args: {\n cliArgs: CliArgs\n databaseType?: DbType\n databaseUri: string\n payloadSecret: string\n projectDir: string\n template?: ProjectTemplate\n}): Promise<void> {\n const { cliArgs, databaseType, databaseUri, payloadSecret, projectDir, template } = args\n\n if (cliArgs['--dry-run']) {\n debug(`DRY RUN: Environment files managed`)\n return\n }\n\n const envExamplePath = path.join(projectDir, '.env.example')\n const envPath = path.join(projectDir, '.env')\n\n try {\n let updatedExampleContents: string\n\n // Update .env.example\n if (template?.type === 'starter') {\n if (!fs.existsSync(envExamplePath)) {\n error(`.env.example file not found at ${envExamplePath}`)\n process.exit(1)\n }\n\n const envExampleContents = await fs.readFile(envExamplePath, 'utf8')\n updatedExampleContents = updateEnvExampleVariables(envExampleContents, databaseType)\n\n await fs.writeFile(envExamplePath, updatedExampleContents.trimEnd() + '\\n')\n debug(`.env.example file successfully updated`)\n } else {\n updatedExampleContents = `# Added by Payload\\nDATABASE_URI=your-connection-string-here\\nPAYLOAD_SECRET=YOUR_SECRET_HERE\\n`\n await fs.writeFile(envExamplePath, updatedExampleContents.trimEnd() + '\\n')\n }\n\n // Merge existing variables and create or update .env\n const envExampleContents = await fs.readFile(envExamplePath, 'utf8')\n const envContent = generateEnvContent(\n envExampleContents,\n databaseType,\n databaseUri,\n payloadSecret,\n )\n await fs.writeFile(envPath, `# Added by Payload\\n${envContent.trimEnd()}\\n`)\n\n debug(`.env file successfully created or updated`)\n } catch (err: unknown) {\n error('Unable to manage environment files')\n if (err instanceof Error) {\n error(err.message)\n }\n process.exit(1)\n }\n}\n"],"names":["fs","path","debug","error","dbChoiceRecord","updateEnvExampleVariables","contents","databaseType","split","map","line","startsWith","includes","key","dbChoice","placeholderUri","dbConnectionPrefix","dbConnectionSuffix","join","generateEnvContent","existingEnv","databaseUri","payloadSecret","dbKey","envVars","filter","forEach","value","Object","entries","manageEnvFiles","args","cliArgs","projectDir","template","envExamplePath","envPath","updatedExampleContents","type","existsSync","process","exit","envExampleContents","readFile","writeFile","trimEnd","envContent","err","Error","message"],"mappings":"AAAA,OAAOA,QAAQ,WAAU;AACzB,OAAOC,UAAU,OAAM;AAIvB,SAASC,KAAK,EAAEC,KAAK,QAAQ,kBAAiB;AAC9C,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,MAAMC,4BAA4B,CAACC,UAAkBC;IACnD,OAAOD,SACJE,KAAK,CAAC,MACNC,GAAG,CAAC,CAACC;QACJ,IAAIA,KAAKC,UAAU,CAAC,QAAQ,CAACD,KAAKE,QAAQ,CAAC,MAAM;YAC/C,OAAOF,KAAK,wCAAwC;;QACtD;QAEA,MAAM,CAACG,IAAI,GAAGH,KAAKF,KAAK,CAAC;QAEzB,IAAIK,QAAQ,kBAAkBA,QAAQ,kBAAkBA,QAAQ,eAAe;YAC7E,MAAMC,WAAWP,eAAeH,cAAc,CAACG,aAAa,GAAG;YAE/D,IAAIO,UAAU;gBACZ,MAAMC,iBAAiB,GAAGD,SAASE,kBAAkB,CAAC,kBAAkB,EACtEF,SAASG,kBAAkB,IAAI,IAC/B;gBACF,OAAOV,iBAAiB,oBACpB,CAAC,aAAa,EAAEQ,gBAAgB,GAChC,CAAC,aAAa,EAAEA,gBAAgB;YACtC;YAEA,OAAO,CAAC,0CAA0C,CAAC,CAAC,WAAW;;QACjE;QAEA,IAAIF,QAAQ,oBAAoBA,QAAQ,sBAAsB;YAC5D,OAAO,CAAC,+BAA+B,CAAC;QAC1C;QAEA,OAAOH;IACT,GACCQ,IAAI,CAAC;AACV;AAEA,MAAMC,qBAAqB,CACzBC,aACAb,cACAc,aACAC;IAEA,MAA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Q,OAAO,KAAK;YACtE3C,MAAM,CAAC,sCAAsC,CAAC;QAChD,OAAO;YACLmC,yBAAyB,CAAC,+FAA+F,CAAC;YAC1H,MAAMrC,GAAG4C,SAAS,CAACT,gBAAgBE,uBAAuBQ,OAAO,KAAK;QACxE;QAEA,qDAAqD;QACrD,MAAMH,qBAAqB,MAAM1C,GAAG2C,QAAQ,CAACR,gBAAgB;QAC7D,MAAMW,aAAa3B,mBACjBuB,oBACAnC,cACAc,aACAC;QAEF,MAAMtB,GAAG4C,SAAS,CAACR,SAAS,CAAC,oBAAoB,EAAEU,WAAWD,OAAO,GAAG,EAAE,CAAC;QAE3E3C,MAAM,CAAC,yCAAyC,CAAC;IACnD,EAAE,OAAO6C,KAAc;QACrB5C,MAAM;QACN,IAAI4C,eAAeC,OAAO;YACxB7C,MAAM4C,IAAIE,OAAO;QACnB;QACAT,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/dist/lib/select-db.d.ts
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
-
import type { CliArgs, DbDetails } from '../types.js';
|
1
|
+
import type { CliArgs, DbDetails, DbType } from '../types.js';
|
2
|
+
type DbChoice = {
|
3
|
+
dbConnectionPrefix: `${string}/`;
|
4
|
+
dbConnectionSuffix?: string;
|
5
|
+
title: string;
|
6
|
+
value: DbType;
|
7
|
+
};
|
8
|
+
export declare const dbChoiceRecord: Record<DbType, DbChoice>;
|
2
9
|
export declare function selectDb(args: CliArgs, projectName: string): Promise<DbDetails>;
|
10
|
+
export {};
|
3
11
|
//# sourceMappingURL=select-db.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select-db.d.ts","sourceRoot":"","sources":["../../src/lib/select-db.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,
|
1
|
+
{"version":3,"file":"select-db.d.ts","sourceRoot":"","sources":["../../src/lib/select-db.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE7D,KAAK,QAAQ,GAAG;IACd,kBAAkB,EAAE,GAAG,MAAM,GAAG,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAsBnD,CAAA;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAkDrF"}
|
package/dist/lib/select-db.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/lib/select-db.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport slugify from '@sindresorhus/slugify'\n\nimport type { CliArgs, DbDetails, DbType } from '../types.js'\n\ntype DbChoice = {\n dbConnectionPrefix: `${string}/`\n dbConnectionSuffix?: string\n title: string\n value: DbType\n}\n\
|
1
|
+
{"version":3,"sources":["../../src/lib/select-db.ts"],"sourcesContent":["import * as p from '@clack/prompts'\nimport slugify from '@sindresorhus/slugify'\n\nimport type { CliArgs, DbDetails, DbType } from '../types.js'\n\ntype DbChoice = {\n dbConnectionPrefix: `${string}/`\n dbConnectionSuffix?: string\n title: string\n value: DbType\n}\n\nexport const dbChoiceRecord: Record<DbType, DbChoice> = {\n mongodb: {\n dbConnectionPrefix: 'mongodb://127.0.0.1/',\n title: 'MongoDB',\n value: 'mongodb',\n },\n postgres: {\n dbConnectionPrefix: 'postgres://postgres:<password>@127.0.0.1:5432/',\n title: 'PostgreSQL',\n value: 'postgres',\n },\n sqlite: {\n dbConnectionPrefix: 'file:./',\n dbConnectionSuffix: '.db',\n title: 'SQLite',\n value: 'sqlite',\n },\n 'vercel-postgres': {\n dbConnectionPrefix: 'postgres://postgres:<password>@127.0.0.1:5432/',\n title: 'Vercel Postgres',\n value: 'vercel-postgres',\n },\n}\n\nexport async function selectDb(args: CliArgs, projectName: string): Promise<DbDetails> {\n let dbType: DbType | symbol | undefined = undefined\n if (args['--db']) {\n if (!Object.values(dbChoiceRecord).some((dbChoice) => dbChoice.value === args['--db'])) {\n throw new Error(\n `Invalid database type given. Valid types are: ${Object.values(dbChoiceRecord)\n .map((dbChoice) => dbChoice.value)\n .join(', ')}`,\n )\n }\n dbType = args['--db'] as DbType\n } else {\n dbType = await p.select<{ label: string; value: DbType }[], DbType>({\n initialValue: 'mongodb',\n message: `Select a database`,\n options: Object.values(dbChoiceRecord).map((dbChoice) => ({\n label: dbChoice.title,\n value: dbChoice.value,\n })),\n })\n if (p.isCancel(dbType)) {\n process.exit(0)\n }\n }\n\n const dbChoice = dbChoiceRecord[dbType]\n\n let dbUri: string | symbol | undefined = undefined\n const initialDbUri = `${dbChoice.dbConnectionPrefix}${\n projectName === '.' ? `payload-${getRandomDigitSuffix()}` : slugify(projectName)\n }${dbChoice.dbConnectionSuffix || ''}`\n\n if (args['--db-accept-recommended']) {\n dbUri = initialDbUri\n } else if (args['--db-connection-string']) {\n dbUri = args['--db-connection-string']\n } else {\n dbUri = await p.text({\n initialValue: initialDbUri,\n message: `Enter ${dbChoice.title.split(' ')[0]} connection string`, // strip beta from title\n })\n if (p.isCancel(dbUri)) {\n process.exit(0)\n }\n }\n\n return {\n type: dbChoice.value,\n dbUri,\n }\n}\n\nfunction getRandomDigitSuffix(): string {\n return (Math.random() * Math.pow(10, 6)).toFixed(0)\n}\n"],"names":["p","slugify","dbChoiceRecord","mongodb","dbConnectionPrefix","title","value","postgres","sqlite","dbConnectionSuffix","selectDb","args","projectName","dbType","undefined","Object","values","some","dbChoice","Error","map","join","select","initialValue","message","options","label","isCancel","process","exit","dbUri","initialDbUri","getRandomDigitSuffix","text","split","type","Math","random","pow","toFixed"],"mappings":"AAAA,YAAYA,OAAO,iBAAgB;AACnC,OAAOC,aAAa,wBAAuB;AAW3C,OAAO,MAAMC,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AA0B,EAAE;QACnCmB,QAAQC;IACV,OAAO,IAAIpB,IAAI,CAAC,yBAAyB,EAAE;QACzCmB,QAAQnB,IAAI,CAAC,yBAAyB;IACxC,OAAO;QACLmB,QAAQ,MAAM9B,EAAEiC,IAAI,CAAC;YACnBV,cAAcQ;YACdP,SAAS,CAAC,MAAM,EAAEN,SAASb,KAAK,CAAC6B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC;QACpE;QACA,IAAIlC,EAAE2B,QAAQ,CAACG,QAAQ;YACrBF,QAAQC,IAAI,CAAC;QACf;IACF;IAEA,OAAO;QACLM,MAAMjB,SAASZ,KAAK;QACpBwB;IACF;AACF;AAEA,SAASE;IACP,OAAO,AAACI,CAAAA,KAAKC,MAAM,KAAKD,KAAKE,GAAG,CAAC,IAAI,EAAC,EAAGC,OAAO,CAAC;AACnD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAqBzF"}
|
@@ -13,10 +13,13 @@ import path from 'path';
|
|
13
13
|
recursive: true
|
14
14
|
});
|
15
15
|
fs.readdirSync(src).forEach((childItemName)=>{
|
16
|
-
if (ignoreRegex && ignoreRegex.some((regex)=>
|
16
|
+
if (ignoreRegex && ignoreRegex.some((regex)=>{
|
17
|
+
return new RegExp(regex).test(childItemName);
|
18
|
+
})) {
|
19
|
+
console.log(`Ignoring ${childItemName} due to regex: ${ignoreRegex}`);
|
17
20
|
return;
|
18
21
|
}
|
19
|
-
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
22
|
+
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName), ignoreRegex);
|
20
23
|
});
|
21
24
|
} else {
|
22
25
|
fs.copyFileSync(src, dest);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n *\n * @internal\n */\nexport function copyRecursiveSync(src: string, dest: string, ignoreRegex?: string[]): void {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n if (ignoreRegex
|
1
|
+
{"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n *\n * @internal\n */\nexport function copyRecursiveSync(src: string, dest: string, ignoreRegex?: string[]): void {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n if (\n ignoreRegex &&\n ignoreRegex.some((regex) => {\n return new RegExp(regex).test(childItemName)\n })\n ) {\n console.log(`Ignoring ${childItemName} due to regex: ${ignoreRegex}`)\n return\n }\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName), ignoreRegex)\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["fs","path","copyRecursiveSync","src","dest","ignoreRegex","exists","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","some","regex","RegExp","test","console","log","join","copyFileSync"],"mappings":"AAAA,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;;;CAIC,GACD,OAAO,SAASC,kBAAkBC,GAAW,EAAEC,IAAY,EAAEC,WAAsB;IACjF,MAAMC,SAASN,GAAGO,UAAU,CAACJ;IAC7B,MAAMK,QAAQF,UAAUN,GAAGS,QAAQ,CAACN;IACpC,MAAMO,cAAcJ,UAAUE,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfV,GAAGW,SAAS,CAACP,MAAM;YAAEQ,WAAW;QAAK;QACrCZ,GAAGa,WAAW,CAACV,KAAKW,OAAO,CAAC,CAACC;YAC3B,IACEV,eACAA,YAAYW,IAAI,CAAC,CAACC;gBAChB,OAAO,IAAIC,OAAOD,OAAOE,IAAI,CAACJ;YAChC,IACA;gBACAK,QAAQC,GAAG,CAAC,CAAC,SAAS,EAAEN,cAAc,eAAe,EAAEV,aAAa;gBACpE;YACF;YACAH,kBAAkBD,KAAKqB,IAAI,CAACnB,KAAKY,gBAAgBd,KAAKqB,IAAI,CAAClB,MAAMW,gBAAgBV;QACnF;IACF,OAAO;QACLL,GAAGuB,YAAY,CAACpB,KAAKC;IACvB;AACF"}
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"create-project.spec.d.ts","sourceRoot":"","sources":["../../src/lib/create-project.spec.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"wrap-next-config.spec.d.ts","sourceRoot":"","sources":["../../src/lib/wrap-next-config.spec.ts"],"names":[],"mappings":""}
|
File without changes
|