Skip to content

Commit

Permalink
fix(skeleton): fix readonly environment files
Browse files Browse the repository at this point in the history
closes #1031
  • Loading branch information
lorond committed Jun 14, 2019
1 parent 1dc6179 commit 4ae1bba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
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
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 4ae1bba

Please sign in to comment.