@enact/cli 3.0.3 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ name: Update copyright year(s) in license file
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 7 1 1 *"
6
+
7
+ jobs:
8
+ run:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ with:
13
+ ref: develop
14
+ fetch-depth: 0
15
+ - uses: FantasticFiasco/action-update-license-year@v2
16
+ with:
17
+ token: ${{ secrets.GITHUB_TOKEN }}
18
+ path: README.md
19
+ branchName: license/{{currentYear}}
20
+ commitTitle: update license
21
+ commitBody: Let's keep legal happy.
22
+ prTitle: Update copyright years in README.md file
23
+ prBody: It's that time of the year, let's update the license.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,45 @@
1
+ ## 3.0.8 (February 17, 2022)
2
+
3
+ * No significant changes.
4
+
5
+ ## 3.0.7 (February 17, 2022)
6
+
7
+ ### pack
8
+
9
+ * Updated `postcss` related dependencies including `postcss-normalize` 10.0.1.
10
+
11
+ ## 3.0.6 (May 11, 2021)
12
+
13
+ ### pack
14
+
15
+ * Fixed not inserting title into the output HTML.
16
+
17
+ ## 3.0.5 (February 3, 2021)
18
+
19
+ ### serve
20
+
21
+ * Fixed https serve is not working.
22
+
23
+ ### eject
24
+
25
+ * Fixed `--bare` option to work.
26
+
27
+ ## 3.0.4 (August 10, 2020)
28
+
29
+ ### create
30
+
31
+ * Switched back to `@enact/template-moonstone` as default templated included in CLI.
32
+
33
+ ### template
34
+
35
+ * Fixed error being thrown when dead symlinks are detected in template userspace.
36
+
1
37
  ## 3.0.3 (August 5, 2020)
2
38
 
3
39
  ### transpile
4
40
 
5
41
  * When transpiling in standalone mode, do not use `@babel/plugin-transform-runtime`.
6
42
 
7
-
8
43
  ## 3.0.2 (August 3, 2020)
9
44
 
10
45
  ### pack
@@ -111,7 +146,7 @@ All dependencies updated to latest release.
111
146
  ### pack
112
147
 
113
148
  * Fixed theme feature detection on local theme files (eg. when a local ThemeDecorator is present)
114
- * Fixed bug with `--framework` option with regards to erroneously including unneeded or invalid iLib dependencies and test files.
149
+ * Fixed bug with `--framework` option with regards to erroneously including unneeded or invalid iLib dependencies and test files.
115
150
 
116
151
  ### clean
117
152
 
package/README.md CHANGED
@@ -116,7 +116,7 @@ npm install -g eslint@5 eslint-plugin-react eslint-plugin-react-hooks eslint-plu
116
116
 
117
117
  Unless otherwise specified, all content, including all source code files and documentation files in this repository are:
118
118
 
119
- Copyright (c) 2016-2020 LG Electronics
119
+ Copyright (c) 2016-2021 LG Electronics
120
120
 
121
121
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
122
122
 
package/bin/enact.js CHANGED
File without changes
@@ -27,6 +27,11 @@ function displayHelp() {
27
27
  console.log(' -v, --version Display version information');
28
28
  console.log(' -h, --help Display help information');
29
29
  console.log();
30
+ /*
31
+ Private Options:
32
+ --override Directory containing package .tgz archives to override dependencies.
33
+ */
34
+
30
35
  process.exit(0);
31
36
  }
32
37
 
