Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuklis committed Jan 25, 2021
0 parents commit 980810b
Show file tree
Hide file tree
Showing 54 changed files with 2,676 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
*.swp
*.swo
node_modules
!test/webpack/node_modules/@folio/app2/node_modules/
!test/webpack/node_modules/
npm-debug.log
static
README.html
OVERVIEW.html
yarn.lock
yarn-error.log
artifacts
dist
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Stripes Webpack

Copyright (C) 2017-2021 The Open Library Foundation

This software is distributed under the terms of the Apache License,
Version 2.0. See the file "[LICENSE](LICENSE)" for more information.


## Introduction

Stripes Webpack contains webpack config files used for building and serving Folio bundles via [stripes-cli](https://github.com/folio-org/stripes-cli).


## Additional information

See project [STRIPES](https://issues.folio.org/browse/STRIPES)
at the [FOLIO issue tracker](https://dev.folio.org/guidelines/issue-tracker/).

Other FOLIO Developer documentation is at [dev.folio.org](https://dev.folio.org/)

12 changes: 12 additions & 0 deletions default-assets/branding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// These default branding values are used when no branding is present in stripes.config.js
// Default src are prefixed with '@folio/stripes-core' so they can be imported
// and processed through the webpack loaders from the stripes-core in use.
module.exports = {
logo: {
src: `${__dirname}/folio-logo.svg`,
alt: 'FOLIO',
},
favicon: {
src: `${__dirname}/favicon.svg`,
},
};
1 change: 1 addition & 0 deletions default-assets/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions default-assets/folio-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>FOLIO</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="root">
</div>
</body>
</html>
83 changes: 83 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"name": "@folio/stripes-webpack",
"version": "1.0.0",
"description": "The webpack config for stripes",
"license": "Apache-2.0",
"publishConfig": {
"registry": "https://repository.folio.org/repository/npm-folio/"
},
"scripts": {
"test": "mocha --opts test/mocha.opts './test/webpack/**/*.js'"
},
"engines": {
"node": ">=10.0.0"
},
"dependencies": {
"@babel/core": "^7.8.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.7.4",
"@babel/preset-react": "^7.7.4",
"@babel/preset-typescript": "^7.7.7",
"@babel/register": "^7.0.0",
"@bigtest/mirage": "^0.0.1",
"@hot-loader/react-dom": "^16.8.6",
"add-asset-html-webpack-plugin": "^3.1.3",
"autoprefixer": "^9.1.1",
"awesome-typescript-loader": "^5.2.0",
"babel-loader": "^8.0.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-remove-jsx-attributes": "^0.0.2",
"commander": "^2.9.0",
"connect-history-api-fallback": "^1.3.0",
"core-js": "^3.6.1",
"css-loader": "^1.0.0",
"debug": "^4.0.1",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"express": "^4.14.0",
"favicons-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.11",
"handlebars-loader": "^1.7.1",
"hard-source-webpack-plugin": "^0.12.0",
"html-webpack-plugin": "^4.0.0-beta.10",
"lodash-webpack-plugin": "^0.11.5",
"mini-css-extract-plugin": "^0.4.0",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"postcss": "^7.0.2",
"postcss-calc": "^6.0.0",
"postcss-color-function": "^4.0.0",
"postcss-custom-media": "^6.0.0",
"postcss-custom-properties": "^10.0.0",
"postcss-import": "^12.0.0",
"postcss-loader": "^3.0.0",
"postcss-media-minmax": "^3.0.0",
"postcss-nesting": "^6.0.0",
"postcss-url": "^8.0.0",
"regenerator-runtime": "^0.13.3",
"rimraf": "^2.5.4",
"rtl-detect": "^1.0.2",
"semver": "^7.1.3",
"serialize-javascript": "^5.0.0",
"style-loader": "^1.0.0",
"svgo": "^1.2.2",
"svgo-loader": "^2.2.1",
"tapable": "^1.0.0",
"typescript": "^2.8.1",
"use-deep-compare": "^1.1.0",
"uuid": "^3.0.0",
"webpack": "^4.10.2",
"webpack-dev-middleware": "^3.1.3",
"webpack-hot-middleware": "^2.22.2",
"webpack-virtual-modules": "^0.1.10"
},
"devDependencies": {
"mocha": "^6.1.3",
"mocha-junit-reporter": "^1.17.0"
}
}
67 changes: 67 additions & 0 deletions stripes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env node

/* eslint-disable no-console */

const commander = require('commander');
const path = require('path');
const stripes = require('./webpack/stripes-node-api');
const packageJSON = require('./package.json');

commander.version(packageJSON.version);

// Display error to the console and exit
function processError(err) {
if (err) {
console.error(err);
}
process.exit(1);
}

// Display webpack output to the console
function processStats(stats) {
console.log(stats.toString({
chunks: false,
colors: true,
}));
// Check for webpack compile errors and exit
if (stats.hasErrors()) {
processError();
}
}

commander
.command('dev')
.option('--port [port]', 'Port')
.option('--host [host]', 'Host')
.option('--cache', 'Use HardSourceWebpackPlugin cache')
.option('--devtool [devtool]', 'Use another value for devtool instead of "inline-source-map"')
.arguments('<config>')
.description('Launch a webpack-dev-server')
.action((stripesConfigFile, options) => {
// eslint-disable-next-line global-require,import/no-dynamic-require
const stripesConfig = require(path.resolve(stripesConfigFile));
stripes.serve(stripesConfig, options);
});

commander
.command('build')
.option('--publicPath [publicPath]', 'publicPath')
.option('--sourcemap', 'include sourcemaps in build')
.option('--no-minify', 'do not minify JavaScript')
.arguments('<config> <output>')
.description('Build a tenant bundle')
.action((stripesConfigFile, outputPath, options) => {
// eslint-disable-next-line global-require,import/no-dynamic-require
const stripesConfig = require(path.resolve(stripesConfigFile));
options.outputPath = outputPath;
stripes.build(stripesConfig, options)
.then(stats => processStats(stats))
.catch(err => processError(err));
});

commander.parse(process.argv);

// output help if no command specified
if (!process.argv.slice(2).length) {
commander.outputHelp();
}
3 changes: 3 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--require @babel/register
--watch-extensions json
--recursive
5 changes: 5 additions & 0 deletions test/webpack/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}
Loading

0 comments on commit 980810b

Please sign in to comment.