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

OTOOLS-84 - Create a patch version for @sencha/cmd to support latest CMD 7.4 #276

Open
wants to merge 2 commits into
base: ext-allshared-7.4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
{
<tpl if="universal == true">
"scripts": {
"start": "npm run dev:desktop",
"clean": "rimraf build",
"dev:desktop": "webpack-dev-server --env.profile=desktop --env.browser=yes --env.verbose=no",
"dev:phone": "webpack-dev-server --env.profile=phone --env.browser=yes --env.verbose=no",
"build:desktop": "npm run clean && cross-env webpack --env.profile=desktop --env.environment=production --env.treeshake=yes",
"build:phone": "npm run clean && cross-env webpack --env.profile=phone --env.environment=production --env.treeshake=yes"
"start": "npm run dev:desktop",
"clean": "rimraf build",
"dev:desktop": "webpack-dev-server --env.profile=desktop --env.browser=yes --env.verbose=no",
"dev:phone": "webpack-dev-server --env.profile=phone --env.browser=yes --env.verbose=no",
"build:desktop": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--environment=production --env.cmdopts=--build=desktop",
"build:phone": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--environment=production --env.cmdopts=--build=phone",
"testing:desktop": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--testing --env.cmdopts=--build=desktop",
"testing:phone": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--testing --env.cmdopts=--build=phone"
},
</tpl>
<tpl if="universal == false">
"scripts": {
"start": "npm run dev",
"clean": "rimraf build",
"dev": "webpack-dev-server --env.profile=desktop --env.browser=yes --env.verbose=no",
"build": "npm run clean && cross-env webpack --env.profile=desktop --env.environment=production --env.treeshake=yes"
"build": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--environment=production --env.cmdopts=--build=desktop",
"build:testing": "npm run clean && cross-env webpack --env.treeshake=yes --env.cmdopts=--testing --env.cmdopts=--build=desktop"
},
</tpl>
<tpl if="modern == true">
Expand All @@ -41,7 +44,7 @@
},
</tpl>
"devDependencies": {
"@sencha/ext-webpack-plugin": "~7.4.0",
"@sencha/ext-webpack-plugin": "~7.4.1",
"cross-env": "^5.2.0",
"portfinder": "^1.0.21",
"webpack": "~4.39.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ExtWebpackPlugin = require('@sencha/ext-webpack-plugin');
const portfinder = require('portfinder');

module.exports = async function (env) {

// Utility function for retrieving environment variables
function get(it, val) {if(env == undefined) {return val} else if(env[it] == undefined) {return val} else {return env[it]}}

Expand All @@ -29,16 +29,27 @@ module.exports = async function (env) {
var browser = get('browser', 'yes')
var watch = get('watch', 'yes')
var verbose = get('verbose', 'no')
var isProd = false;

if (environment === 'production') { isProd = true; }
var cmdopts = get('cmdopts', [])
var isProd = false

if (environment === 'production' ||
(cmdopts.includes('--production') ||
cmdopts.includes('--environment=production') ||
cmdopts.includes('-e=production') ||
cmdopts.includes('-pr'))
)
{
browser = 'no'
watch = 'no'
isProd = true
}

// The build.xml Sencha Cmd plugin uses a regex to locate the webpack bundle for use in app.json to be included in
// The build.xml Sencha Cmd plugin uses a regex to locate the webpack bundle for use in app.json to be included in
// the different build environments. For development builds, the file is served in memory.
// For production builds, the hashed file name is stored as an ant property and added to the build via app.json.
const bundleFormat = isProd ? "[name].[hash].js" : "[name].js";

// Using Live Reload with a root context directory, necessary for Sencha Cmd, requires these folders be ignored
// Using Live Reload with a root context directory, necessary for Sencha Cmd, requires these folders be ignored
const ignoreFolders = [path.resolve(__dirname, './generatedFiles'), path.resolve(__dirname, './build')]

portfinder.basePort = (env && env.port) || 1962
Expand All @@ -52,12 +63,13 @@ module.exports = async function (env) {
script: script,
emit: emit,
port: port,
profile: profile,
profile: profile,
environment: environment,
treeshake: treeshake,
browser: browser,
watch: watch,
verbose: verbose
verbose: verbose,
cmdopts: cmdopts
})
]
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"devDependencies": {
"@sencha/ext-react-babel-plugin": "~7.1.0",
"@sencha/ext-webpack-plugin": "~7.4.0",
"@sencha/ext-webpack-plugin": "~7.4.1",
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-decorators": "^7.4.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/ext-webpack-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sencha/ext-webpack-plugin",
"version": "7.4.0",
"version": "7.4.1",
"description": "A webpack plugin for ext-* applications",
"main": "dist/index.js",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"dependencies": {
"@babel/generator": "^7.9.5",
"@babel/polyfill": "^7.8.7",
"@sencha/cmd": "^7.4.0",
"@sencha/cmd": "^7.4.1",
"ast-traverse": "^0.1.1",
"babylon": "^6.18.0",
"chalk": "^4.0.0",
Expand Down