forked from Tencent/Hippy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(debug): add debug example compact script
- Loading branch information
1 parent
d7ddc56
commit 973a4be
Showing
6 changed files
with
155 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* eslint-disable no-console */ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const { | ||
exec, | ||
pushd, | ||
test, | ||
} = require('shelljs'); | ||
|
||
const cmdExample = 'please execute command like \'npm run debugexample -- hippy-react-demo dev\' or \'npm run debugexample -- hippy-react-demo debug\''; | ||
|
||
const example = process.argv[2]; | ||
if (!example) { | ||
console.error(`❌ No example argument found, ${cmdExample}`); | ||
process.exit(1); | ||
return; | ||
} | ||
const cmd = process.argv[3]; | ||
if (!cmd) { | ||
console.error(`❌ No cmd argument found, ${cmdExample}`); | ||
process.exit(1); | ||
return; | ||
} | ||
const BASE_PATH = process.cwd(); | ||
// Target demo project path | ||
const DEMO_PATH = path.join(BASE_PATH, 'framework/js/examples', example); | ||
if (!test('-d', DEMO_PATH)) { | ||
console.error(`❌ Can not find demo project: ${example}, ${cmdExample}.`); | ||
process.exit(1); | ||
return; | ||
} | ||
|
||
pushd(DEMO_PATH); | ||
|
||
const execOptions = { stdio: 'inherit' }; | ||
if (!fs.existsSync(path.resolve(DEMO_PATH, 'node_modules'))) { | ||
console.error(`❌ ${example} dependencies have not been installed, please execute 'npm run init:example -- ${example}' first.`); | ||
process.exit(1); | ||
return; | ||
} | ||
|
||
console.log(`Start to start ${example} with cmd 'npm run hippy:${cmd}'.`); | ||
exec(`npm run hippy:local-${cmd}`, execOptions); // start to build dev js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-disable no-console */ | ||
const path = require('path'); | ||
const { | ||
exec, | ||
pushd, | ||
test, | ||
rm, | ||
} = require('shelljs'); | ||
|
||
const cmdExample = 'please execute command like \'npm run init:example -- hippy-react-demo\' or \'npm run init:example -- hippy-vue-demo\''; | ||
const example = process.argv[2]; | ||
if (!example) { | ||
console.error(`❌ No example argument found, ${cmdExample}`); | ||
return; | ||
} | ||
const BASE_PATH = process.cwd(); | ||
// Target demo project path | ||
const DEMO_PATH = path.join(BASE_PATH, 'framework/js/examples', example); | ||
if (!test('-d', DEMO_PATH)) { | ||
console.error(`❌ Can not find demo project: ${example}, ${cmdExample}`); | ||
return; | ||
} | ||
|
||
pushd(DEMO_PATH); | ||
|
||
const execOptions = { stdio: 'inherit' }; | ||
console.log(`1/2 Start to install ${example} dependencies`); | ||
rm('-rf', './node_modules'); | ||
exec('npm install --legacy-peer-deps', execOptions); | ||
|
||
console.log(`${example} dependencies have been installed.`); |