This revises the build process to handle grunt components requiring two versions of grunt. The new BUILD.md file documents the changes.

This commit is contained in:
Steve Ireland
2023-02-26 11:19:50 -05:00
committed by jekkos
parent ae357cab4a
commit 2e06f89724
15 changed files with 11094 additions and 9723 deletions

View File

@@ -1,7 +1,3 @@
{
"directory": "public/bower_components",
"scripts": {
"postinstall": "grunt default genlicense",
"postuninstall": "grunt default genlicense"
}
"directory": "public/resources"
}

4
.gitignore vendored
View File

@@ -1,7 +1,7 @@
# Dependency directories
node_modules
vendor
public/bower_components
public/resources
app/Config/email.php
app/sessions/*
app/logs/*
@@ -78,4 +78,4 @@ auth.json
*.png
*.jpg
*.jpeg
*copy*
*copy*

50
BUILD.md Normal file
View File

@@ -0,0 +1,50 @@
## Building From Source
If you have special requirements that you need to add to OSPOS, you can download the raw code from the github repository and make your changes. If it's a really cool change that might benefit others, we ask that you consider contributing it to the project.
After you've made your changes you will need to do a "BUILD" on it to add all necessary components that OSPOS needs to actually run.
This documents the "How to Build" process.
The goal here was to do a lot of work in setting up and configuring the build process so that the actual build is as simple as possible. I think we've accomplished that task.
## Requirements
This applies only to the upcoming 3.4.0 release of OSPOS which is being worked on in the CI4 branch.
- Install the latest version of NPM.
- Install the latest version of Composer.
## The Workflow
1. Download the code from the CI4 branch found at https://github.com/opensourcepos/opensourcepos/tree/ci4-upgrade.
2. Unzip it and copy the contents into your working folder.
3. Start a terminal session from the root of your working folder. For example, I normally open up the working folder in PHPStorm and run the commands from the Terminal provided by the IDE.
4. Enter the following commands:
- `npm install`
- `npm run build`
That's all there is to it. The build task threads a lot of smaller grunt tasks together and will run them sequentially. If you want to run each step manually then you will need to pay attention to the bouncing between folders that takes place in order to run the correct version of Grunt.
If you have the database set up and a preconfigured copy of .env, just drop the .env file into the root of the working folder. You should be ready to go.
If not, then you will need to continue from this point forward with the standard installation instructions, but at this point you have runnable version of OSPOS.
### Windows Platform
The .env file is a convenience method for setting your configuration.
If you are running on a Windows based work station (which is what I use) I've added a couple of Powershell scripts to make my life a bit easier, which I share with you.
* `build.ps1` - Which runs the build but also restores the .env from a backup I make of it in a specifically placed folder. I place a copy of the configured .env file in a folder that has the following path from the working folder: `../env/<working-folder-name>/.env`
* `build-steps.ps1` - This runs through each step of the build and pauses just before it executes the next build step so that the developer can check the results of the previous build step.
## The Result
The build creates a developer version of a runnable instance of OSPOS.
It is NOT something that should be used for production.
However, the zip and tar files, found in the root `dist` folder, are created as part of the build process and can be used for deploying a production instance of OSPOS.
Good luck with your build.

View File

@@ -1,29 +1,47 @@
module.exports = function(grunt) {
dist_files = [
{
src: [
'public/**',
'vendor/**',
'app/**',
'!/tests',
'!/public/images/menubar/png/',
'!/public/dist/bootswatch/',
'/public/dist/bootswatch/*/*.css',
'!/public/dist/bootswatch-5/',
'/public/dist/bootswatch-5/*/*.css',
'app/Database/**',
'*.txt',
'*.md',
'LICENSE',
'docker*',
'docker/**',
'Dockerfile',
'**/.htaccess',
'*.csv'
]
}
];
dist_files = [
{
src: [
'public/**',
'vendor/**',
'app/**',
'!/tests',
'!/grunt045',
'!/public/images/menubar/png/',
'!/public/dist/bootswatch/',
'/public/dist/bootswatch/*/*.css',
'!/public/dist/bootswatch-5/',
'/public/dist/bootswatch-5/*/*.css',
'app/Database/**',
'*.txt',
'*.md',
'LICENSE',
'docker*',
'docker/**',
'Dockerfile',
'**/.htaccess',
'*.csv'
]
}
];
ospos_css = ['public/css/*.css',
'!public/css/login.css',
'!public/css/login.min.css',
'!public/css/invoice_email.css',
'!public/css/barcode_font.css',
'!public/css/darkly.css'];
ospos_js = ['public/dist/bootstrap/js/*.min.js',
'public/js/jquery*',
'public/js/*.js'];
ospos_min_css = ['public/dist/jquery-ui/*.css',
'public/dist/*.css'];
ospos_min_js = ['public/dist/*min.js'];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
@@ -33,24 +51,38 @@ module.exports = function(grunt) {
src: ['app/Views/partial/header.php']
}
},
bower_concat: {
all: {
mainFiles: {
'bootstrap-table': [
"dist/bootstrap-table.min.js",
"dist/bootstrap-table.css",
"dist/extensions/export/bootstrap-table-export.min.js",
"dist/extensions/mobile/bootstrap-table-mobile.min.js",
"dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js",
"dist/extensions/sticky-header/bootstrap-table-sticky-header.css"
],
'chartist-plugin-axistitle': [ "./dist/chartist-plugin-axistitle.min.js"]
injector: {
options: {
lineEnding: '\n',
ignorePath: 'public/',
addRootSlash: false,
},
css_js_header: {
files: {
'app/Views/partial/header.php': [ospos_css, ospos_js]
},
dest: {
'js': 'tmp/opensourcepos_bower.js',
'css': 'tmp/opensourcepos_bower.css'
}
}
},
mincss_header: {
options: {
starttag: '<!-- mincss injector:css -->',
},
files: {
'app/Views/partial/header.php': [ospos_min_css]
},
},
minjs: {
options: {
starttag: '<!-- minjs injector:css -->',
},
files: {
'app/Views/partial/header.php': [ospos_min_css]
},
},
css_login: {
files: {
'app/Views/login.php': ['public/css/login.min.css']
},
},
},
bowercopy: {
options: {
@@ -58,7 +90,7 @@ module.exports = function(grunt) {
},
targetdistjqueryui: {
options: {
srcPrefix: 'public/bower_components/jquery-ui',
srcPrefix: 'public/resources/jquery-ui',
destPrefix: 'public/dist'
},
files: {
@@ -67,7 +99,7 @@ module.exports = function(grunt) {
},
targetdistbootswatch: {
options: {
srcPrefix: 'public/bower_components/bootswatch',
srcPrefix: 'public/resources/bootswatch',
destPrefix: 'public/dist'
},
files: {
@@ -83,50 +115,6 @@ module.exports = function(grunt) {
}
}
},
copy: {
themes: {
files: [
{
expand: true,
cwd: 'node_modules/bootstrap/dist/css',
src: ['bootstrap.css', 'bootstrap.min.css'],
dest: 'public/dist/bootswatch-5/bootstrap/',
filter: 'isFile'
},
{
expand: true,
cwd: 'node_modules/bootswatch/dist',
src: ['**/bootstrap.css', '**/bootstrap.min.css'],
dest: 'public/dist/bootswatch-5/',
filter: 'isFile'
}
],
},
licenses: {
files: [{
expand: true,
src: 'LICENSE',
dest: 'public/license/',
filter: 'isFile',},
{
expand: true,
cwd: 'node_modules/bootstrap',
src: 'LICENSE',
dest: 'public/license/',
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootstrap-5.license'); },
filter: 'isFile'
},
{
expand: true,
cwd: 'node_modules/bootswatch',
src: 'LICENSE',
dest: 'public/license/',
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootswatch-5.license'); },
filter: 'isFile'
},
],
},
},
cssmin: {
target: {
files: {
@@ -165,9 +153,11 @@ module.exports = function(grunt) {
}
},
jshint: {
files: ['Gruntfile.js', 'public/js/*.js'],
files: ['public/js/imgpreview.full.jquery.js',
'public/js/manage_tables.js',
'public/js/nominatim.autocomplete.js'],
options: {
// options here to override JSHint defaults
esversion: 6,
globals: {
jQuery: true,
console: true,
@@ -176,140 +166,38 @@ module.exports = function(grunt) {
}
}
},
tags: {
css_header: {
options: {
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
openTag: '<!-- start css template tags -->',
closeTag: '<!-- end css template tags -->',
ignorePath: '../../../public/'
},
src: ['public/css/*.css', '!public/css/login.css', '!public/css/login.min.css', '!public/css/invoice_email.css', '!public/css/barcode_font.css', '!public/css/darkly.css'],
dest: 'app/Views/partial/header.php',
},
mincss_header: {
options: {
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
openTag: '<!-- start mincss template tags -->',
closeTag: '<!-- end mincss template tags -->',
ignorePath: '../../../public/'
},
// jquery-ui must be first or at least before opensourcepos.min.css
src: ['public/dist/jquery-ui/*.css', 'public/dist/*.css'],
dest: 'app/Views/partial/header.php',
},
css_login: {
options: {
scriptTemplate: '<rel type="text/css" src="{{ path }}"></rel>',
openTag: '<!-- start css template tags -->',
closeTag: '<!-- end css template tags -->',
ignorePath: '../../public/'
},
src: 'public/css/login.min.css',
dest: 'app/Views/login.php'
},
js: {
options: {
scriptTemplate: '<script type="text/javascript" src="{{ path }}"></script>',
openTag: '<!-- start js template tags -->',
closeTag: '<!-- end js template tags -->',
ignorePath: '../../../public/'
},
src: ['public/dist/bootstrap/js/*.min.js', 'public/js/jquery*', 'public/js/*.js'],
dest: 'app/Views/partial/header.php'
},
minjs: {
options: {
scriptTemplate: '<script type="text/javascript" src="{{ path }}"></script>',
openTag: '<!-- start minjs template tags -->',
closeTag: '<!-- end minjs template tags -->',
ignorePath: '../../../public/'
},
src: ['public/dist/*min.js'],
dest: 'app/Views/partial/header.php'
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
},
cachebreaker: {
dev: {
compress: {
tar: {
options: {
match: [ {
'opensourcepos.min.js': 'public/dist/opensourcepos.min.js',
'opensourcepos.min.css': 'public/dist/opensourcepos.min.css'
} ],
replacement: 'md5'
mode: 'tar',
archive: 'dist/opensourcepos.tgz',
level: 2,
},
files: {
src: ['app/Views/partial/header.php', 'app/Views/login.php']
}
}
},
clean: {
bower: ["public/bower_components"],
composer: ["vendor"],
license: ['public/bower_components/**/bower.json'],
npm: ["node_modules"]
},
license: {
all: {
// Target-specific file lists and/or options go here.
files: dist_files
},
zip: {
options: {
// Target-specific options go here.
directory: 'public/bower_components',
output: 'public/license/bower.LICENSES'
}
}
},
'bower-licensechecker': {
options: {
/*directory: 'path/to/bower',*/
acceptable: [ 'MIT', 'BSD', 'LICENSE.md' ],
printTotal: true,
warn: {
nonBower: true,
noLicense: true,
allGood: true,
noGood: true
mode: 'zip',
archive: 'dist/opensourcepos.zip',
},
log: {
outFile: 'public/license/.licenses',
nonBower: true,
noLicense: true,
allGood: true,
noGood: true,
}
files: dist_files
}
},
compress: {
tar: {
options: {
mode: 'tar',
archive: 'dist/opensourcepos.tgz',
level: 2,
},
files: dist_files
},
zip: {
options: {
mode: 'zip',
archive: 'dist/opensourcepos.zip',
},
files: dist_files
}
}
}
});
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-composer');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('default', ['wiredep', 'bower_concat', 'bowercopy', 'copy', 'concat', 'uglify', 'cssmin', 'tags', 'cachebreaker']);
grunt.registerTask('update', ['composer:update', 'bower:update']);
grunt.registerTask('genlicense', ['clean:license', 'license', 'bower-licensechecker']);
grunt.registerTask('package', ['default', 'compress']);
grunt.registerTask('packages', ['composer:update']);
grunt.registerTask('task1', ['wiredep']);
grunt.registerTask('task3', ['bowercopy']);
grunt.registerTask('task5', ['concat','uglify','cssmin','injector','jshint']);
grunt.registerTask('task7', ['compress']);
grunt.registerTask('watch', ['watch']);
};

12
LICENSE
View File

@@ -1,11 +1,11 @@
MIT License
Copyright (c) 2013-2022 jekkos
Copyright (c) 2015-2021 FrancescoUK (aka daN4cat)
Copyright (c) 2017-2021 Steve Ireland
Copyright (c) 2017-2022 objecttothis
Copyright (c) 2017-2021 odiea
Copyright (c) 2017-2021 WebShells
Copyright (c) 2013-2023 jekkos
Copyright (c) 2015-2023 FrancescoUK (aka daN4cat)
Copyright (c) 2017-2023 Steve Ireland
Copyright (c) 2017-2023 objecttothis
Copyright (c) 2017-2023 odiea
Copyright (c) 2017-2023 WebShells
Copyright (c) 2020-2021 Andriux1990
Copyright (c) 2021 BudsieBuds
Copyright (c) 2019 Loyd Jayme (aka loydjayme25)

View File

@@ -11,12 +11,12 @@
<!doctype html>
<html lang="<?= current_language_code() ?>">
<head>
<meta charset="utf-8">
<base href="<?= base_url() ?>">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<base href="<?= base_url() . '/' ?>">
<title><?= $config['company'] . '&nbsp;|&nbsp;' . lang('Common.software_short') . '&nbsp;|&nbsp;' . lang('Login.login') ?></title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="noindex, nofollow" name="robots">
<link href="<?= base_url('images/favicon.ico') ?>" rel="shortcut icon" type="image/x-icon">
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon">
<?php
$theme = (empty($config['theme'])
|| 'paper' == $config['theme']
@@ -24,10 +24,9 @@
? 'flatly'
: $config['theme']);
?>
<link href="<?= base_url("dist/bootswatch/$theme/bootstrap.min.css") ?>" rel="stylesheet" type="text/css">
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="../../public/css/login.min.css"/>
<!-- end css template tags -->
<link href="<?= "dist/bootswatch-5/$theme/bootstrap.min.css" ?>" rel="stylesheet" type="text/css">
<!-- injector:css -->
<!-- endinjector -->
<meta content="#2c3e50" name="theme-color">
</head>
<body class="bg-light d-flex flex-column">

View File

@@ -14,90 +14,33 @@ $request = Services::request();
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php echo $request->getLocale() ?>">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<base href="<?php echo base_url() ?>" />
<base href="<?php echo base_url() . '/' ?>" />
<title><?php echo esc($config['company']) . ' | ' . lang('Common.powered_by') . ' OSPOS ' . esc(config('App')->application_version) ?></title>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo base_url() ?>favicon.ico">
<link rel="stylesheet" type="text/css" href="<?php echo 'dist/bootswatch/' . (empty($config['theme']) ? 'flatly' : esc($config['theme'])) . '/bootstrap.min.css' ?>"/>
<?php if (get_cookie('debug') == 'true' || $request->getGet('debug') == 'true') : ?>
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/jquery-ui/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="bower_components/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css" />
<link rel="stylesheet" href="bower_components/jasny-bootstrap/dist/css/jasny-bootstrap.css" />
<link rel="stylesheet" href="bower_components/smalot-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="bower_components/bootstrap-select/dist/css/bootstrap-select.css" />
<link rel="stylesheet" href="bower_components/bootstrap-table/dist/bootstrap-table.css" />
<link rel="stylesheet" href="bower_components/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.css" />
<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker.css" />
<link rel="stylesheet" href="bower_components/chartist/dist/chartist.min.css" />
<link rel="stylesheet" href="bower_components/chartist-plugin-tooltip/dist/chartist-plugin-tooltip.css" />
<link rel="stylesheet" href="bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" />
<link rel="stylesheet" href="bower_components/bootstrap-toggle/css/bootstrap-toggle.min.css" />
<!-- endbower -->
<!-- start css template tags -->
<link rel="stylesheet" type="text/css" href="../../../public/css/bootstrap.autocomplete.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/invoice.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/ospos_print.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/ospos.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/popupbox.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/receipt.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/register.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/css/reports.css"/>
<!-- end css template tags -->
<!-- injector:css -->
<!-- endinjector -->
<!-- bower:js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-form/src/jquery.form.js"></script>
<script src="bower_components/jquery-validate/dist/jquery.validate.js"></script>
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js"></script>
<script src="bower_components/jasny-bootstrap/dist/js/jasny-bootstrap.js"></script>
<script src="bower_components/smalot-bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="bower_components/bootstrap-select/dist/js/bootstrap-select.js"></script>
<script src="bower_components/bootstrap-table/dist/bootstrap-table.min.js"></script>
<script src="bower_components/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js"></script>
<script src="bower_components/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<script src="bower_components/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="bower_components/es6-promise/es6-promise.js"></script>
<script src="bower_components/file-saver/dist/FileSaver.min.js"></script>
<script src="bower_components/html2canvas/build/html2canvas.js"></script>
<script src="bower_components/jspdf/dist/jspdf.debug.js"></script>
<script src="bower_components/jspdf-autotable/dist/jspdf.plugin.autotable.js"></script>
<script src="bower_components/tableExport.jquery.plugin/tableExport.js"></script>
<script src="bower_components/chartist/dist/chartist.min.js"></script>
<script src="bower_components/chartist-plugin-pointlabels/dist/chartist-plugin-pointlabels.min.js"></script>
<script src="bower_components/chartist-plugin-tooltip/dist/chartist-plugin-tooltip.min.js"></script>
<script src="bower_components/chartist-plugin-barlabels/dist/chartist-plugin-barlabels.min.js"></script>
<script src="bower_components/remarkable-bootstrap-notify/bootstrap-notify.js"></script>
<script src="bower_components/js-cookie/src/js.cookie.js"></script>
<script src="bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.js"></script>
<script src="bower_components/bootstrap-toggle/js/bootstrap-toggle.min.js"></script>
<!-- endbower -->
<!-- start js template tags -->
<script type="text/javascript" src="../../../public/js/clipboard.min.js"></script>
<script type="text/javascript" src="../../../public/js/imgpreview.full.jquery.js"></script>
<script type="text/javascript" src="../../../public/js/manage_tables.js"></script>
<script type="text/javascript" src="../../../public/js/nominatim.autocomplete.js"></script>
<!-- end js template tags -->
<!-- injector:js -->
<!-- endinjector -->
<?php else : ?>
<!--[if lte IE 8]>
<link rel="stylesheet" media="print" href="dist/print.css" type="text/css" />
<![endif]-->
<!-- start mincss template tags -->
<link rel="stylesheet" type="text/css" href="../../../public/dist/jquery-ui/jquery-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="../../../public/dist/opensourcepos.min.css?rel=77a4efd3b0"/>
<!-- end mincss template tags -->
<!-- mincss injector:css -->
<!-- endinjector -->
<!-- Tweaks to the UI for a particular theme should drop here -->
<?php if ($config['theme'] != 'flatly' && file_exists($_SERVER['DOCUMENT_ROOT'] . '/public/css/' . esc($config['theme']) . '.css')) { ?>
<link rel="stylesheet" type="text/css" href="<?php echo 'css/' . esc($config['theme']) . '.css' ?>"/>
<?php } ?>
<!-- start minjs template tags -->
<script type="text/javascript" src="../../../public/dist/opensourcepos.min.js?rel=16e6f23cde"></script>
<!-- end minjs template tags -->
<!-- minjs injector:css -->
<!-- endinjector -->
<?php endif; ?>
<?php echo view('partial/header_js') ?>

136
build-steps.ps1 Normal file
View File

@@ -0,0 +1,136 @@
# ------------------------------------------------------
# Run this Powershell script to "build" OSPOS.
# Execute this script from a terminal starting
# with the project root as the working directory.
# Use ".\build.ps1"
# The leading ".\" tells Powershell that you trust it.
# ------------------------------------------------------
Write-Output "============================================================================="
Write-Output "1. Run Composer Instsall, NPM Install, and install Grunt-CLI "
Write-Output "============================================================================="
composer install
npm install
npm install -g grunt-cli
Write-Output "============================================================================="
Write-Output "2. Run Bower Install "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
bower install
Write-Output "============================================================================="
Write-Output "3. Run NPM Install for 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd grunt045
npm install
Write-Output "============================================================================="
Write-Output "4. Run task1 wiredep : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd ../
grunt task1
Write-Output "============================================================================="
Write-Output "5. Run task2 bower_concat : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd grunt045
grunt task2
Write-Output "============================================================================="
Write-Output "6. Run 'task3', ['bowercopy'] 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd ../
grunt task3
Write-Output "============================================================================="
Write-Output "7. Run 'task4', ['copy'] : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd grunt045
grunt task4
Write-Output "============================================================================="
Write-Output "8. Run 'task5', ['concat', ...] : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd ../
grunt concat
Write-Output "============================================================================="
Write-Output "9. Run 'task5', [...cat','uglify',...] : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt uglify
Write-Output "============================================================================="
Write-Output "10 .Run 'task5', [...ify','cssmin',...] : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt cssmin
Write-Output "============================================================================="
Write-Output "11. Run 'task5', [...min','injector',...] : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt injector
Write-Output "============================================================================="
Write-Output "12. Run 'task5', [...tor','jshint'] : 1.6.1 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt jshint --force
Write-Output "============================================================================="
Write-Output "13. Run 'task6', ['cachebreaker',... : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
cd grunt045
grunt cachebreaker
Write-Output "============================================================================="
Write-Output "14. Run 'task6', [...ker', 'clean:license',... : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt clean:license
Write-Output "============================================================================="
Write-Output "15. Run 'task6', [...nse', 'license'... : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt license
Write-Output "============================================================================="
Write-Output "16. Run 'task6', [...nse', 'bower-licensechecker'] : 0.4.5 "
Write-Output "============================================================================="
Read-Host -Prompt "Press any key to continue"
grunt bower-licensechecker
Read-Host -Prompt "Press any key to continue"
Write-Output "============================================================================="
Write-Output "17. Run'task7', ['compress'] : 1.6.1 "
Write-Output "============================================================================="
cd ../
grunt compress

38
build.ps1 Normal file
View File

@@ -0,0 +1,38 @@
# ------------------------------------------------------
# Run this Powershell script to "build" OSPOS.
# Execute this script from a terminal starting
# with the project root as the working directory.
# Use ".\build.ps1"
# The leading ".\" tells Powershell that you trust it.
# ------------------------------------------------------
Write-Output "============================================================================="
Write-Output "Run NPM Install and Composer Install"
Write-Output "============================================================================="
npm install
Write-Output "============================================================================="
Write-Output "Install the components needed to build OSPOS"
Write-Output "============================================================================="
npm run buildsetup
Write-Output "============================================================================="
Write-Output "Run the tasks needed to build OSPOS"
Write-Output "============================================================================="
npm run buildtasks
Write-Output "============================================================================="
Write-Output "Restore configured .env file if it exists."
Write-Output "(If one is found in a folder located at ../env/<name-of-ospos-root-folder>)"
Write-Output "============================================================================="
$currentfolder = Split-Path -Path (Get-Location) -Leaf
if(Test-Path -Path ../env/$currentfolder/.env -PathType Leaf)
{
Copy ../env/$currentfolder/.env
}
Write-Output "============================================================================="
Write-Output "Run Watch (To monitor for javascript changes). Ctrl-C or close to break out"
Write-Output "Ctrl-C, or close Powershell script, or close terminal session, to break out"
Write-Output "============================================================================="
grunt watch

3
grunt045/.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory": "../public/resources"
}

128
grunt045/Gruntfile.js Normal file
View File

@@ -0,0 +1,128 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
bower_concat: {
all: {
mainFiles: {
'bootstrap-table': [
'dist/bootstrap-table.min.js',
'dist/bootstrap-table.css',
'dist/extensions/export/bootstrap-table-export.min.js',
'dist/extensions/mobile/bootstrap-table-mobile.min.js',
'dist/extensions/sticky-header/bootstrap-table-sticky-header.min.js',
'dist/extensions/sticky-header/bootstrap-table-sticky-header.css'
],
'chartist-plugin-axistitle': [ "./dist/chartist-plugin-axistitle.min.js"]
},
dest: {
'js': '../../tmp/opensourcepos_bower.js',
'css': '../../tmp/opensourcepos_bower.css'
}
}
},
copy: {
themes: {
files: [
{
expand: true,
cwd: '../node_modules/bootstrap/dist/css',
src: ['bootstrap.css', 'bootstrap.min.css'],
dest: '../public/dist/bootswatch-5/bootstrap/',
filter: 'isFile'
},
{
expand: true,
cwd: '../node_modules/bootswatch/dist',
src: ['**/bootstrap.css', '**/bootstrap.min.css'],
dest: '../public/dist/bootswatch-5/',
filter: 'isFile'
}
],
},
licenses: {
files: [{
expand: true,
src: 'LICENSE',
dest: 'public/license/',
filter: 'isFile',},
{
expand: true,
cwd: '../node_modules/bootstrap',
src: 'LICENSE',
dest: '../public/license/',
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootstrap-5.license'); },
filter: 'isFile'
},
{
expand: true,
cwd: '../node_modules/bootswatch',
src: 'LICENSE',
dest: '../public/license/',
rename: function(dest, src) { return dest + src.replace('LICENSE', 'bootswatch-5.license'); },
filter: 'isFile'
},
],
},
},
cachebreaker: {
dev: {
options: {
match: [ {
'opensourcepos.min.js': '../public/dist/opensourcepos.min.js',
'opensourcepos.min.css': '../public/dist/opensourcepos.min.css'
} ],
replacement: 'md5'
},
files: {
src: ['../app/Views/partial/header.php', '../app/Views/login.php']
}
}
},
clean: {
options: {
force: true
},
bower: ["../public/resources"],
composer: ["../vendor"],
license: ['../public/resources/**/bower.json'],
npm: ["../node_modules"]
},
license: {
all: {
options: {
directory: '../public/resources',
output: '../public/license/bower.LICENSES'
}
}
},
'bower-licensechecker': {
options: {
acceptable: [ 'MIT', 'BSD', 'LICENSE.md' ],
printTotal: true,
warn: {
nonBower: true,
noLicense: true,
allGood: true,
noGood: true
},
log: {
outFile: '../public/license/.licenses',
nonBower: true,
noLicense: true,
allGood: true,
noGood: true,
}
}
},
});
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-bower-concat');
grunt.registerTask('task2', ['bower_concat']);
grunt.registerTask('task4', ['copy']);
grunt.registerTask('task6', ['cachebreaker', 'clean:license', 'license', 'bower-licensechecker']);
};

1644
grunt045/package-lock.json generated Normal file
View File

File diff suppressed because it is too large Load Diff

31
grunt045/package.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "opensourcepos",
"version": "3.4.0",
"description": "Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.",
"main": "index.php",
"license": "MIT",
"authors": [
"jekkos <jekkos - at - opensourcepos.org>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>",
"objecttothis <objecttothis - at - gmail.com>",
"SteveIreland <steve.ireland.de - at - gmail.com>"
],
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"keywords": [
"point-of-sale",
"POS"
],
"devDependencies": {
"grunt": "^0.4.5",
"grunt-bower": "^0.21.4",
"grunt-bower-concat": "^1.0.0",
"grunt-bower-licensechecker": "^0.1.2",
"grunt-cache-breaker": "^2.0.1",
"grunt-composer": "^0.4.5",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-license-bower": "^1.0.1"
}
}

18267
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,55 +1,51 @@
{
"name": "opensourcepos",
"version": "3.4.0",
"description": "Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.",
"main": "index.php",
"license": "MIT",
"authors": [
"jekkos <jekkos - at - opensourcepos.org>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>",
"objecttothis <objecttothis - at - gmail.com>"
],
"scripts": {
"install": "composer install & bower install",
"update": "npm update & composer self-update & composer update",
"clean": "grunt clean:composer & grunt clean:bower & grunt clean:npm",
"test": "echo \\\"Error: no tests specified\\\" && exit 1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"keywords": [
"point-of-sale",
"POS"
],
"devDependencies": {
"grunt": "^1.6.1",
"grunt-bower": "^0.5.0",
"grunt-bower-concat": "^0.1.1",
"grunt-bower-licensechecker": "^0.1.2",
"grunt-bowercopy": "^1.2.5",
"grunt-cache-breaker": "^0.5.6",
"grunt-cli": "^1.4.3",
"grunt-composer": "^0.2.0",
"grunt-contrib-clean": "~2.0.1",
"grunt-contrib-compress": "^2.0.0",
"grunt-contrib-concat": "~2.1.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-uglify": "~5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-license-bower": "~1.0.1",
"grunt-script-link-tags": "^1.0.2",
"grunt-wiredep": "^3.0.1",
"load-grunt-tasks": "^5.1.0",
"npm-check-updates": "^16.6.5"
},
"dependencies": {
"bootstrap-5": "npm:bootstrap@^5.2.3",
"bootswatch-5": "npm:bootswatch@^5.2.3",
"coffeescript": "^2.7.0",
"npm": "^9.4.2",
"npm-check-updates": "^16.6.5"
}
"name": "opensourcepos",
"version": "3.4.0",
"description": "Open Source Point of Sale is a web based point of sale system written in the PHP language. It uses MySQL as the data storage back-end and has a simple user interface.",
"main": "index.php",
"license": "MIT",
"authors": [
"jekkos <jekkos - at - opensourcepos.org>",
"FrancescoUK <francesco.lodolo.uk - at - gmail.com>",
"objecttothis <objecttothis - at - gmail.com>",
"SteveIreland <steve.ireland.de - at - gmail.com>"
],
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"keywords": [
"point-of-sale",
"POS"
],
"scripts": {
"install": "composer install",
"buildsetup": "npm install -g grunt-cli && bower install && cd grunt045 && npm install cd ../",
"buildtasks": "grunt task1 && cd grunt045 && grunt task2 && cd ../ && grunt task3 && cd grunt045 && grunt task4 && cd ../ && grunt task5 --force && cd grunt045 && grunt task6 && cd ../ && grunt task7",
"build": "npm run buildsetup && npm run buildtasks",
"watch": "grunt watch",
"build": "npm run install && npm run buildsetup && npm run buildtasks && npm run watch",
"update": "npm update & composer self-update & composer update",
"clean": "grunt clean:composer & grunt clean:bower & grunt clean:npm",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"bootstrap": "^5.2.3",
"bootswatch": "^5.2.3",
"coffeescript": "^2.7.0",
"npm": "^9.4.2",
"npm-check-updates": "^16.6.5"
},
"devDependencies": {
"grunt": "^1.6.1",
"grunt-bowercopy": "^1.2.5",
"grunt-contrib-compress": "^2.0.0",
"grunt-contrib-concat": "~2.1.0",
"grunt-contrib-cssmin": "^4.0.0",
"grunt-contrib-jshint": "^3.2.0",
"grunt-contrib-uglify": "~5.2.2",
"grunt-contrib-watch": "^1.1.0",
"grunt-injector": "^1.1.0",
"grunt-wiredep": "^3.0.1",
"load-grunt-tasks": "^5.1.0"
}
}