@nx/expo 20.2.0-beta.2 → 20.2.0-beta.4
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/package.json +8 -8
- package/src/generators/application/application.js +11 -2
- package/src/generators/application/lib/add-e2e.js +44 -15
- package/src/generators/application/lib/add-project.js +20 -1
- package/src/generators/application/schema.d.ts +3 -0
- package/src/generators/application/schema.json +8 -5
- package/src/generators/component/lib/normalize-options.js +1 -14
- package/src/generators/component/schema.d.ts +0 -1
- package/src/generators/component/schema.json +11 -9
- package/src/generators/init/init.js +0 -2
- package/src/generators/library/lib/normalize-options.d.ts +1 -0
- package/src/generators/library/lib/normalize-options.js +2 -0
- package/src/generators/library/library.js +40 -7
- package/src/generators/library/schema.json +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/expo",
|
|
3
|
-
"version": "20.2.0-beta.
|
|
3
|
+
"version": "20.2.0-beta.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
|
6
6
|
"keywords": [
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"main": "./index",
|
|
29
29
|
"types": "index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@nx/devkit": "20.2.0-beta.
|
|
32
|
-
"@nx/eslint": "20.2.0-beta.
|
|
33
|
-
"@nx/jest": "20.2.0-beta.
|
|
34
|
-
"@nx/js": "20.2.0-beta.
|
|
35
|
-
"@nx/react": "20.2.0-beta.
|
|
36
|
-
"@nx/web": "20.2.0-beta.
|
|
37
|
-
"@nx/webpack": "20.2.0-beta.
|
|
31
|
+
"@nx/devkit": "20.2.0-beta.4",
|
|
32
|
+
"@nx/eslint": "20.2.0-beta.4",
|
|
33
|
+
"@nx/jest": "20.2.0-beta.4",
|
|
34
|
+
"@nx/js": "20.2.0-beta.4",
|
|
35
|
+
"@nx/react": "20.2.0-beta.4",
|
|
36
|
+
"@nx/web": "20.2.0-beta.4",
|
|
37
|
+
"@nx/webpack": "20.2.0-beta.4",
|
|
38
38
|
"enhanced-resolve": "^5.8.3",
|
|
39
39
|
"metro-config": "~0.80.4",
|
|
40
40
|
"metro-resolver": "~0.80.4",
|
|
@@ -23,13 +23,14 @@ async function expoApplicationGenerator(host, schema) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
async function expoApplicationGeneratorInternal(host, schema) {
|
|
26
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'application');
|
|
27
|
-
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
28
26
|
const tasks = [];
|
|
29
27
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
30
28
|
...schema,
|
|
31
29
|
skipFormat: true,
|
|
30
|
+
addTsPlugin: schema.useTsSolution,
|
|
31
|
+
formatter: schema.formatter,
|
|
32
32
|
});
|
|
33
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
33
34
|
tasks.push(jsInitTask);
|
|
34
35
|
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
35
36
|
tasks.push(initTask);
|
|
@@ -52,6 +53,14 @@ async function expoApplicationGeneratorInternal(host, schema) {
|
|
|
52
53
|
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
53
54
|
tasks.push(e2eTask);
|
|
54
55
|
(0, add_eas_scripts_1.addEasScripts)(host);
|
|
56
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.appProjectRoot, 'tsconfig.app.json', {
|
|
57
|
+
jsx: 'react-jsx',
|
|
58
|
+
module: 'esnext',
|
|
59
|
+
moduleResolution: 'bundler',
|
|
60
|
+
noUnusedLocals: false,
|
|
61
|
+
}, options.linter === 'eslint'
|
|
62
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
63
|
+
: undefined);
|
|
55
64
|
if (!options.skipFormat) {
|
|
56
65
|
await (0, devkit_1.formatFiles)(host);
|
|
57
66
|
}
|
|
@@ -8,6 +8,7 @@ const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
|
8
8
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
9
9
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
10
10
|
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
11
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
11
12
|
async function addE2e(tree, options) {
|
|
12
13
|
const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
|
|
13
14
|
if (!hasPlugin) {
|
|
@@ -20,14 +21,28 @@ async function addE2e(tree, options) {
|
|
|
20
21
|
switch (options.e2eTestRunner) {
|
|
21
22
|
case 'cypress': {
|
|
22
23
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
23
|
-
(0,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
|
|
25
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
26
|
+
name: options.e2eProjectName,
|
|
27
|
+
version: '0.0.1',
|
|
28
|
+
private: true,
|
|
29
|
+
nx: {
|
|
30
|
+
projectType: 'application',
|
|
31
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
32
|
+
implicitDependencies: [options.projectName],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
38
|
+
projectType: 'application',
|
|
39
|
+
root: options.e2eProjectRoot,
|
|
40
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
41
|
+
targets: {},
|
|
42
|
+
implicitDependencies: [options.projectName],
|
|
43
|
+
tags: [],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
31
46
|
const e2eTask = await configurationGenerator(tree, {
|
|
32
47
|
...options,
|
|
33
48
|
project: options.e2eProjectName,
|
|
@@ -63,13 +78,27 @@ async function addE2e(tree, options) {
|
|
|
63
78
|
}
|
|
64
79
|
case 'playwright': {
|
|
65
80
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
66
|
-
(0,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
|
|
82
|
+
(0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
83
|
+
name: options.e2eProjectName,
|
|
84
|
+
version: '0.0.1',
|
|
85
|
+
private: true,
|
|
86
|
+
nx: {
|
|
87
|
+
projectType: 'application',
|
|
88
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
89
|
+
implicitDependencies: [options.projectName],
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
95
|
+
projectType: 'application',
|
|
96
|
+
root: options.e2eProjectRoot,
|
|
97
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
98
|
+
targets: {},
|
|
99
|
+
implicitDependencies: [options.projectName],
|
|
100
|
+
});
|
|
101
|
+
}
|
|
73
102
|
const e2eTask = await configurationGenerator(tree, {
|
|
74
103
|
project: options.e2eProjectName,
|
|
75
104
|
skipFormat: true,
|
|
@@ -4,6 +4,8 @@ exports.addProject = addProject;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
|
|
6
6
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
7
9
|
function addProject(host, options) {
|
|
8
10
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
9
11
|
const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(host);
|
|
@@ -17,7 +19,24 @@ function addProject(host, options) {
|
|
|
17
19
|
targets: hasPlugin ? {} : getTargets(options),
|
|
18
20
|
tags: options.parsedTags,
|
|
19
21
|
};
|
|
20
|
-
(0,
|
|
22
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
23
|
+
const packageName = (0, get_import_path_1.getImportPath)(host, options.name);
|
|
24
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
25
|
+
name: packageName,
|
|
26
|
+
version: '0.0.1',
|
|
27
|
+
private: true,
|
|
28
|
+
nx: {
|
|
29
|
+
name: packageName === options.name ? undefined : options.name,
|
|
30
|
+
projectType: 'application',
|
|
31
|
+
sourceRoot: `${options.appProjectRoot}/src`,
|
|
32
|
+
targets: hasPlugin ? undefined : getTargets(options),
|
|
33
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, projectConfiguration, options.standaloneConfig);
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
function getTargets(options) {
|
|
23
42
|
const architect = {};
|
|
@@ -15,6 +15,9 @@ export interface Schema {
|
|
|
15
15
|
e2eTestRunner: 'cypress' | 'playwright' | 'detox' | 'none'; // default is none
|
|
16
16
|
standaloneConfig?: boolean;
|
|
17
17
|
skipPackageJson?: boolean; // default is false
|
|
18
|
+
// Internal options
|
|
18
19
|
addPlugin?: boolean;
|
|
19
20
|
nxCloudToken?: string;
|
|
21
|
+
useTsSolution?: boolean;
|
|
22
|
+
formatter?: 'prettier' | 'none';
|
|
20
23
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"description": "Create an Expo Application for Nx.",
|
|
6
6
|
"examples": [
|
|
7
7
|
{
|
|
8
|
-
"command": "g @nx/expo:app myapp --directory=nested",
|
|
8
|
+
"command": "nx g @nx/expo:app myapp --directory=nested",
|
|
9
9
|
"description": "Generate apps/nested/myapp"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"command": "g @nx/expo:app myapp --classComponent",
|
|
12
|
+
"command": "nx g @nx/expo:app myapp --classComponent",
|
|
13
13
|
"description": "Use class components instead of functional components"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
@@ -44,13 +44,15 @@
|
|
|
44
44
|
"description": "The tool to use for running lint checks.",
|
|
45
45
|
"type": "string",
|
|
46
46
|
"enum": ["eslint", "none"],
|
|
47
|
-
"default": "
|
|
47
|
+
"default": "none",
|
|
48
|
+
"x-priority": "important"
|
|
48
49
|
},
|
|
49
50
|
"unitTestRunner": {
|
|
50
51
|
"type": "string",
|
|
51
52
|
"enum": ["jest", "none"],
|
|
52
53
|
"description": "Test runner to use for unit tests",
|
|
53
|
-
"default": "
|
|
54
|
+
"default": "none",
|
|
55
|
+
"x-priority": "important"
|
|
54
56
|
},
|
|
55
57
|
"tags": {
|
|
56
58
|
"type": "string",
|
|
@@ -71,7 +73,8 @@
|
|
|
71
73
|
"description": "Adds the specified e2e test runner",
|
|
72
74
|
"type": "string",
|
|
73
75
|
"enum": ["playwright", "cypress", "detox", "none"],
|
|
74
|
-
"default": "none"
|
|
76
|
+
"default": "none",
|
|
77
|
+
"x-priority": "important"
|
|
75
78
|
},
|
|
76
79
|
"standaloneConfig": {
|
|
77
80
|
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
@@ -4,7 +4,6 @@ exports.normalizeOptions = normalizeOptions;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils");
|
|
6
6
|
async function normalizeOptions(host, options) {
|
|
7
|
-
assertValidOptions(options);
|
|
8
7
|
const { artifactName: name, fileName, filePath, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, {
|
|
9
8
|
name: options.name,
|
|
10
9
|
path: options.path,
|
|
@@ -19,6 +18,7 @@ async function normalizeOptions(host, options) {
|
|
|
19
18
|
options.classComponent = options.classComponent ?? false;
|
|
20
19
|
return {
|
|
21
20
|
...options,
|
|
21
|
+
name,
|
|
22
22
|
directory,
|
|
23
23
|
className,
|
|
24
24
|
fileName,
|
|
@@ -27,16 +27,3 @@ async function normalizeOptions(host, options) {
|
|
|
27
27
|
projectName,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function assertValidOptions(options) {
|
|
31
|
-
const slashes = ['/', '\\'];
|
|
32
|
-
slashes.forEach((s) => {
|
|
33
|
-
if (options.name.indexOf(s) !== -1) {
|
|
34
|
-
const [name, ...rest] = options.name.split(s).reverse();
|
|
35
|
-
let suggestion = rest.map((x) => x.toLowerCase()).join(s);
|
|
36
|
-
if (options.path) {
|
|
37
|
-
suggestion = `${options.path}${s}${suggestion}`;
|
|
38
|
-
}
|
|
39
|
-
throw new Error(`Found "${s}" in the component name. Did you mean to use the --directory option (e.g. \`nx g c ${name} --directory ${suggestion}\`)?`);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
@@ -6,29 +6,31 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"examples": [
|
|
8
8
|
{
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"description": "Generate a component with the exported symbol matching the file name. It results in the component `Foo` at `mylib/src/foo.tsx`",
|
|
10
|
+
"command": "nx g @nx/expo:component mylib/src/foo"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"description": "Generate a component with the exported symbol different from the file name. It results in the component `Custom` at `mylib/src/foo.tsx`",
|
|
14
|
+
"command": "nx g @nx/expo:component mylib/src/foo --name=custom"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "Generate a class component at `mylib/src/foo.tsx`",
|
|
18
|
+
"command": "nx g @nx/expo:component mylib/src/foo --classComponent"
|
|
15
19
|
}
|
|
16
20
|
],
|
|
17
21
|
"properties": {
|
|
18
22
|
"path": {
|
|
19
23
|
"type": "string",
|
|
20
|
-
"description": "
|
|
24
|
+
"description": "The file path to the component without the file extension. Relative to the current working directory.",
|
|
21
25
|
"$default": {
|
|
22
26
|
"$source": "argv",
|
|
23
27
|
"index": 0
|
|
24
28
|
},
|
|
25
|
-
"x-prompt": "
|
|
26
|
-
"x-priority": "important"
|
|
29
|
+
"x-prompt": "What is the component file path?"
|
|
27
30
|
},
|
|
28
31
|
"name": {
|
|
29
32
|
"type": "string",
|
|
30
|
-
"description": "The name of the
|
|
31
|
-
"x-prompt": "What name would you like to use for the component?"
|
|
33
|
+
"description": "The component symbol name. Defaults to the last segment of the file path."
|
|
32
34
|
},
|
|
33
35
|
"js": {
|
|
34
36
|
"type": "boolean",
|
|
@@ -5,7 +5,6 @@ exports.expoInitGeneratorInternal = expoInitGeneratorInternal;
|
|
|
5
5
|
exports.updateDependencies = updateDependencies;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
8
|
const plugin_1 = require("../../../plugins/plugin");
|
|
10
9
|
const versions_1 = require("../../utils/versions");
|
|
11
10
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
@@ -13,7 +12,6 @@ function expoInitGenerator(tree, schema) {
|
|
|
13
12
|
return expoInitGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
14
13
|
}
|
|
15
14
|
async function expoInitGeneratorInternal(host, schema) {
|
|
16
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'init');
|
|
17
15
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
18
16
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
19
17
|
nxJson.useInferencePlugins !== false;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
7
|
async function normalizeOptions(host, options) {
|
|
7
8
|
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
8
9
|
const { projectName, names: projectNames, projectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -28,6 +29,7 @@ async function normalizeOptions(host, options) {
|
|
|
28
29
|
parsedTags,
|
|
29
30
|
importPath,
|
|
30
31
|
appMain,
|
|
32
|
+
isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
31
33
|
};
|
|
32
34
|
return normalized;
|
|
33
35
|
}
|
|
@@ -4,7 +4,6 @@ exports.expoLibraryGenerator = expoLibraryGenerator;
|
|
|
4
4
|
exports.expoLibraryGeneratorInternal = expoLibraryGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
7
|
const init_1 = require("../init/init");
|
|
9
8
|
const add_linting_1 = require("../../utils/add-linting");
|
|
10
9
|
const add_jest_1 = require("../../utils/add-jest");
|
|
@@ -14,6 +13,8 @@ const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
|
|
|
14
13
|
const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
|
|
15
14
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
16
15
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
16
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
17
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
17
18
|
async function expoLibraryGenerator(host, schema) {
|
|
18
19
|
return await expoLibraryGeneratorInternal(host, {
|
|
19
20
|
addPlugin: false,
|
|
@@ -21,17 +22,16 @@ async function expoLibraryGenerator(host, schema) {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
async function expoLibraryGeneratorInternal(host, schema) {
|
|
24
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'expo', 'library');
|
|
25
|
-
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
26
|
-
if (options.publishable === true && !schema.importPath) {
|
|
27
|
-
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
|
28
|
-
}
|
|
29
25
|
const tasks = [];
|
|
30
26
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
31
27
|
...schema,
|
|
32
28
|
skipFormat: true,
|
|
33
29
|
});
|
|
34
30
|
tasks.push(jsInitTask);
|
|
31
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
32
|
+
if (options.publishable === true && !schema.importPath) {
|
|
33
|
+
throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
|
|
34
|
+
}
|
|
35
35
|
const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
|
|
36
36
|
tasks.push(initTask);
|
|
37
37
|
if (!options.skipPackageJson) {
|
|
@@ -61,9 +61,20 @@ async function expoLibraryGeneratorInternal(host, schema) {
|
|
|
61
61
|
(0, devkit_1.joinPathFragments)(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
|
62
62
|
]);
|
|
63
63
|
}
|
|
64
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
65
|
+
jsx: 'react-jsx',
|
|
66
|
+
module: 'esnext',
|
|
67
|
+
moduleResolution: 'bundler',
|
|
68
|
+
}, options.linter === 'eslint'
|
|
69
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
70
|
+
: undefined);
|
|
64
71
|
if (!options.skipFormat) {
|
|
65
72
|
await (0, devkit_1.formatFiles)(host);
|
|
66
73
|
}
|
|
74
|
+
// Always run install to link packages.
|
|
75
|
+
if (options.isUsingTsSolutionConfig) {
|
|
76
|
+
tasks.push(() => (0, devkit_1.installPackagesTask)(host));
|
|
77
|
+
}
|
|
67
78
|
tasks.push(() => {
|
|
68
79
|
(0, log_show_project_command_1.logShowProjectCommand)(options.name);
|
|
69
80
|
});
|
|
@@ -77,7 +88,29 @@ async function addProject(host, options) {
|
|
|
77
88
|
tags: options.parsedTags,
|
|
78
89
|
targets: {},
|
|
79
90
|
};
|
|
80
|
-
|
|
91
|
+
if (options.isUsingTsSolutionConfig) {
|
|
92
|
+
const packageName = (0, get_import_path_1.getImportPath)(host, options.name);
|
|
93
|
+
const sourceEntry = !options.buildable
|
|
94
|
+
? options.js
|
|
95
|
+
? './src/index.js'
|
|
96
|
+
: './src/index.ts'
|
|
97
|
+
: undefined;
|
|
98
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), {
|
|
99
|
+
name: packageName,
|
|
100
|
+
version: '0.0.1',
|
|
101
|
+
main: sourceEntry,
|
|
102
|
+
types: sourceEntry,
|
|
103
|
+
nx: {
|
|
104
|
+
name: packageName === options.name ? undefined : options.name,
|
|
105
|
+
projectType: 'library',
|
|
106
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
107
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
(0, devkit_1.addProjectConfiguration)(host, options.name, project);
|
|
113
|
+
}
|
|
81
114
|
if (!options.publishable && !options.buildable) {
|
|
82
115
|
return () => { };
|
|
83
116
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"examples": [
|
|
8
8
|
{
|
|
9
|
-
"command": "g @nx/expo:lib mylib --directory=myapp",
|
|
9
|
+
"command": "nx g @nx/expo:lib mylib --directory=myapp",
|
|
10
10
|
"description": "Generate libs/myapp/mylib"
|
|
11
11
|
}
|
|
12
12
|
],
|
|
@@ -29,13 +29,16 @@
|
|
|
29
29
|
"description": "The tool to use for running lint checks.",
|
|
30
30
|
"type": "string",
|
|
31
31
|
"enum": ["eslint", "none"],
|
|
32
|
-
"default": "
|
|
32
|
+
"default": "none",
|
|
33
|
+
"x-prompt": "Which linter would you like to use?",
|
|
34
|
+
"x-priority": "important"
|
|
33
35
|
},
|
|
34
36
|
"unitTestRunner": {
|
|
35
37
|
"type": "string",
|
|
36
38
|
"enum": ["jest", "none"],
|
|
37
39
|
"description": "Test runner to use for unit tests.",
|
|
38
|
-
"default": "
|
|
40
|
+
"default": "none",
|
|
41
|
+
"x-priority": "important"
|
|
39
42
|
},
|
|
40
43
|
"tags": {
|
|
41
44
|
"type": "string",
|