fix(expo): fix the buildable library (#14142)
This commit is contained in:
parent
02d1cc85ca
commit
74d8a4830e
@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
checkFilesExist,
|
||||||
cleanupProject,
|
cleanupProject,
|
||||||
expectTestsPass,
|
expectTestsPass,
|
||||||
newProject,
|
newProject,
|
||||||
@ -47,4 +48,21 @@ describe('expo', () => {
|
|||||||
'Export was successful. Your exported files can be found'
|
'Export was successful. Your exported files can be found'
|
||||||
);
|
);
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
|
|
||||||
|
it('should build publishable library', async () => {
|
||||||
|
const libName = uniq('lib');
|
||||||
|
const componentName = uniq('component');
|
||||||
|
|
||||||
|
runCLI(
|
||||||
|
`generate @nrwl/expo:library ${libName} --buildable --publishable --importPath=${proj}/${libName}`
|
||||||
|
);
|
||||||
|
runCLI(
|
||||||
|
`generate @nrwl/expo:component ${componentName} --project=${libName} --export`
|
||||||
|
);
|
||||||
|
expect(() => {
|
||||||
|
runCLI(`build ${libName}`);
|
||||||
|
checkFilesExist(`dist/libs/${libName}/index.js`);
|
||||||
|
checkFilesExist(`dist/libs/${libName}/src/index.d.ts`);
|
||||||
|
}).not.toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@nrwl/react/babel",
|
||||||
|
{
|
||||||
|
"runtime": "automatic",
|
||||||
|
"useBuiltIns": "usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"plugins": [],
|
||||||
|
"env": {
|
||||||
|
"test": {
|
||||||
"presets": ["babel-preset-expo"]
|
"presets": ["babel-preset-expo"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -235,7 +235,7 @@ describe('lib', () => {
|
|||||||
executor: '@nrwl/web:rollup',
|
executor: '@nrwl/web:rollup',
|
||||||
outputs: ['{options.outputPath}'],
|
outputs: ['{options.outputPath}'],
|
||||||
options: {
|
options: {
|
||||||
external: ['react/jsx-runtime'],
|
external: ['react/jsx-runtime', 'react-native'],
|
||||||
entryFile: 'libs/my-lib/src/index.ts',
|
entryFile: 'libs/my-lib/src/index.ts',
|
||||||
outputPath: 'dist/libs/my-lib',
|
outputPath: 'dist/libs/my-lib',
|
||||||
project: 'libs/my-lib/package.json',
|
project: 'libs/my-lib/package.json',
|
||||||
|
|||||||
@ -79,7 +79,7 @@ function addProject(host: Tree, options: NormalizedSchema) {
|
|||||||
|
|
||||||
if (options.publishable || options.buildable) {
|
if (options.publishable || options.buildable) {
|
||||||
const { libsDir } = getWorkspaceLayout(host);
|
const { libsDir } = getWorkspaceLayout(host);
|
||||||
const external = ['react/jsx-runtime'];
|
const external = ['react/jsx-runtime', 'react-native'];
|
||||||
|
|
||||||
targets.build = {
|
targets.build = {
|
||||||
executor: '@nrwl/web:rollup',
|
executor: '@nrwl/web:rollup',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user