FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
patternfly-react/scripts/exportSubpaths.mjs at main · patternfly/patternfly-react · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
patternfly
/
patternfly-react
Public
Notifications
You must be signed in to change notification settings
Fork
392
Star
862
Code
Issues
215
Pull requests
24
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
patternfly-react
/
scripts
/
exportSubpaths.mjs
Copy path
More file actions
More file actions
Latest commit
History
History
History
54 lines (45 loc) · 1.53 KB
Breadcrumbs
patternfly-react
/
scripts
/
exportSubpaths.mjs
Copy path
File metadata and controls
54 lines (45 loc) · 1.53 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* eslint-disable no-console */
import
fse
from
'fs-extra'
;
import
{
createRequire
}
from
'node:module'
;
import
path
from
'node:path'
;
const
require
=
createRequire
(
import
.
meta
.
url
)
;
const
root
=
process
.
cwd
(
)
;
const
packageJson
=
require
(
`
${
root
}
/package.json`
)
;
if
(
!
(
process
.
argv
.
includes
(
'--config'
)
&&
process
.
argv
.
indexOf
(
'--config'
)
+
1
<
process
.
argv
.
length
)
)
{
console
.
log
(
'--config is required followed by the config file name'
)
;
process
.
exit
(
1
)
;
}
const
configJson
=
require
(
`
${
root
}
/
${
process
.
argv
[
process
.
argv
.
indexOf
(
'--config'
)
+
1
]
}
`
)
;
if
(
!
configJson
.
paths
||
configJson
.
paths
.
length
===
0
)
{
console
.
log
(
'directories are required'
)
;
process
.
exit
(
1
)
;
}
const
packageName
=
configJson
.
packageName
;
if
(
!
packageName
)
{
console
.
log
(
'packageName is required'
)
;
process
.
exit
(
1
)
;
}
/**
* Re-export subpath modules into the package root directory for ease of access.
*/
async
function
createPackage
(
directoryName
)
{
const
content
=
{
name
:
`
${
packageName
}
-
${
directoryName
}
`
,
main
:
`../dist/js/
${
directoryName
}
/index.js`
,
module
:
`../dist/esm/
${
directoryName
}
/index.js`
,
typings
:
`../dist/esm/
${
directoryName
}
/index.d.ts`
,
version
:
packageJson
.
version
,
private
:
true
}
;
const
dirPath
=
path
.
join
(
root
,
directoryName
)
;
await
fse
.
mkdir
(
dirPath
)
;
await
fse
.
writeJSON
(
path
.
join
(
dirPath
,
'package.json'
)
,
content
)
;
}
configJson
.
paths
.
forEach
(
(
dirName
)
=>
{
try
{
createPackage
(
dirName
)
;
}
catch
(
error
)
{
console
.
log
(
'failed to create re-export package file'
)
;
console
.
log
(
error
)
;
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL