Skip to content

Commit

Permalink
Merge pull request #1118 from lorond/master
Browse files Browse the repository at this point in the history
fix(skeleton): fix readonly environment files
  • Loading branch information
EisenbergEffect authored Jun 17, 2019
2 parents 1dc6179 + cb464a2 commit f3dbd29
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"del": "^3.0.0",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"expose-loader": "^0.7.5",
"merge2": "^1.2.3",
"mini-css-extract-plugin": "^0.4.3",
"file-loader": "^2.0.0",
"gulp": "^4.0.0",
Expand Down Expand Up @@ -107,4 +106,4 @@
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9",
"webpack-hot-middleware": "^2.24.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import notify from 'gulp-notify';
import rename from 'gulp-rename';
import cache from 'gulp-cache';
import project from '../aurelia.json';
import fs from 'fs';
import through from 'through2';
import {CLIOptions, build, Configuration} from 'aurelia-cli';

let env = CLIOptions.getEnvironment();
Expand All @@ -14,6 +16,10 @@ const useCache = buildOptions.isApplicable('cache');
function configureEnvironment() {
return gulp.src(`aurelia_project/environments/${env}.js`, {since: gulp.lastRun(configureEnvironment)})
.pipe(rename('environment.js'))
.pipe(through.obj(function (file, _, cb) {
// https://github.com/aurelia/cli/issues/1031
fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
}))
.pipe(gulp.dest(project.paths.root));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import * as notify from 'gulp-notify';
import * as rename from 'gulp-rename';
import * as ts from 'gulp-typescript';
import * as project from '../aurelia.json';
import * as fs from 'fs';
import * as through from 'through2';
import {CLIOptions, build} from 'aurelia-cli';
import * as merge2 from 'merge2';

function configureEnvironment() {
let env = CLIOptions.getEnvironment();

return gulp.src(`aurelia_project/environments/${env}.ts`, {since: gulp.lastRun(configureEnvironment)})
.pipe(rename('environment.ts'))
.pipe(through.obj(function (file, _, cb) {
// https://github.com/aurelia/cli/issues/1031
fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
}))
.pipe(gulp.dest(project.paths.root));
}

Expand Down
3 changes: 1 addition & 2 deletions skeleton/cli-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
// @if feat.typescript
"gulp-typescript": "",
"gulp-tslint": "",
"merge2": "",
"tslint": "",
"typescript": "",
"@types/node": "",
Expand Down Expand Up @@ -68,4 +67,4 @@
"gulp-notify": "",
"gulp-watch": "",
}
}
}
4 changes: 4 additions & 0 deletions skeleton/webpack/aurelia_project/tasks/environment.ext
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function configureEnvironment() {

return gulp.src(`aurelia_project/environments/${env}${project.transpiler.fileExtension}`)
.pipe(rename(`environment${project.transpiler.fileExtension}`))
.pipe(through.obj(function (file, _, cb) {
// https://github.com/aurelia/cli/issues/1031
fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
}))
.pipe(gulp.dest(project.paths.root))
.pipe(through.obj(function(file, enc, cb) {
// https://github.com/webpack/watchpack/issues/25#issuecomment-287789288
Expand Down

0 comments on commit f3dbd29

Please sign in to comment.