Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Toolchain
sgc
Commits
ce4ead74
Commit
ce4ead74
authored
Aug 31, 2018
by
Philipp Nowinski
Browse files
[TASK] remove old upgrade script
parent
2b584aa5
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/installers/upgrade.js
deleted
100644 → 0
View file @
2b584aa5
'
use strict
'
;
let
filePath
=
process
.
cwd
()
+
'
/../.sgc-config.json
'
;
const
sgcConfiguration
=
require
(
filePath
);
const
jsonFormat
=
require
(
'
json-format
'
);
const
fs
=
require
(
'
fs
'
);
const
chalk
=
require
(
'
chalk
'
);
const
request
=
require
(
'
request
'
);
const
inquirer
=
require
(
'
inquirer
'
);
if
(
!
sgcConfiguration
.
js
.
hasOwnProperty
(
'
pipeline
'
))
{
console
.
log
(
chalk
.
green
(
'
Add JS pipeline configuration to your .sgc-config.json ✓
'
));
sgcConfiguration
.
js
.
pipeline
=
{
uglify
:
true
,
renameToDotMin
:
true
};
}
if
(
!
sgcConfiguration
.
css
.
hasOwnProperty
(
'
pipeline
'
))
{
console
.
log
(
chalk
.
green
(
'
Add CSS pipeline configuration to your .sgc-config.json ✓
'
));
sgcConfiguration
.
css
.
pipeline
=
{
cleanCss
:
true
,
renameToDotMin
:
true
};
}
if
(
!
sgcConfiguration
.
css
.
hasOwnProperty
(
'
supportedBrowsers
'
))
{
console
.
log
(
chalk
.
green
(
'
Add supported Browsers configuration to your .sgc-config.json ✓
'
));
sgcConfiguration
.
css
.
supportedBrowsers
=
[
'
last 1 version
'
,
'
> 1%
'
,
'
ie 8
'
];
}
console
.
log
(
''
);
console
.
log
(
chalk
.
green
(
'
Your .sgc-config.json is compatible with SGC 2.1.0 ✓
'
));
fs
.
writeFile
(
filePath
,
jsonFormat
(
sgcConfiguration
),
error
=>
console
.
log
);
checkEslint
();
function
checkEslint
()
{
fs
.
exists
(
process
.
cwd
()
+
'
/../.eslintrc.js
'
,
exists
=>
{
if
(
!
exists
)
{
console
.
log
(
''
);
inquirer
.
prompt
([
{
type
:
'
confirm
'
,
name
:
'
provideEsLint
'
,
message
:
'
Looks like you don
\'
t have an EsLint configuration file, yet. Do you want to include the sgalinski default configuration?
'
}
]).
then
(
answers
=>
{
if
(
answers
.
provideEsLint
)
{
request
(
'
https://gitlab.sgalinski.de/snippets/28/raw
'
).
pipe
(
fs
.
createWriteStream
(
process
.
cwd
()
+
'
/../.eslintrc.js
'
));
console
.
log
(
chalk
.
green
(
'
Add EsLint configuration ✓
'
));
}
checkJsHint
();
});
}
else
{
console
.
log
(
chalk
.
green
(
'
EsLint configuration found ✓
'
));
checkJsHint
();
}
});
}
function
checkJsHint
()
{
fs
.
exists
(
process
.
cwd
()
+
'
/../.jshintrc
'
,
exists
=>
{
if
(
exists
)
{
console
.
log
(
''
);
inquirer
.
prompt
([
{
type
:
'
confirm
'
,
name
:
'
removeJsHint
'
,
message
:
'
The SGC does not use JsHint anymore. Do you want to remove your .jshintrc file?
'
}
]).
then
(
answers
=>
{
if
(
answers
.
removeJsHint
)
{
fs
.
unlink
(
process
.
cwd
()
+
'
/../.jshintrc
'
,
error
=>
console
.
log
);
console
.
log
(
chalk
.
green
(
'
Removed .jshintrc ✓
'
));
}
checkStyleLint
();
});
}
else
{
checkStyleLint
();
}
});
}
function
checkStyleLint
()
{
fs
.
exists
(
process
.
cwd
()
+
'
/../.stylelintrc
'
,
exists
=>
{
if
(
!
exists
)
{
console
.
log
(
''
);
inquirer
.
prompt
([
{
type
:
'
confirm
'
,
name
:
'
provideStyleLint
'
,
message
:
'
Looks like you don
\'
t have a Stylelint configuration file, yet. Do you want to include the sgalinski default configuration?
'
}
]).
then
(
answers
=>
{
if
(
answers
.
provideStyleLint
)
{
request
(
'
https://gitlab.sgalinski.de/snippets/29/raw
'
).
pipe
(
fs
.
createWriteStream
(
process
.
cwd
()
+
'
/../.stylelintrc
'
));
console
.
log
(
chalk
.
green
(
'
Add Stylelint configuration ✓
'
));
}
checkScssLint
();
});
}
else
{
console
.
log
(
chalk
.
green
(
'
Stylelint configuration found ✓
'
));
checkScssLint
();
}
});
}
function
checkScssLint
()
{
fs
.
exists
(
process
.
cwd
()
+
'
/../.scss-lint.yml
'
,
exists
=>
{
if
(
exists
)
{
console
.
log
(
''
);
inquirer
.
prompt
([
{
type
:
'
confirm
'
,
name
:
'
removeScssLint
'
,
message
:
'
The SGC does not use scss-lint anymore. Do you want to remove your .scss-lint.yml file?
'
}
]).
then
(
answers
=>
{
if
(
answers
.
removeScssLint
)
{
fs
.
unlink
(
process
.
cwd
()
+
'
/../.scss-lint.yml
'
,
error
=>
console
.
log
);
console
.
log
(
chalk
.
green
(
'
Removed .scss-lint.yml ✓
'
));
}
});
}
});
}
install.sh
View file @
ce4ead74
...
...
@@ -75,17 +75,6 @@ npm ci --prefer-offline --no-audit &> /dev/null
npm
set
progress
=
true
echo
-e
"
\0
33[0;32mDependencies installed ✓
\0
33[0m
\n
"
# copy config file if no present yet
if
[
!
-e
../.sgc-config.json
]
then
cp
./gulp/sgc-config.template.json ../.sgc-config.json
echo
-e
"
\0
33[0;32mSGC config file created ✓
\0
33[0m
\n
"
else
echo
-e
"
\0
33[0;34mSGC config file found. Skip config creation...
\0
33[0m"
;
# run upgrade wizard to ensure compatibility with current version
# node ./core/installers/upgrade.js
fi
if
[
"
$1
"
==
"--local"
]
;
then
# install cli locally
echo
-e
"
\0
33[0;34mInstall sgc
\0
33[0m"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment