-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
965 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import sourceMaps from 'rollup-plugin-sourcemaps' | ||
import camelCase from 'lodash.camelcase' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import resolve from "rollup-plugin-node-resolve" | ||
import commonjs from "rollup-plugin-commonjs" | ||
import sourceMaps from "rollup-plugin-sourcemaps" | ||
import camelCase from "lodash.camelcase" | ||
import typescript from "rollup-plugin-typescript2" | ||
|
||
const pkg = require('./package.json') | ||
const pkg = require("./package.json") | ||
|
||
const libraryName = 'mosia' | ||
const libraryName = "mosia" | ||
|
||
export default { | ||
input: `src/${libraryName}.ts`, | ||
output: [ | ||
{ file: pkg.main, name: camelCase(libraryName), format: 'umd' }, | ||
{ file: pkg.module, format: 'es' }, | ||
], | ||
sourcemap: true, | ||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') | ||
external: [], | ||
watch: { | ||
include: 'src/**', | ||
export default [ | ||
{ | ||
input: `src/cli.js`, | ||
output: { file: "dist/cli.umd.js", format: "umd" }, | ||
}, | ||
plugins: [ | ||
// Compile TypeScript files | ||
typescript(), | ||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) | ||
commonjs(), | ||
// Allow node_modules resolution, so you can use 'external' to control | ||
// which external modules to include in the bundle | ||
// https://github.com/rollup/rollup-plugin-node-resolve#usage | ||
resolve(), | ||
{ | ||
input: `src/${libraryName}.ts`, | ||
output: [ | ||
{ file: pkg.main, name: camelCase(libraryName), format: "umd" }, | ||
{ file: pkg.module, format: "es" } | ||
], | ||
sourcemap: true, | ||
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash') | ||
external: [], | ||
watch: { | ||
include: "src/**" | ||
}, | ||
plugins: [ | ||
// Compile TypeScript files | ||
typescript(), | ||
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs) | ||
commonjs(), | ||
// Allow node_modules resolution, so you can use 'external' to control | ||
// which external modules to include in the bundle | ||
// https://github.com/rollup/rollup-plugin-node-resolve#usage | ||
resolve(), | ||
|
||
// Resolve source maps to the original source | ||
sourceMaps(), | ||
], | ||
} | ||
// Resolve source maps to the original source | ||
sourceMaps() | ||
] | ||
} | ||
] |
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,14 @@ | ||
const meow = require('meow') | ||
const Mosia = require('./mosia.umd') | ||
|
||
const cli = () => { | ||
return meow(` | ||
Usage | ||
$ mosia <command> | ||
mosia | ||
`) | ||
} | ||
|
||
const mosia = new Mosia() | ||
mosia.cmd(cli()) |
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,4 +1,7 @@ | ||
// Import here Polyfills if needed. Recommended core-js (npm i -D core-js) | ||
// import "core-js/fn/array.find" | ||
// ... | ||
export default class DummyClass {} | ||
import meow from 'meow' | ||
|
||
export default class Mosia { | ||
cmd(input: meow.Result) { | ||
console.log(input) | ||
} | ||
} |
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,14 +1,14 @@ | ||
import DummyClass from '../src/mosia' | ||
import Mosia from '../src/mosia' | ||
|
||
/** | ||
* Dummy test | ||
*/ | ||
describe('Dummy test', () => { | ||
describe('Mosia test', () => { | ||
it('works if true is truthy', () => { | ||
expect(true).toBeTruthy() | ||
}) | ||
|
||
it('DummyClass is instantiable', () => { | ||
expect(new DummyClass()).toBeInstanceOf(DummyClass) | ||
expect(new Mosia()).toBeInstanceOf(Mosia) | ||
}) | ||
}) |
Oops, something went wrong.