Closed pinxue closed 5 years ago
Dear @pinxue, thank you very much for your contribution! :+1:
I noticed some small improvements:
The following line in build.js
doesn't run on linux
(Kubuntu 4.15.0-34-generic). I found on stackoverflow that the macOS grep
version needs a proper extension string to parameter -i
(source: https://stackoverflow.com/questions/15402770/how-to-grep-and-replace)
Error under linux:
sed: can't read s/5f5b3cf5/594fe0f3/g: No such file or directory
This works under linux (I removed the ''
after the sed -i
):
shell.exec(`cd ${fullPath}/tmp && pwd && git clone --single-branch -b ${branch} https://github.com/AschPlatform/asch-frontend-2.git \
&& cd asch-frontend-2 && yarn install && pwd && sed -i 's/5f5b3cf5/${magic}/g' src/utils/constants.js \
&& quasar build && cp -r dist/spa-mat/* ../../public/dist/ && rm -rf asch-frontend-2`, { silent: false })
In the following line you use the yarn
and quasar-cli
command but we can't be sure that there are installed. I would check if yarn
and quasar
are globally installed. You could display an message with one of the two is not installed:
Code:
shell.exec(`cd ${fullPath}/tmp && pwd && git clone --single-branch -b ${branch} https://github.com/AschPlatform/asch-frontend-2.git \
&& cd asch-frontend-2 && yarn install && pwd && sed -i '' 's/5f5b3cf5/${magic}/g' src/utils/constants.js \
&& quasar build && cp -r dist/spa-mat/* ../../public/dist/ && rm -rf asch-frontend-2`, { silent: false })
Show if command is globally installed:
npm list --global --depth 0 | grep yarn
npm list --global --depth 0 | grep quasar-cli
Please also check if git
installed. Because not all users download the ASCH blockchain with git
. If you have a production server you maybe download the ASCH blockchain from wget https://downloads.asch.cn/package/asch-linux-latest-mainnet.tar.gz
and then you necessary have git
installed.
Check if git is installed:
which git
Please have a look at asch-frontend-2/develop/gulpfile.js. You would also need to replace the property serverUrl
in the constants.js
file.
@pinxue you could push to the same branch (install_front
) to add the missing parts for the pull request
Thank you :+1:
All the best!
a1300
I think you mean sed, which is complex than expected, https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux So that the fix has to be use different syntax for Linux and macOS.
It has to be yarn. npm install will result a vue version conflict. Checking is added. Quasar-cli is already a devDep, use that one instead.
Wish it will contain the frontend later. But git checking is added anyway.
Great finding and is added. Perhaps somebody more familiar with the code may centralize these information.
Dear @pinxue
great update!
I noticed some small things, everything is working so fine:
On the following line you check the config.json
file.
Only consideres localnet
config.json
:
const magic = shell.exec('grep magic config.json | awk \'{print $2}\' | sed -e \'s/[",]//g\'', { silent: true }).stdout.trim()
I think you would need to make the config.json
dependent upon the netVersion. Because we have the following config files: config-mainnet.json
, config-testnet.json
, config.json
Something like:
let magic = ''
if (netVersion !== 'localnet') {
magic = shell.exec(`grep magic config-${netversion}.json | awk \'{print $2}\' | sed -e \'s/[",]//g\'`, { silent: true }).stdout.trim()
} else {
magic = shell.exec('grep magic config.json | awk \'{print $2}\' | sed -e \'s/[",]//g\'', { silent: true }).stdout.trim()
}
The eslint
is complaining about some small things
Great job!
As this patch is already merged, I will refine it on another one.
For 1., I think
shell.cp(`config-${netVersion}.json`, `${fullPath}/config.json`)
at beginning makes it good enough