FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nativescript-cli/scripts/clean.js at main · NativeScript/nativescript-cli · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
NativeScript
/
nativescript-cli
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
205
Star
1.1k
Code
Issues
356
Pull requests
22
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nativescript-cli
/
scripts
/
clean.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 1.17 KB
Breadcrumbs
nativescript-cli
/
scripts
/
clean.js
Copy path
File metadata and controls
37 lines (30 loc) · 1.17 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
const
child_process
=
require
(
"child_process"
)
;
const
fs
=
require
(
"fs"
)
;
const
path
=
require
(
"path"
)
;
const
rootDir
=
path
.
join
(
__dirname
,
".."
)
;
fs
.
rmSync
(
path
.
join
(
rootDir
,
"dist"
)
,
{
recursive
:
true
,
force
:
true
}
)
;
// tsc never removes output whose source is gone, so every build starts from an
// empty dist - otherwise a deleted file keeps being compiled-in and tested
// against, which is the failure this whole layout exists to prevent.
if
(
process
.
argv
.
includes
(
"--dist-only"
)
)
{
process
.
exit
(
0
)
;
}
// Builds used to emit next to each source file, so a tree that predates dist/
// still has hundreds of stale .js lying around. .gitignore is the source of
// truth for which of those are compiler output - its negations protect the
// vendored, hook and fixture .js that must survive.
const
result
=
child_process
.
spawnSync
(
"git"
,
[
"clean"
,
"-Xdf"
,
"lib"
,
"test"
]
,
{
cwd
:
rootDir
,
stdio
:
"inherit"
,
}
)
;
if
(
result
.
error
)
{
throw
result
.
error
;
}
if
(
result
.
status
!==
0
)
{
throw
new
Error
(
`git clean exited with status
${
result
.
status
}
`
)
;
}
for
(
const
entry
of
fs
.
readdirSync
(
rootDir
)
)
{
if
(
entry
.
endsWith
(
".tgz"
)
)
{
fs
.
rmSync
(
path
.
join
(
rootDir
,
entry
)
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL