create-expo-module 1.0.14 → 1.0.15
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/build/create-expo-module.js +164 -7
- package/build/create-expo-module.js.map +1 -1
- package/build/types.d.ts +7 -0
- package/build/types.js.map +1 -1
- package/package.json +2 -2
|
@@ -12,11 +12,14 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
12
12
|
const getenv_1 = require("getenv");
|
|
13
13
|
const path_1 = __importDefault(require("path"));
|
|
14
14
|
const prompts_1 = __importDefault(require("prompts"));
|
|
15
|
+
const validate_npm_package_name_1 = __importDefault(require("validate-npm-package-name"));
|
|
15
16
|
const createExampleApp_1 = require("./createExampleApp");
|
|
16
17
|
const packageManager_1 = require("./packageManager");
|
|
17
18
|
const prompts_2 = require("./prompts");
|
|
18
19
|
const resolvePackageManager_1 = require("./resolvePackageManager");
|
|
19
20
|
const telemetry_1 = require("./telemetry");
|
|
21
|
+
const git_1 = require("./utils/git");
|
|
22
|
+
const github_1 = require("./utils/github");
|
|
20
23
|
const ora_1 = require("./utils/ora");
|
|
21
24
|
const debug = require('debug')('create-expo-module:main');
|
|
22
25
|
const packageJson = require('../package.json');
|
|
@@ -37,6 +40,41 @@ const IGNORES_PATHS = [
|
|
|
37
40
|
// Url to the documentation on Expo Modules
|
|
38
41
|
const DOCS_URL = 'https://docs.expo.dev/modules';
|
|
39
42
|
const FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md';
|
|
43
|
+
/**
|
|
44
|
+
* Determines if we're in an interactive environment.
|
|
45
|
+
* Non-interactive when: CI=1/true or non-TTY stdin.
|
|
46
|
+
*/
|
|
47
|
+
function isInteractive() {
|
|
48
|
+
// Check for CI environment
|
|
49
|
+
const ci = process.env.CI;
|
|
50
|
+
if (ci === '1' || ci === 'true' || ci?.toLowerCase() === 'true') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// Check for TTY
|
|
54
|
+
if (!process.stdin.isTTY) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Converts a slug to a native module name (PascalCase).
|
|
61
|
+
*/
|
|
62
|
+
function slugToModuleName(slug) {
|
|
63
|
+
return slug
|
|
64
|
+
.replace(/^@/, '')
|
|
65
|
+
.replace(/^./, (match) => match.toUpperCase())
|
|
66
|
+
.replace(/\W+(\w)/g, (_, p1) => p1.toUpperCase());
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Converts a slug to an Android package name.
|
|
70
|
+
*/
|
|
71
|
+
function slugToAndroidPackage(slug) {
|
|
72
|
+
const namespace = slug
|
|
73
|
+
.replace(/\W/g, '')
|
|
74
|
+
.replace(/^(expo|reactnative)/, '')
|
|
75
|
+
.toLowerCase();
|
|
76
|
+
return `expo.modules.${namespace}`;
|
|
77
|
+
}
|
|
40
78
|
async function getCorrectLocalDirectory(targetOrSlug) {
|
|
41
79
|
let packageJsonPath = null;
|
|
42
80
|
for (let dir = CWD; path_1.default.dirname(dir) !== dir; dir = path_1.default.dirname(dir)) {
|
|
@@ -60,12 +98,16 @@ async function getCorrectLocalDirectory(targetOrSlug) {
|
|
|
60
98
|
* @param options An options object for `commander`.
|
|
61
99
|
*/
|
|
62
100
|
async function main(target, options) {
|
|
101
|
+
const interactive = isInteractive();
|
|
102
|
+
if (!interactive) {
|
|
103
|
+
debug('Running in non-interactive mode');
|
|
104
|
+
}
|
|
63
105
|
if (options.local) {
|
|
64
106
|
console.log();
|
|
65
107
|
console.log(`${chalk_1.default.gray('The local module will be created in the ')}${chalk_1.default.gray.bold.italic('modules')} ${chalk_1.default.gray('directory in the root of your project. Learn more: ')}${chalk_1.default.gray.bold(FYI_LOCAL_DIR)}`);
|
|
66
108
|
console.log();
|
|
67
109
|
}
|
|
68
|
-
const slug = await askForPackageSlugAsync(target, options.local);
|
|
110
|
+
const slug = await askForPackageSlugAsync(target, options.local, options);
|
|
69
111
|
const targetDir = options.local
|
|
70
112
|
? await getCorrectLocalDirectory(target || slug)
|
|
71
113
|
: path_1.default.join(CWD, target || slug);
|
|
@@ -73,9 +115,9 @@ async function main(target, options) {
|
|
|
73
115
|
return;
|
|
74
116
|
}
|
|
75
117
|
await fs_1.default.promises.mkdir(targetDir, { recursive: true });
|
|
76
|
-
await confirmTargetDirAsync(targetDir);
|
|
118
|
+
await confirmTargetDirAsync(targetDir, options);
|
|
77
119
|
options.target = targetDir;
|
|
78
|
-
const data = await askForSubstitutionDataAsync(slug, options.local);
|
|
120
|
+
const data = await askForSubstitutionDataAsync(slug, options.local, options);
|
|
79
121
|
// Make one line break between prompts and progress logs
|
|
80
122
|
console.log();
|
|
81
123
|
const packageManager = (0, resolvePackageManager_1.resolvePackageManager)();
|
|
@@ -287,8 +329,19 @@ async function createGitRepositoryAsync(targetDir) {
|
|
|
287
329
|
}
|
|
288
330
|
/**
|
|
289
331
|
* Asks the user for the package slug (npm package name).
|
|
332
|
+
* In non-interactive mode, uses the target path or 'my-module' as default.
|
|
290
333
|
*/
|
|
291
|
-
async function askForPackageSlugAsync(customTargetPath, isLocal
|
|
334
|
+
async function askForPackageSlugAsync(customTargetPath, isLocal, options) {
|
|
335
|
+
const interactive = isInteractive();
|
|
336
|
+
// In non-interactive mode, derive slug from target path or use default
|
|
337
|
+
if (!interactive) {
|
|
338
|
+
const targetBasename = customTargetPath && path_1.default.basename(customTargetPath);
|
|
339
|
+
const slug = targetBasename && (0, validate_npm_package_name_1.default)(targetBasename).validForNewPackages
|
|
340
|
+
? targetBasename
|
|
341
|
+
: 'my-module';
|
|
342
|
+
debug(`Non-interactive mode: using slug "${slug}"`);
|
|
343
|
+
return slug;
|
|
344
|
+
}
|
|
292
345
|
const { slug } = await (0, prompts_1.default)((isLocal ? prompts_2.getLocalFolderNamePrompt : prompts_2.getSlugPrompt)(customTargetPath), {
|
|
293
346
|
onCancel: () => process.exit(0),
|
|
294
347
|
});
|
|
@@ -297,14 +350,96 @@ async function askForPackageSlugAsync(customTargetPath, isLocal = false) {
|
|
|
297
350
|
/**
|
|
298
351
|
* Asks the user for some data necessary to render the template.
|
|
299
352
|
* Some values may already be provided by command options, the prompt is skipped in that case.
|
|
353
|
+
* In non-interactive mode, uses defaults or CLI-provided values.
|
|
300
354
|
*/
|
|
301
|
-
async function askForSubstitutionDataAsync(slug, isLocal
|
|
355
|
+
async function askForSubstitutionDataAsync(slug, isLocal, options) {
|
|
356
|
+
const interactive = isInteractive();
|
|
357
|
+
// Non-interactive mode: use CLI options and defaults
|
|
358
|
+
if (!interactive) {
|
|
359
|
+
return getSubstitutionDataFromOptions(slug, isLocal, options);
|
|
360
|
+
}
|
|
361
|
+
// Interactive mode: prompt for values, but skip prompts for CLI-provided values
|
|
302
362
|
const promptQueries = await (isLocal ? prompts_2.getLocalSubstitutionDataPrompts : prompts_2.getSubstitutionDataPrompts)(slug);
|
|
363
|
+
// Filter out prompts for values already provided via CLI
|
|
364
|
+
const filteredPrompts = promptQueries.filter((prompt) => {
|
|
365
|
+
const name = prompt.name;
|
|
366
|
+
const cliValue = getCliValueForPrompt(name, options);
|
|
367
|
+
return cliValue === undefined;
|
|
368
|
+
});
|
|
303
369
|
// Stop the process when the user cancels/exits the prompt.
|
|
304
370
|
const onCancel = () => {
|
|
305
371
|
process.exit(0);
|
|
306
372
|
};
|
|
307
|
-
|
|
373
|
+
// Get values from prompts
|
|
374
|
+
const promptedValues = filteredPrompts.length > 0 ? await (0, prompts_1.default)(filteredPrompts, { onCancel }) : {};
|
|
375
|
+
// Merge CLI-provided values with prompted values
|
|
376
|
+
const name = options.name ?? promptedValues.name ?? slugToModuleName(slug);
|
|
377
|
+
const projectPackage = options.package ?? promptedValues.package ?? slugToAndroidPackage(slug);
|
|
378
|
+
if (isLocal) {
|
|
379
|
+
return {
|
|
380
|
+
project: {
|
|
381
|
+
slug,
|
|
382
|
+
name,
|
|
383
|
+
package: projectPackage,
|
|
384
|
+
moduleName: handleSuffix(name, 'Module'),
|
|
385
|
+
viewName: handleSuffix(name, 'View'),
|
|
386
|
+
},
|
|
387
|
+
type: 'local',
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
const description = options.description ?? promptedValues.description ?? 'My new module';
|
|
391
|
+
const authorName = options.authorName ?? promptedValues.authorName ?? (await (0, git_1.findMyName)()) ?? '';
|
|
392
|
+
const authorEmail = options.authorEmail ?? promptedValues.authorEmail ?? (await (0, git_1.findGitHubEmail)()) ?? '';
|
|
393
|
+
const authorUrl = options.authorUrl ??
|
|
394
|
+
promptedValues.authorUrl ??
|
|
395
|
+
(authorEmail ? ((await (0, github_1.findGitHubUserFromEmail)(authorEmail)) ?? '') : '');
|
|
396
|
+
const repo = options.repo ?? promptedValues.repo ?? (await (0, github_1.guessRepoUrl)(authorUrl, slug)) ?? '';
|
|
397
|
+
return {
|
|
398
|
+
project: {
|
|
399
|
+
slug,
|
|
400
|
+
name,
|
|
401
|
+
version: '0.1.0',
|
|
402
|
+
description,
|
|
403
|
+
package: projectPackage,
|
|
404
|
+
moduleName: handleSuffix(name, 'Module'),
|
|
405
|
+
viewName: handleSuffix(name, 'View'),
|
|
406
|
+
},
|
|
407
|
+
author: `${authorName} <${authorEmail}> (${authorUrl})`,
|
|
408
|
+
license: 'MIT',
|
|
409
|
+
repo,
|
|
410
|
+
type: 'remote',
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Gets the CLI value for a given prompt name.
|
|
415
|
+
*/
|
|
416
|
+
function getCliValueForPrompt(promptName, options) {
|
|
417
|
+
switch (promptName) {
|
|
418
|
+
case 'name':
|
|
419
|
+
return options.name;
|
|
420
|
+
case 'description':
|
|
421
|
+
return options.description;
|
|
422
|
+
case 'package':
|
|
423
|
+
return options.package;
|
|
424
|
+
case 'authorName':
|
|
425
|
+
return options.authorName;
|
|
426
|
+
case 'authorEmail':
|
|
427
|
+
return options.authorEmail;
|
|
428
|
+
case 'authorUrl':
|
|
429
|
+
return options.authorUrl;
|
|
430
|
+
case 'repo':
|
|
431
|
+
return options.repo;
|
|
432
|
+
default:
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Gets substitution data from CLI options and defaults (for non-interactive mode).
|
|
438
|
+
*/
|
|
439
|
+
async function getSubstitutionDataFromOptions(slug, isLocal, options) {
|
|
440
|
+
const name = options.name ?? slugToModuleName(slug);
|
|
441
|
+
const projectPackage = options.package ?? slugToAndroidPackage(slug);
|
|
442
|
+
debug(`Non-interactive mode: name="${name}", package="${projectPackage}"`);
|
|
308
443
|
if (isLocal) {
|
|
309
444
|
return {
|
|
310
445
|
project: {
|
|
@@ -317,6 +452,13 @@ async function askForSubstitutionDataAsync(slug, isLocal = false) {
|
|
|
317
452
|
type: 'local',
|
|
318
453
|
};
|
|
319
454
|
}
|
|
455
|
+
// For remote modules, resolve author info
|
|
456
|
+
const description = options.description ?? 'My new module';
|
|
457
|
+
const authorName = options.authorName ?? (await (0, git_1.findMyName)()) ?? '';
|
|
458
|
+
const authorEmail = options.authorEmail ?? (await (0, git_1.findGitHubEmail)()) ?? '';
|
|
459
|
+
const authorUrl = options.authorUrl ?? (authorEmail ? ((await (0, github_1.findGitHubUserFromEmail)(authorEmail)) ?? '') : '');
|
|
460
|
+
const repo = options.repo ?? (await (0, github_1.guessRepoUrl)(authorUrl, slug)) ?? '';
|
|
461
|
+
debug(`Non-interactive mode: description="${description}", authorName="${authorName}", authorEmail="${authorEmail}", authorUrl="${authorUrl}", repo="${repo}"`);
|
|
320
462
|
return {
|
|
321
463
|
project: {
|
|
322
464
|
slug,
|
|
@@ -335,12 +477,19 @@ async function askForSubstitutionDataAsync(slug, isLocal = false) {
|
|
|
335
477
|
}
|
|
336
478
|
/**
|
|
337
479
|
* Checks whether the target directory is empty and if not, asks the user to confirm if he wants to continue.
|
|
480
|
+
* In non-interactive mode, automatically continues (assumes intent to overwrite).
|
|
338
481
|
*/
|
|
339
|
-
async function confirmTargetDirAsync(targetDir) {
|
|
482
|
+
async function confirmTargetDirAsync(targetDir, options) {
|
|
340
483
|
const files = await fs_1.default.promises.readdir(targetDir);
|
|
341
484
|
if (files.length === 0) {
|
|
342
485
|
return;
|
|
343
486
|
}
|
|
487
|
+
// In non-interactive mode, proceed automatically
|
|
488
|
+
if (!isInteractive()) {
|
|
489
|
+
debug(`Non-interactive mode: target directory "${targetDir}" is not empty, continuing anyway`);
|
|
490
|
+
console.log(chalk_1.default.yellow(`Warning: Target directory ${chalk_1.default.magenta(targetDir)} is not empty, continuing anyway.`));
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
344
493
|
const { shouldContinue } = await (0, prompts_1.default)({
|
|
345
494
|
type: 'confirm',
|
|
346
495
|
name: 'shouldContinue',
|
|
@@ -390,6 +539,14 @@ program
|
|
|
390
539
|
.option('--with-changelog', 'Whether to include CHANGELOG.md file.', false)
|
|
391
540
|
.option('--no-example', 'Whether to skip creating the example app.', false)
|
|
392
541
|
.option('--local', 'Whether to create a local module in the current project, skipping installing node_modules and creating the example directory.', false)
|
|
542
|
+
// Module configuration options (skip prompts when provided)
|
|
543
|
+
.option('--name <name>', 'Native module name (e.g., MyModule).')
|
|
544
|
+
.option('--description <description>', 'Module description.')
|
|
545
|
+
.option('--package <package>', 'Android package name (e.g., expo.modules.mymodule).')
|
|
546
|
+
.option('--author-name <name>', 'Author name for package.json.')
|
|
547
|
+
.option('--author-email <email>', 'Author email for package.json.')
|
|
548
|
+
.option('--author-url <url>', "URL to the author's profile (e.g., GitHub profile).")
|
|
549
|
+
.option('--repo <url>', 'URL of the repository.')
|
|
393
550
|
.action(main);
|
|
394
551
|
program
|
|
395
552
|
.hook('postAction', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-expo-module.js","sourceRoot":"","sources":["../src/create-expo-module.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAC1B,yCAAoC;AACpC,wEAA+C;AAC/C,8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C,GAAG,CACT,eAAK,CAAC,MAAM,CACV,2DAA2D,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,gGAAgG,CACtL,CACF,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;KACtB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC;KAC5B,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC;KACpC,SAAS,CAAC,QAAQ,CAAC;KACnB,MAAM,CACL,2BAA2B,EAC3B,sFAAsF,CACvF;KACA,MAAM,CAAC,eAAe,EAAE,oCAAoC,EAAE,KAAK,CAAC;KACpE,MAAM,CAAC,kBAAkB,EAAE,uCAAuC,EAAE,KAAK,CAAC;KAC1E,MAAM,CAAC,cAAc,EAAE,2CAA2C,EAAE,KAAK,CAAC;KAC1E,MAAM,CACL,SAAS,EACT,+HAA+H,EAC/H,KAAK,CACN;KACA,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhB,OAAO;KACJ,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,IAAA,8BAAkB,GAAE,CAAC,KAAK,EAAE,EAAE,CAAC;AACvC,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport downloadTarball from 'download-tarball';\nimport ejs from 'ejs';\nimport fs from 'fs';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport prompts from 'prompts';\n\nimport { createExampleApp } from './createExampleApp';\nimport { installDependencies } from './packageManager';\nimport {\n getLocalFolderNamePrompt,\n getLocalSubstitutionDataPrompts,\n getSlugPrompt,\n getSubstitutionDataPrompts,\n} from './prompts';\nimport {\n formatRunCommand,\n PackageManagerName,\n resolvePackageManager,\n} from './resolvePackageManager';\nimport { eventCreateExpoModule, getTelemetryClient, logEventAsync } from './telemetry';\nimport { CommandOptions, LocalSubstitutionData, SubstitutionData } from './types';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:main') as typeof console.log;\nconst packageJson = require('../package.json');\n\n// Opt in to using beta versions\nconst EXPO_BETA = boolish('EXPO_BETA', false);\n\n// `yarn run` may change the current working dir, then we should use `INIT_CWD` env.\nconst CWD = process.env.INIT_CWD || process.cwd();\n\n// Ignore some paths. Especially `package.json` as it is rendered\n// from `$package.json` file instead of the original one.\nconst IGNORES_PATHS = [\n '.DS_Store',\n 'build',\n 'node_modules',\n 'package.json',\n '.npmignore',\n '.gitignore',\n];\n\n// Url to the documentation on Expo Modules\nconst DOCS_URL = 'https://docs.expo.dev/modules';\n\nconst FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md';\n\nasync function getCorrectLocalDirectory(targetOrSlug: string) {\n let packageJsonPath: string | null = null;\n for (let dir = CWD; path.dirname(dir) !== dir; dir = path.dirname(dir)) {\n const file = path.resolve(dir, 'package.json');\n if (fs.existsSync(file)) {\n packageJsonPath = file;\n break;\n }\n }\n if (!packageJsonPath) {\n console.log(\n chalk.red.bold(\n '⚠️ This command should be run inside your Expo project when run with the --local flag.'\n )\n );\n console.log(\n chalk.red(\n 'For native modules to autolink correctly, you need to place them in the `modules` directory in the root of the project.'\n )\n );\n return null;\n }\n return path.join(packageJsonPath, '..', 'modules', targetOrSlug);\n}\n\n/**\n * The main function of the command.\n *\n * @param target Path to the directory where to create the module. Defaults to current working dir.\n * @param options An options object for `commander`.\n */\nasync function main(target: string | undefined, options: CommandOptions) {\n if (options.local) {\n console.log();\n console.log(\n `${chalk.gray('The local module will be created in the ')}${chalk.gray.bold.italic(\n 'modules'\n )} ${chalk.gray('directory in the root of your project. Learn more: ')}${chalk.gray.bold(\n FYI_LOCAL_DIR\n )}`\n );\n console.log();\n }\n const slug = await askForPackageSlugAsync(target, options.local);\n const targetDir = options.local\n ? await getCorrectLocalDirectory(target || slug)\n : path.join(CWD, target || slug);\n\n if (!targetDir) {\n return;\n }\n await fs.promises.mkdir(targetDir, { recursive: true });\n await confirmTargetDirAsync(targetDir);\n\n options.target = targetDir;\n\n const data = await askForSubstitutionDataAsync(slug, options.local);\n\n // Make one line break between prompts and progress logs\n console.log();\n\n const packageManager = resolvePackageManager();\n const packagePath = options.source\n ? path.join(CWD, options.source)\n : await downloadPackageAsync(targetDir, options.local);\n\n await logEventAsync(eventCreateExpoModule(packageManager, options));\n\n await newStep('Creating the module from template files', async (step) => {\n await createModuleFromTemplate(packagePath, targetDir, data);\n step.succeed('Created the module from template files');\n });\n if (!options.local) {\n await newStep('Installing module dependencies', async (step) => {\n await installDependencies(packageManager, targetDir);\n step.succeed('Installed module dependencies');\n });\n await newStep('Compiling TypeScript files', async (step) => {\n await spawnAsync(packageManager, ['run', 'build'], {\n cwd: targetDir,\n stdio: 'ignore',\n });\n step.succeed('Compiled TypeScript files');\n });\n }\n\n if (!options.source) {\n // Files in the downloaded tarball are wrapped in `package` dir.\n // We should remove it after all.\n await fs.promises.rm(packagePath, { recursive: true, force: true });\n }\n if (!options.local && data.type !== 'local') {\n if (!options.withReadme) {\n await fs.promises.rm(path.join(targetDir, 'README.md'), { force: true });\n }\n if (!options.withChangelog) {\n await fs.promises.rm(path.join(targetDir, 'CHANGELOG.md'), { force: true });\n }\n if (options.example) {\n // Create \"example\" folder\n await createExampleApp(data, targetDir, packageManager);\n }\n\n await newStep('Creating an empty Git repository', async (step) => {\n try {\n const result = await createGitRepositoryAsync(targetDir);\n if (result) {\n step.succeed('Created an empty Git repository');\n } else if (result === null) {\n step.succeed('Skipped creating an empty Git repository, already within a Git repository');\n } else if (result === false) {\n step.warn(\n 'Could not create an empty Git repository, see debug logs with EXPO_DEBUG=true'\n );\n }\n } catch (error: any) {\n step.fail(error.toString());\n }\n });\n }\n\n console.log();\n if (options.local) {\n console.log(`✅ Successfully created Expo module in ${chalk.bold.italic(`modules/${slug}`)}`);\n printFurtherLocalInstructions(slug, data.project.moduleName);\n } else {\n console.log('✅ Successfully created Expo module');\n printFurtherInstructions(targetDir, packageManager, options.example);\n }\n}\n\n/**\n * Recursively scans for the files within the directory. Returned paths are relative to the `root` path.\n */\nasync function getFilesAsync(root: string, dir: string | null = null): Promise<string[]> {\n const files: string[] = [];\n const baseDir = dir ? path.join(root, dir) : root;\n\n for (const file of await fs.promises.readdir(baseDir)) {\n const relativePath = dir ? path.join(dir, file) : file;\n\n if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) {\n continue;\n }\n\n const fullPath = path.join(baseDir, file);\n const stat = await fs.promises.lstat(fullPath);\n if (stat.isDirectory()) {\n files.push(...(await getFilesAsync(root, relativePath)));\n } else {\n files.push(relativePath);\n }\n }\n return files;\n}\n\n/**\n * Asks NPM registry for the url to the tarball.\n */\nasync function getNpmTarballUrl(packageName: string, version: string = 'latest'): Promise<string> {\n debug(`Using module template ${chalk.bold(packageName)}@${chalk.bold(version)}`);\n const { stdout } = await spawnAsync('npm', ['view', `${packageName}@${version}`, 'dist.tarball']);\n return stdout.trim();\n}\n\n/**\n * Gets expo SDK version major from the local package.json.\n */\nasync function getLocalSdkMajorVersion(): Promise<string | null> {\n const path = require.resolve('expo/package.json', { paths: [process.cwd()] });\n if (!path) {\n return null;\n }\n const { version } = require(path) ?? {};\n return version?.split('.')[0] ?? null;\n}\n\n/**\n * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag.\n */\nasync function getTemplateVersion(isLocal: boolean) {\n if (EXPO_BETA) {\n return 'next';\n }\n if (!isLocal) {\n return 'latest';\n }\n try {\n const sdkVersionMajor = await getLocalSdkMajorVersion();\n return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest';\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't determine the SDK version from the local project, using `latest` as the template version.\"\n )\n );\n return 'latest';\n }\n}\n\n/**\n * Downloads the template from NPM registry.\n */\nasync function downloadPackageAsync(targetDir: string, isLocal = false): Promise<string> {\n return await newStep('Downloading module template from npm', async (step) => {\n const templateVersion = await getTemplateVersion(isLocal);\n const packageName = isLocal ? 'expo-module-template-local' : 'expo-module-template';\n\n try {\n await downloadTarball({\n url: await getNpmTarballUrl(packageName, templateVersion),\n dir: targetDir,\n });\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't download the versioned template from npm, falling back to the latest version.\"\n )\n );\n await downloadTarball({\n url: await getNpmTarballUrl(packageName, 'latest'),\n dir: targetDir,\n });\n }\n\n step.succeed('Downloaded module template from npm registry.');\n\n return path.join(targetDir, 'package');\n });\n}\n\nfunction handleSuffix(name: string, suffix: string): string {\n if (name.endsWith(suffix)) {\n return name;\n }\n return `${name}${suffix}`;\n}\n\n/**\n * Creates the module based on the `ejs` template (e.g. `expo-module-template` package).\n */\nasync function createModuleFromTemplate(\n templatePath: string,\n targetPath: string,\n data: SubstitutionData | LocalSubstitutionData\n) {\n const files = await getFilesAsync(templatePath);\n\n // Iterate through all template files.\n for (const file of files) {\n const renderedRelativePath = ejs.render(file.replace(/^\\$/, ''), data, {\n openDelimiter: '{',\n closeDelimiter: '}',\n escape: (value: string) => value.replace(/\\./g, path.sep),\n });\n const fromPath = path.join(templatePath, file);\n const toPath = path.join(targetPath, renderedRelativePath);\n const template = await fs.promises.readFile(fromPath, 'utf8');\n const renderedContent = ejs.render(template, data);\n\n if (!fs.existsSync(path.dirname(toPath))) {\n await fs.promises.mkdir(path.dirname(toPath), { recursive: true });\n }\n await fs.promises.writeFile(toPath, renderedContent, 'utf8');\n }\n}\n\nasync function createGitRepositoryAsync(targetDir: string) {\n // Check if we are inside a git repository already\n try {\n await spawnAsync('git', ['rev-parse', '--is-inside-work-tree'], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n debug(chalk.dim('New project is already inside of a Git repository, skipping `git init`.'));\n return null;\n } catch (e: any) {\n if (e.errno === 'ENOENT') {\n debug(chalk.dim('Unable to initialize Git repo. `git` not in $PATH.'));\n return false;\n }\n }\n\n // Create a new git repository\n await spawnAsync('git', ['init'], { stdio: 'ignore', cwd: targetDir });\n await spawnAsync('git', ['add', '-A'], { stdio: 'ignore', cwd: targetDir });\n\n const commitMsg = `Initial commit\\n\\nGenerated by ${packageJson.name} ${packageJson.version}.`;\n await spawnAsync('git', ['commit', '-m', commitMsg], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n\n debug(chalk.dim('Initialized a Git repository.'));\n return true;\n}\n\n/**\n * Asks the user for the package slug (npm package name).\n */\nasync function askForPackageSlugAsync(customTargetPath?: string, isLocal = false): Promise<string> {\n const { slug } = await prompts(\n (isLocal ? getLocalFolderNamePrompt : getSlugPrompt)(customTargetPath),\n {\n onCancel: () => process.exit(0),\n }\n );\n return slug;\n}\n\n/**\n * Asks the user for some data necessary to render the template.\n * Some values may already be provided by command options, the prompt is skipped in that case.\n */\nasync function askForSubstitutionDataAsync(\n slug: string,\n isLocal = false\n): Promise<SubstitutionData | LocalSubstitutionData> {\n const promptQueries = await (\n isLocal ? getLocalSubstitutionDataPrompts : getSubstitutionDataPrompts\n )(slug);\n\n // Stop the process when the user cancels/exits the prompt.\n const onCancel = () => {\n process.exit(0);\n };\n\n const {\n name,\n description,\n package: projectPackage,\n authorName,\n authorEmail,\n authorUrl,\n repo,\n } = await prompts(promptQueries, { onCancel });\n\n if (isLocal) {\n return {\n project: {\n slug,\n name,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n type: 'local',\n };\n }\n\n return {\n project: {\n slug,\n name,\n version: '0.1.0',\n description,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n author: `${authorName} <${authorEmail}> (${authorUrl})`,\n license: 'MIT',\n repo,\n type: 'remote',\n };\n}\n\n/**\n * Checks whether the target directory is empty and if not, asks the user to confirm if he wants to continue.\n */\nasync function confirmTargetDirAsync(targetDir: string): Promise<void> {\n const files = await fs.promises.readdir(targetDir);\n if (files.length === 0) {\n return;\n }\n const { shouldContinue } = await prompts(\n {\n type: 'confirm',\n name: 'shouldContinue',\n message: `The target directory ${chalk.magenta(\n targetDir\n )} is not empty, do you want to continue anyway?`,\n initial: true,\n },\n {\n onCancel: () => false,\n }\n );\n if (!shouldContinue) {\n process.exit(0);\n }\n}\n\n/**\n * Prints how the user can follow up once the script finishes creating the module.\n */\nfunction printFurtherInstructions(\n targetDir: string,\n packageManager: PackageManagerName,\n includesExample: boolean\n) {\n if (includesExample) {\n const commands = [\n `cd ${path.relative(CWD, targetDir)}`,\n formatRunCommand(packageManager, 'open:ios'),\n formatRunCommand(packageManager, 'open:android'),\n ];\n\n console.log();\n console.log(\n 'To start developing your module, navigate to the directory and open Android and iOS projects of the example app'\n );\n commands.forEach((command) => console.log(chalk.gray('>'), chalk.bold(command)));\n console.log();\n }\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n}\n\nfunction printFurtherLocalInstructions(slug: string, name: string) {\n console.log();\n console.log(`You can now import this module inside your application.`);\n console.log(`For example, you can add this line to your App.tsx or App.js file:`);\n console.log(`${chalk.gray.italic(`import ${name} from './modules/${slug}';`)}`);\n console.log();\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n console.log(\n chalk.yellow(\n `Remember to re-build your native app (for example, with ${chalk.bold('npx expo run')}) when you make changes to the module. Native code changes are not reloaded with Fast Refresh.`\n )\n );\n}\n\nconst program = new Command();\n\nprogram\n .name(packageJson.name)\n .version(packageJson.version)\n .description(packageJson.description)\n .arguments('[path]')\n .option(\n '-s, --source <source_dir>',\n 'Local path to the template. By default it downloads `expo-module-template` from NPM.'\n )\n .option('--with-readme', 'Whether to include README.md file.', false)\n .option('--with-changelog', 'Whether to include CHANGELOG.md file.', false)\n .option('--no-example', 'Whether to skip creating the example app.', false)\n .option(\n '--local',\n 'Whether to create a local module in the current project, skipping installing node_modules and creating the example directory.',\n false\n )\n .action(main);\n\nprogram\n .hook('postAction', async () => {\n await getTelemetryClient().flush?.();\n })\n .parse(process.argv);\n"]}
|
|
1
|
+
{"version":3,"file":"create-expo-module.js","sourceRoot":"","sources":["../src/create-expo-module.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAA0B;AAC1B,yCAAoC;AACpC,wEAA+C;AAC/C,8CAAsB;AACtB,4CAAoB;AACpB,mCAAiC;AACjC,gDAAwB;AACxB,sDAA8B;AAC9B,0FAA2D;AAE3D,yDAAsD;AACtD,qDAAuD;AACvD,uCAKmB;AACnB,mEAIiC;AACjC,2CAAuF;AAEvF,qCAA0D;AAC1D,2CAAuE;AACvE,qCAAsC;AAEtC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,yBAAyB,CAAuB,CAAC;AAChF,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C,gCAAgC;AAChC,MAAM,SAAS,GAAG,IAAA,gBAAO,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AAE9C,oFAAoF;AACpF,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAElD,iEAAiE;AACjE,yDAAyD;AACzD,MAAM,aAAa,GAAG;IACpB,WAAW;IACX,OAAO;IACP,cAAc;IACd,cAAc;IACd,YAAY;IACZ,YAAY;CACb,CAAC;AAEF,2CAA2C;AAC3C,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAEjD,MAAM,aAAa,GAAG,mDAAmD,CAAC;AAE1E;;;GAGG;AACH,SAAS,aAAa;IACpB,2BAA2B;IAC3B,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QAChE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,gBAAgB;IAChB,I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,SAAS,EACT,+HAA+H,EAC/H,KAAK,CACN;IACD,4DAA4D;KAC3D,MAAM,CAAC,eAAe,EAAE,sCAAsC,CAAC;KAC/D,MAAM,CAAC,6BAA6B,EAAE,qBAAqB,CAAC;KAC5D,MAAM,CAAC,qBAAqB,EAAE,qDAAqD,CAAC;KACpF,MAAM,CAAC,sBAAsB,EAAE,+BAA+B,CAAC;KAC/D,MAAM,CAAC,wBAAwB,EAAE,gCAAgC,CAAC;KAClE,MAAM,CAAC,oBAAoB,EAAE,qDAAqD,CAAC;KACnF,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC;KAChD,MAAM,CAAC,IAAI,CAAC,CAAC;AAEhB,OAAO;KACJ,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,IAAA,8BAAkB,GAAE,CAAC,KAAK,EAAE,EAAE,CAAC;AACvC,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import spawnAsync from '@expo/spawn-async';\nimport chalk from 'chalk';\nimport { Command } from 'commander';\nimport downloadTarball from 'download-tarball';\nimport ejs from 'ejs';\nimport fs from 'fs';\nimport { boolish } from 'getenv';\nimport path from 'path';\nimport prompts from 'prompts';\nimport validateNpmPackage from 'validate-npm-package-name';\n\nimport { createExampleApp } from './createExampleApp';\nimport { installDependencies } from './packageManager';\nimport {\n getLocalFolderNamePrompt,\n getLocalSubstitutionDataPrompts,\n getSlugPrompt,\n getSubstitutionDataPrompts,\n} from './prompts';\nimport {\n formatRunCommand,\n PackageManagerName,\n resolvePackageManager,\n} from './resolvePackageManager';\nimport { eventCreateExpoModule, getTelemetryClient, logEventAsync } from './telemetry';\nimport { CommandOptions, LocalSubstitutionData, SubstitutionData } from './types';\nimport { findGitHubEmail, findMyName } from './utils/git';\nimport { findGitHubUserFromEmail, guessRepoUrl } from './utils/github';\nimport { newStep } from './utils/ora';\n\nconst debug = require('debug')('create-expo-module:main') as typeof console.log;\nconst packageJson = require('../package.json');\n\n// Opt in to using beta versions\nconst EXPO_BETA = boolish('EXPO_BETA', false);\n\n// `yarn run` may change the current working dir, then we should use `INIT_CWD` env.\nconst CWD = process.env.INIT_CWD || process.cwd();\n\n// Ignore some paths. Especially `package.json` as it is rendered\n// from `$package.json` file instead of the original one.\nconst IGNORES_PATHS = [\n '.DS_Store',\n 'build',\n 'node_modules',\n 'package.json',\n '.npmignore',\n '.gitignore',\n];\n\n// Url to the documentation on Expo Modules\nconst DOCS_URL = 'https://docs.expo.dev/modules';\n\nconst FYI_LOCAL_DIR = 'https://expo.fyi/expo-module-local-autolinking.md';\n\n/**\n * Determines if we're in an interactive environment.\n * Non-interactive when: CI=1/true or non-TTY stdin.\n */\nfunction isInteractive(): boolean {\n // Check for CI environment\n const ci = process.env.CI;\n if (ci === '1' || ci === 'true' || ci?.toLowerCase() === 'true') {\n return false;\n }\n // Check for TTY\n if (!process.stdin.isTTY) {\n return false;\n }\n return true;\n}\n\n/**\n * Converts a slug to a native module name (PascalCase).\n */\nfunction slugToModuleName(slug: string): string {\n return slug\n .replace(/^@/, '')\n .replace(/^./, (match) => match.toUpperCase())\n .replace(/\\W+(\\w)/g, (_, p1) => p1.toUpperCase());\n}\n\n/**\n * Converts a slug to an Android package name.\n */\nfunction slugToAndroidPackage(slug: string): string {\n const namespace = slug\n .replace(/\\W/g, '')\n .replace(/^(expo|reactnative)/, '')\n .toLowerCase();\n return `expo.modules.${namespace}`;\n}\n\nasync function getCorrectLocalDirectory(targetOrSlug: string) {\n let packageJsonPath: string | null = null;\n for (let dir = CWD; path.dirname(dir) !== dir; dir = path.dirname(dir)) {\n const file = path.resolve(dir, 'package.json');\n if (fs.existsSync(file)) {\n packageJsonPath = file;\n break;\n }\n }\n if (!packageJsonPath) {\n console.log(\n chalk.red.bold(\n '⚠️ This command should be run inside your Expo project when run with the --local flag.'\n )\n );\n console.log(\n chalk.red(\n 'For native modules to autolink correctly, you need to place them in the `modules` directory in the root of the project.'\n )\n );\n return null;\n }\n return path.join(packageJsonPath, '..', 'modules', targetOrSlug);\n}\n\n/**\n * The main function of the command.\n *\n * @param target Path to the directory where to create the module. Defaults to current working dir.\n * @param options An options object for `commander`.\n */\nasync function main(target: string | undefined, options: CommandOptions) {\n const interactive = isInteractive();\n if (!interactive) {\n debug('Running in non-interactive mode');\n }\n\n if (options.local) {\n console.log();\n console.log(\n `${chalk.gray('The local module will be created in the ')}${chalk.gray.bold.italic(\n 'modules'\n )} ${chalk.gray('directory in the root of your project. Learn more: ')}${chalk.gray.bold(\n FYI_LOCAL_DIR\n )}`\n );\n console.log();\n }\n const slug = await askForPackageSlugAsync(target, options.local, options);\n const targetDir = options.local\n ? await getCorrectLocalDirectory(target || slug)\n : path.join(CWD, target || slug);\n\n if (!targetDir) {\n return;\n }\n await fs.promises.mkdir(targetDir, { recursive: true });\n await confirmTargetDirAsync(targetDir, options);\n\n options.target = targetDir;\n\n const data = await askForSubstitutionDataAsync(slug, options.local, options);\n\n // Make one line break between prompts and progress logs\n console.log();\n\n const packageManager = resolvePackageManager();\n const packagePath = options.source\n ? path.join(CWD, options.source)\n : await downloadPackageAsync(targetDir, options.local);\n\n await logEventAsync(eventCreateExpoModule(packageManager, options));\n\n await newStep('Creating the module from template files', async (step) => {\n await createModuleFromTemplate(packagePath, targetDir, data);\n step.succeed('Created the module from template files');\n });\n if (!options.local) {\n await newStep('Installing module dependencies', async (step) => {\n await installDependencies(packageManager, targetDir);\n step.succeed('Installed module dependencies');\n });\n await newStep('Compiling TypeScript files', async (step) => {\n await spawnAsync(packageManager, ['run', 'build'], {\n cwd: targetDir,\n stdio: 'ignore',\n });\n step.succeed('Compiled TypeScript files');\n });\n }\n\n if (!options.source) {\n // Files in the downloaded tarball are wrapped in `package` dir.\n // We should remove it after all.\n await fs.promises.rm(packagePath, { recursive: true, force: true });\n }\n if (!options.local && data.type !== 'local') {\n if (!options.withReadme) {\n await fs.promises.rm(path.join(targetDir, 'README.md'), { force: true });\n }\n if (!options.withChangelog) {\n await fs.promises.rm(path.join(targetDir, 'CHANGELOG.md'), { force: true });\n }\n if (options.example) {\n // Create \"example\" folder\n await createExampleApp(data, targetDir, packageManager);\n }\n\n await newStep('Creating an empty Git repository', async (step) => {\n try {\n const result = await createGitRepositoryAsync(targetDir);\n if (result) {\n step.succeed('Created an empty Git repository');\n } else if (result === null) {\n step.succeed('Skipped creating an empty Git repository, already within a Git repository');\n } else if (result === false) {\n step.warn(\n 'Could not create an empty Git repository, see debug logs with EXPO_DEBUG=true'\n );\n }\n } catch (error: any) {\n step.fail(error.toString());\n }\n });\n }\n\n console.log();\n if (options.local) {\n console.log(`✅ Successfully created Expo module in ${chalk.bold.italic(`modules/${slug}`)}`);\n printFurtherLocalInstructions(slug, data.project.moduleName);\n } else {\n console.log('✅ Successfully created Expo module');\n printFurtherInstructions(targetDir, packageManager, options.example);\n }\n}\n\n/**\n * Recursively scans for the files within the directory. Returned paths are relative to the `root` path.\n */\nasync function getFilesAsync(root: string, dir: string | null = null): Promise<string[]> {\n const files: string[] = [];\n const baseDir = dir ? path.join(root, dir) : root;\n\n for (const file of await fs.promises.readdir(baseDir)) {\n const relativePath = dir ? path.join(dir, file) : file;\n\n if (IGNORES_PATHS.includes(relativePath) || IGNORES_PATHS.includes(file)) {\n continue;\n }\n\n const fullPath = path.join(baseDir, file);\n const stat = await fs.promises.lstat(fullPath);\n if (stat.isDirectory()) {\n files.push(...(await getFilesAsync(root, relativePath)));\n } else {\n files.push(relativePath);\n }\n }\n return files;\n}\n\n/**\n * Asks NPM registry for the url to the tarball.\n */\nasync function getNpmTarballUrl(packageName: string, version: string = 'latest'): Promise<string> {\n debug(`Using module template ${chalk.bold(packageName)}@${chalk.bold(version)}`);\n const { stdout } = await spawnAsync('npm', ['view', `${packageName}@${version}`, 'dist.tarball']);\n return stdout.trim();\n}\n\n/**\n * Gets expo SDK version major from the local package.json.\n */\nasync function getLocalSdkMajorVersion(): Promise<string | null> {\n const path = require.resolve('expo/package.json', { paths: [process.cwd()] });\n if (!path) {\n return null;\n }\n const { version } = require(path) ?? {};\n return version?.split('.')[0] ?? null;\n}\n\n/**\n * Selects correct version of the template based on the SDK version for local modules and EXPO_BETA flag.\n */\nasync function getTemplateVersion(isLocal: boolean) {\n if (EXPO_BETA) {\n return 'next';\n }\n if (!isLocal) {\n return 'latest';\n }\n try {\n const sdkVersionMajor = await getLocalSdkMajorVersion();\n return sdkVersionMajor ? `sdk-${sdkVersionMajor}` : 'latest';\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't determine the SDK version from the local project, using `latest` as the template version.\"\n )\n );\n return 'latest';\n }\n}\n\n/**\n * Downloads the template from NPM registry.\n */\nasync function downloadPackageAsync(targetDir: string, isLocal = false): Promise<string> {\n return await newStep('Downloading module template from npm', async (step) => {\n const templateVersion = await getTemplateVersion(isLocal);\n const packageName = isLocal ? 'expo-module-template-local' : 'expo-module-template';\n\n try {\n await downloadTarball({\n url: await getNpmTarballUrl(packageName, templateVersion),\n dir: targetDir,\n });\n } catch {\n console.log();\n console.warn(\n chalk.yellow(\n \"Couldn't download the versioned template from npm, falling back to the latest version.\"\n )\n );\n await downloadTarball({\n url: await getNpmTarballUrl(packageName, 'latest'),\n dir: targetDir,\n });\n }\n\n step.succeed('Downloaded module template from npm registry.');\n\n return path.join(targetDir, 'package');\n });\n}\n\nfunction handleSuffix(name: string, suffix: string): string {\n if (name.endsWith(suffix)) {\n return name;\n }\n return `${name}${suffix}`;\n}\n\n/**\n * Creates the module based on the `ejs` template (e.g. `expo-module-template` package).\n */\nasync function createModuleFromTemplate(\n templatePath: string,\n targetPath: string,\n data: SubstitutionData | LocalSubstitutionData\n) {\n const files = await getFilesAsync(templatePath);\n\n // Iterate through all template files.\n for (const file of files) {\n const renderedRelativePath = ejs.render(file.replace(/^\\$/, ''), data, {\n openDelimiter: '{',\n closeDelimiter: '}',\n escape: (value: string) => value.replace(/\\./g, path.sep),\n });\n const fromPath = path.join(templatePath, file);\n const toPath = path.join(targetPath, renderedRelativePath);\n const template = await fs.promises.readFile(fromPath, 'utf8');\n const renderedContent = ejs.render(template, data);\n\n if (!fs.existsSync(path.dirname(toPath))) {\n await fs.promises.mkdir(path.dirname(toPath), { recursive: true });\n }\n await fs.promises.writeFile(toPath, renderedContent, 'utf8');\n }\n}\n\nasync function createGitRepositoryAsync(targetDir: string) {\n // Check if we are inside a git repository already\n try {\n await spawnAsync('git', ['rev-parse', '--is-inside-work-tree'], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n debug(chalk.dim('New project is already inside of a Git repository, skipping `git init`.'));\n return null;\n } catch (e: any) {\n if (e.errno === 'ENOENT') {\n debug(chalk.dim('Unable to initialize Git repo. `git` not in $PATH.'));\n return false;\n }\n }\n\n // Create a new git repository\n await spawnAsync('git', ['init'], { stdio: 'ignore', cwd: targetDir });\n await spawnAsync('git', ['add', '-A'], { stdio: 'ignore', cwd: targetDir });\n\n const commitMsg = `Initial commit\\n\\nGenerated by ${packageJson.name} ${packageJson.version}.`;\n await spawnAsync('git', ['commit', '-m', commitMsg], {\n stdio: 'ignore',\n cwd: targetDir,\n });\n\n debug(chalk.dim('Initialized a Git repository.'));\n return true;\n}\n\n/**\n * Asks the user for the package slug (npm package name).\n * In non-interactive mode, uses the target path or 'my-module' as default.\n */\nasync function askForPackageSlugAsync(\n customTargetPath: string | undefined,\n isLocal: boolean,\n options: CommandOptions\n): Promise<string> {\n const interactive = isInteractive();\n\n // In non-interactive mode, derive slug from target path or use default\n if (!interactive) {\n const targetBasename = customTargetPath && path.basename(customTargetPath);\n const slug =\n targetBasename && validateNpmPackage(targetBasename).validForNewPackages\n ? targetBasename\n : 'my-module';\n debug(`Non-interactive mode: using slug \"${slug}\"`);\n return slug;\n }\n\n const { slug } = await prompts(\n (isLocal ? getLocalFolderNamePrompt : getSlugPrompt)(customTargetPath),\n {\n onCancel: () => process.exit(0),\n }\n );\n return slug;\n}\n\n/**\n * Asks the user for some data necessary to render the template.\n * Some values may already be provided by command options, the prompt is skipped in that case.\n * In non-interactive mode, uses defaults or CLI-provided values.\n */\nasync function askForSubstitutionDataAsync(\n slug: string,\n isLocal: boolean,\n options: CommandOptions\n): Promise<SubstitutionData | LocalSubstitutionData> {\n const interactive = isInteractive();\n\n // Non-interactive mode: use CLI options and defaults\n if (!interactive) {\n return getSubstitutionDataFromOptions(slug, isLocal, options);\n }\n\n // Interactive mode: prompt for values, but skip prompts for CLI-provided values\n const promptQueries = await (\n isLocal ? getLocalSubstitutionDataPrompts : getSubstitutionDataPrompts\n )(slug);\n\n // Filter out prompts for values already provided via CLI\n const filteredPrompts = promptQueries.filter((prompt) => {\n const name = prompt.name as string;\n const cliValue = getCliValueForPrompt(name, options);\n return cliValue === undefined;\n });\n\n // Stop the process when the user cancels/exits the prompt.\n const onCancel = () => {\n process.exit(0);\n };\n\n // Get values from prompts\n const promptedValues =\n filteredPrompts.length > 0 ? await prompts(filteredPrompts, { onCancel }) : {};\n\n // Merge CLI-provided values with prompted values\n const name = options.name ?? promptedValues.name ?? slugToModuleName(slug);\n const projectPackage = options.package ?? promptedValues.package ?? slugToAndroidPackage(slug);\n\n if (isLocal) {\n return {\n project: {\n slug,\n name,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n type: 'local',\n };\n }\n\n const description = options.description ?? promptedValues.description ?? 'My new module';\n const authorName = options.authorName ?? promptedValues.authorName ?? (await findMyName()) ?? '';\n const authorEmail =\n options.authorEmail ?? promptedValues.authorEmail ?? (await findGitHubEmail()) ?? '';\n const authorUrl =\n options.authorUrl ??\n promptedValues.authorUrl ??\n (authorEmail ? ((await findGitHubUserFromEmail(authorEmail)) ?? '') : '');\n const repo = options.repo ?? promptedValues.repo ?? (await guessRepoUrl(authorUrl, slug)) ?? '';\n\n return {\n project: {\n slug,\n name,\n version: '0.1.0',\n description,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n author: `${authorName} <${authorEmail}> (${authorUrl})`,\n license: 'MIT',\n repo,\n type: 'remote',\n };\n}\n\n/**\n * Gets the CLI value for a given prompt name.\n */\nfunction getCliValueForPrompt(promptName: string, options: CommandOptions): string | undefined {\n switch (promptName) {\n case 'name':\n return options.name;\n case 'description':\n return options.description;\n case 'package':\n return options.package;\n case 'authorName':\n return options.authorName;\n case 'authorEmail':\n return options.authorEmail;\n case 'authorUrl':\n return options.authorUrl;\n case 'repo':\n return options.repo;\n default:\n return undefined;\n }\n}\n\n/**\n * Gets substitution data from CLI options and defaults (for non-interactive mode).\n */\nasync function getSubstitutionDataFromOptions(\n slug: string,\n isLocal: boolean,\n options: CommandOptions\n): Promise<SubstitutionData | LocalSubstitutionData> {\n const name = options.name ?? slugToModuleName(slug);\n const projectPackage = options.package ?? slugToAndroidPackage(slug);\n\n debug(`Non-interactive mode: name=\"${name}\", package=\"${projectPackage}\"`);\n\n if (isLocal) {\n return {\n project: {\n slug,\n name,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n type: 'local',\n };\n }\n\n // For remote modules, resolve author info\n const description = options.description ?? 'My new module';\n const authorName = options.authorName ?? (await findMyName()) ?? '';\n const authorEmail = options.authorEmail ?? (await findGitHubEmail()) ?? '';\n const authorUrl =\n options.authorUrl ?? (authorEmail ? ((await findGitHubUserFromEmail(authorEmail)) ?? '') : '');\n const repo = options.repo ?? (await guessRepoUrl(authorUrl, slug)) ?? '';\n\n debug(\n `Non-interactive mode: description=\"${description}\", authorName=\"${authorName}\", authorEmail=\"${authorEmail}\", authorUrl=\"${authorUrl}\", repo=\"${repo}\"`\n );\n\n return {\n project: {\n slug,\n name,\n version: '0.1.0',\n description,\n package: projectPackage,\n moduleName: handleSuffix(name, 'Module'),\n viewName: handleSuffix(name, 'View'),\n },\n author: `${authorName} <${authorEmail}> (${authorUrl})`,\n license: 'MIT',\n repo,\n type: 'remote',\n };\n}\n\n/**\n * Checks whether the target directory is empty and if not, asks the user to confirm if he wants to continue.\n * In non-interactive mode, automatically continues (assumes intent to overwrite).\n */\nasync function confirmTargetDirAsync(targetDir: string, options: CommandOptions): Promise<void> {\n const files = await fs.promises.readdir(targetDir);\n if (files.length === 0) {\n return;\n }\n\n // In non-interactive mode, proceed automatically\n if (!isInteractive()) {\n debug(`Non-interactive mode: target directory \"${targetDir}\" is not empty, continuing anyway`);\n console.log(\n chalk.yellow(\n `Warning: Target directory ${chalk.magenta(targetDir)} is not empty, continuing anyway.`\n )\n );\n return;\n }\n\n const { shouldContinue } = await prompts(\n {\n type: 'confirm',\n name: 'shouldContinue',\n message: `The target directory ${chalk.magenta(\n targetDir\n )} is not empty, do you want to continue anyway?`,\n initial: true,\n },\n {\n onCancel: () => false,\n }\n );\n if (!shouldContinue) {\n process.exit(0);\n }\n}\n\n/**\n * Prints how the user can follow up once the script finishes creating the module.\n */\nfunction printFurtherInstructions(\n targetDir: string,\n packageManager: PackageManagerName,\n includesExample: boolean\n) {\n if (includesExample) {\n const commands = [\n `cd ${path.relative(CWD, targetDir)}`,\n formatRunCommand(packageManager, 'open:ios'),\n formatRunCommand(packageManager, 'open:android'),\n ];\n\n console.log();\n console.log(\n 'To start developing your module, navigate to the directory and open Android and iOS projects of the example app'\n );\n commands.forEach((command) => console.log(chalk.gray('>'), chalk.bold(command)));\n console.log();\n }\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n}\n\nfunction printFurtherLocalInstructions(slug: string, name: string) {\n console.log();\n console.log(`You can now import this module inside your application.`);\n console.log(`For example, you can add this line to your App.tsx or App.js file:`);\n console.log(`${chalk.gray.italic(`import ${name} from './modules/${slug}';`)}`);\n console.log();\n console.log(`Learn more on Expo Modules APIs: ${chalk.blue.bold(DOCS_URL)}`);\n console.log(\n chalk.yellow(\n `Remember to re-build your native app (for example, with ${chalk.bold('npx expo run')}) when you make changes to the module. Native code changes are not reloaded with Fast Refresh.`\n )\n );\n}\n\nconst program = new Command();\n\nprogram\n .name(packageJson.name)\n .version(packageJson.version)\n .description(packageJson.description)\n .arguments('[path]')\n .option(\n '-s, --source <source_dir>',\n 'Local path to the template. By default it downloads `expo-module-template` from NPM.'\n )\n .option('--with-readme', 'Whether to include README.md file.', false)\n .option('--with-changelog', 'Whether to include CHANGELOG.md file.', false)\n .option('--no-example', 'Whether to skip creating the example app.', false)\n .option(\n '--local',\n 'Whether to create a local module in the current project, skipping installing node_modules and creating the example directory.',\n false\n )\n // Module configuration options (skip prompts when provided)\n .option('--name <name>', 'Native module name (e.g., MyModule).')\n .option('--description <description>', 'Module description.')\n .option('--package <package>', 'Android package name (e.g., expo.modules.mymodule).')\n .option('--author-name <name>', 'Author name for package.json.')\n .option('--author-email <email>', 'Author email for package.json.')\n .option('--author-url <url>', \"URL to the author's profile (e.g., GitHub profile).\")\n .option('--repo <url>', 'URL of the repository.')\n .action(main);\n\nprogram\n .hook('postAction', async () => {\n await getTelemetryClient().flush?.();\n })\n .parse(process.argv);\n"]}
|
package/build/types.d.ts
CHANGED
|
@@ -9,6 +9,13 @@ export type CommandOptions = {
|
|
|
9
9
|
withChangelog: boolean;
|
|
10
10
|
example: boolean;
|
|
11
11
|
local: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
package?: string;
|
|
15
|
+
authorName?: string;
|
|
16
|
+
authorEmail?: string;
|
|
17
|
+
authorUrl?: string;
|
|
18
|
+
repo?: string;
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
14
21
|
* Represents an object that is passed to `ejs` when rendering the template.
|
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PromptObject } from 'prompts';\n\n/**\n * Possible command options.\n */\nexport type CommandOptions = {\n target: string;\n source?: string;\n withReadme: boolean;\n withChangelog: boolean;\n example: boolean;\n local: boolean;\n};\n\n/**\n * Represents an object that is passed to `ejs` when rendering the template.\n */\nexport type SubstitutionData = {\n project: {\n slug: string;\n name: string;\n version: string;\n description: string;\n package: string;\n moduleName: string;\n viewName: string;\n };\n author: string;\n license: string;\n repo: string;\n type: 'remote';\n};\n\nexport type LocalSubstitutionData = {\n project: {\n slug: string;\n name: string;\n package: string;\n moduleName: string;\n viewName: string;\n };\n type: 'local';\n};\n\nexport type CustomPromptObject = PromptObject & {\n name: string;\n resolvedValue?: string | null;\n};\n\nexport type Answers = Record<string, string>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PromptObject } from 'prompts';\n\n/**\n * Possible command options.\n */\nexport type CommandOptions = {\n target: string;\n source?: string;\n withReadme: boolean;\n withChangelog: boolean;\n example: boolean;\n local: boolean;\n // Module configuration options (skip prompts when provided)\n name?: string;\n description?: string;\n package?: string;\n authorName?: string;\n authorEmail?: string;\n authorUrl?: string;\n repo?: string;\n};\n\n/**\n * Represents an object that is passed to `ejs` when rendering the template.\n */\nexport type SubstitutionData = {\n project: {\n slug: string;\n name: string;\n version: string;\n description: string;\n package: string;\n moduleName: string;\n viewName: string;\n };\n author: string;\n license: string;\n repo: string;\n type: 'remote';\n};\n\nexport type LocalSubstitutionData = {\n project: {\n slug: string;\n name: string;\n package: string;\n moduleName: string;\n viewName: string;\n };\n type: 'local';\n};\n\nexport type CustomPromptObject = PromptObject & {\n name: string;\n resolvedValue?: string | null;\n};\n\nexport type Answers = Record<string, string>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-expo-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "The script to create the Expo module",
|
|
5
5
|
"main": "build/create-expo-module.js",
|
|
6
6
|
"types": "build/create-expo-module.d.ts",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@types/prompts": "^2.4.9",
|
|
57
57
|
"expo-module-scripts": "^5.0.8"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "dd4e87727c4ef32ac5d8a7b5a42fd80da254140f"
|
|
60
60
|
}
|