Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rollup instead of webpack #309

Merged
merged 21 commits into from
Jan 12, 2019
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/coverage/
/cypress/dummy/js/prism.js
/dist/
/docs/
/docs/
/src/scss/
27 changes: 20 additions & 7 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@ module.exports = function(api) {

return {
presets: [
['@babel/preset-env']
],
plugins: [
'add-module-exports',
'lodash',
'transform-es2015-modules-commonjs'
[
'@babel/preset-env',
{
modules: false,
targets: {
browsers: 'ie >= 11'
}
}
]
],
env: {
test: {
plugins: ['istanbul']
presets: [
[
'@babel/preset-env',
{
modules: false
}
]
],
plugins: [
'transform-es2015-modules-commonjs'
]
}
}
};
Expand Down
3 changes: 0 additions & 3 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"coverageFolder": "coverage",
"fixturesFolder": "test/cypress/fixtures",
"integrationFolder": "test/cypress/integration",
"pluginsFile": "test/cypress/plugins/index.js",
"supportFile": "test/cypress/support/index.js",
"video": false,
"baseUrl": "http://localhost:9002"
}
23 changes: 23 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,29 @@ Click Install to create a tour right on your site with no coding required.-->

<!--iframe style="height: 48px; width: 180px" src="//install.eager.io?appId=AalP5veMma6s" allowtransparency="true" scroll="no" frameBorder="0"></iframe-->

### Importing Shepherd into your app

#### Ember Apps

