create-react-native-library 0.62.0 → 0.62.2
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/bin/create-react-native-library +1 -1
- package/lib/package.json +69 -0
- package/lib/src/constants.d.ts +5 -0
- package/lib/src/constants.js +6 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/exampleApp/dependencies.d.ts +8 -0
- package/lib/src/exampleApp/dependencies.js +34 -0
- package/lib/src/exampleApp/dependencies.js.map +1 -0
- package/lib/src/exampleApp/generateExampleApp.d.ts +6 -0
- package/lib/src/exampleApp/generateExampleApp.js +309 -0
- package/lib/src/exampleApp/generateExampleApp.js.map +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +137 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/inform.d.ts +10 -0
- package/lib/src/inform.js +56 -0
- package/lib/src/inform.js.map +1 -0
- package/lib/src/prompt.d.ts +130 -0
- package/lib/src/prompt.js +349 -0
- package/lib/src/prompt.js.map +1 -0
- package/lib/src/template.d.ts +44 -0
- package/lib/src/template.js +279 -0
- package/lib/src/template.js.map +1 -0
- package/lib/src/utils/assert.d.ts +1 -0
- package/lib/src/utils/assert.js +17 -0
- package/lib/src/utils/assert.js.map +1 -0
- package/lib/src/utils/configureTools.d.ts +43 -0
- package/lib/src/utils/configureTools.js +122 -0
- package/lib/src/utils/configureTools.js.map +1 -0
- package/lib/src/utils/createMetadata.d.ts +4 -0
- package/lib/src/utils/createMetadata.js +23 -0
- package/lib/src/utils/createMetadata.js.map +1 -0
- package/lib/src/utils/initialCommit.d.ts +1 -0
- package/lib/src/utils/initialCommit.js +24 -0
- package/lib/src/utils/initialCommit.js.map +1 -0
- package/lib/src/utils/local.d.ts +5 -0
- package/lib/src/utils/local.js +49 -0
- package/lib/src/utils/local.js.map +1 -0
- package/lib/src/utils/packageManager.d.ts +1 -0
- package/lib/src/utils/packageManager.js +8 -0
- package/lib/src/utils/packageManager.js.map +1 -0
- package/lib/src/utils/resolveNpmPackageVersion.d.ts +1 -0
- package/lib/src/utils/resolveNpmPackageVersion.js +20 -0
- package/lib/src/utils/resolveNpmPackageVersion.js.map +1 -0
- package/lib/src/utils/sortObjectKeys.d.ts +1 -0
- package/lib/src/utils/sortObjectKeys.js +9 -0
- package/lib/src/utils/sortObjectKeys.js.map +1 -0
- package/lib/src/utils/spawn.d.ts +2 -0
- package/lib/src/utils/spawn.js +26 -0
- package/lib/src/utils/spawn.js.map +1 -0
- package/package.json +12 -10
- package/templates/common/$package.json +1 -1
- package/templates/common/tsconfig.json +0 -2
- package/templates/common-local/$package.json +13 -1
- package/templates/native-common/android/build.gradle +33 -43
- package/templates/tools/eslint/~package.json +3 -3
- package/templates/tools/jest/~package.json +2 -2
- package/templates/tools/lefthook/~package.json +3 -3
- package/templates/tools/release-it/~package.json +2 -2
- package/templates/tools/turborepo/~package.json +1 -1
- package/templates/tools/vite/example/~package.json +1 -1
- package/templates/tools/vite/~package.json +1 -1
- package/lib/constants.js +0 -12
- package/lib/constants.js.map +0 -1
- package/lib/exampleApp/dependencies.js +0 -34
- package/lib/exampleApp/dependencies.js.map +0 -1
- package/lib/exampleApp/generateExampleApp.js +0 -249
- package/lib/exampleApp/generateExampleApp.js.map +0 -1
- package/lib/index.js +0 -130
- package/lib/index.js.map +0 -1
- package/lib/inform.js +0 -72
- package/lib/inform.js.map +0 -1
- package/lib/prompt.js +0 -305
- package/lib/prompt.js.map +0 -1
- package/lib/template.js +0 -258
- package/lib/template.js.map +0 -1
- package/lib/utils/assert.js +0 -22
- package/lib/utils/assert.js.map +0 -1
- package/lib/utils/configureTools.js +0 -137
- package/lib/utils/configureTools.js.map +0 -1
- package/lib/utils/createMetadata.js +0 -17
- package/lib/utils/createMetadata.js.map +0 -1
- package/lib/utils/initialCommit.js +0 -37
- package/lib/utils/initialCommit.js.map +0 -1
- package/lib/utils/local.js +0 -55
- package/lib/utils/local.js.map +0 -1
- package/lib/utils/packageManager.js +0 -13
- package/lib/utils/packageManager.js.map +0 -1
- package/lib/utils/resolveNpmPackageVersion.js +0 -22
- package/lib/utils/resolveNpmPackageVersion.js.map +0 -1
- package/lib/utils/sortObjectKeys.js +0 -15
- package/lib/utils/sortObjectKeys.js.map +0 -1
- package/lib/utils/spawn.js +0 -33
- package/lib/utils/spawn.js.map +0 -1
package/lib/prompt.js
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.prompt = void 0;
|
|
7
|
-
var _nodeFs = _interopRequireDefault(require("node:fs"));
|
|
8
|
-
var _nodePath = _interopRequireDefault(require("node:path"));
|
|
9
|
-
var _pigment = require("pigment");
|
|
10
|
-
var _validateNpmPackageName = _interopRequireDefault(require("validate-npm-package-name"));
|
|
11
|
-
var _spawn = require("./utils/spawn");
|
|
12
|
-
var _githubUsername = _interopRequireDefault(require("github-username"));
|
|
13
|
-
var _configureTools = require("./utils/configureTools");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const TYPE_CHOICES = [{
|
|
16
|
-
title: 'Turbo module',
|
|
17
|
-
value: 'turbo-module',
|
|
18
|
-
description: 'Integration for native APIs to JS'
|
|
19
|
-
}, {
|
|
20
|
-
title: 'Fabric view',
|
|
21
|
-
value: 'fabric-view',
|
|
22
|
-
description: 'Integration for native views to JS'
|
|
23
|
-
}, {
|
|
24
|
-
title: 'Nitro module',
|
|
25
|
-
value: 'nitro-module',
|
|
26
|
-
description: 'Type-safe, fast integration for native APIs to JS'
|
|
27
|
-
}, {
|
|
28
|
-
title: 'Nitro view',
|
|
29
|
-
value: 'nitro-view',
|
|
30
|
-
description: 'Integration for native views to JS using nitro'
|
|
31
|
-
}, {
|
|
32
|
-
title: 'JavaScript library',
|
|
33
|
-
value: 'library',
|
|
34
|
-
description: 'Plain JavaScript library with Web support'
|
|
35
|
-
}];
|
|
36
|
-
const LANGUAGE_CHOICES = [{
|
|
37
|
-
title: 'Kotlin & Swift',
|
|
38
|
-
value: 'kotlin-swift',
|
|
39
|
-
types: ['nitro-module', 'nitro-view']
|
|
40
|
-
}, {
|
|
41
|
-
title: 'Kotlin & Objective-C',
|
|
42
|
-
value: 'kotlin-objc',
|
|
43
|
-
types: ['turbo-module', 'fabric-view']
|
|
44
|
-
}, {
|
|
45
|
-
title: 'C++ (Experimental)',
|
|
46
|
-
value: 'cpp',
|
|
47
|
-
types: ['turbo-module']
|
|
48
|
-
}, {
|
|
49
|
-
title: 'JavaScript for Android, iOS & Web',
|
|
50
|
-
value: 'js',
|
|
51
|
-
types: ['library']
|
|
52
|
-
}];
|
|
53
|
-
const EXAMPLE_CHOICES = [{
|
|
54
|
-
title: 'App with Community CLI',
|
|
55
|
-
value: 'vanilla',
|
|
56
|
-
description: 'Classic React Native app with native code access'
|
|
57
|
-
}, {
|
|
58
|
-
title: 'App with Expo CLI',
|
|
59
|
-
value: 'expo',
|
|
60
|
-
description: 'Managed Expo app for easier upgrades'
|
|
61
|
-
}, {
|
|
62
|
-
title: 'Test App by Microsoft',
|
|
63
|
-
value: 'test-app',
|
|
64
|
-
description: "Test app with app's native code abstracted"
|
|
65
|
-
}];
|
|
66
|
-
const validateDirectory = input => {
|
|
67
|
-
if (!input) {
|
|
68
|
-
return 'Cannot be empty';
|
|
69
|
-
}
|
|
70
|
-
const targetPath = _nodePath.default.join(process.cwd(), input);
|
|
71
|
-
if (!_nodeFs.default.existsSync(targetPath)) {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
const stat = _nodeFs.default.statSync(targetPath);
|
|
75
|
-
if (!stat.isDirectory()) {
|
|
76
|
-
return 'Path exists and is not a directory';
|
|
77
|
-
}
|
|
78
|
-
const files = _nodeFs.default.readdirSync(targetPath);
|
|
79
|
-
const isEmpty = files.length === 0 || files.length === 1 && files[0] === '.git';
|
|
80
|
-
if (!isEmpty) {
|
|
81
|
-
return 'Directory already exists and is not empty';
|
|
82
|
-
}
|
|
83
|
-
return true;
|
|
84
|
-
};
|
|
85
|
-
const getGitConfig = async key => {
|
|
86
|
-
try {
|
|
87
|
-
const value = await (0, _spawn.spawn)('git', ['config', '--get', key]);
|
|
88
|
-
return value.trim();
|
|
89
|
-
} catch {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const isInPackage = () => {
|
|
94
|
-
try {
|
|
95
|
-
const stat = _nodeFs.default.statSync(_nodePath.default.resolve(process.cwd(), 'package.json'));
|
|
96
|
-
return stat.isFile();
|
|
97
|
-
} catch {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
const prompt = exports.prompt = (0, _pigment.create)(['[name]'], {
|
|
102
|
-
local: {
|
|
103
|
-
type: 'confirm',
|
|
104
|
-
description: 'Whether to create a local library',
|
|
105
|
-
message: `Looks like you're under a project folder. Do you want to create a local library?`,
|
|
106
|
-
default: isInPackage,
|
|
107
|
-
skip: () => !isInPackage()
|
|
108
|
-
},
|
|
109
|
-
directory: {
|
|
110
|
-
type: 'text',
|
|
111
|
-
description: 'Directory to create the library at',
|
|
112
|
-
message: 'Where do you want to create the library?',
|
|
113
|
-
default: () => {
|
|
114
|
-
const answers = prompt.read();
|
|
115
|
-
if (answers.name == null) {
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
if (answers.local && !answers.name?.includes(_nodePath.default.sep)) {
|
|
119
|
-
return _nodePath.default.join('modules', answers.name);
|
|
120
|
-
}
|
|
121
|
-
return answers.name;
|
|
122
|
-
},
|
|
123
|
-
validate: validateDirectory,
|
|
124
|
-
skip: () => {
|
|
125
|
-
const answers = prompt.read();
|
|
126
|
-
if (answers.name && !answers.local && validateDirectory(answers.name) === true) {
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
slug: {
|
|
133
|
-
type: 'text',
|
|
134
|
-
description: 'Name of the npm package',
|
|
135
|
-
message: 'What do you want to name the npm package?',
|
|
136
|
-
default: () => {
|
|
137
|
-
const answers = prompt.read();
|
|
138
|
-
const value = typeof answers.directory === 'string' ? answers.directory : answers.name;
|
|
139
|
-
if (typeof value !== 'string') {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
const basename = _nodePath.default.basename(value);
|
|
143
|
-
if ((0, _validateNpmPackageName.default)(basename).validForNewPackages) {
|
|
144
|
-
if (/^(@|react-native)/.test(basename)) {
|
|
145
|
-
return basename;
|
|
146
|
-
}
|
|
147
|
-
return `react-native-${basename}`;
|
|
148
|
-
}
|
|
149
|
-
return undefined;
|
|
150
|
-
},
|
|
151
|
-
validate: input => (0, _validateNpmPackageName.default)(input).validForNewPackages || 'Must be a valid npm package name',
|
|
152
|
-
required: true
|
|
153
|
-
},
|
|
154
|
-
description: {
|
|
155
|
-
type: 'text',
|
|
156
|
-
description: 'Description of the npm package',
|
|
157
|
-
message: 'How would you describe the package?',
|
|
158
|
-
validate: input => Boolean(input) || 'Cannot be empty',
|
|
159
|
-
required: true
|
|
160
|
-
},
|
|
161
|
-
authorName: {
|
|
162
|
-
type: 'text',
|
|
163
|
-
description: 'Name of the package author',
|
|
164
|
-
message: 'What is the name of the package author?',
|
|
165
|
-
default: async () => getGitConfig('user.name'),
|
|
166
|
-
validate: input => Boolean(input) || 'Cannot be empty',
|
|
167
|
-
skip: () => prompt.read().local === true
|
|
168
|
-
},
|
|
169
|
-
authorEmail: {
|
|
170
|
-
type: 'text',
|
|
171
|
-
description: 'Email address of the package author',
|
|
172
|
-
message: 'What is the email address of the package author?',
|
|
173
|
-
default: async () => getGitConfig('user.email'),
|
|
174
|
-
validate: input => /^\S+@\S+$/.test(input) || 'Must be a valid email address',
|
|
175
|
-
skip: () => prompt.read().local === true
|
|
176
|
-
},
|
|
177
|
-
authorUrl: {
|
|
178
|
-
type: 'text',
|
|
179
|
-
description: 'Profile URL of the package author',
|
|
180
|
-
message: 'What is the profile URL for the package author?',
|
|
181
|
-
default: async () => {
|
|
182
|
-
const answers = prompt.read();
|
|
183
|
-
if (typeof answers.authorEmail !== 'string') {
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
try {
|
|
187
|
-
const username = await (0, _githubUsername.default)(answers.authorEmail);
|
|
188
|
-
if (username) {
|
|
189
|
-
return `https://github.com/${username}`;
|
|
190
|
-
}
|
|
191
|
-
} catch (e) {
|
|
192
|
-
// Ignore error
|
|
193
|
-
}
|
|
194
|
-
return undefined;
|
|
195
|
-
},
|
|
196
|
-
validate: input => /^https?:\/\//.test(input) || 'Must be a valid URL',
|
|
197
|
-
skip: () => prompt.read().local === true
|
|
198
|
-
},
|
|
199
|
-
repoUrl: {
|
|
200
|
-
type: 'text',
|
|
201
|
-
description: 'Repository URL of the package',
|
|
202
|
-
message: 'What is the repository URL for the package?',
|
|
203
|
-
default: () => {
|
|
204
|
-
const answers = prompt.read();
|
|
205
|
-
if (typeof answers.authorUrl === 'string' && typeof answers.slug === 'string' && /^https?:\/\/github.com\/[^/]+/.test(answers.authorUrl)) {
|
|
206
|
-
return `${answers.authorUrl}/${answers.slug.replace(/^@/, '').replace(/\//g, '-')}`;
|
|
207
|
-
}
|
|
208
|
-
return undefined;
|
|
209
|
-
},
|
|
210
|
-
validate: input => /^https?:\/\//.test(input) || 'Must be a valid URL',
|
|
211
|
-
skip: () => prompt.read().local === true
|
|
212
|
-
},
|
|
213
|
-
type: {
|
|
214
|
-
type: 'select',
|
|
215
|
-
description: 'Type of library you want to develop',
|
|
216
|
-
message: 'What type of library do you want to develop?',
|
|
217
|
-
choices: TYPE_CHOICES,
|
|
218
|
-
required: true
|
|
219
|
-
},
|
|
220
|
-
languages: {
|
|
221
|
-
type: 'select',
|
|
222
|
-
description: 'Languages to use for native code',
|
|
223
|
-
message: 'Which language do you want to use for native code?',
|
|
224
|
-
choices: LANGUAGE_CHOICES.map(choice => ({
|
|
225
|
-
title: choice.title,
|
|
226
|
-
value: choice.value,
|
|
227
|
-
description: choice.description,
|
|
228
|
-
skip: () => {
|
|
229
|
-
const answers = prompt.read();
|
|
230
|
-
if (choice.value === 'cpp' && answers.local === true) {
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
if (typeof answers.type === 'string') {
|
|
234
|
-
return !choice.types.includes(answers.type);
|
|
235
|
-
}
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
})),
|
|
239
|
-
required: true
|
|
240
|
-
},
|
|
241
|
-
example: {
|
|
242
|
-
type: 'select',
|
|
243
|
-
description: 'Type of the example app to create',
|
|
244
|
-
message: 'What type of example app do you want to create?',
|
|
245
|
-
choices: EXAMPLE_CHOICES.map(choice => ({
|
|
246
|
-
title: choice.title,
|
|
247
|
-
value: choice.value,
|
|
248
|
-
description: choice.description,
|
|
249
|
-
skip: () => {
|
|
250
|
-
const answers = prompt.read();
|
|
251
|
-
if (answers.languages === 'cpp') {
|
|
252
|
-
return choice.value !== 'vanilla';
|
|
253
|
-
}
|
|
254
|
-
return false;
|
|
255
|
-
}
|
|
256
|
-
})),
|
|
257
|
-
required: true,
|
|
258
|
-
skip: () => {
|
|
259
|
-
const answers = prompt.read();
|
|
260
|
-
return answers.local === true;
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
tools: {
|
|
264
|
-
type: 'multiselect',
|
|
265
|
-
description: 'Additional tools to configure',
|
|
266
|
-
message: 'Which tools do you want to configure?',
|
|
267
|
-
choices: Object.entries(_configureTools.AVAILABLE_TOOLS).map(([key, tool]) => ({
|
|
268
|
-
value: key,
|
|
269
|
-
title: tool.name,
|
|
270
|
-
description: tool.description,
|
|
271
|
-
skip: () => {
|
|
272
|
-
if ('condition' in tool && tool.condition) {
|
|
273
|
-
return !tool.condition({
|
|
274
|
-
example: prompt.read().example
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
|
-
})),
|
|
280
|
-
default: () => {
|
|
281
|
-
const answers = prompt.read();
|
|
282
|
-
return Object.entries(_configureTools.AVAILABLE_TOOLS).filter(([, tool]) => {
|
|
283
|
-
if ('condition' in tool && tool.condition) {
|
|
284
|
-
return tool.condition({
|
|
285
|
-
example: answers.example
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
return true;
|
|
289
|
-
}).map(([key]) => key);
|
|
290
|
-
},
|
|
291
|
-
required: true,
|
|
292
|
-
skip: () => {
|
|
293
|
-
const answers = prompt.read();
|
|
294
|
-
return answers.local === true;
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
reactNativeVersion: {
|
|
298
|
-
type: 'text',
|
|
299
|
-
description: 'Version of React Native to use in the example app',
|
|
300
|
-
message: 'Which version of React Native do you want to use in the example app?',
|
|
301
|
-
validate: input => input === 'latest' || /^\d+\.\d+(?:\.\d+)?(?:-.+)?$/.test(input) || 'Must be a valid version',
|
|
302
|
-
skip: true
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
//# sourceMappingURL=prompt.js.map
|
package/lib/prompt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","names":["_nodeFs","_interopRequireDefault","require","_nodePath","_pigment","_validateNpmPackageName","_spawn","_githubUsername","_configureTools","e","__esModule","default","TYPE_CHOICES","title","value","description","LANGUAGE_CHOICES","types","EXAMPLE_CHOICES","validateDirectory","input","targetPath","path","join","process","cwd","fs","existsSync","stat","statSync","isDirectory","files","readdirSync","isEmpty","length","getGitConfig","key","spawn","trim","undefined","isInPackage","resolve","isFile","prompt","exports","create","local","type","message","skip","directory","answers","read","name","includes","sep","validate","slug","basename","validateNpmPackage","validForNewPackages","test","required","Boolean","authorName","authorEmail","authorUrl","username","githubUsername","repoUrl","replace","choices","languages","map","choice","example","tools","Object","entries","AVAILABLE_TOOLS","tool","condition","filter","reactNativeVersion"],"sources":["../src/prompt.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { create } from 'pigment';\nimport validateNpmPackage from 'validate-npm-package-name';\nimport { spawn } from './utils/spawn';\nimport githubUsername from 'github-username';\nimport { AVAILABLE_TOOLS } from './utils/configureTools';\n\nexport type Answers = NonNullable<Awaited<ReturnType<typeof prompt.show>>>;\n\nexport type ExampleApp = 'test-app' | 'expo' | 'vanilla' | undefined;\n\nexport type ProjectLanguages = 'kotlin-objc' | 'kotlin-swift' | 'cpp' | 'js';\n\nexport type ProjectType =\n | 'turbo-module'\n | 'fabric-view'\n | 'nitro-module'\n | 'nitro-view'\n | 'library';\n\nconst TYPE_CHOICES: {\n title: string;\n value: ProjectType;\n description: string;\n}[] = [\n {\n title: 'Turbo module',\n value: 'turbo-module',\n description: 'Integration for native APIs to JS',\n },\n {\n title: 'Fabric view',\n value: 'fabric-view',\n description: 'Integration for native views to JS',\n },\n {\n title: 'Nitro module',\n value: 'nitro-module',\n description: 'Type-safe, fast integration for native APIs to JS',\n },\n {\n title: 'Nitro view',\n value: 'nitro-view',\n description: 'Integration for native views to JS using nitro',\n },\n {\n title: 'JavaScript library',\n value: 'library',\n description: 'Plain JavaScript library with Web support',\n },\n];\n\nconst LANGUAGE_CHOICES: {\n title: string;\n value: ProjectLanguages;\n types: ProjectType[];\n description?: string;\n}[] = [\n {\n title: 'Kotlin & Swift',\n value: 'kotlin-swift',\n types: ['nitro-module', 'nitro-view'],\n },\n {\n title: 'Kotlin & Objective-C',\n value: 'kotlin-objc',\n types: ['turbo-module', 'fabric-view'],\n },\n {\n title: 'C++ (Experimental)',\n value: 'cpp',\n types: ['turbo-module'],\n },\n {\n title: 'JavaScript for Android, iOS & Web',\n value: 'js',\n types: ['library'],\n },\n];\n\nconst EXAMPLE_CHOICES = [\n {\n title: 'App with Community CLI',\n value: 'vanilla',\n description: 'Classic React Native app with native code access',\n },\n {\n title: 'App with Expo CLI',\n value: 'expo',\n description: 'Managed Expo app for easier upgrades',\n },\n {\n title: 'Test App by Microsoft',\n value: 'test-app',\n description: \"Test app with app's native code abstracted\",\n },\n] as const;\n\nconst validateDirectory = (input: string) => {\n if (!input) {\n return 'Cannot be empty';\n }\n\n const targetPath = path.join(process.cwd(), input);\n\n if (!fs.existsSync(targetPath)) {\n return true;\n }\n\n const stat = fs.statSync(targetPath);\n\n if (!stat.isDirectory()) {\n return 'Path exists and is not a directory';\n }\n\n const files = fs.readdirSync(targetPath);\n\n const isEmpty =\n files.length === 0 || (files.length === 1 && files[0] === '.git');\n\n if (!isEmpty) {\n return 'Directory already exists and is not empty';\n }\n\n return true;\n};\n\nconst getGitConfig = async (key: string): Promise<string | undefined> => {\n try {\n const value: string = await spawn('git', ['config', '--get', key]);\n\n return value.trim();\n } catch {\n return undefined;\n }\n};\n\nconst isInPackage = (): boolean => {\n try {\n const stat = fs.statSync(path.resolve(process.cwd(), 'package.json'));\n\n return stat.isFile();\n } catch {\n return false;\n }\n};\n\nexport const prompt = create(['[name]'], {\n local: {\n type: 'confirm',\n description: 'Whether to create a local library',\n message: `Looks like you're under a project folder. Do you want to create a local library?`,\n default: isInPackage,\n skip: () => !isInPackage(),\n },\n directory: {\n type: 'text',\n description: 'Directory to create the library at',\n message: 'Where do you want to create the library?',\n default: (): string | undefined => {\n const answers = prompt.read();\n\n if (answers.name == null) {\n return undefined;\n }\n\n if (answers.local && !answers.name?.includes(path.sep)) {\n return path.join('modules', answers.name);\n }\n\n return answers.name;\n },\n validate: validateDirectory,\n skip: () => {\n const answers = prompt.read();\n\n if (\n answers.name &&\n !answers.local &&\n validateDirectory(answers.name) === true\n ) {\n return true;\n }\n\n return false;\n },\n },\n slug: {\n type: 'text',\n description: 'Name of the npm package',\n message: 'What do you want to name the npm package?',\n default: (): string | undefined => {\n const answers = prompt.read();\n const value =\n typeof answers.directory === 'string'\n ? answers.directory\n : answers.name;\n\n if (typeof value !== 'string') {\n return undefined;\n }\n\n const basename = path.basename(value);\n\n if (validateNpmPackage(basename).validForNewPackages) {\n if (/^(@|react-native)/.test(basename)) {\n return basename;\n }\n\n return `react-native-${basename}`;\n }\n\n return undefined;\n },\n validate: (input) =>\n validateNpmPackage(input).validForNewPackages ||\n 'Must be a valid npm package name',\n required: true,\n },\n description: {\n type: 'text',\n description: 'Description of the npm package',\n message: 'How would you describe the package?',\n validate: (input) => Boolean(input) || 'Cannot be empty',\n required: true,\n },\n authorName: {\n type: 'text',\n description: 'Name of the package author',\n message: 'What is the name of the package author?',\n default: async () => getGitConfig('user.name'),\n validate: (input) => Boolean(input) || 'Cannot be empty',\n skip: (): boolean => prompt.read().local === true,\n },\n authorEmail: {\n type: 'text',\n description: 'Email address of the package author',\n message: 'What is the email address of the package author?',\n default: async () => getGitConfig('user.email'),\n validate: (input) =>\n /^\\S+@\\S+$/.test(input) || 'Must be a valid email address',\n skip: (): boolean => prompt.read().local === true,\n },\n authorUrl: {\n type: 'text',\n description: 'Profile URL of the package author',\n message: 'What is the profile URL for the package author?',\n default: async () => {\n const answers = prompt.read();\n\n if (typeof answers.authorEmail !== 'string') {\n return undefined;\n }\n\n try {\n const username = await githubUsername(answers.authorEmail);\n\n if (username) {\n return `https://github.com/${username}`;\n }\n } catch (e) {\n // Ignore error\n }\n\n return undefined;\n },\n validate: (input) => /^https?:\\/\\//.test(input) || 'Must be a valid URL',\n skip: (): boolean => prompt.read().local === true,\n },\n repoUrl: {\n type: 'text',\n description: 'Repository URL of the package',\n message: 'What is the repository URL for the package?',\n default: (): string | undefined => {\n const answers = prompt.read();\n\n if (\n typeof answers.authorUrl === 'string' &&\n typeof answers.slug === 'string' &&\n /^https?:\\/\\/github.com\\/[^/]+/.test(answers.authorUrl)\n ) {\n return `${answers.authorUrl}/${answers.slug\n .replace(/^@/, '')\n .replace(/\\//g, '-')}`;\n }\n\n return undefined;\n },\n validate: (input) => /^https?:\\/\\//.test(input) || 'Must be a valid URL',\n skip: (): boolean => prompt.read().local === true,\n },\n type: {\n type: 'select',\n description: 'Type of library you want to develop',\n message: 'What type of library do you want to develop?',\n choices: TYPE_CHOICES,\n required: true,\n },\n languages: {\n type: 'select',\n description: 'Languages to use for native code',\n message: 'Which language do you want to use for native code?',\n choices: LANGUAGE_CHOICES.map((choice) => ({\n title: choice.title,\n value: choice.value,\n description: choice.description,\n skip: (): boolean => {\n const answers = prompt.read();\n\n if (choice.value === 'cpp' && answers.local === true) {\n return true;\n }\n\n if (typeof answers.type === 'string') {\n return !choice.types.includes(answers.type);\n }\n\n return false;\n },\n })),\n required: true,\n },\n example: {\n type: 'select',\n description: 'Type of the example app to create',\n message: 'What type of example app do you want to create?',\n choices: EXAMPLE_CHOICES.map((choice) => ({\n title: choice.title,\n value: choice.value,\n description: choice.description,\n skip: (): boolean => {\n const answers = prompt.read();\n\n if (answers.languages === 'cpp') {\n return choice.value !== 'vanilla';\n }\n\n return false;\n },\n })),\n required: true,\n skip: (): boolean => {\n const answers = prompt.read();\n\n return answers.local === true;\n },\n },\n tools: {\n type: 'multiselect',\n description: 'Additional tools to configure',\n message: 'Which tools do you want to configure?',\n choices: Object.entries(AVAILABLE_TOOLS).map(([key, tool]) => ({\n value: key,\n title: tool.name,\n description: tool.description,\n skip: (): boolean => {\n if ('condition' in tool && tool.condition) {\n return !tool.condition({ example: prompt.read().example });\n }\n\n return false;\n },\n })),\n default: (): string[] => {\n const answers = prompt.read();\n\n return Object.entries(AVAILABLE_TOOLS)\n .filter(([, tool]) => {\n if ('condition' in tool && tool.condition) {\n return tool.condition({ example: answers.example });\n }\n\n return true;\n })\n .map(([key]) => key);\n },\n required: true,\n skip: (): boolean => {\n const answers = prompt.read();\n\n return answers.local === true;\n },\n },\n reactNativeVersion: {\n type: 'text',\n description: 'Version of React Native to use in the example app',\n message:\n 'Which version of React Native do you want to use in the example app?',\n validate: (input) =>\n input === 'latest' ||\n /^\\d+\\.\\d+(?:\\.\\d+)?(?:-.+)?$/.test(input) ||\n 'Must be a valid version',\n skip: true,\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAA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,CAAC;MAE7B,OAAOD,OAAO,CAACL,KAAK,KAAK,IAAI;IAC/B;EACF,CAAC;EACDqC,kBAAkB,EAAE;IAClBpC,IAAI,EAAE,MAAM;IACZhC,WAAW,EAAE,mDAAmD;IAChEiC,OAAO,EACL,sEAAsE;IACxEQ,QAAQ,EAAGpC,KAAK,IACdA,KAAK,KAAK,QAAQ,IAClB,8BAA8B,CAACyC,IAAI,CAACzC,KAAK,CAAC,IAC1C,yBAAyB;IAC3B6B,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
package/lib/template.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.applyTemplate = applyTemplate;
|
|
7
|
-
exports.applyTemplates = applyTemplates;
|
|
8
|
-
exports.generateTemplateConfiguration = generateTemplateConfiguration;
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
11
|
-
var _ejs = _interopRequireDefault(require("ejs"));
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
// Please think at least 5 times before introducing a new config key
|
|
14
|
-
// You can just reuse the existing ones most of the time
|
|
15
|
-
|
|
16
|
-
const BINARIES = [/(gradlew|\.(jar|keystore|png|jpg|gif))$/, /\$\.yarn(?![a-z])/];
|
|
17
|
-
const COMMON_FILES = _path.default.resolve(__dirname, '../templates/common');
|
|
18
|
-
const COMMON_LOCAL_FILES = _path.default.resolve(__dirname, '../templates/common-local');
|
|
19
|
-
const EXAMPLE_COMMON_FILES = _path.default.resolve(__dirname, '../templates/example-common');
|
|
20
|
-
const EXAMPLE_BARE_FILES = _path.default.resolve(__dirname, '../templates/example-bare');
|
|
21
|
-
const EXAMPLE_MODULE_NEW_FILES = _path.default.resolve(__dirname, '../templates/example-module-new');
|
|
22
|
-
const EXAMPLE_VIEW_FILES = _path.default.resolve(__dirname, '../templates/example-view');
|
|
23
|
-
const EXAMPLE_EXPO_FILES = _path.default.resolve(__dirname, '../templates/example-expo');
|
|
24
|
-
const JS_FILES = _path.default.resolve(__dirname, '../templates/js-library');
|
|
25
|
-
const JS_VIEW_FILES = _path.default.resolve(__dirname, '../templates/js-view');
|
|
26
|
-
const NATIVE_COMMON_FILES = _path.default.resolve(__dirname, '../templates/native-common');
|
|
27
|
-
const EXAMPLE_NATIVE_COMMON_FILES = _path.default.resolve(__dirname, '../templates/example-native-common');
|
|
28
|
-
const NITRO_COMMON_FILES = _path.default.resolve(__dirname, '../templates/nitro-common');
|
|
29
|
-
const CPP_FILES = _path.default.resolve(__dirname, '../templates/cpp-library');
|
|
30
|
-
const NATIVE_FILES = {
|
|
31
|
-
module_new: _path.default.resolve(__dirname, '../templates/native-library-new'),
|
|
32
|
-
view_new: _path.default.resolve(__dirname, '../templates/native-view-new'),
|
|
33
|
-
module_nitro: _path.default.resolve(__dirname, '../templates/nitro-module'),
|
|
34
|
-
view_nitro: _path.default.resolve(__dirname, '../templates/nitro-view')
|
|
35
|
-
};
|
|
36
|
-
const OBJC_FILES = {
|
|
37
|
-
module_common: _path.default.resolve(__dirname, '../templates/objc-library'),
|
|
38
|
-
view_new: _path.default.resolve(__dirname, '../templates/objc-view-new')
|
|
39
|
-
};
|
|
40
|
-
const KOTLIN_FILES = {
|
|
41
|
-
module_new: _path.default.resolve(__dirname, '../templates/kotlin-library-new'),
|
|
42
|
-
view_new: _path.default.resolve(__dirname, '../templates/kotlin-view-new')
|
|
43
|
-
};
|
|
44
|
-
function generateTemplateConfiguration({
|
|
45
|
-
versions,
|
|
46
|
-
basename,
|
|
47
|
-
answers
|
|
48
|
-
}) {
|
|
49
|
-
const {
|
|
50
|
-
slug,
|
|
51
|
-
languages,
|
|
52
|
-
type
|
|
53
|
-
} = answers;
|
|
54
|
-
const project = slug.replace(/^(react-native-|@[^/]+\/)/, '');
|
|
55
|
-
let namespace;
|
|
56
|
-
if (slug.startsWith('@') && slug.includes('/')) {
|
|
57
|
-
namespace = slug.split('/')[0]?.replace(/[^a-z0-9]/g, '').toLowerCase();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Create a package identifier with specified namespace when possible
|
|
61
|
-
const pack = `${namespace ? `${namespace}.` : ''}${project.replace(/[^a-z0-9]/g, '').toLowerCase()}`;
|
|
62
|
-
return {
|
|
63
|
-
versions,
|
|
64
|
-
project: {
|
|
65
|
-
slug,
|
|
66
|
-
description: answers.description,
|
|
67
|
-
name: /^[A-Z]/.test(basename) && /^[a-z0-9]+$/i.test(basename) ?
|
|
68
|
-
// If the project name is already in PascalCase, use it as-is
|
|
69
|
-
basename :
|
|
70
|
-
// Otherwise, convert it to PascalCase and remove any non-alphanumeric characters
|
|
71
|
-
`${project.charAt(0).toUpperCase()}${project.replace(/[^a-z0-9](\w)/g, (_, $1) => $1.toUpperCase()).slice(1)}`,
|
|
72
|
-
package: pack,
|
|
73
|
-
package_dir: pack.replace(/\./g, _path.default.sep),
|
|
74
|
-
package_cpp: pack.replace(/\./g, '_'),
|
|
75
|
-
identifier: slug.replace(/[^a-z0-9]+/g, '-').replace(/^-/, ''),
|
|
76
|
-
native: languages !== 'js',
|
|
77
|
-
cpp: languages === 'cpp',
|
|
78
|
-
swift: languages === 'kotlin-swift',
|
|
79
|
-
viewConfig: getViewConfig(type),
|
|
80
|
-
moduleConfig: getModuleConfig(type)
|
|
81
|
-
},
|
|
82
|
-
author: {
|
|
83
|
-
name: answers.authorName,
|
|
84
|
-
email: answers.authorEmail,
|
|
85
|
-
url: answers.authorUrl
|
|
86
|
-
},
|
|
87
|
-
repo: answers.repoUrl,
|
|
88
|
-
example: answers.example,
|
|
89
|
-
tools: answers.tools,
|
|
90
|
-
year: new Date().getFullYear()
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function getModuleConfig(projectType) {
|
|
94
|
-
switch (projectType) {
|
|
95
|
-
case 'nitro-module':
|
|
96
|
-
return 'nitro-modules';
|
|
97
|
-
case 'turbo-module':
|
|
98
|
-
return 'turbo-modules';
|
|
99
|
-
case 'fabric-view':
|
|
100
|
-
case 'library':
|
|
101
|
-
case 'nitro-view':
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function getViewConfig(projectType) {
|
|
106
|
-
switch (projectType) {
|
|
107
|
-
case 'fabric-view':
|
|
108
|
-
return 'fabric-view';
|
|
109
|
-
case 'nitro-view':
|
|
110
|
-
return 'nitro-view';
|
|
111
|
-
case 'nitro-module':
|
|
112
|
-
case 'turbo-module':
|
|
113
|
-
case 'library':
|
|
114
|
-
default:
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async function applyTemplates(answers, config, folder) {
|
|
119
|
-
const {
|
|
120
|
-
local
|
|
121
|
-
} = answers;
|
|
122
|
-
if (local) {
|
|
123
|
-
await applyTemplate(config, COMMON_LOCAL_FILES, folder);
|
|
124
|
-
} else {
|
|
125
|
-
await applyTemplate(config, COMMON_FILES, folder);
|
|
126
|
-
if (config.example != null) {
|
|
127
|
-
await applyTemplate(config, EXAMPLE_COMMON_FILES, folder);
|
|
128
|
-
if (config.project.viewConfig !== null) {
|
|
129
|
-
await applyTemplate(config, EXAMPLE_VIEW_FILES, folder);
|
|
130
|
-
} else {
|
|
131
|
-
await applyTemplate(config, EXAMPLE_MODULE_NEW_FILES, folder);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (answers.languages === 'js') {
|
|
136
|
-
await applyTemplate(config, JS_FILES, folder);
|
|
137
|
-
if (config.example != null) {
|
|
138
|
-
if (config.example === 'expo') {
|
|
139
|
-
await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);
|
|
140
|
-
} else {
|
|
141
|
-
await applyTemplate(config, EXAMPLE_BARE_FILES, folder);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} else {
|
|
145
|
-
if (answers.languages === 'cpp') {
|
|
146
|
-
if (config.example === 'expo') {
|
|
147
|
-
await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);
|
|
148
|
-
if (config.project.native) {
|
|
149
|
-
await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);
|
|
150
|
-
}
|
|
151
|
-
} else if (config.example != null) {
|
|
152
|
-
await applyTemplate(config, EXAMPLE_BARE_FILES, folder);
|
|
153
|
-
if (config.project.native) {
|
|
154
|
-
await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
await applyTemplate(config, NATIVE_FILES['module_new'], folder);
|
|
158
|
-
await applyTemplate(config, CPP_FILES, folder);
|
|
159
|
-
if (config.example === 'expo' || config.tools.includes('vite')) {
|
|
160
|
-
await applyTemplate(config, JS_FILES, folder);
|
|
161
|
-
}
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
await applyTemplate(config, NATIVE_COMMON_FILES, folder);
|
|
165
|
-
if (config.example === 'expo') {
|
|
166
|
-
await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);
|
|
167
|
-
if (config.project.native) {
|
|
168
|
-
await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);
|
|
169
|
-
}
|
|
170
|
-
} else if (config.example != null) {
|
|
171
|
-
await applyTemplate(config, EXAMPLE_BARE_FILES, folder);
|
|
172
|
-
if (config.project.native) {
|
|
173
|
-
await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (config.project.moduleConfig === 'nitro-modules') {
|
|
177
|
-
await applyTemplate(config, NITRO_COMMON_FILES, folder);
|
|
178
|
-
await applyTemplate(config, NATIVE_FILES['module_nitro'], folder);
|
|
179
|
-
if (config.example === 'expo' || config.tools.includes('vite')) {
|
|
180
|
-
await applyTemplate(config, JS_FILES, folder);
|
|
181
|
-
}
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (config.project.viewConfig === 'nitro-view') {
|
|
185
|
-
await applyTemplate(config, NITRO_COMMON_FILES, folder);
|
|
186
|
-
await applyTemplate(config, NATIVE_FILES['view_nitro'], folder);
|
|
187
|
-
if (config.example === 'expo' || config.tools.includes('vite')) {
|
|
188
|
-
await applyTemplate(config, JS_VIEW_FILES, folder);
|
|
189
|
-
}
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
if (config.project.moduleConfig !== null) {
|
|
193
|
-
await applyTemplate(config, NATIVE_FILES[`module_new`], folder);
|
|
194
|
-
} else {
|
|
195
|
-
await applyTemplate(config, NATIVE_FILES[`view_new`], folder);
|
|
196
|
-
}
|
|
197
|
-
if (config.project.moduleConfig !== null) {
|
|
198
|
-
await applyTemplate(config, OBJC_FILES[`module_common`], folder);
|
|
199
|
-
} else {
|
|
200
|
-
await applyTemplate(config, OBJC_FILES[`view_new`], folder);
|
|
201
|
-
}
|
|
202
|
-
const templateType = `${config.project.moduleConfig !== null ? 'module' : 'view'}_new`;
|
|
203
|
-
await applyTemplate(config, KOTLIN_FILES[templateType], folder);
|
|
204
|
-
if (config.example === 'expo' || config.tools.includes('vite')) {
|
|
205
|
-
if (config.project.viewConfig !== null) {
|
|
206
|
-
await applyTemplate(config, JS_VIEW_FILES, folder);
|
|
207
|
-
} else {
|
|
208
|
-
await applyTemplate(config, JS_FILES, folder);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* This copies the template files and renders them via ejs
|
|
216
|
-
*/
|
|
217
|
-
async function applyTemplate(config, source, destination) {
|
|
218
|
-
await _fsExtra.default.mkdirp(destination);
|
|
219
|
-
const files = await _fsExtra.default.readdir(source);
|
|
220
|
-
for (const f of files) {
|
|
221
|
-
if (f.startsWith('~')) {
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
let name;
|
|
225
|
-
try {
|
|
226
|
-
name = _ejs.default.render(f.replace(/^\$/, ''), config, {
|
|
227
|
-
openDelimiter: '{',
|
|
228
|
-
closeDelimiter: '}'
|
|
229
|
-
});
|
|
230
|
-
} catch (e) {
|
|
231
|
-
throw new Error(`Failed to render template file name: ${f}`, {
|
|
232
|
-
cause: e
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
const target = _path.default.join(destination, name);
|
|
236
|
-
const file = _path.default.join(source, f);
|
|
237
|
-
const stats = await _fsExtra.default.stat(file);
|
|
238
|
-
if (stats.isDirectory()) {
|
|
239
|
-
await applyTemplate(config, file, target);
|
|
240
|
-
} else if (!BINARIES.some(r => r.test(file))) {
|
|
241
|
-
const content = await _fsExtra.default.readFile(file, 'utf8');
|
|
242
|
-
let result;
|
|
243
|
-
try {
|
|
244
|
-
result = _ejs.default.render(content, config)
|
|
245
|
-
// Make sure that line endings are 'lf' (Unix style)
|
|
246
|
-
.replace(/\r\n/g, '\n');
|
|
247
|
-
} catch (e) {
|
|
248
|
-
throw new Error(`Failed to render template file content: ${f}`, {
|
|
249
|
-
cause: e
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
await _fsExtra.default.writeFile(target, result);
|
|
253
|
-
} else {
|
|
254
|
-
await _fsExtra.default.copyFile(file, target);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=template.js.map
|
package/lib/template.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","names":["_path","_interopRequireDefault","require","_fsExtra","_ejs","e","__esModule","default","BINARIES","COMMON_FILES","path","resolve","__dirname","COMMON_LOCAL_FILES","EXAMPLE_COMMON_FILES","EXAMPLE_BARE_FILES","EXAMPLE_MODULE_NEW_FILES","EXAMPLE_VIEW_FILES","EXAMPLE_EXPO_FILES","JS_FILES","JS_VIEW_FILES","NATIVE_COMMON_FILES","EXAMPLE_NATIVE_COMMON_FILES","NITRO_COMMON_FILES","CPP_FILES","NATIVE_FILES","module_new","view_new","module_nitro","view_nitro","OBJC_FILES","module_common","KOTLIN_FILES","generateTemplateConfiguration","versions","basename","answers","slug","languages","type","project","replace","namespace","startsWith","includes","split","toLowerCase","pack","description","name","test","charAt","toUpperCase","_","$1","slice","package","package_dir","sep","package_cpp","identifier","native","cpp","swift","viewConfig","getViewConfig","moduleConfig","getModuleConfig","author","authorName","email","authorEmail","url","authorUrl","repo","repoUrl","example","tools","year","Date","getFullYear","projectType","applyTemplates","config","folder","local","applyTemplate","templateType","source","destination","fs","mkdirp","files","readdir","f","ejs","render","openDelimiter","closeDelimiter","Error","cause","target","join","file","stats","stat","isDirectory","some","r","content","readFile","result","writeFile","copyFile"],"sources":["../src/template.ts"],"sourcesContent":["import path from 'path';\nimport fs from 'fs-extra';\nimport ejs from 'ejs';\nimport type { Answers, ExampleApp, ProjectType } from './prompt';\n\nexport type TemplateVersions = {\n bob: string;\n nitro: string | undefined;\n};\n\nexport type ModuleConfig =\n | 'native-modules'\n | 'turbo-modules'\n | 'nitro-modules'\n | null;\n\nexport type ViewConfig = 'paper-view' | 'fabric-view' | 'nitro-view' | null;\n\n// Please think at least 5 times before introducing a new config key\n// You can just reuse the existing ones most of the time\nexport type TemplateConfiguration = {\n versions: TemplateVersions;\n project: {\n slug: string;\n description: string;\n name: string;\n package: string;\n package_dir: string;\n package_cpp: string;\n identifier: string;\n native: boolean;\n cpp: boolean;\n swift: boolean;\n viewConfig: ViewConfig;\n moduleConfig: ModuleConfig;\n };\n author: {\n name: string;\n email: string;\n url: string;\n };\n /** Git repo URL */\n repo: string;\n example: ExampleApp;\n year: number;\n tools: string[];\n};\n\nconst BINARIES = [\n /(gradlew|\\.(jar|keystore|png|jpg|gif))$/,\n /\\$\\.yarn(?![a-z])/,\n];\n\nconst COMMON_FILES = path.resolve(__dirname, '../templates/common');\nconst COMMON_LOCAL_FILES = path.resolve(__dirname, '../templates/common-local');\nconst EXAMPLE_COMMON_FILES = path.resolve(\n __dirname,\n '../templates/example-common'\n);\nconst EXAMPLE_BARE_FILES = path.resolve(__dirname, '../templates/example-bare');\nconst EXAMPLE_MODULE_NEW_FILES = path.resolve(\n __dirname,\n '../templates/example-module-new'\n);\nconst EXAMPLE_VIEW_FILES = path.resolve(__dirname, '../templates/example-view');\nconst EXAMPLE_EXPO_FILES = path.resolve(__dirname, '../templates/example-expo');\n\nconst JS_FILES = path.resolve(__dirname, '../templates/js-library');\nconst JS_VIEW_FILES = path.resolve(__dirname, '../templates/js-view');\nconst NATIVE_COMMON_FILES = path.resolve(\n __dirname,\n '../templates/native-common'\n);\nconst EXAMPLE_NATIVE_COMMON_FILES = path.resolve(\n __dirname,\n '../templates/example-native-common'\n);\nconst NITRO_COMMON_FILES = path.resolve(__dirname, '../templates/nitro-common');\nconst CPP_FILES = path.resolve(__dirname, '../templates/cpp-library');\n\nconst NATIVE_FILES = {\n module_new: path.resolve(__dirname, '../templates/native-library-new'),\n view_new: path.resolve(__dirname, '../templates/native-view-new'),\n module_nitro: path.resolve(__dirname, '../templates/nitro-module'),\n view_nitro: path.resolve(__dirname, '../templates/nitro-view'),\n} as const;\n\nconst OBJC_FILES = {\n module_common: path.resolve(__dirname, '../templates/objc-library'),\n view_new: path.resolve(__dirname, '../templates/objc-view-new'),\n} as const;\n\nconst KOTLIN_FILES = {\n module_new: path.resolve(__dirname, '../templates/kotlin-library-new'),\n view_new: path.resolve(__dirname, '../templates/kotlin-view-new'),\n} as const;\n\nexport function generateTemplateConfiguration({\n versions,\n basename,\n answers,\n}: {\n versions: TemplateVersions;\n basename: string;\n answers: Answers;\n}): TemplateConfiguration {\n const { slug, languages, type } = answers;\n\n const project = slug.replace(/^(react-native-|@[^/]+\\/)/, '');\n let namespace: string | undefined;\n\n if (slug.startsWith('@') && slug.includes('/')) {\n namespace = slug\n .split('/')[0]\n ?.replace(/[^a-z0-9]/g, '')\n .toLowerCase();\n }\n\n // Create a package identifier with specified namespace when possible\n const pack = `${namespace ? `${namespace}.` : ''}${project\n .replace(/[^a-z0-9]/g, '')\n .toLowerCase()}`;\n\n return {\n versions,\n project: {\n slug,\n description: answers.description,\n name:\n /^[A-Z]/.test(basename) && /^[a-z0-9]+$/i.test(basename)\n ? // If the project name is already in PascalCase, use it as-is\n basename\n : // Otherwise, convert it to PascalCase and remove any non-alphanumeric characters\n `${project.charAt(0).toUpperCase()}${project\n .replace(/[^a-z0-9](\\w)/g, (_, $1: string) => $1.toUpperCase())\n .slice(1)}`,\n package: pack,\n package_dir: pack.replace(/\\./g, path.sep),\n package_cpp: pack.replace(/\\./g, '_'),\n identifier: slug.replace(/[^a-z0-9]+/g, '-').replace(/^-/, ''),\n native: languages !== 'js',\n cpp: languages === 'cpp',\n swift: languages === 'kotlin-swift',\n viewConfig: getViewConfig(type),\n moduleConfig: getModuleConfig(type),\n },\n author: {\n name: answers.authorName,\n email: answers.authorEmail,\n url: answers.authorUrl,\n },\n repo: answers.repoUrl,\n example: answers.example,\n tools: answers.tools,\n year: new Date().getFullYear(),\n };\n}\n\nfunction getModuleConfig(projectType: ProjectType): ModuleConfig {\n switch (projectType) {\n case 'nitro-module':\n return 'nitro-modules';\n case 'turbo-module':\n return 'turbo-modules';\n case 'fabric-view':\n case 'library':\n case 'nitro-view':\n return null;\n }\n}\n\nfunction getViewConfig(projectType: ProjectType): ViewConfig {\n switch (projectType) {\n case 'fabric-view':\n return 'fabric-view';\n case 'nitro-view':\n return 'nitro-view';\n case 'nitro-module':\n case 'turbo-module':\n case 'library':\n default:\n return null;\n }\n}\n\nexport async function applyTemplates(\n answers: Answers,\n config: TemplateConfiguration,\n folder: string\n) {\n const { local } = answers;\n\n if (local) {\n await applyTemplate(config, COMMON_LOCAL_FILES, folder);\n } else {\n await applyTemplate(config, COMMON_FILES, folder);\n\n if (config.example != null) {\n await applyTemplate(config, EXAMPLE_COMMON_FILES, folder);\n\n if (config.project.viewConfig !== null) {\n await applyTemplate(config, EXAMPLE_VIEW_FILES, folder);\n } else {\n await applyTemplate(config, EXAMPLE_MODULE_NEW_FILES, folder);\n }\n }\n }\n\n if (answers.languages === 'js') {\n await applyTemplate(config, JS_FILES, folder);\n\n if (config.example != null) {\n if (config.example === 'expo') {\n await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);\n } else {\n await applyTemplate(config, EXAMPLE_BARE_FILES, folder);\n }\n }\n } else {\n if (answers.languages === 'cpp') {\n if (config.example === 'expo') {\n await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);\n\n if (config.project.native) {\n await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);\n }\n } else if (config.example != null) {\n await applyTemplate(config, EXAMPLE_BARE_FILES, folder);\n\n if (config.project.native) {\n await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);\n }\n }\n\n await applyTemplate(config, NATIVE_FILES['module_new'], folder);\n await applyTemplate(config, CPP_FILES, folder);\n\n if (config.example === 'expo' || config.tools.includes('vite')) {\n await applyTemplate(config, JS_FILES, folder);\n }\n\n return;\n }\n\n await applyTemplate(config, NATIVE_COMMON_FILES, folder);\n\n if (config.example === 'expo') {\n await applyTemplate(config, EXAMPLE_EXPO_FILES, folder);\n\n if (config.project.native) {\n await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);\n }\n } else if (config.example != null) {\n await applyTemplate(config, EXAMPLE_BARE_FILES, folder);\n\n if (config.project.native) {\n await applyTemplate(config, EXAMPLE_NATIVE_COMMON_FILES, folder);\n }\n }\n\n if (config.project.moduleConfig === 'nitro-modules') {\n await applyTemplate(config, NITRO_COMMON_FILES, folder);\n await applyTemplate(config, NATIVE_FILES['module_nitro'], folder);\n\n if (config.example === 'expo' || config.tools.includes('vite')) {\n await applyTemplate(config, JS_FILES, folder);\n }\n\n return;\n }\n\n if (config.project.viewConfig === 'nitro-view') {\n await applyTemplate(config, NITRO_COMMON_FILES, folder);\n await applyTemplate(config, NATIVE_FILES['view_nitro'], folder);\n\n if (config.example === 'expo' || config.tools.includes('vite')) {\n await applyTemplate(config, JS_VIEW_FILES, folder);\n }\n\n return;\n }\n\n if (config.project.moduleConfig !== null) {\n await applyTemplate(config, NATIVE_FILES[`module_new`], folder);\n } else {\n await applyTemplate(config, NATIVE_FILES[`view_new`], folder);\n }\n\n if (config.project.moduleConfig !== null) {\n await applyTemplate(config, OBJC_FILES[`module_common`], folder);\n } else {\n await applyTemplate(config, OBJC_FILES[`view_new`], folder);\n }\n\n const templateType = `${\n config.project.moduleConfig !== null ? 'module' : 'view'\n }_new` as const;\n\n await applyTemplate(config, KOTLIN_FILES[templateType], folder);\n\n if (config.example === 'expo' || config.tools.includes('vite')) {\n if (config.project.viewConfig !== null) {\n await applyTemplate(config, JS_VIEW_FILES, folder);\n } else {\n await applyTemplate(config, JS_FILES, folder);\n }\n }\n }\n}\n\n/**\n * This copies the template files and renders them via ejs\n */\nexport async function applyTemplate(\n config: TemplateConfiguration,\n source: string,\n destination: string\n) {\n await fs.mkdirp(destination);\n\n const files = await fs.readdir(source);\n\n for (const f of files) {\n if (f.startsWith('~')) {\n continue;\n }\n\n let name;\n\n try {\n name = ejs.render(f.replace(/^\\$/, ''), config, {\n openDelimiter: '{',\n closeDelimiter: '}',\n });\n } catch (e) {\n throw new Error(`Failed to render template file name: ${f}`, {\n cause: e,\n });\n }\n\n const target = path.join(destination, name);\n\n const file = path.join(source, f);\n const stats = await fs.stat(file);\n\n if (stats.isDirectory()) {\n await applyTemplate(config, file, target);\n } else if (!BINARIES.some((r) => r.test(file))) {\n const content = await fs.readFile(file, 'utf8');\n\n let result;\n\n try {\n result = ejs\n .render(content, config)\n // Make sure that line endings are 'lf' (Unix style)\n .replace(/\\r\\n/g, '\\n');\n } catch (e) {\n throw new Error(`Failed to render template file content: ${f}`, {\n cause: e,\n });\n }\n\n await fs.writeFile(target, result);\n } else {\n await fs.copyFile(file, target);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IA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