-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Readonly attribute on environment scipt file #1031
Comments
Some windows user reported this issue before, but didn’t know it is from TFS. Thanks for clarifying. |
EDIT: ORIGINAL: keep in mind that the first: install transpile.js import gulp from 'gulp';
import changedInPlace from 'gulp-changed-in-place';
import plumber from 'gulp-plumber';
import babel from 'gulp-babel';
import sourcemaps from 'gulp-sourcemaps';
import notify from 'gulp-notify';
import rename from 'gulp-rename';
import project from '../aurelia.json';
import {CLIOptions, build} from 'aurelia-cli';
import chmod from 'gulp-chmod'; //<-- added
function configureEnvironment() {
let env = CLIOptions.getEnvironment();
return gulp.src(`aurelia_project/environments/${env}.js`)
.pipe(changedInPlace({firstPass: true}))
.pipe(rename('environment.js'))
.pipe(chmod(666)) //<-- added
.pipe(gulp.dest(project.paths.root));
}
function buildJavaScript() {
return gulp.src(project.transpiler.source)
.pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')}))
.pipe(changedInPlace({firstPass: true}))
.pipe(sourcemaps.init())
.pipe(babel(project.transpiler.options))
.pipe(build.bundle());
}
export default gulp.series(
configureEnvironment,
buildJavaScript
); copy-files.js import gulp from 'gulp';
import path from 'path';
import minimatch from 'minimatch';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
import chmod from 'gulp-chmod'; //<-- added
export default function copyFiles(done)
{
if (typeof project.build.copyFiles !== 'object')
{
done();
return;
}
const instruction = getNormalizedInstruction();
const files = Object.keys(instruction);
return gulp.src(files)
.pipe(changedInPlace({ firstPass: true }))
.pipe(chmod(666))//<-- added
.pipe(gulp.dest(x =>
{
const filePath = prepareFilePath(x.path);
const key = files.find(f => minimatch(filePath, f));
return instruction[key];
}));
}
function getNormalizedInstruction()
{
const files = project.build.copyFiles;
let normalizedInstruction = {};
for (let key in files)
{
normalizedInstruction[path.posix.normalize(key)] = files[key];
}
return normalizedInstruction;
}
function prepareFilePath(filePath)
{
let preparedPath = filePath.replace(process.cwd(), '').substring(1);
//if we are running on windows we have to fix the path
if (/^win/.test(process.platform))
{
preparedPath = preparedPath.replace(/\\/g, '/');
}
return preparedPath;
} |
@avrahamcool it's enought just to add 0o200 - own write mode |
@avrahamcool also |
I don't know TFS, is there an way to make sure the source file is not read-only? |
even if you can.. it's not something you want to do. |
Sounds like everyone should switch to git... |
in organizations.. this is not always open for you to deiced.. we are making it sound like it's a big issue.. clearing the readonly file while creating the environment file is pretty simple. |
There is other way for cli to not copy environment file, but it's breaking change. In my own project, I didn't have an environment file, I use // @if isProduction
aurelia.use.developmentLogging('warn');
// @endif
// @if !isProduction
aurelia.use.developmentLogging('info');
// @endif
// @if isTest
aurelia.use.plugin('aurelia-testing');
// @endif |
@huochunpeng environment file could be the only file processed in the same manner (e.g. mentioned |
Library Version:
aurelia-cli v1.0.0-beta.12
Operating System:
Windows 10
Node Version:
10.15.0
NPM Version:
6.4.1
Browser:
not applicable
Language:
all
Loader/bundler:
Webpack (didn't tested other)
Current behavior:
If target
environment.[tj]s
file is readonly, build fails when trying to copy corresponding file fromaurelia_project\environments
.What is the expected behavior?
As file created by aurelia on each build, readonly attribute should not fail entire build process.
What is the motivation / use case for changing the behavior?
Team Foundation System with Server Repositories places readonly attribute on files that is not checked out. File
environment.[tj]s
is not exist on first build and copied with all attributes of source file, including readonly attribute as environment configuration files are rarely being edited and usually not checked out. Each subsequent build fails until either file or attribute removed. However, in this case source file copied again with all attributes. So it required to do manual cleanup before each build.The text was updated successfully, but these errors were encountered: