File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 11{
2- "name" : " dart- sass" ,
2+ "name" : " sass" ,
33 "description" : " A Dart implementation of Sass, compiled to JS." ,
44 "license" : " MIT" ,
55 "bugs" : " https://github.com/sass/dart-sass/issues" ,
Original file line number Diff line number Diff line change @@ -71,13 +71,22 @@ js() {
7171@Task ('Build a pure-JS npm package.' )
7272@Depends (js)
7373npm_package () {
74- var dir = new Directory ('build/npm' );
74+ var json = JSON .decode (new File ('package/package.json' ).readAsStringSync ());
75+ json['version' ] = _version;
76+
77+ _writeNpmPackage ('build/npm' , json);
78+ _writeNpmPackage ('build/npm-old' , json..addAll ({"name" : "dart-sass" }));
79+ }
80+
81+ /// Writes a Dart Sass NPM package to the directory at [destination] .
82+ ///
83+ /// The [json] will be used as the package's package.json.
84+ void _writeNpmPackage (String destination, Map <String , dynamic > json) {
85+ var dir = new Directory (destination);
7586 if (dir.existsSync ()) dir.deleteSync (recursive: true );
7687 dir.createSync (recursive: true );
7788
78- log ("copying package/package.json to build/npm" );
79- var json = JSON .decode (new File ('package/package.json' ).readAsStringSync ());
80- json['version' ] = _version;
89+ log ("copying package/package.json to $destination " );
8190 new File (p.join (dir.path, 'package.json' ))
8291 .writeAsStringSync (JSON .encode (json));
8392
You can’t perform that action at this time.
0 commit comments