@@ -55,6 +60,7 @@ function api({
55
60
  allsamples = false,
56
61
  link = true,
57
62
  loglevel = 'error',
63
+ override,
58
64
  verbose = false
59
65
  } = {}) {
60
66
  const pkg = packageRoot(cwd);
@@ -62,6 +68,51 @@ function api({
62
68
  if (verbose) loglevel = 'verbose';
63
69
 
64
70
  return Promise.resolve()
71
+ .then(() => {
72
+ // Override dependencies in package.json, package-lock.json and npm-shrinkwrap.json
73
+ if (override) {
74
+ console.log('Overrides with local dependencies from', override);
75
+ // Collect list of all valid local package tgz archives found
76
+ const scoped = s => fs.readdirSync(path.join(override, s)).map(d => path.join(s, d));
77
+ const local = fs
78
+ .readdirSync(override)
79
+ .reduce((a, curr) => a.concat(curr.startsWith('@') ? scoped(curr) : curr), [])
80
+ .filter(d => fs.existsSync(path.join(override, d, 'package.tgz')));
81
+ if (path.isAbsolute(override)) override = path.relative(cwd, override);
82
+ ['package.json', 'package-lock.json', 'npm-shrinkwrap.json']
83
+ .map(f => path.join(cwd, f))
84
+ .filter(f => fs.existsSync(f))
85
+ .forEach((f, i) => {
86
+ const lockfile = i > 0;
87
+ // Restore any detected backups
88
+ if (fs.existsSync(f + '.bak')) {
89
+ fs.unlinkSync(f);
90
+ fs.renameSync(f + '.bak', f);
91
+ }
92
+ const obj = JSON.parse(fs.readFileSync(f, {encoding: 'utf8'}));
93
+ // Update dependency entry for local entries that exist
94
+ local
95
+ .filter(dep => obj.dependencies && obj.dependencies[dep])
96
+ .forEach(dep => {
97
+ const fileDep = 'file:' + path.join(override, dep, 'package.tgz');
98
+ if (lockfile) {
99
+ obj.lockfileVersion = obj.lockfileVersion || 1;
100
+ obj.requires = true;
101
+ obj.dependencies[dep].version = fileDep;
102
+ // Remove unneeded properties to avoid issues
103
+ ['resolved', 'from', 'integrity', 'requires'].forEach(
104
+ key => delete obj.dependencies[dep][key]
105
+ );
106
+ } else {
107
+ obj.dependencies[dep] = fileDep;
108
+ }
109
+ });
110
+ // Backup existing and write the newly modified file
111
+ fs.renameSync(f, f + '.bak');
112
+ fs.writeFileSync(f, JSON.stringify(obj, null, ' '), {encoding: 'utf8'});
113
+ });
114
+ }
115
+ })
65
116
  .then(() => {
66
117
  // Root package install
67
118
  if (base) {
@@ -116,12 +167,14 @@ function api({
116
167
  function cli(args) {
117
168
  const opts = minimist(args, {
118
169
  boolean: ['base', 'sampler', 'allsamples', 'link', 'verbose', 'help'],
119
- string: ['loglevel'],
170
+ string: ['loglevel', 'override'],
120
171
  default: {base: true, sampler: true, link: true},
121
172
  alias: {b: 'base', s: 'sampler', a: 'allsamples', l: 'link', h: 'help'}
122
173
  });
123
174
  if (opts.help) displayHelp();
124
175
 
176
+ if (opts._[0] && fs.statSync(opts._[0]).isDirectory()) opts.cwd = opts._[0];
177
+
125
178
  api(opts).catch(err => {
126
179
  console.error(chalk.red('ERROR: ') + err.message);
127
180
  process.exit(1);
package/commands/clean.js CHANGED
File without changes
@@ -18,7 +18,7 @@ const minimist = require('minimist');
18
18
  const validatePackageName = require('validate-npm-package-name');
19
19
 
20
20
  const ENACT_DEV_NPM = '@enact/cli';
21
- const INCLUDED = path.dirname(require.resolve('@enact/template-sandstone'));
21
+ const INCLUDED = path.dirname(require.resolve('@enact/template-moonstone'));
22
22
  const TEMPLATE_DIR = path.join(process.env.APPDATA || os.homedir(), '.enact');
23
23
 
24
24
  const defaultGenerator = {
@@ -170,7 +170,7 @@ function resolveTemplateGenerator(template) {
170
170
  return new Promise((resolve, reject) => {
171
171
  let templatePath = path.join(TEMPLATE_DIR, template);
172
172
  if (!fs.existsSync(templatePath)) {
173
- if (['default', 'sandstone'].includes(template)) {
173
+ if (['default', 'moonstone'].includes(template)) {
174
174
  templatePath = path.join(INCLUDED, 'template');
175
175
  } else {
176
176
  reject(new Error(`Template ${chalk.bold(template)} not found.`));
package/commands/eject.js CHANGED
@@ -159,7 +159,7 @@ function configurePackage(bare) {
159
159
  const own = require('../package.json');
160
160
  const app = require(path.resolve('package.json'));
161
161
  const backup = JSON.stringify(app, null, 2) + os.EOL;
162
- const availScripts = fs.readdirSync('./scripts').map(f => f.replace(/\.js$/, ''));
162
+ const availScripts = fs.existsSync('./scripts') ? fs.readdirSync('./scripts').map(f => f.replace(/\.js$/, '')) : [];
163
163
  const enactCLI = new RegExp('enact (' + availScripts.join('|') + ')', 'g');
164
164
  const eslintConfig = {extends: 'enact'};
165
165
  const eslintIgnore = ['build/*', 'config/*', 'dist/*', 'node_modules/*', 'scripts/*'];
package/commands/link.js CHANGED
File without changes
package/commands/lint.js CHANGED
File without changes
package/commands/pack.js CHANGED
File without changes
package/commands/serve.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-env node, es6 */
2
+ /* eslint-disable prettier/prettier */
2
3
  // @remove-on-eject-begin
3
4
  /**
4
5
  * Portions of this source code file are from create-react-app, used under the
@@ -99,7 +100,7 @@ function hotDevServer(config, fastRefresh) {
99
100
  function devServerConfig(host, protocol, publicPath, proxy, allowedHost) {
100
101
  let https = false;
101
102
  const {SSL_CRT_FILE, SSL_KEY_FILE} = process.env;
102
- if (protocol === 'https' && [SSL_CRT_FILE, SSL_KEY_FILE].all(f => f && fs.existsSync(f))) {
103
+ if (protocol === 'https' && [SSL_CRT_FILE, SSL_KEY_FILE].every(f => f && fs.existsSync(f))) {
103
104
  https = {
104
105
  cert: fs.readFileSync(SSL_CRT_FILE),
105
106
  key: fs.readFileSync(SSL_KEY_FILE)
@@ -10,7 +10,7 @@ const inquirer = require('react-dev-utils/inquirer');
10
10
  const tar = require('tar');
11
11
 
12
12
  const TEMPLATE_DIR = path.join(process.env.APPDATA || os.homedir(), '.enact');
13
- const INCLUDED = path.dirname(require.resolve('@enact/template-sandstone'));
13
+ const INCLUDED = path.dirname(require.resolve('@enact/template-moonstone'));
14
14
  const DEFAULT_LINK = path.join(TEMPLATE_DIR, 'default');
15
15
 
16
16
  function displayHelp() {
@@ -58,10 +58,21 @@ function displayHelp() {
58
58
  function initTemplateArea() {
59
59
  if (!fs.existsSync(TEMPLATE_DIR)) {
60
60
  fs.mkdirSync(TEMPLATE_DIR);
61
+ } else {
62
+ // Remove any dead/unreadable link
63
+ fs.readdirSync(TEMPLATE_DIR)
64
+ .map(d => path.join(TEMPLATE_DIR, d))
65
+ .forEach(d => {
66
+ try {
67
+ fs.realpathSync(d);
68
+ } catch (e) {
69
+ fs.removeSync(d);
70
+ }
71
+ });
61
72
  }
62
- const init = doLink(path.join(INCLUDED, 'template'), 'sandstone');
63
- const sandstoneLink = path.join(TEMPLATE_DIR, 'sandstone');
64
- return init.then(() => !fs.existsSync(DEFAULT_LINK) && doLink(sandstoneLink, 'default'));
73
+ const init = doLink(path.join(INCLUDED, 'template'), 'moonstone');
74
+ const moonstoneLink = path.join(TEMPLATE_DIR, 'moonstone');
75
+ return init.then(() => !fs.existsSync(DEFAULT_LINK) && doLink(moonstoneLink, 'default'));
65
76
  }
66
77
 
67
78
  function doInstall(target, name) {
package/commands/test.js CHANGED
File without changes
File without changes
@@ -91,11 +91,8 @@ module.exports = function (env) {
91
91
  // package.json
92
92
  loader: require.resolve('postcss-loader'),
93
93
  options: {
94
- // https://webpack.js.org/guides/migrating/#complex-options
95
- ident: 'postcss',
96
- sourceMap: shouldUseSourceMap,
97
- plugins: () =>
98
- [
94
+ postcssOptions: {
95
+ plugins: [
99
96
  // Fix and adjust for known flexbox issues
100
97
  // See https://github.com/philipwalton/flexbugs
101
98
  require('postcss-flexbugs-fixes'),
@@ -118,6 +115,8 @@ module.exports = function (env) {
118
115
  // Resolution indepedence support
119
116
  app.ri !== false && require('postcss-resolution-independence')(app.ri)
120
117
  ].filter(Boolean)
118
+ },
119
+ sourceMap: shouldUseSourceMap
121
120
  }
122
121
  }
123
122
  ];
@@ -452,7 +451,7 @@ module.exports = function (env) {
452
451
  new ILibPlugin({symlinks: false}),
453
452
  // Automatically detect ./appinfo.json and ./webos-meta/appinfo.json files,
454
453
  // and parses any to copy over any webOS meta assets at build time.
455
- new WebOSMetaPlugin(),
454
+ new WebOSMetaPlugin({htmlPlugin: HtmlWebpackPlugin}),
456
455
  // TypeScript type checking
457
456
  useTypeScript &&
458
457
  new ForkTsCheckerWebpackPlugin({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/cli",
3
- "version": "3.0.3",
3
+ "version": "3.0.8",
4
4
  "description": "Full-featured build environment tool for Enact applications.",
5
5
  "main": "index.js",
6
6
  "author": "Jason Robitaille <jason.robitaille@lge.com>",
@@ -55,8 +55,8 @@
55
55
  "@babel/preset-react": "7.10.4",
56
56
  "@babel/preset-typescript": "7.10.4",
57
57
  "@babel/runtime": "7.10.5",
58
- "@enact/dev-utils": "3.1.0",
59
- "@enact/template-sandstone": "1.0.0-pre.1",
58
+ "@enact/dev-utils": "3.1.2",
59
+ "@enact/template-moonstone": "3.1.0",
60
60
  "@pmmmwh/react-refresh-webpack-plugin": "0.3.3",
61
61
  "@typescript-eslint/eslint-plugin": "3.6.0",
62
62
  "@typescript-eslint/parser": "3.6.0",
@@ -102,10 +102,11 @@
102
102
  "mini-css-extract-plugin": "0.9.0",
103
103
  "minimist": "1.2.5",
104
104
  "optimize-css-assets-webpack-plugin": "5.0.3",
105
- "postcss-flexbugs-fixes": "4.2.1",
105
+ "postcss": "8.3.5",
106
+ "postcss-flexbugs-fixes": "5.0.2",
106
107
  "postcss-global-import": "1.0.6",
107
- "postcss-loader": "3.0.0",
108
- "postcss-normalize": "9.0.0",
108
+ "postcss-loader": "4.2.0",
109
+ "postcss-normalize": "10.0.1",
109
110
  "postcss-preset-env": "6.7.0",
110
111
  "postcss-resolution-independence": "1.0.0",
111
112
  "postcss-safe-parser": "4.0.2",