create-react-native-library 0.61.0 → 0.62.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/bin/create-react-native-library +1 -1
  2. package/lib/package.json +69 -0
  3. package/lib/src/constants.d.ts +5 -0
  4. package/lib/src/constants.js +6 -0
  5. package/lib/src/constants.js.map +1 -0
  6. package/lib/src/exampleApp/dependencies.d.ts +8 -0
  7. package/lib/src/exampleApp/dependencies.js +34 -0
  8. package/lib/src/exampleApp/dependencies.js.map +1 -0
  9. package/lib/src/exampleApp/generateExampleApp.d.ts +6 -0
  10. package/lib/src/exampleApp/generateExampleApp.js +309 -0
  11. package/lib/src/exampleApp/generateExampleApp.js.map +1 -0
  12. package/lib/src/index.d.ts +1 -0
  13. package/lib/src/index.js +134 -0
  14. package/lib/src/index.js.map +1 -0
  15. package/lib/src/inform.d.ts +10 -0
  16. package/lib/src/inform.js +56 -0
  17. package/lib/src/inform.js.map +1 -0
  18. package/lib/src/prompt.d.ts +125 -0
  19. package/lib/src/prompt.js +325 -0
  20. package/lib/src/prompt.js.map +1 -0
  21. package/lib/src/template.d.ts +44 -0
  22. package/lib/src/template.js +258 -0
  23. package/lib/src/template.js.map +1 -0
  24. package/lib/src/utils/assert.d.ts +1 -0
  25. package/lib/src/utils/assert.js +17 -0
  26. package/lib/src/utils/assert.js.map +1 -0
  27. package/lib/src/utils/configureTools.d.ts +43 -0
  28. package/lib/src/utils/configureTools.js +122 -0
  29. package/lib/src/utils/configureTools.js.map +1 -0
  30. package/lib/src/utils/createMetadata.d.ts +4 -0
  31. package/lib/src/utils/createMetadata.js +23 -0
  32. package/lib/src/utils/createMetadata.js.map +1 -0
  33. package/lib/src/utils/initialCommit.d.ts +1 -0
  34. package/lib/src/utils/initialCommit.js +24 -0
  35. package/lib/src/utils/initialCommit.js.map +1 -0
  36. package/lib/src/utils/local.d.ts +5 -0
  37. package/lib/src/utils/local.js +49 -0
  38. package/lib/src/utils/local.js.map +1 -0
  39. package/lib/src/utils/packageManager.d.ts +1 -0
  40. package/lib/src/utils/packageManager.js +8 -0
  41. package/lib/src/utils/packageManager.js.map +1 -0
  42. package/lib/src/utils/resolveNpmPackageVersion.d.ts +1 -0
  43. package/lib/src/utils/resolveNpmPackageVersion.js +20 -0
  44. package/lib/src/utils/resolveNpmPackageVersion.js.map +1 -0
  45. package/lib/src/utils/sortObjectKeys.d.ts +1 -0
  46. package/lib/src/utils/sortObjectKeys.js +9 -0
  47. package/lib/src/utils/sortObjectKeys.js.map +1 -0
  48. package/lib/src/utils/spawn.d.ts +2 -0
  49. package/lib/src/utils/spawn.js +26 -0
  50. package/lib/src/utils/spawn.js.map +1 -0
  51. package/package.json +12 -10
  52. package/templates/common/$package.json +1 -1
  53. package/templates/common/tsconfig.json +0 -2
  54. package/templates/tools/eslint/~package.json +3 -3
  55. package/templates/tools/jest/~package.json +2 -2
  56. package/templates/tools/lefthook/~package.json +3 -3
  57. package/templates/tools/release-it/~package.json +2 -2
  58. package/templates/tools/turborepo/~package.json +1 -1
  59. package/templates/tools/vite/example/~package.json +1 -1
  60. package/templates/tools/vite/~package.json +1 -1
  61. package/lib/constants.js +0 -11
  62. package/lib/constants.js.map +0 -1
  63. package/lib/exampleApp/dependencies.js +0 -34
  64. package/lib/exampleApp/dependencies.js.map +0 -1
  65. package/lib/exampleApp/generateExampleApp.js +0 -209
  66. package/lib/exampleApp/generateExampleApp.js.map +0 -1
  67. package/lib/index.js +0 -129
  68. package/lib/index.js.map +0 -1
  69. package/lib/inform.js +0 -82
  70. package/lib/inform.js.map +0 -1
  71. package/lib/prompt.js +0 -307
  72. package/lib/prompt.js.map +0 -1
  73. package/lib/template.js +0 -258
  74. package/lib/template.js.map +0 -1
  75. package/lib/utils/assert.js +0 -22
  76. package/lib/utils/assert.js.map +0 -1
  77. package/lib/utils/configureTools.js +0 -137
  78. package/lib/utils/configureTools.js.map +0 -1
  79. package/lib/utils/createMetadata.js +0 -17
  80. package/lib/utils/createMetadata.js.map +0 -1
  81. package/lib/utils/initialCommit.js +0 -37
  82. package/lib/utils/initialCommit.js.map +0 -1
  83. package/lib/utils/local.js +0 -55
  84. package/lib/utils/local.js.map +0 -1
  85. package/lib/utils/packageManager.js +0 -13
  86. package/lib/utils/packageManager.js.map +0 -1
  87. package/lib/utils/resolveNpmPackageVersion.js +0 -22
  88. package/lib/utils/resolveNpmPackageVersion.js.map +0 -1
  89. package/lib/utils/sortObjectKeys.js +0 -15
  90. package/lib/utils/sortObjectKeys.js.map +0 -1
  91. package/lib/utils/spawn.js +0 -33
  92. package/lib/utils/spawn.js.map +0 -1
@@ -0,0 +1,56 @@
1
+ import path from 'node:path';
2
+ import dedent from 'dedent';
3
+ import kleur from 'kleur';
4
+ export function printNonLocalLibNextSteps(config) {
5
+ const platforms = {
6
+ ios: { name: 'iOS', color: 'cyan' },
7
+ android: { name: 'Android', color: 'green' },
8
+ ...(config.example === 'expo' || config.tools.includes('vite')
9
+ ? { web: { name: 'Web', color: 'blue' } }
10
+ : null),
11
+ };
12
+ console.log(dedent(`
13
+ ${kleur.magenta(`${kleur.bold('Get started')} with the project`)}${kleur.gray(':')}
14
+
15
+ ${kleur.gray('$')} yarn
16
+ ${Object.entries(platforms)
17
+ .map(([script, { name, color }]) => `
18
+ ${kleur[color](`Run the example app on ${kleur.bold(name)}`)}${kleur.gray(':')}
19
+
20
+ ${kleur.gray('$')} yarn example ${script}`)
21
+ .join('\n')}
22
+
23
+ ${kleur.yellow(`See ${kleur.bold('CONTRIBUTING.md')} for more details. Good luck!`)}
24
+ `));
25
+ }
26
+ export function printLocalLibNextSteps({ folder, config, linkedLocalLibrary, addedNitro, packageManager, }) {
27
+ console.log(dedent(`
28
+ ${kleur.magenta(`${kleur.bold('Get started')} with the project`)}${kleur.gray(':')}
29
+
30
+ ${(linkedLocalLibrary
31
+ ? `- Run ${kleur.blue(`${packageManager} install`)} to link the library\n`
32
+ : `- Link the library at ${kleur.blue(path.relative(process.cwd(), folder))} based on your project setup\n`) +
33
+ (config.project.moduleConfig === 'nitro-modules' && !addedNitro
34
+ ? `- Run ${kleur.blue(`${packageManager} add react-native-nitro-modules`)} to install nitro modules \n`
35
+ : '') +
36
+ `- Run ${kleur.blue('pod install --project-directory=ios')} to install dependencies with CocoaPods\n` +
37
+ `- Run ${kleur.blue('npx react-native run-android')} or ${kleur.blue('npx react-native run-ios')} to build and run the app\n` +
38
+ `- Import from ${kleur.blue(config.project.slug)} and use it in your app.`}
39
+
40
+ ${kleur.yellow(`Good luck!`)}
41
+ `));
42
+ }
43
+ export function printErrorHelp(message, error) {
44
+ console.log('\n');
45
+ if (message) {
46
+ console.log(message);
47
+ }
48
+ else {
49
+ console.log(`An unknown error occurred. See ${kleur.blue('--help')} for usage guide.`);
50
+ }
51
+ if (error) {
52
+ console.log('\n');
53
+ throw error;
54
+ }
55
+ }
56
+ //# sourceMappingURL=inform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inform.js","sourceRoot":"","sources":["../../src/inform.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,yBAAyB,CAAC,MAA6B;IACrE,MAAM,SAAS,GAAG;QAChB,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;QACnC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE;QAC5C,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5D,CAAC,CAAE,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAY;YACpD,CAAC,CAAC,IAAI,CAAC;KACD,CAAC;IAEX,OAAO,CAAC,G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Y,KAAK,eAAe,IAAI,CAAC,UAAU;YAC7D,CAAC,CAAC,SAAS,KAAK,CAAC,IAAI,CACjB,GAAG,cAAc,iCAAiC,CACnD,8BAA8B;YACjC,CAAC,CAAC,EAAE,CAAC;QACP,SAAS,KAAK,CAAC,IAAI,CACjB,qCAAqC,CACtC,2CAA2C;QAC5C,SAAS,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,OAAO,KAAK,CAAC,IAAI,CAClE,0BAA0B,CAC3B,6BAA6B;QAC9B,iBAAiB,KAAK,CAAC,IAAI,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CACpB,0BACH;;QAEE,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC;KAC7B,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,KAAY;IAC1D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAElB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,kCAAkC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAC1E,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAElB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,125 @@
1
+ export type Answers = NonNullable<Awaited<ReturnType<typeof prompt.show>>>;
2
+ export type ExampleApp = 'test-app' | 'expo' | 'vanilla' | undefined;
3
+ export type ProjectLanguages = 'kotlin-objc' | 'kotlin-swift' | 'cpp' | 'js';
4
+ export type ProjectType = 'turbo-module' | 'fabric-view' | 'nitro-module' | 'nitro-view' | 'library';
5
+ export declare const prompt: import("pigment").Prompt<["[name]"], {
6
+ readonly local: {
7
+ readonly type: "confirm";
8
+ readonly description: "Whether to create a local library";
9
+ readonly message: "Looks like you're under a project folder. Do you want to create a local library?";
10
+ readonly default: () => boolean;
11
+ readonly skip: () => boolean;
12
+ };
13
+ readonly directory: {
14
+ readonly type: "text";
15
+ readonly description: "Directory to create the library at";
16
+ readonly message: "Where do you want to create the library?";
17
+ readonly default: () => string | undefined;
18
+ readonly validate: (input: string) => true | "Cannot be empty" | "Path exists and is not a directory" | "Directory already exists and is not empty";
19
+ readonly skip: () => boolean;
20
+ };
21
+ readonly slug: {
22
+ readonly type: "text";
23
+ readonly description: "Name of the npm package";
24
+ readonly message: "What do you want to name the npm package?";
25
+ readonly default: () => string | undefined;
26
+ readonly validate: (input: string) => true | "Must be a valid npm package name";
27
+ readonly required: true;
28
+ };
29
+ readonly description: {
30
+ readonly type: "text";
31
+ readonly description: "Description of the npm package";
32
+ readonly message: "How would you describe the package?";
33
+ readonly validate: (input: string) => true | "Cannot be empty";
34
+ readonly required: true;
35
+ };
36
+ readonly authorName: {
37
+ readonly type: "text";
38
+ readonly description: "Name of the package author";
39
+ readonly message: "What is the name of the package author?";
40
+ readonly default: () => Promise<string | undefined>;
41
+ readonly validate: (input: string) => true | "Cannot be empty";
42
+ readonly skip: () => boolean;
43
+ };
44
+ readonly authorEmail: {
45
+ readonly type: "text";
46
+ readonly description: "Email address of the package author";
47
+ readonly message: "What is the email address of the package author?";
48
+ readonly default: () => Promise<string | undefined>;
49
+ readonly validate: (input: string) => true | "Must be a valid email address";
50
+ readonly skip: () => boolean;
51
+ };
52
+ readonly authorUrl: {
53
+ readonly type: "text";
54
+ readonly description: "Profile URL of the package author";
55
+ readonly message: "What is the profile URL for the package author?";
56
+ readonly default: () => Promise<string | undefined>;
57
+ readonly validate: (input: string) => true | "Must be a valid URL";
58
+ readonly skip: () => boolean;
59
+ };
60
+ readonly repoUrl: {
61
+ readonly type: "text";
62
+ readonly description: "Repository URL of the package";
63
+ readonly message: "What is the repository URL for the package?";
64
+ readonly default: () => string | undefined;
65
+ readonly validate: (input: string) => true | "Must be a valid URL";
66
+ readonly skip: () => boolean;
67
+ };
68
+ readonly type: {
69
+ readonly type: "select";
70
+ readonly description: "Type of library you want to develop";
71
+ readonly message: "What type of library do you want to develop?";
72
+ readonly choices: {
73
+ title: string;
74
+ value: ProjectType;
75
+ description: string;
76
+ }[];
77
+ readonly required: true;
78
+ };
79
+ readonly languages: {
80
+ readonly type: "select";
81
+ readonly description: "Languages to use for native code";
82
+ readonly message: "Which language do you want to use for native code?";
83
+ readonly choices: {
84
+ title: string;
85
+ value: ProjectLanguages;
86
+ description: string | undefined;
87
+ skip: () => boolean;
88
+ }[];
89
+ readonly required: true;
90
+ };
91
+ readonly example: {
92
+ readonly type: "select";
93
+ readonly description: "Type of the example app to create";
94
+ readonly message: "What type of example app do you want to create?";
95
+ readonly choices: {
96
+ title: "App with Community CLI" | "App with Expo CLI" | "Test App by Microsoft";
97
+ value: "test-app" | "expo" | "vanilla";
98
+ description: "Classic React Native app with native code access" | "Managed Expo app for easier upgrades" | "Test app with app's native code abstracted";
99
+ skip: () => boolean;
100
+ }[];
101
+ readonly required: true;
102
+ readonly skip: () => boolean;
103
+ };
104
+ readonly tools: {
105
+ readonly type: "multiselect";
106
+ readonly description: "Additional tools to configure";
107
+ readonly message: "Which tools do you want to configure?";
108
+ readonly choices: {
109
+ value: string;
110
+ title: string;
111
+ description: string;
112
+ skip: () => boolean;
113
+ }[];
114
+ readonly default: () => string[];
115
+ readonly required: true;
116
+ readonly skip: () => boolean;
117
+ };
118
+ readonly reactNativeVersion: {
119
+ readonly type: "text";
120
+ readonly description: "Version of React Native to use in the example app";
121
+ readonly message: "Which version of React Native do you want to use in the example app?";
122
+ readonly validate: (input: string) => true | "Must be a valid version";
123
+ readonly skip: true;
124
+ };
125
+ }>;
@@ -0,0 +1,325 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import githubUsername from 'github-username';
4
+ import { create } from 'pigment';
5
+ import validateNpmPackage from 'validate-npm-package-name';
6
+ import { AVAILABLE_TOOLS } from "./utils/configureTools.js";
7
+ import { spawn } from "./utils/spawn.js";
8
+ const TYPE_CHOICES = [
9
+ {
10
+ title: 'Turbo module',
11
+ value: 'turbo-module',
12
+ description: 'Integration for native APIs to JS',
13
+ },
14
+ {
15
+ title: 'Fabric view',
16
+ value: 'fabric-view',
17
+ description: 'Integration for native views to JS',
18
+ },
19
+ {
20
+ title: 'Nitro module',
21
+ value: 'nitro-module',
22
+ description: 'Type-safe, fast integration for native APIs to JS',
23
+ },
24
+ {
25
+ title: 'Nitro view',
26
+ value: 'nitro-view',
27
+ description: 'Integration for native views to JS using nitro',
28
+ },
29
+ {
30
+ title: 'JavaScript library',
31
+ value: 'library',
32
+ description: 'Plain JavaScript library with Web support',
33
+ },
34
+ ];
35
+ const LANGUAGE_CHOICES = [
36
+ {
37
+ title: 'Kotlin & Swift',
38
+ value: 'kotlin-swift',
39
+ types: ['nitro-module', 'nitro-view'],
40
+ },
41
+ {
42
+ title: 'Kotlin & Objective-C',
43
+ value: 'kotlin-objc',
44
+ types: ['turbo-module', 'fabric-view'],
45
+ },
46
+ {
47
+ title: 'C++ (Experimental)',
48
+ value: 'cpp',
49
+ types: ['turbo-module'],
50
+ },
51
+ {
52
+ title: 'JavaScript for Android, iOS & Web',
53
+ value: 'js',
54
+ types: ['library'],
55
+ },
56
+ ];
57
+ const EXAMPLE_CHOICES = [
58
+ {
59
+ title: 'App with Community CLI',
60
+ value: 'vanilla',
61
+ description: 'Classic React Native app with native code access',
62
+ },
63
+ {
64
+ title: 'App with Expo CLI',
65
+ value: 'expo',
66
+ description: 'Managed Expo app for easier upgrades',
67
+ },
68
+ {
69
+ title: 'Test App by Microsoft',
70
+ value: 'test-app',
71
+ description: "Test app with app's native code abstracted",
72
+ },
73
+ ];
74
+ const validateDirectory = (input) => {
75
+ if (!input) {
76
+ return 'Cannot be empty';
77
+ }
78
+ const targetPath = path.join(process.cwd(), input);
79
+ if (!fs.existsSync(targetPath)) {
80
+ return true;
81
+ }
82
+ const stat = fs.statSync(targetPath);
83
+ if (!stat.isDirectory()) {
84
+ return 'Path exists and is not a directory';
85
+ }
86
+ const files = fs.readdirSync(targetPath);
87
+ const isEmpty = files.length === 0 || (files.length === 1 && files[0] === '.git');
88
+ if (!isEmpty) {
89
+ return 'Directory already exists and is not empty';
90
+ }
91
+ return true;
92
+ };
93
+ const getGitConfig = async (key) => {
94
+ try {
95
+ const value = await spawn('git', ['config', '--get', key]);
96
+ return value.trim();
97
+ }
98
+ catch {
99
+ return undefined;
100
+ }
101
+ };
102
+ const isInPackage = () => {
103
+ try {
104
+ const stat = fs.statSync(path.resolve(process.cwd(), 'package.json'));
105
+ return stat.isFile();
106
+ }
107
+ catch {
108
+ return false;
109
+ }
110
+ };
111
+ export const prompt = create(['[name]'], {
112
+ local: {
113
+ type: 'confirm',
114
+ description: 'Whether to create a local library',
115
+ message: `Looks like you're under a project folder. Do you want to create a local library?`,
116
+ default: isInPackage,
117
+ skip: () => !isInPackage(),
118
+ },
119
+ directory: {
120
+ type: 'text',
121
+ description: 'Directory to create the library at',
122
+ message: 'Where do you want to create the library?',
123
+ default: () => {
124
+ const answers = prompt.read();
125
+ if (answers.name == null) {
126
+ return undefined;
127
+ }
128
+ if (answers.local && !answers.name?.includes(path.sep)) {
129
+ return path.join('modules', answers.name);
130
+ }
131
+ return answers.name;
132
+ },
133
+ validate: validateDirectory,
134
+ skip: () => {
135
+ const answers = prompt.read();
136
+ if (answers.name &&
137
+ !answers.local &&
138
+ validateDirectory(answers.name) === true) {
139
+ return true;
140
+ }
141
+ return false;
142
+ },
143
+ },
144
+ slug: {
145
+ type: 'text',
146
+ description: 'Name of the npm package',
147
+ message: 'What do you want to name the npm package?',
148
+ default: () => {
149
+ const answers = prompt.read();
150
+ const value = typeof answers.directory === 'string'
151
+ ? answers.directory
152
+ : answers.name;
153
+ if (typeof value !== 'string') {
154
+ return undefined;
155
+ }
156
+ const basename = path.basename(value);
157
+ if (validateNpmPackage(basename).validForNewPackages) {
158
+ if (/^(@|react-native)/.test(basename)) {
159
+ return basename;
160
+ }
161
+ return `react-native-${basename}`;
162
+ }
163
+ return undefined;
164
+ },
165
+ validate: (input) => validateNpmPackage(input).validForNewPackages ||
166
+ 'Must be a valid npm package name',
167
+ required: true,
168
+ },
169
+ description: {
170
+ type: 'text',
171
+ description: 'Description of the npm package',
172
+ message: 'How would you describe the package?',
173
+ validate: (input) => Boolean(input) || 'Cannot be empty',
174
+ required: true,
175
+ },
176
+ authorName: {
177
+ type: 'text',
178
+ description: 'Name of the package author',
179
+ message: 'What is the name of the package author?',
180
+ default: async () => getGitConfig('user.name'),
181
+ validate: (input) => Boolean(input) || 'Cannot be empty',
182
+ skip: () => prompt.read().local === true,
183
+ },
184
+ authorEmail: {
185
+ type: 'text',
186
+ description: 'Email address of the package author',
187
+ message: 'What is the email address of the package author?',
188
+ default: async () => getGitConfig('user.email'),
189
+ validate: (input) => /^\S+@\S+$/.test(input) || 'Must be a valid email address',
190
+ skip: () => prompt.read().local === true,
191
+ },
192
+ authorUrl: {
193
+ type: 'text',
194
+ description: 'Profile URL of the package author',
195
+ message: 'What is the profile URL for the package author?',
196
+ default: async () => {
197
+ const answers = prompt.read();
198
+ if (typeof answers.authorEmail !== 'string') {
199
+ return undefined;
200
+ }
201
+ try {
202
+ const username = await githubUsername(answers.authorEmail);
203
+ if (username) {
204
+ return `https://github.com/${username}`;
205
+ }
206
+ }
207
+ catch (e) {
208
+ // Ignore error
209
+ }
210
+ return undefined;
211
+ },
212
+ validate: (input) => /^https?:\/\//.test(input) || 'Must be a valid URL',
213
+ skip: () => prompt.read().local === true,
214
+ },
215
+ repoUrl: {
216
+ type: 'text',
217
+ description: 'Repository URL of the package',
218
+ message: 'What is the repository URL for the package?',
219
+ default: () => {
220
+ const answers = prompt.read();
221
+ if (typeof answers.authorUrl === 'string' &&
222
+ typeof answers.slug === 'string' &&
223
+ /^https?:\/\/github.com\/[^/]+/.test(answers.authorUrl)) {
224
+ return `${answers.authorUrl}/${answers.slug
225
+ .replace(/^@/, '')
226
+ .replace(/\//g, '-')}`;
227
+ }
228
+ return undefined;
229
+ },
230
+ validate: (input) => /^https?:\/\//.test(input) || 'Must be a valid URL',
231
+ skip: () => prompt.read().local === true,
232
+ },
233
+ type: {
234
+ type: 'select',
235
+ description: 'Type of library you want to develop',
236
+ message: 'What type of library do you want to develop?',
237
+ choices: TYPE_CHOICES,
238
+ required: true,
239
+ },
240
+ languages: {
241
+ type: 'select',
242
+ description: 'Languages to use for native code',
243
+ message: 'Which language do you want to use for native code?',
244
+ choices: LANGUAGE_CHOICES.map((choice) => ({
245
+ title: choice.title,
246
+ value: choice.value,
247
+ description: choice.description,
248
+ skip: () => {
249
+ const answers = prompt.read();
250
+ if (choice.value === 'cpp' && answers.local === true) {
251
+ return true;
252
+ }
253
+ if (typeof answers.type === 'string') {
254
+ return !choice.types.includes(answers.type);
255
+ }
256
+ return false;
257
+ },
258
+ })),
259
+ required: true,
260
+ },
261
+ example: {
262
+ type: 'select',
263
+ description: 'Type of the example app to create',
264
+ message: 'What type of example app do you want to create?',
265
+ choices: EXAMPLE_CHOICES.map((choice) => ({
266
+ title: choice.title,
267
+ value: choice.value,
268
+ description: choice.description,
269
+ skip: () => {
270
+ const answers = prompt.read();
271
+ if (answers.languages === 'cpp') {
272
+ return choice.value !== 'vanilla';
273
+ }
274
+ return false;
275
+ },
276
+ })),
277
+ required: true,
278
+ skip: () => {
279
+ const answers = prompt.read();
280
+ return answers.local === true;
281
+ },
282
+ },
283
+ tools: {
284
+ type: 'multiselect',
285
+ description: 'Additional tools to configure',
286
+ message: 'Which tools do you want to configure?',
287
+ choices: Object.entries(AVAILABLE_TOOLS).map(([key, tool]) => ({
288
+ value: key,
289
+ title: tool.name,
290
+ description: tool.description,
291
+ skip: () => {
292
+ if ('condition' in tool && tool.condition) {
293
+ return !tool.condition({ example: prompt.read().example });
294
+ }
295
+ return false;
296
+ },
297
+ })),
298
+ default: () => {
299
+ const answers = prompt.read();
300
+ return Object.entries(AVAILABLE_TOOLS)
301
+ .filter(([, tool]) => {
302
+ if ('condition' in tool && tool.condition) {
303
+ return tool.condition({ example: answers.example });
304
+ }
305
+ return true;
306
+ })
307
+ .map(([key]) => key);
308
+ },
309
+ required: true,
310
+ skip: () => {
311
+ const answers = prompt.read();
312
+ return answers.local === true;
313
+ },
314
+ },
315
+ reactNativeVersion: {
316
+ type: 'text',
317
+ description: 'Version of React Native to use in the example app',
318
+ message: 'Which version of React Native do you want to use in the example app?',
319
+ validate: (input) => input === 'latest' ||
320
+ /^\d+\.\d+(?:\.\d+)?(?:-.+)?$/.test(input) ||
321
+ 'Must be a valid version',
322
+ skip: true,
323
+ },
324
+ });
325
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAezC,MAAM,YAAY,GAIZ;IACJ;QACE,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,mCAAmC;KACjD;IACD;QACE,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,oCAAoC;KAClD;IACD;QACE,KAAK,EAAE,cAAc;QACrB,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,mDAAmD;KACjE;IACD;QACE,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,gDAAgD;KAC9D;IACD;QACE,KAAK,EAAE,oBAAoB;QAC3B,KAAK,EA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CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC7D,CAAC;gBAED,OAAO,KAAK,CAAC;YACf,CAAC;SACF,CAAC,CAAC;QACH,OAAO,EAAE,GAAa,EAAE;YACtB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAE9B,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;iBACnC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE;gBACnB,IAAI,WAAW,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;oBAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;gBACtD,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;iBACD,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QACD,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,GAAY,EAAE;YAClB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;YAE9B,OAAO,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC;QAChC,CAAC;KACF;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,mDAAmD;QAChE,OAAO,EACL,sEAAsE;QACxE,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,KAAK,KAAK,QAAQ;YAClB,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC;YAC1C,yBAAyB;QAC3B,IAAI,EAAE,IAAI;KACX;CACF,CAAC,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { Answers, ExampleApp } from './prompt.ts';
2
+ export type TemplateVersions = {
3
+ bob: string;
4
+ nitro: string | undefined;
5
+ };
6
+ export type ModuleConfig = 'native-modules' | 'turbo-modules' | 'nitro-modules' | null;
7
+ export type ViewConfig = 'paper-view' | 'fabric-view' | 'nitro-view' | null;
8
+ export type TemplateConfiguration = {
9
+ versions: TemplateVersions;
10
+ project: {
11
+ slug: string;
12
+ description: string;
13
+ name: string;
14
+ package: string;
15
+ package_dir: string;
16
+ package_cpp: string;
17
+ identifier: string;
18
+ native: boolean;
19
+ cpp: boolean;
20
+ swift: boolean;
21
+ viewConfig: ViewConfig;
22
+ moduleConfig: ModuleConfig;
23
+ };
24
+ author: {
25
+ name: string;
26
+ email: string;
27
+ url: string;
28
+ };
29
+ /** Git repo URL */
30
+ repo: string;
31
+ example: ExampleApp;
32
+ year: number;
33
+ tools: string[];
34
+ };
35
+ export declare function generateTemplateConfiguration({ versions, basename, answers, }: {
36
+ versions: TemplateVersions;
37
+ basename: string;
38
+ answers: Answers;
39
+ }): TemplateConfiguration;
40
+ export declare function applyTemplates(answers: Answers, config: TemplateConfiguration, folder: string): Promise<void>;
41
+ /**
42
+ * This copies the template files and renders them via ejs
43
+ */
44
+ export declare function applyTemplate(config: TemplateConfiguration, source: string, destination: string): Promise<void>;