Skip to content

Commit 58d5e11

Browse files
authored
call gulp copy after Build in .csproj (#480)
* simplify build steps, call gulp copy after Build in .csproj
1 parent a5cbb6a commit 58d5e11

File tree

8 files changed

+178
-17
lines changed

8 files changed

+178
-17
lines changed

Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ RUN sed -i 's/UseSqlServer/UseNpgsql/' src/SimplCommerce.WebHost/Extensions/Serv
2020
RUN rm src/SimplCommerce.WebHost/Migrations/* && cp -f src/SimplCommerce.WebHost/appsettings.docker.json src/SimplCommerce.WebHost/appsettings.json
2121
RUN dotnet restore && dotnet build -c Release
2222
RUN cd src/SimplCommerce.WebHost \
23-
&& sed -i 's/Debug/Release/' gulpfile.js \
24-
&& npm install \
25-
&& npm install --global gulp-cli \
26-
&& gulp copy-modules \
2723
&& dotnet ef migrations add initialSchema \
2824
&& dotnet ef migrations script -o dbscript.sql \
2925
&& dotnet publish -c Release -o out

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ http://demo.simplcommerce.com
2727

2828
- Update the connection string in appsettings.json in SimplCommerce.WebHost
2929
- Build whole solution.
30-
- In the Task Runner Explorer, right click on the "copy-modules" task and Run.
3130
- Open Package Manager Console Window and type "Update-Database" then press "Enter". This action will create database schema.
3231
- In Visual Studio, press "Control + F5".
3332
- The back-office can access via /Admin using the pre-created account: [email protected], 1qazZAQ!

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
image: Visual Studio 2017 Preview
22
init:
33
- git config --global core.autocrlf true
4+
install:
5+
- ps: Install-Product node 8.11.2 x64
46
before_build:
57
- appveyor-retry dotnet restore -v Minimal
68
test: on

simpl-build.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ rm -rf src/SimplCommerce.WebHost/Migrations/*
1010
dotnet restore && dotnet build
1111

1212
cd src/SimplCommerce.WebHost \
13-
&& npm install \
14-
&& npm install --global gulp-cli \
15-
&& gulp copy-modules \
1613
&& dotnet ef migrations add initialSchema \
1714
&& dotnet ef database update
1815

src/SimplCommerce.WebHost/SimplCommerce.WebHost.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,13 @@
5858
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.2.1" />
5959
</ItemGroup>
6060

61+
<Target Name="RestoreNpmPackage" AfterTargets="CollectPackageReferences" Condition="!Exists('node_modules') ">
62+
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
63+
<Exec WorkingDirectory="." Command="npm install" />
64+
</Target>
65+
66+
<Target Name="CopyModules" AfterTargets="Build">
67+
<Exec WorkingDirectory="." Command="npm run gulp-copy-modules -- --configurationName $(ConfigurationName)" />
68+
</Target>
69+
6170
</Project>

src/SimplCommerce.WebHost/gulpfile.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/// <binding AfterBuild='copy-modules' />
2-
"use strict";
1+
"use strict";
32

43
var gulp = require('gulp'),
54
clean = require('gulp-clean'),
@@ -8,7 +7,10 @@ var gulp = require('gulp'),
87
uglify = require("gulp-uglify"),
98
ignore = require('gulp-ignore'),
109
glob = require("glob"),
11-
rimraf = require("rimraf");
10+
rimraf = require("rimraf"),
11+
argv = require('yargs').argv;
12+
13+
var buildConfigurationName = argv.configurationName || 'Debug';
1214

1315
var paths = {
1416
host: {
@@ -20,7 +22,7 @@ var paths = {
2022
},
2123
dev: {
2224
modules: "../Modules/",
23-
moduleBin: "/bin/Debug/netcoreapp2.1/"
25+
moduleBin: "/bin/" + buildConfigurationName +"/netcoreapp2.1/"
2426
}
2527
};
2628

@@ -80,6 +82,7 @@ gulp.task('clean-module', function () {
8082

8183
gulp.task('copy-static', function () {
8284
modules.forEach(function (module) {
85+
console.log('copying static contents ' + paths.dev.modules + module.fullName);
8386
gulp.src([paths.dev.modules + module.fullName + '/Views/**/*.*',
8487
paths.dev.modules + module.fullName + '/module.json'], { base: module.fullName })
8588
.pipe(gulp.dest(paths.host.modules + module.fullName));
@@ -96,6 +99,7 @@ gulp.task('copy-modules', ['clean-module'], function () {
9699

97100
modules.forEach(function (module) {
98101
if (!module.isBundledWithHost) {
102+
console.log('copying ' + paths.dev.modules + module.fullName + paths.dev.moduleBin);
99103
gulp.src(paths.dev.modules + module.fullName + paths.dev.moduleBin + '**/*.*')
100104
.pipe(gulp.dest(paths.host.modules + module.fullName + paths.host.moduleBin));
101105
}

src/SimplCommerce.WebHost/package-lock.json

Lines changed: 156 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SimplCommerce.WebHost/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"gulp-ignore": "^2.0.1",
2626
"gulp-uglify": "^3.0.0",
2727
"glob": "^7.1.2",
28-
"rimraf": "^2.6.2"
28+
"rimraf": "^2.6.2",
29+
"yargs": "^6.6.0"
2930
},
3031
"engines": {
3132
"node": "^8.9.3"
@@ -51,4 +52,4 @@
5152
"SimplCommerce contributors"
5253
],
5354
"license": "Apache License 2.0"
54-
}
55+
}

0 commit comments

Comments
 (0)