create-react-native-library
Advanced tools
Comparing version 0.31.1 to 0.32.0
@@ -15,4 +15,2 @@ "use strict"; | ||
var _crossSpawn = _interopRequireDefault(require("cross-spawn")); | ||
var _ora = _interopRequireDefault(require("ora")); | ||
@@ -28,2 +26,4 @@ | ||
var _spawn = require("./utils/spawn"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -193,7 +193,3 @@ | ||
try { | ||
const child = (0, _crossSpawn.default)('npx', ['--help']); | ||
await new Promise((resolve, reject) => { | ||
child.once('error', reject); | ||
child.once('close', resolve); | ||
}); | ||
await (0, _spawn.spawn)('npx', ['--help']); | ||
} catch (error) { | ||
@@ -212,4 +208,4 @@ // @ts-expect-error: TS doesn't know about `code` | ||
try { | ||
name = _crossSpawn.default.sync('git', ['config', '--get', 'user.name']).stdout.toString().trim(); | ||
email = _crossSpawn.default.sync('git', ['config', '--get', 'user.email']).stdout.toString().trim(); | ||
name = await (0, _spawn.spawn)('git', ['config', '--get', 'user.name']); | ||
email = await (0, _spawn.spawn)('git', ['config', '--get', 'user.email']); | ||
} catch (e) {// Ignore error | ||
@@ -346,6 +342,4 @@ } | ||
...(await (0, _prompts.default)(Object.entries(questions).filter(([k, v]) => { | ||
var _v$validate; | ||
// Skip questions which are passed as parameter and pass validation | ||
if (argv[k] != null && ((_v$validate = v.validate) === null || _v$validate === void 0 ? void 0 : _v$validate.call(v, argv[k])) !== false) { | ||
if (argv[k] != null && v.validate?.(argv[k]) !== false) { | ||
return false; | ||
@@ -389,10 +383,3 @@ } // Skip questions with a single choice | ||
try { | ||
version = await Promise.race([new Promise(resolve => setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000)), new Promise((resolve, reject) => { | ||
var _npm$stdout, _npm$stderr; | ||
const npm = (0, _crossSpawn.default)('npm', ['view', 'react-native-builder-bob', 'dist-tags.latest']); | ||
(_npm$stdout = npm.stdout) === null || _npm$stdout === void 0 ? void 0 : _npm$stdout.on('data', data => resolve(data.toString().trim())); | ||
(_npm$stderr = npm.stderr) === null || _npm$stderr === void 0 ? void 0 : _npm$stderr.on('data', data => reject(data.toString().trim())); | ||
npm.on('error', err => reject(err)); | ||
})]); | ||
version = await Promise.race([new Promise(resolve => setTimeout(() => resolve(FALLBACK_BOB_VERSION), 1000)), (0, _spawn.spawn)('npm', ['view', 'react-native-builder-bob', 'dist-tags.latest'])]); | ||
} catch (e) { | ||
@@ -410,5 +397,3 @@ // Fallback to a known version if we couldn't fetch | ||
if (slug.startsWith('@') && slug.includes('/')) { | ||
var _slug$split$; | ||
namespace = (_slug$split$ = slug.split('/')[0]) === null || _slug$split$ === void 0 ? void 0 : _slug$split$.replace(/[^a-z0-9]/g, '').toLowerCase(); | ||
namespace = slug.split('/')[0]?.replace(/[^a-z0-9]/g, '').toLowerCase(); | ||
} // Create a package identifier with specified namespace when possible | ||
@@ -552,15 +537,12 @@ | ||
try { | ||
_crossSpawn.default.sync('git', ['init'], { | ||
await (0, _spawn.spawn)('git', ['init'], { | ||
cwd: folder | ||
}); | ||
_crossSpawn.default.sync('git', ['branch', '-M', 'main'], { | ||
await (0, _spawn.spawn)('git', ['branch', '-M', 'main'], { | ||
cwd: folder | ||
}); | ||
_crossSpawn.default.sync('git', ['add', '.'], { | ||
await (0, _spawn.spawn)('git', ['add', '.'], { | ||
cwd: folder | ||
}); | ||
_crossSpawn.default.sync('git', ['commit', '-m', 'chore: initial commit'], { | ||
await (0, _spawn.spawn)('git', ['commit', '-m', 'chore: initial commit'], { | ||
cwd: folder | ||
@@ -567,0 +549,0 @@ }); |
@@ -10,4 +10,2 @@ "use strict"; | ||
var _crossSpawn = _interopRequireDefault(require("cross-spawn")); | ||
var _path = _interopRequireDefault(require("path")); | ||
@@ -17,6 +15,8 @@ | ||
var _spawn = require("./spawn"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const FILES_TO_DELETE = ['__tests__', '.buckconfig', '.eslintrc.js', '.flowconfig', '.git', '.gitignore', '.prettierrc.js', 'App.js', 'App.tsx', 'index.js', 'tsconfig.json']; | ||
const PACKAGES_TO_REMOVE = ['@react-native-community/eslint-config', '@tsconfig/react-native', '@types/jest', '@types/react', '@types/react-test-renderer', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', 'babel-jest', 'eslint', 'jest', 'prettier', 'react-test-renderer', 'typescript']; | ||
const PACKAGES_TO_REMOVE = ['@react-native/eslint-config', '@tsconfig/react-native', '@types/jest', '@types/react', '@types/react-test-renderer', '@typescript-eslint/eslint-plugin', '@typescript-eslint/parser', 'babel-jest', 'eslint', 'jest', 'prettier', 'react-test-renderer', 'typescript']; | ||
const PACKAGES_TO_ADD_DEV = { | ||
@@ -46,23 +46,7 @@ 'babel-plugin-module-resolver': '^5.0.0' | ||
['create-expo-app@latest', directory, '--no-install']; | ||
await new Promise((resolve, reject) => { | ||
var _child$stderr, _child$stderr2; | ||
const child = (0, _crossSpawn.default)('npx', args, { | ||
cwd: dest, | ||
env: { ...process.env, | ||
npm_config_yes: 'true' | ||
} | ||
}); | ||
let stderr = ''; | ||
(_child$stderr = child.stderr) === null || _child$stderr === void 0 ? void 0 : _child$stderr.setEncoding('utf8'); | ||
(_child$stderr2 = child.stderr) === null || _child$stderr2 === void 0 ? void 0 : _child$stderr2.on('data', data => { | ||
stderr += data; | ||
}); | ||
child.once('error', reject); | ||
child.once('close', resolve); | ||
child.once('exit', code => { | ||
if (code === 1) { | ||
reject(new Error(stderr)); | ||
} | ||
}); | ||
await (0, _spawn.spawn)('npx', args, { | ||
cwd: dest, | ||
env: { ...process.env, | ||
npm_config_yes: 'true' | ||
} | ||
}); // Remove unnecessary files and folders | ||
@@ -69,0 +53,0 @@ |
{ | ||
"name": "create-react-native-library", | ||
"version": "0.31.1", | ||
"version": "0.32.0", | ||
"description": "CLI to scaffold React Native libraries", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">= 16.0.0" | ||
"node": ">= 18.0.0" | ||
}, | ||
@@ -57,5 +57,2 @@ "publishConfig": { | ||
}, | ||
"optionalDependencies": { | ||
"jetifier": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -75,3 +72,3 @@ "@babel/cli": "^7.17.10", | ||
}, | ||
"gitHead": "6650bc170b3c872ad290965856162334c8394df6" | ||
"gitHead": "2a92f26b642637b853c0dfe7f59e2d561d6394af" | ||
} |
@@ -7,3 +7,3 @@ { | ||
"module": "lib/module/index", | ||
"types": "lib/typescript/index.d.ts", | ||
"types": "lib/typescript/src/index.d.ts", | ||
"react-native": "src/index", | ||
@@ -64,3 +64,3 @@ "source": "src/index", | ||
"@evilmartians/lefthook": "^1.2.2", | ||
"@react-native-community/eslint-config": "^3.0.2", | ||
"@react-native/eslint-config": "^0.72.2", | ||
"@release-it/conventional-changelog": "^5.0.0", | ||
@@ -95,3 +95,3 @@ "@types/jest": "^28.1.2", | ||
"engines": { | ||
"node": ">= 16.0.0" | ||
"node": ">= 18.0.0" | ||
}, | ||
@@ -131,3 +131,3 @@ "packageManager": "^yarn@1.22.15", | ||
"extends": [ | ||
"@react-native-community", | ||
"@react-native", | ||
"prettier" | ||
@@ -134,0 +134,0 @@ ], |
{ | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"rootDir": ".", | ||
"paths": { | ||
@@ -5,0 +5,0 @@ "<%- project.slug -%>": ["./src/index"] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
10
124
1061
184516