-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(UX): switch to rollup, return promise<UX> in configure (#147)
- Loading branch information
Showing
9 changed files
with
185 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ lerna-debug.log | |
*.swp | ||
npm-debug.log* | ||
.test | ||
.rollupcache | ||
dist/doc-temp | ||
dist/test | ||
coverage | ||
|
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
src | ||
test | ||
rollup.config.js | ||
karma.conf.js | ||
tsconfig.json | ||
package-lock.json | ||
test | ||
.npmignore |
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 |
---|---|---|
|
@@ -15,10 +15,11 @@ | |
"license": "MIT", | ||
"author": "Rob Eisenberg <[email protected]> (http://robeisenberg.com/)", | ||
"contributors": [ | ||
"Zach Hollingshead <[email protected]>" | ||
"Zach Hollingshead <[email protected]>", | ||
"bigopon <[email protected]>" | ||
], | ||
"main": "dist/commonjs/index.js", | ||
"typings": "dist/commonjs/index.d.ts", | ||
"typings": "dist/types/index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/aurelia/ux" | ||
|
@@ -28,22 +29,9 @@ | |
"test": "cross-env TS_NODE_PROJECT=\"../../tsconfig-tsnode.json\" karma start --single-run", | ||
"develop": "cross-env TS_NODE_PROJECT=\"../../tsconfig-tsnode.json\" karma start", | ||
"prebuild:amd": "cross-env rimraf dist/amd", | ||
"build:amd": "cross-env tsc --project tsconfig.json --outDir dist/amd --module amd", | ||
"postbuild:amd": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/amd", | ||
"prebuild:commonjs": "cross-env rimraf dist/commonjs", | ||
"build:commonjs": "cross-env tsc --project tsconfig.json --outDir dist/commonjs --module commonjs", | ||
"postbuild:commonjs": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/commonjs", | ||
"prebuild:es2015": "cross-env rimraf dist/es2015", | ||
"build:es2015": "cross-env tsc --project tsconfig.json --outDir dist/es2015 --module es2015 --target es2015", | ||
"postbuild:es2015": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/es2015", | ||
"prebuild:native-modules": "cross-env rimraf dist/native-modules", | ||
"build:native-modules": "cross-env tsc --project tsconfig.json --outDir dist/native-modules --module es2015", | ||
"postbuild:native-modules": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/native-modules", | ||
"prebuild:system": "cross-env rimraf dist/system", | ||
"build:system": "cross-env tsc --project tsconfig.json --outDir dist/system --module system", | ||
"postbuild:system": "cross-env copyfiles --up 1 src/**/*.html src/**/*.css dist/system", | ||
"develop2": "rollup -c -w", | ||
"prebuild": "cross-env rimraf dist", | ||
"build": "concurrently \"npm run build:amd\" \"npm run build:commonjs\" \"npm run build:es2015\" \"npm run build:native-modules\" \"npm run build:system\"", | ||
"build": "rollup -c --environment NODE_ENV:production", | ||
"predoc": "cross-env rimraf doc/api.json && rimraf dist/doc-temp && tsc --project tsconfig.json --outFile dist/doc-temp/aurelia-ux.js && node doc/shape-defs && copyfiles tsconfig.json dist/doc-temp", | ||
"doc": "cross-env typedoc --json doc/api.json --excludeExternals --includeDeclarations --mode modules --target ES6 --name aurelia-ux-docs dist/doc-temp/", | ||
"postdoc": "cross-env node doc/shape-doc && rimraf dist/doc-temp", | ||
|
@@ -126,15 +114,9 @@ | |
"tsconfig-paths": "^3.1.1", | ||
"tslint": "^4.4.2", | ||
"typedoc": "^0.9.0", | ||
"rollup": "^0.55.1", | ||
"rollup-plugin-typescript2": "^0.10.0", | ||
"typescript": "^2.2.1", | ||
"webpack": "^4.0.1" | ||
}, | ||
"aurelia": { | ||
"build": { | ||
"resources": [] | ||
}, | ||
"documentation": { | ||
"articles": [] | ||
} | ||
} | ||
} |
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,102 @@ | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import * as fse from 'fs-extra'; | ||
import * as colors from 'colors'; | ||
|
||
export default ([ | ||
{ | ||
input: 'src/index.ts', | ||
output: { | ||
file: 'dist/es2015/index.js', | ||
format: 'es' | ||
}, | ||
plugins: [ | ||
typescript({ | ||
useTsconfigDeclarationDir: true, | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
target: 'es2015' | ||
} | ||
}, | ||
cacheRoot: '.rollupcache' | ||
}), | ||
copy({ | ||
verbose: true, | ||
files: [ | ||
{ from: 'src/reset.css', to: 'dist/es2015/reset.css' }, | ||
{ from: 'src/effects/paper-ripple.css', to: 'dist/es2015/paper-ripple.css' } | ||
] | ||
}) | ||
] | ||
} | ||
].concat(process.env.NODE_ENV !== 'production' | ||
? [] | ||
: [{ | ||
input: 'src/index.ts', | ||
output: [ | ||
{ file: 'dist/commonjs/index.js', format: 'cjs' }, | ||
{ file: 'dist/amd/index.js', format: 'amd', amd: { id: '@aurelia-ux/core' } }, | ||
{ file: 'dist/native-modules/index.js', format: 'es' } | ||
], | ||
plugins: [ | ||
typescript({ | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: false, | ||
declarationDir: null | ||
} | ||
}, | ||
cacheRoot: '.rollupcache', | ||
}), | ||
copy({ | ||
verbose: true, | ||
files: [ | ||
{ from: 'src/reset.css', to: 'dist/commonjs/reset.css' }, | ||
{ from: 'src/reset.css', to: 'dist/amd/reset.css' }, | ||
{ from: 'src/reset.css', to: 'dist/native-modules/reset.css' }, | ||
{ from: 'src/effects/paper-ripple.css', to: 'dist/commonjs/paper-ripple.css' }, | ||
{ from: 'src/effects/paper-ripple.css', to: 'dist/amd/paper-ripple.css' }, | ||
{ from: 'src/effects/paper-ripple.css', to: 'dist/native-modules/paper-ripple.css' } | ||
] | ||
}) | ||
] | ||
}] | ||
)); | ||
|
||
function success (name, src, dest) { | ||
console.log('(' + name + ") '" + src.green + "' -> '" + dest.green + "' (" + '\u2714'.green + ')'); | ||
} | ||
|
||
function fatal (name, src, dest, err) { | ||
console.error('(' + name + ") '" + src.red + "' -> '" + dest.red + "' (" + '\u2718'.red + ')'); | ||
console.error(); | ||
console.error(' ' + err); | ||
process.exit(err.errno); | ||
} | ||
|
||
var copyTimer; | ||
|
||
/** | ||
* @param {{ verbose: boolean, files: { from: string, to: string }[] }} options | ||
*/ | ||
function copy (options = {}) { | ||
const { verbose = false, files = [] } = options; | ||
const name = 'rollup-plugin-copy-fork-aurelia'; | ||
|
||
return { | ||
name: name, | ||
onwrite: function (object) { | ||
clearTimeout(copyTimer); | ||
copyTimer = setTimeout(() => { | ||
for (const { from, to } of files) { | ||
fse.copy(from, to).then(() => { | ||
if (verbose) { | ||
success(name, from, to); | ||
} | ||
}).catch(ex => { | ||
fatal(name, from, to, ex); | ||
}); | ||
} | ||
}, 1000); | ||
} | ||
}; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,35 @@ | ||
import {configure} from '../../src/index'; | ||
import { AureliaUX } from '../../src/index'; | ||
import { Container, bindingMode, ObserverLocator } from 'aurelia-framework'; | ||
|
||
describe('aurelia-ux/core', () => { | ||
it('configure is defined', () => { | ||
expect(configure).toBeDefined(); | ||
let container: Container; | ||
let ux: AureliaUX; | ||
let observerLocator: ObserverLocator; | ||
|
||
beforeEach(() => { | ||
container = new Container(); | ||
ux = container.get(AureliaUX); | ||
observerLocator = container.get(ObserverLocator); | ||
}); | ||
|
||
it('add ux elements observer adapter', () => { | ||
let adapter: any = {}; | ||
|
||
ux.addUxElementObserverAdapter('UX-INPUT', { | ||
value: { | ||
defaultBindingMode: bindingMode.twoWay, | ||
getObserver: () => adapter | ||
} | ||
}); | ||
|
||
let input = document.createElement('ux-input'); | ||
// needs a getter to get it resolves to adapter | ||
Object.defineProperty(input, 'value', { | ||
get() { | ||
return ''; | ||
} | ||
}); | ||
let observer = observerLocator.getObserver(input, 'value'); | ||
expect(observer).toBe(adapter); | ||
}); | ||
}); |
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