/
PCF.bat
126 lines (115 loc) · 5.41 KB
/
PCF.bat
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@echo off
echo ---------------------------------------------------------------------------------
echo variables name list/ You can name it as per your requirement
set ParentDir="PCF"
set AppName="AppName"
set nameSpaceName="SampleNameSpace"
set initName="SampleComponent"
set pubName="Samples"
set pubPrefix="samples"
set SolutionsPath="Solutions"
:: for setting enviroment if ms build is not working Change According to your installed app in pc
:: be Carefull here if Problem persist google it
set msbuildPath="C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\"
echo -----------------------------------------------
echo Project is in this Format
echo Parent Directory : %ParentDir%
echo Application Name : %AppName%
echo App Namespace : %nameSpaceName%
echo Name : %initName%
echo Publisher Name : %pubName%
echo Publisher Prefix : %pubPrefix%
echo -----------------------------------------------
mkdir %ParentDir%
cd %ParentDir%
mkdir %AppName%
cd %AppName%
set buildPath=%cd%
echo ---------------------------------------------------------------------------------
call pac install latest
echo ---------------------------------------------------------------------------------
echo "Project Creation Started"
call pac pcf init --namespace %nameSpaceName% --name %initName% --template field
echo ---------------------------------------------------------------------------------
echo "Running npm install Command"
call npm install
echo ---------------------------------------------------------------------------------
Echo "Running npm install react react-dom Command"
call npm install react react-dom
echo ---------------------------------------------------------------------------------
Echo "Running "npm install @types/react --save-dev" Command"
call npm install @types/react --save-dev
echo ---------------------------------------------------------------------------------
Echo "Opening Vs Code"
call code .
echo ---------------------------------------------------------------------------------
Echo "Running run refresh command"
call npm run refreshTypes
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
Echo "Running run build command"
call npm run build
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
start cmd.exe /k "npm run start"
echo ---------------------------------------------------------------------------------
mkdir %SolutionsPath%
cd %SolutionsPath%
Echo "Adding Solution File to solution Folder"
call pac solution init --publisher-name %pubName% --publisher-prefix %pubPrefix%
echo ---------------------------------------------------------------------------------
set pathSolution=%cd%
echo "Adding Solution reference to %pathSolution%"
cd %pathSolution%
::call pac solution add-reference --path %path%
::call pac solution add-reference --path ..
call pac solution add-reference --path %pathSolution%
echo "add reference part done"
echo ---------------------------------------------------------------------------------
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo ++++"From Now on Bhagwan Bharose"++++
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo +++++++++++++++++++++++++++++++++++++
echo ---------------------------------------------------------------------------------
echo Changing Enviroment variables path
call setx msbuild %msbuildPath%
echo ---------------------------------------------------------------------------------
Echo "Project Building With MsBuild"
call msbuild /t:build /restore
::msbuild /t:build /restore
echo ---------------------------------------------------------------------------------
Echo "Project Building With dotnet Build"
::call dotnet build
dotnet build
echo ---------------------------------------------------------------------------------
::echo "Running msbuild command again For Release mode"
::call msbuild /property:configuration=Release
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
echo Project is in this Format
echo Parent Directory : %ParentDir%
echo Application Name : %AppName%
echo App Namespace : %nameSpaceName%
echo Name : %initName%
echo Publisher Name : %pubName%
echo Publisher Prefix : %pubPrefix%
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
echo %pathSolution%
echo Some of the Command may have not worked
echo try to execute it mannually in vs code
echo %SolutionsPath%
echo pac solution add-reference --path ..
echo msbuild /t:build /restore
echo dotnet build
echo msbuild
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
echo ---------------------------------------------------------------------------------
pause