Switching from grunt to webpack for compilation, minify wasn't working
This commit is contained in:
@@ -78,7 +78,7 @@ jobs:
|
|||||||
|
|
||||||
# run babel compile
|
# run babel compile
|
||||||
- run: git config user.email "jputney@noverant.com" && git config user.name "Jonathan Putney"
|
- run: git config user.email "jputney@noverant.com" && git config user.name "Jonathan Putney"
|
||||||
- run: ./node_modules/.bin/grunt
|
- run: ./node_modules/.bin/webpack --bail --config webpack.js
|
||||||
- run: git add --all dist/
|
- run: git add --all dist/
|
||||||
|
|
||||||
# run jsdoc
|
# run jsdoc
|
||||||
@@ -101,4 +101,4 @@ jobs:
|
|||||||
|
|
||||||
- store_artifacts: # upload test coverage as artifact
|
- store_artifacts: # upload test coverage as artifact
|
||||||
path: ./coverage/lcov.info
|
path: ./coverage/lcov.info
|
||||||
prefix: tests
|
prefix: tests
|
||||||
|
|||||||
@@ -270,8 +270,8 @@ I welcome any and all feedback and contributions to this project! I'm sure it wo
|
|||||||
#### Setup and Development
|
#### Setup and Development
|
||||||
You will need `node` installed on your local machine, and you'll have to run `npm install` in the repo directory before starting development.
|
You will need `node` installed on your local machine, and you'll have to run `npm install` in the repo directory before starting development.
|
||||||
|
|
||||||
To run a build, you need to just run the `grunt` command in the root of the project.
|
To run a build, you need to just run the `yarn run compile` command in the root of the project.
|
||||||
|
|
||||||
Similarly, to run the tests, you just run the `grunt test` or `npm test` command.
|
Similarly, to run the tests, you just run the `yarn test` command.
|
||||||
|
|
||||||
Before submitting pull requests, please also run `eslint ./src --fix` against your code first, otherwise your pull request build could fail.
|
Before submitting pull requests, please also run `eslint ./src --fix` against your code first, otherwise your pull request build could fail.
|
||||||
|
|||||||
908
dist/aicc.js
vendored
908
dist/aicc.js
vendored
File diff suppressed because one or more lines are too long
1
dist/aicc.js.map
vendored
Normal file
1
dist/aicc.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
7336
dist/aicc.min.js
vendored
7336
dist/aicc.min.js
vendored
File diff suppressed because one or more lines are too long
1212
dist/scorm-again.js
vendored
1212
dist/scorm-again.js
vendored
File diff suppressed because one or more lines are too long
1
dist/scorm-again.js.map
vendored
Normal file
1
dist/scorm-again.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
10972
dist/scorm-again.min.js
vendored
10972
dist/scorm-again.min.js
vendored
File diff suppressed because one or more lines are too long
727
dist/scorm12.js
vendored
727
dist/scorm12.js
vendored
File diff suppressed because one or more lines are too long
1
dist/scorm12.js.map
vendored
Normal file
1
dist/scorm12.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
5563
dist/scorm12.min.js
vendored
5563
dist/scorm12.min.js
vendored
File diff suppressed because one or more lines are too long
794
dist/scorm2004.js
vendored
794
dist/scorm2004.js
vendored
File diff suppressed because one or more lines are too long
1
dist/scorm2004.js.map
vendored
Normal file
1
dist/scorm2004.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
6963
dist/scorm2004.min.js
vendored
6963
dist/scorm2004.min.js
vendored
File diff suppressed because one or more lines are too long
90
gruntfile.js
90
gruntfile.js
@@ -1,90 +0,0 @@
|
|||||||
module.exports = function(grunt) {
|
|
||||||
grunt.initConfig({
|
|
||||||
mochaTest: {
|
|
||||||
test: {
|
|
||||||
options: {
|
|
||||||
reporter: 'list',
|
|
||||||
require: '@babel/register',
|
|
||||||
noFail: false,
|
|
||||||
recursive: true,
|
|
||||||
captureFile: false,
|
|
||||||
},
|
|
||||||
src: ['test/**/*.spec.js'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
scripts: {
|
|
||||||
files: ['src/**/*.js'],
|
|
||||||
tasks: ['default'],
|
|
||||||
options: {
|
|
||||||
spawn: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
browserify: {
|
|
||||||
development: {
|
|
||||||
files: [{
|
|
||||||
expand: true,
|
|
||||||
cwd: 'src/exports/',
|
|
||||||
src: ['*.js'],
|
|
||||||
dest: 'dist/',
|
|
||||||
ext: '.js',
|
|
||||||
extDot: 'first',
|
|
||||||
}],
|
|
||||||
options: {
|
|
||||||
browserifyOptions: {debug: true},
|
|
||||||
transform: [
|
|
||||||
[
|
|
||||||
'babelify', {
|
|
||||||
'presets': ['@babel/preset-env', '@babel/preset-flow'],
|
|
||||||
'plugins': [
|
|
||||||
'@babel/plugin-proposal-class-properties',
|
|
||||||
'@babel/plugin-proposal-private-methods',
|
|
||||||
'@babel/plugin-proposal-optional-chaining',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
production: {
|
|
||||||
files: [{
|
|
||||||
expand: true,
|
|
||||||
cwd: 'src/exports/',
|
|
||||||
src: ['*.js'],
|
|
||||||
dest: 'dist/',
|
|
||||||
ext: '.min.js',
|
|
||||||
extDot: 'first',
|
|
||||||
}],
|
|
||||||
options: {
|
|
||||||
browserifyOptions: {debug: false},
|
|
||||||
transform: [
|
|
||||||
[
|
|
||||||
'babelify', {
|
|
||||||
'presets': ['@babel/preset-env', '@babel/preset-flow'],
|
|
||||||
'plugins': [
|
|
||||||
'@babel/plugin-proposal-class-properties',
|
|
||||||
'@babel/plugin-proposal-private-methods',
|
|
||||||
'@babel/plugin-proposal-optional-chaining',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'uglifyify', {
|
|
||||||
sourceMap: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.loadNpmTasks('grunt-browserify');
|
|
||||||
grunt.loadNpmTasks('grunt-mocha-test');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
||||||
|
|
||||||
grunt.registerTask('test', 'mochaTest');
|
|
||||||
|
|
||||||
grunt.registerTask('default',
|
|
||||||
['browserify:development', 'browserify:production']);
|
|
||||||
};
|
|
||||||
22
package.json
22
package.json
@@ -3,6 +3,15 @@
|
|||||||
"version": "1.6.2",
|
"version": "1.6.2",
|
||||||
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
"description": "A modern SCORM JavaScript run-time library for AICC, SCORM 1.2, and SCORM 2004",
|
||||||
"main": "dist/scorm-again.min.js",
|
"main": "dist/scorm-again.min.js",
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"edge >= 16",
|
||||||
|
"safari >= 9",
|
||||||
|
"firefox >= 57",
|
||||||
|
"ie >= 11",
|
||||||
|
"ios >= 9",
|
||||||
|
"chrome >= 49"
|
||||||
|
],
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
@@ -19,18 +28,15 @@
|
|||||||
"@types/chai": "^4.3.0",
|
"@types/chai": "^4.3.0",
|
||||||
"@types/mocha": "^9.1.0",
|
"@types/mocha": "^9.1.0",
|
||||||
"babel-eslint": "^11.0.0-beta.2",
|
"babel-eslint": "^11.0.0-beta.2",
|
||||||
|
"babel-loader": "^8.2.3",
|
||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
"browserify": "^17.0.0",
|
"browserify": "^17.0.0",
|
||||||
"chai": "^4.3.6",
|
"chai": "^4.3.6",
|
||||||
"eslint": "^8.8.0",
|
"eslint": "^8.8.0",
|
||||||
"eslint-config-google": "^0.14.0",
|
"eslint-config-google": "^0.14.0",
|
||||||
"eslint-plugin-import": "^2.25.4",
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
"eslint-webpack-plugin": "^3.1.1",
|
||||||
"fetch-pretender": "^1.5.0",
|
"fetch-pretender": "^1.5.0",
|
||||||
"grunt": "^1.4.1",
|
|
||||||
"grunt-browserify": "^6.0.0",
|
|
||||||
"grunt-cli": "^1.4.3",
|
|
||||||
"grunt-contrib-watch": "^1.1.0",
|
|
||||||
"grunt-mocha-test": "^0.13.3",
|
|
||||||
"jsdoc": "^3.6.10",
|
"jsdoc": "^3.6.10",
|
||||||
"jsdoc-babel": "^0.5.0",
|
"jsdoc-babel": "^0.5.0",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
@@ -40,11 +46,13 @@
|
|||||||
"mochawesome": "^7.0.1",
|
"mochawesome": "^7.0.1",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"sinon": "^13.0.1",
|
"sinon": "^13.0.1",
|
||||||
"uglifyify": "^5.0.2"
|
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||||
|
"webpack": "^5.68.0",
|
||||||
|
"webpack-cli": "^4.9.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./node_modules/.bin/mocha --require @babel/register --bdd --recursive --reporter list",
|
"test": "./node_modules/.bin/mocha --require @babel/register --bdd --recursive --reporter list",
|
||||||
"compile": "./node_modules/.bin/grunt default",
|
"compile": "./node_modules/.bin/webpack --bail --config webpack.js",
|
||||||
"fix": "./node_modules/.bin/eslint ./src --fix"
|
"fix": "./node_modules/.bin/eslint ./src --fix"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
78
webpack.js
Normal file
78
webpack.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||||
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||||
|
|
||||||
|
const JSLoader = {
|
||||||
|
test: /\.js$/i,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
'corejs': '3',
|
||||||
|
'useBuiltIns': 'entry',
|
||||||
|
'targets': {
|
||||||
|
'browsers': [
|
||||||
|
'edge >= 16',
|
||||||
|
'safari >= 9',
|
||||||
|
'firefox >= 57',
|
||||||
|
'ie >= 11',
|
||||||
|
'ios >= 9',
|
||||||
|
'chrome >= 49',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
['@babel/preset-flow'],
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
'@babel/plugin-proposal-private-methods',
|
||||||
|
'@babel/plugin-proposal-optional-chaining',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: 'development',
|
||||||
|
devtool: 'source-map',
|
||||||
|
entry: {
|
||||||
|
'aicc': './src/exports/aicc.js',
|
||||||
|
'scorm12': './src/exports/scorm12.js',
|
||||||
|
'scorm2004': './src/exports/scorm2004.js',
|
||||||
|
'scorm-again': './src/exports/scorm-again.js',
|
||||||
|
'aicc.min': './src/exports/aicc.js',
|
||||||
|
'scorm12.min': './src/exports/scorm12.js',
|
||||||
|
'scorm2004.min': './src/exports/scorm2004.js',
|
||||||
|
'scorm-again.min': './src/exports/scorm-again.js',
|
||||||
|
},
|
||||||
|
target: ['web', 'es5'],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
JSLoader,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, 'dist'),
|
||||||
|
environment: {
|
||||||
|
arrowFunction: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [new UglifyJsPlugin({
|
||||||
|
include: /\.min\.js$/,
|
||||||
|
})],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new ESLintPlugin({
|
||||||
|
overrideConfigFile: path.resolve(__dirname, '.eslintrc.js'),
|
||||||
|
context: path.resolve(__dirname, '../src'),
|
||||||
|
files: '**/*.js',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user