Skip to content
Permalink
Browse files

fix(skeleton): fix readonly environment files

closes #1031
  • Loading branch information...
lorond committed Jun 14, 2019
1 parent 1dc6179 commit 4ae1bba1028e179c25ce03cb932fe27d52ecc524
@@ -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();
@@ -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));
}

@@ -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));
}

@@ -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

0 comments on commit 4ae1bba

Please sign in to comment.
You can’t perform that action at this time.