There is an official Ember Addon, [ember-shepherd](https://github.com/shipshapecode/ember-shepherd), for using Shepherd with Ember apps.

#### Rollup/Webpack Based Builds

The latest versions of Rollup and Webpack support ES6 imports. We have an ES module
exported to `dist/js/shepherd.esm.js`. This is also specified as `"module"` in
`package.json`, which should allow you to import using standard ES import syntax.

i.e.

```js
import Shepherd from 'shepherd.js';
```

#### GitHub Releases

Whenever we release a new version, the contents of the `dist` are uploaded
to the release in GitHub. You can find those assets [here](https://github.com/shipshapecode/shepherd/releases).

### Usage

First create a new `Tour` instance for your tour:
Expand Down
183 changes: 183 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after the first failure
// bail: false,

// Respect "browser" field in package.json when resolving modules
// browser: false,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/var/folders/tf/h_tyhd41165d978ps4hgc5wc0000gn/T/jest_dx",

// Automatically clear mock calls and instances between every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: ['src/js/**.js'],

// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: null,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// Force coverage collection from ignored files usin a array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: null,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: null,

// A set of global variables that need to be available in all test environments
// globals: {},

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "node"
// ],

// A map from regular expressions to module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "always",

// A preset that is used as a base for Jest's configuration
// preset: null,

// Run tests from one or more projects
// projects: null,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state between every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: null,

// Automatically restore mock state between every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
rootDir: './',

// A list of paths to directories that Jest should use to search for files in
roots: [
'<rootDir>/test/unit'
],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// The path to a module that runs some code to configure or set up the testing framework before each test
setupTestFrameworkScriptFile: '<rootDir>/test/unit/setupTests.js',

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
// testEnvironment: "jest-environment-jsdom",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.js?(x)",
// "**/?(*.)+(spec|test).js?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern Jest uses to detect test files
// testRegex: "",

// This option allows the use of a custom results processor
// testResultsProcessor: null,

// This option allows use of a custom test runner
// testRunner: "jasmine2",

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",

// A map from regular expressions to paths to transformers
transform: {
'^.+\\.js$': 'babel-jest',
'.+\\.(css|styl|less|sass|scss)$': 'jest-transform-css'
},

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [
'node_modules/(?!lodash-es/.*)'
]

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: null,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
};
87 changes: 36 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,93 +23,78 @@
"Chuck Carpenter <charleswcarpenter3@gmail.com>"
],
"scripts": {
"build": "yarn clean && webpack --mode production",
"build": "yarn clean && rollup -c",
"esdoc": "esdoc",
"postbuild": "rm -f dist/removable-*",
"clean": "rm -rf dist",
"cy:open": "./node_modules/.bin/cypress open",
"cy:run": "./node_modules/.bin/cypress run --env coverage=true",
"mocha-headless-chrome": "mocha-headless-chrome -c coverage/coverage.json -f test/unit/index.html -a no-sandbox",
"posttest:ci": "nyc report --reporter=lcov --reporter=text",
"cy:run": "./node_modules/.bin/cypress run",
"rewrite-paths": "replace 'SF:.*src' 'SF:src' coverage/lcov.info",
"start": "yarn watch",
"start-test-server": "http-server -p 9002",
"test": "yarn test:ci",
"test:build": "cross-env NODE_ENV=test yarn build",
"test:ci": "yarn test:unit:ci && yarn test:cy:ci",
"test:cy:ci": "yarn test:build && start-server-and-test start-test-server http://localhost:9002 cy:run",
"test:cy:watch": "yarn test:build && start-server-and-test start-test-server http://localhost:9002 cy:open",
"test:unit:ci": "cross-env NODE_ENV=test webpack --config webpack.test.config.js && yarn mocha-headless-chrome",
"test:unit:watch": "webpack-dev-server --config webpack.test.config.js",
"test:cy:ci": "yarn build && start-server-and-test start-test-server http://localhost:9002 cy:run",
"test:cy:watch": "yarn build && start-server-and-test start-test-server http://localhost:9002 cy:open",
"test:unit:ci": "jest --coverage",
"test:unit:watch": "jest --watch",
"view-coverage": "http-server -p 9003 ./coverage/lcov-report -o",
"watch": "yarn clean && webpack --watch --mode development"
"watch": "yarn clean && rollup -c --environment DEVELOPMENT"
},
"homepage": "http://shipshapecode.github.io/shepherd/docs/welcome/",
"license": "MIT",
"main": "dist/js/shepherd.js",
"module": "dist/js/shepherd.esm.js",
"dependencies": {
"element-matches": "^0.1.2",
"lodash-es": "^4.17.11",
"tippy.js": "^3.3.0"
"tippy.js": "^3.4.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"autoprefixer": "^9.4.3",
"babel-loader": "^8.0.4",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-istanbul": "^5.1.0",
"babel-plugin-lodash": "^3.3.4",
"autoprefixer": "^9.4.4",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"browser-sync": "^2.26.3",
"browser-sync-webpack-plugin": "^2.2.2",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"codeclimate-test-reporter": "^0.5.1",
"cross-env": "^5.2.0",
"css-loader": "^2.1.0",
"cypress": "^3.1.4",
"del": "^3.0.0",
"esdoc": "^1.1.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-standard-plugin": "^1.0.0",
"eslint": "^5.11.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-mocha": "^5.1.0",
"eslint": "^5.12.0",
"eslint-plugin-jest": "^22.1.3",
"eslint-plugin-ship-shape": "^0.6.0",
"extract-loader": "^3.1.0",
"file-loader": "^3.0.1",
"glob": "^7.1.3",
"http-server": "^0.11.1",
"inject-loader": "^4.0.1",
"istanbul-instrumenter-loader": "^3.0.1",
"istanbul-lib-coverage": "^2.0.1",
"lodash-webpack-plugin": "^0.11.5",
"mocha": "^5.2.0",
"mocha-headless-chrome": "^2.0.1",
"node-sass": "^4.11.0",
"nyc": "13.0.1",
"postcss": "^7.0.7",
"postcss-loader": "^3.0.0",
"jest": "^23.6.0",
"jest-dom": "^3.0.0",
"jest-expect-message": "^1.0.2",
"jest-transform-css": "^2.0.0",
"mutationobserver-shim": "^0.3.2",
"postcss": "^7.0.8",
"replace": "^1.0.1",
"sass-loader": "^7.1.0",
"rollup": "^1.1.0",
"rollup-plugin-alias": "^1.5.1",
"rollup-plugin-babel": "^4.3.0",
"rollup-plugin-babel-minify": "^6.2.0",
"rollup-plugin-browsersync": "^1.0.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-eslint": "^5.0.0",
"rollup-plugin-filesize": "^6.0.0",
"rollup-plugin-license": "^0.7.0",
"rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-sass": "^1.1.0",
"rollup-plugin-serve": "^0.6.1",
"rollup-plugin-stylelint": "^0.0.4",
"rollup-plugin-uglify": "^6.0.0",
"sinon": "^7.2.2",
"source-map-loader": "^0.2.3",
"start-server-and-test": "^1.7.11",
"style-loader": "^0.23.1",
"stylelint": "^8.4.0",
"stylelint-config-ship-shape": "^0.4.0",
"stylelint-webpack-plugin": "^0.10.5",
"uglifyjs-webpack-plugin": "^2.1.1",
"webpack": "^4.28.3",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.14"
"stylelint-config-ship-shape": "^0.4.0"
},
"engines": {
"node": ">= 6.*"
},
"nyc": {
"temp-directory": "./coverage",
"report-dir": "./coverage"
}
}
Loading