Files
vercel/examples/aurelia/aurelia_project/tasks/environment.js
Andy 890de6a625 Add API for frameworks and examples (#3514)
* Add API for frameworks and examples

* Adjust headers

* Update frameworks list

* Always use latest

* Add types

* Use now repo for downloading and listing

* Use .existsSync

* Remove unused packages

* Use 307 for redirect

* Add examples

* Update tsconfig.json

Co-Authored-By: Steven <steven@ceriously.com>

* Make examples unique

* Remove detectors from frameworks API

* Use /api instead of Next.js

* Install dependencies

* Rename project

* Change name

* Empty

* Change name

* Update api/tsconfig.json

Co-Authored-By: Steven <steven@ceriously.com>

* Update examples

Co-authored-by: Steven <steven@ceriously.com>
2020-01-07 23:55:39 +01:00

39 lines
1.1 KiB
JavaScript

import project from '../aurelia.json';
import rename from 'gulp-rename';
import gulp from 'gulp';
import fs from 'fs';
import through from 'through2';
import { CLIOptions } from 'aurelia-cli';
function configureEnvironment() {
let env = CLIOptions.getEnvironment();
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
const now = Date.now() / 1000;
const then = now - 10;
fs.utimes(file.path, then, then, function(err) {
if (err) throw err;
});
cb(null, file);
})
);
}
export default configureEnvironment;