Rename the npm package "sass".

We'll continue to build the "dart-sass" package for the time being to
ease migration, but I expect to move entirely to "sass" by 1.0.0
stable.
This commit is contained in:
Natalie Weizenbaum 2017-06-06 15:11:12 -07:00
parent 54d4f3f608
commit bd4cc36186
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,5 @@
{
"name": "dart-sass",
"name": "sass",
"description": "A Dart implementation of Sass, compiled to JS.",
"license": "MIT",
"bugs": "https://github.com/sass/dart-sass/issues",

View File

@ -71,13 +71,22 @@ js() {
@Task('Build a pure-JS npm package.')
@Depends(js)
npm_package() {
var dir = new Directory('build/npm');
var json = JSON.decode(new File('package/package.json').readAsStringSync());
json['version'] = _version;
_writeNpmPackage('build/npm', json);
_writeNpmPackage('build/npm-old', json..addAll({"name": "dart-sass"}));
}
/// Writes a Dart Sass NPM package to the directory at [destination].
///
/// The [json] will be used as the package's package.json.
void _writeNpmPackage(String destination, Map<String, dynamic> json) {
var dir = new Directory(destination);
if (dir.existsSync()) dir.deleteSync(recursive: true);
dir.createSync(recursive: true);
log("copying package/package.json to build/npm");
var json = JSON.decode(new File('package/package.json').readAsStringSync());
json['version'] = _version;
log("copying package/package.json to $destination");
new File(p.join(dir.path, 'package.json'))
.writeAsStringSync(JSON.encode(json));