-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change enables the user to use a JavaScript module for their config file. The goal of this change is to enable more flexible configuration similar to Webpack or Babel. For example filter functions, which previously could only be provided using the Node API, can now be included directly in a JS config file. JavaScript config files could also eventually remove the need for the register APIs because you could simply pass formatters, transformers, etc. as functions directly in the config instead of registering them with an alias and then referencing that alias in the config. This could potentially provide a simpler API very similar to the way webpack handles plugins: https://webpack.js.org/configuration/plugins/. Just a thought though. For now the default config file `./config.json` and the ability to continue to use JSON config files has not changed.
- Loading branch information
Elliot Dickison
committed
Sep 2, 2018
1 parent
b7b36f7
commit 633cf15
Showing
6 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
var assert = require('chai').assert, | ||
childProcess = require("child_process"), | ||
helpers = require('./helpers'); | ||
|
||
describe('cliBuildWithJsConfig', function() { | ||
beforeEach(function() { | ||
helpers.clearOutput(); | ||
}); | ||
|
||
it('should work with json config', function() { | ||
childProcess.execSync("node ./bin/style-dictionary build --config ./test/configs/test.json") | ||
assert(helpers.fileExists('./test/output/web/_icons.css')); | ||
assert(helpers.fileExists('./test/output/android/colors.xml')); | ||
}); | ||
|
||
it('should work with javascript config', function() { | ||
childProcess.execSync("node ./bin/style-dictionary build --config ./test/configs/test.js") | ||
assert(helpers.fileExists('./test/output/web/_icons.css')); | ||
assert(helpers.fileExists('./test/output/android/colors.xml')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("./test.json") |