feat(expo): add option for skipPackageJson for expo generators (#14570)

This commit is contained in:
Greg Westneat 2023-01-31 09:27:19 -08:00 committed by GitHub
parent b110275f9c
commit 42b9be2a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 39 additions and 1 deletions

View File

@ -77,6 +77,11 @@
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"x-deprecated": "Nx only supports standaloneConfig" "x-deprecated": "Nx only supports standaloneConfig"
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": ["name"], "required": ["name"],

View File

@ -25,6 +25,11 @@
"type": "string", "type": "string",
"enum": ["detox", "none"], "enum": ["detox", "none"],
"default": "detox" "default": "detox"
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": [], "required": [],

View File

@ -88,6 +88,11 @@
"type": "boolean", "type": "boolean",
"description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.", "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
"default": false "default": false
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": ["name"], "required": ["name"],

View File

@ -15,4 +15,5 @@ export interface Schema {
setParserOptionsProject?: boolean; // default is false setParserOptionsProject?: boolean; // default is false
e2eTestRunner: 'detox' | 'none'; // default is detox e2eTestRunner: 'detox' | 'none'; // default is detox
standaloneConfig?: boolean; standaloneConfig?: boolean;
skipPackageJson?: boolean; // default is false
} }

View File

@ -77,6 +77,11 @@
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"x-deprecated": "Nx only supports standaloneConfig" "x-deprecated": "Nx only supports standaloneConfig"
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": ["name"] "required": ["name"]

View File

@ -42,7 +42,12 @@ export async function expoInitGenerator(host: Tree, schema: Schema) {
addGitIgnoreEntry(host); addGitIgnoreEntry(host);
initRootBabelConfig(host); initRootBabelConfig(host);
const tasks = [moveDependency(host), updateDependencies(host)]; const tasks = [];
if (!schema.skipPackageJson) {
tasks.push(moveDependency(host));
tasks.push(updateDependencies(host));
}
if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') { if (!schema.unitTestRunner || schema.unitTestRunner === 'jest') {
const jestTask = jestInitGenerator(host, {}); const jestTask = jestInitGenerator(host, {});

View File

@ -2,4 +2,5 @@ export interface Schema {
unitTestRunner?: 'jest' | 'none'; unitTestRunner?: 'jest' | 'none';
skipFormat?: boolean; skipFormat?: boolean;
e2eTestRunner?: 'detox' | 'none'; e2eTestRunner?: 'detox' | 'none';
skipPackageJson?: boolean; // default is false
} }

View File

@ -22,6 +22,11 @@
"type": "string", "type": "string",
"enum": ["detox", "none"], "enum": ["detox", "none"],
"default": "detox" "default": "detox"
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": [] "required": []

View File

@ -18,4 +18,5 @@ export interface Schema {
js: boolean; // default is false js: boolean; // default is false
strict: boolean; // default is true strict: boolean; // default is true
setParserOptionsProject?: boolean; setParserOptionsProject?: boolean;
skipPackageJson?: boolean; // default is false
} }

View File

@ -88,6 +88,11 @@
"type": "boolean", "type": "boolean",
"description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.", "description": "Whether or not to configure the ESLint \"parserOptions.project\" option. We do not do this by default for lint performance reasons.",
"default": false "default": false
},
"skipPackageJson": {
"type": "boolean",
"description": "Do not add dependencies to `package.json`.",
"default": false
} }
}, },
"required": ["name"] "required": ["name"]