@@ -12,7 +12,7 @@ const addMainLibToPackageJson = async (packageJsonPath, main) => {
1212} ;
1313
1414const createLibIndex = async ( libIndexPath , name ) => {
15- const content = `import { CreateLib } from 'react-microfrontend ';
15+ const content = `import { CreateLib } from '@cmra/ react';
1616import schema from './schema';
1717
1818const api = CreateLib(schema, { apiAccess: CreateLib.BUILD_TYPE.PRIVATE_API, packageName: "${ name } " });
@@ -37,43 +37,31 @@ const addBuildLibToGitIgnore = async (rootAppPath, name) => {
3737} ;
3838
3939const createLibrary = async ( name , folder = '.' , template = 'library' ) => {
40- await explain (
41- 'Creating library' ,
42- async ( ) => {
43- const rootAppPath = resolveApp ( folder ) ;
44- const basePath = `${ rootAppPath } /packages/${ name } ` ;
40+ await explain ( 'Creating library' , async ( ) => {
41+ const rootAppPath = resolveApp ( folder ) ;
42+ const basePath = `${ rootAppPath } /packages/${ name } ` ;
4543
46- await createModule ( name , template , rootAppPath , true ) ;
47- await addMainLibToPackageJson ( `${ basePath } /package.json` , './build-lib/index.js' ) ;
48- await createLibIndex ( `${ basePath } /src/lib/index.js` , name ) ;
49- await addBuildLibToGitIgnore ( rootAppPath , name ) ;
50- } ,
51- ) ;
44+ await createModule ( name , template , rootAppPath , true ) ;
45+ await addMainLibToPackageJson ( `${ basePath } /package.json` , './build-lib/index.js' ) ;
46+ await createLibIndex ( `${ basePath } /src/lib/index.js` , name ) ;
47+ await addBuildLibToGitIgnore ( rootAppPath , name ) ;
48+ } ) ;
5249} ;
5350
5451const deleteUnusedFiles = async ( name , folder ) => {
5552 const rootAppPath = resolveApp ( folder ) ;
5653 const { execInApp } = createExecutionContext ( rootAppPath , name ) ;
5754
58- const filesToDelete = [
59- 'src/App.*' ,
60- 'src/*.css' ,
61- 'src/serviceWorker.js' ,
62- 'src/setupTests.js' ,
63- 'src/logo.*' ,
64- ] ;
55+ const filesToDelete = [ 'src/App.*' , 'src/*.css' , 'src/serviceWorker.js' , 'src/setupTests.js' , 'src/logo.*' ] ;
6556
6657 await execInApp ( `rm -f ${ filesToDelete . join ( ' ' ) } ` ) ;
6758} ;
6859
6960const createStandaloneLibrary = async ( name , folder = '.' ) => {
70- await explain (
71- 'Creating standalone library' ,
72- async ( ) => {
73- await createLibrary ( name , folder ) ;
74- await deleteUnusedFiles ( name , folder ) ;
75- } ,
76- ) ;
61+ await explain ( 'Creating standalone library' , async ( ) => {
62+ await createLibrary ( name , folder ) ;
63+ await deleteUnusedFiles ( name , folder ) ;
64+ } ) ;
7765} ;
7866
7967module . exports = {
0 commit comments