mirror of
https://github.com/aleleba/create-react-ssr.git
synced 2025-01-09 21:46:56 -06:00
PR-767513: fix npx.
This commit is contained in:
parent
dac561b8a7
commit
84120937ac
10
bin/cli.js
10
bin/cli.js
@ -24,13 +24,13 @@ const runCommandWithOutput = command => {
|
||||
}
|
||||
}
|
||||
|
||||
const replaceTextOnFile = async ({
|
||||
const replaceTextOnFile = ({
|
||||
file,
|
||||
textToBeReplaced,
|
||||
textReplace,
|
||||
arrOfObjectsBeReplaced
|
||||
}) => {
|
||||
await fs.readFile(file, 'utf8', function (err,data) {
|
||||
fs.readFile(file, 'utf8', function (err,data) {
|
||||
let result
|
||||
if (err) {
|
||||
return console.error(err);
|
||||
@ -47,7 +47,7 @@ const replaceTextOnFile = async ({
|
||||
result = data.replace(textToBeReplaced, textReplace).replace(/^\s*[\r\n]/gm, ' ');
|
||||
}
|
||||
|
||||
fs.writeFileSync(file, result, 'utf8', function (err) {
|
||||
fs.writeFile(file, result, 'utf8', function (err) {
|
||||
if (err){
|
||||
return console.error(err);
|
||||
}
|
||||
@ -55,6 +55,7 @@ const replaceTextOnFile = async ({
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const repoName = process.argv[2];
|
||||
const gitCheckoutCommand = `git clone --depth 1 https://github.com/aleleba/create-react-ssr ${repoName}`;
|
||||
console.log(`Cloning the repository with name ${repoName}`);
|
||||
@ -84,7 +85,7 @@ console.log(`Installing dependencies for ${repoName}`);
|
||||
const installedDeps = runCommand(installDepsCommand);
|
||||
if(!installedDeps) process.exit(-1);
|
||||
|
||||
replaceTextOnFile({
|
||||
await replaceTextOnFile({
|
||||
file: `./${repoName}/package.json`,
|
||||
arrOfObjectsBeReplaced: [
|
||||
{
|
||||
@ -122,3 +123,4 @@ console.log(`Then you can run: npm start:dev`);
|
||||
|
||||
const deleteFolders = isWin ? runCommand(deleteFoldersCommandWindows) : runCommand(deleteFoldersCommand);
|
||||
if(!deleteFolders) process.exit(-1);
|
||||
})();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aleleba/create-react-ssr",
|
||||
"version": "3.0.44",
|
||||
"version": "3.0.45",
|
||||
"description": "Starter Kit of server side render of react",
|
||||
"bin": "./bin/cli.js",
|
||||
"main": "src/server/index",
|
||||
|
Loading…
Reference in New Issue
Block a user