Skip to content

Commit

Permalink
Merge pull request #100 from Cropster/fn/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
mydea authored Oct 27, 2021
2 parents 48ae04a + 1cf7fab commit 53c49fe
Show file tree
Hide file tree
Showing 31 changed files with 4,113 additions and 4,427 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# misc
/coverage/
!.*
.*/
.eslintcache
/node-tests/fixtures

# ember-try
Expand Down
9 changes: 6 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
legacyDecorators: true,
},
},
plugins: ['ember'],
plugins: ['ember', 'ember-suave'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
Expand All @@ -20,14 +20,17 @@ module.exports = {
env: {
browser: true,
},
rules: {},
rules: {
'ember-suave/lines-between-object-properties': 0,
'ember-suave/lines-between-class-members': 0,
'ember-suave/require-access-in-comments': 0,
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'.eslintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
# Keep this in sync with config/ember-try.js
ember:
[
ember-lts-3.16,
ember-lts-3.20,
ember-lts-3.24,
ember-release,
ember-beta,
ember-canary,
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/*
/libpeerconnection.log
Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
Expand All @@ -23,6 +26,7 @@
/ember-cli-build.js
/testem.js
/tests/
/yarn-error.log
/yarn.lock
.gitkeep
yarn-error.log
Expand Down
28 changes: 22 additions & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
node_modules/
tmp/
dist/
public/
vendor/
/.idea/
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
/.idea/
2 changes: 2 additions & 0 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ module.exports = {
rules: {
quotes: false,
},

ignore: ['tests/**'],
};
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

## Linting

- `npm run lint:hbs`
- `npm run lint:js`
- `npm run lint:js -- --fix`
* `yarn lint`
* `yarn lint:fix`

## Running tests

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ __Note:__ Addon's CLI commands will check dependencies for you and install them
Compatibility
------------------------------------------------------------------------------

* Ember.js v3.16 or above
* Ember CLI v2.13 or above
* Node.js v10 or above
* Ember.js v3.20 or above
* Ember CLI v3.20 or above
* Node.js v12 or above

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion addon/services/l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Promise } from 'rsvp';
import Ember from 'ember';
import Service from '@ember/service';
import { assign } from '@ember/polyfills';
import { guessLocale } from '../utils/guess-locale';
import { guessLocale } from 'ember-l10n/utils/guess-locale';
import { A as array } from '@ember/array';
import { assert } from '@ember/debug';
import { getLocaleAssetMap } from 'ember-l10n/utils/get-locale-asset-map';
Expand Down
1 change: 1 addition & 0 deletions addon/utils/guess-locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function guessLocale(
if (!desiredLocales.find) {
desiredLocales = array(desiredLocales);
}

if (!allowedLocales.find) {
allowedLocales = array(allowedLocales);
}
Expand Down
14 changes: 10 additions & 4 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
'use strict';

const getChannelURL = require('ember-source-channel-url');
const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');

module.exports = async function () {
return {
useYarn: true,
scenarios: [
{
name: 'ember-lts-3.16',
name: 'ember-lts-3.20',
npm: {
devDependencies: {
'ember-source': '~3.16.0',
'ember-source': '~3.20.5',
},
},
},
{
name: 'ember-lts-3.20',
name: 'ember-lts-3.24',
npm: {
devDependencies: {
'ember-source': '~3.20.5',
'ember-source': '~3.24.3',
},
},
},
Expand Down Expand Up @@ -69,11 +70,16 @@ module.exports = async function () {
}),
},
npm: {
devDependencies: {
'ember-source': '~3.28.0',
},
ember: {
edition: 'classic',
},
},
},
embroiderSafe(),
embroiderOptimized(),
],
};
};
9 changes: 8 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ module.exports = function (defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

return app.toTree();
let { maybeEmbroider } = require('@embroider/test-setup');
return maybeEmbroider(app, {
skipBabel: [
{
package: 'qunit',
},
],
});
};
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ module.exports = {

let app = this._findHost();

let hasEmberCliFastboot = !!this.project.findAddonByName(
'ember-cli-fastboot'
);
let hasEmberCliFastboot =
!!this.project.findAddonByName('ember-cli-fastboot');
this._hasEmberCliFastboot = hasEmberCliFastboot;

let env = process.env.EMBER_ENV;
Expand Down
1 change: 1 addition & 0 deletions lib/commands/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ CREATING PO FILE
} catch (e) {
// ignore non-existing folders
}

return files;
}, []);
},
Expand Down
57 changes: 30 additions & 27 deletions lib/commands/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ PARSING SOURCE FILES
//
let messages = {};

let regex = /msgid\s+"(.+)"\s*(?:msgid_plural\s+"(.+)"\s*)?msgstr(?:\[0\])?\s+"(.+)"\s*(?:msgstr(?:\[1\])?\s+"(.+)")?/g;
let regex =
/msgid\s+"(.+)"\s*(?:msgid_plural\s+"(.+)"\s*)?msgstr(?:\[0\])?\s+"(.+)"\s*(?:msgstr(?:\[1\])?\s+"(.+)")?/g;
let data = fs.readFileSync(this.poFile, 'utf8');

let match;
Expand Down Expand Up @@ -245,18 +246,18 @@ PARSING SOURCE FILES
/* eslint-disable prefer-template */
let regex = new RegExp(
'(\\.' +
this._normalizeKey(key) +
'\\((?:\\s*)(?:\'|\\"))' + // = $1
'(' +
this.escapeString_(msgid) +
')' + // = $2
'(\'|\\")' + // = $3
'(?:' +
'(\\s*,\\s*(?:\'|\\"))' + // = $4
'(' +
this.escapeString_(msgidPlural || '') +
')' + // = $5
'(\'|\\")' + // = $6
this._normalizeKey(key) +
'\\((?:\\s*)(?:\'|\\"))' + // = $1
'(' +
this.escapeString_(msgid) +
')' + // = $2
'(\'|\\")' + // = $3
'(?:' +
'(\\s*,\\s*(?:\'|\\"))' + // = $4
'(' +
this.escapeString_(msgidPlural || '') +
')' + // = $5
'(\'|\\")' + // = $6
')?',
'g'
);
Expand Down Expand Up @@ -304,18 +305,18 @@ PARSING SOURCE FILES
/* eslint-disable prefer-template */
let regex = new RegExp(
'((?:\\(|{{{?)' +
this._normalizeKey(key) +
'\\s*(?:\'|\\"))' + // = $1
'(' +
this.escapeString_(msgid) +
')' + // = $2
'(\'|\\")' + // = $3
'(?:' +
'(\\s*(?:\'|\\"))' + // = $4
'(' +
this.escapeString_(msgidPlural || '') +
')' + // = $5
'(\'|\\")' + // = $6
this._normalizeKey(key) +
'\\s*(?:\'|\\"))' + // = $1
'(' +
this.escapeString_(msgid) +
')' + // = $2
'(\'|\\")' + // = $3
'(?:' +
'(\\s*(?:\'|\\"))' + // = $4
'(' +
this.escapeString_(msgidPlural || '') +
')' + // = $5
'(\'|\\")' + // = $6
')?',
'g'
);
Expand Down Expand Up @@ -392,8 +393,10 @@ PARSING SOURCE FILES
// {{n "My Message Id Single" "My Message Id Plural" count}}
// {{some-fancy-component translatable-attribute=(t "My Message Id")}}
// ...
let regex1 = /((?:(?:n|t)?\(|{{{?)(?:n|t)?\s*["])([^"]+)(["])(?:(,?\s*")([^"]+)(["]))?/g;
let regex2 = /((?:(?:n|t)?\(|{{{?)(?:n|t)?\s*['])([^']+)(['])(?:(,?\s*')([^']+)([']))?/g;
let regex1 =
/((?:(?:n|t)?\(|{{{?)(?:n|t)?\s*["])([^"]+)(["])(?:(,?\s*")([^"]+)(["]))?/g;
let regex2 =
/((?:(?:n|t)?\(|{{{?)(?:n|t)?\s*['])([^']+)(['])(?:(,?\s*')([^']+)([']))?/g;

input = input.replace(regex1, (match, p1, p2, p3, p4, p5, p6) => {
return [p1, p2.replace(/\s+/g, ' '), p3, p4, p5, p6].join('');
Expand Down
1 change: 1 addition & 0 deletions lib/commands/utils/build-pot-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function normalizeMsgId(str) {
if (!str) {
return '';
}

return str
.replace(/"/gm, '\\"') // Escape "
.replace(/(\n|(\r\n))[\t ]*/gm, '\n') // Remove leading whitespace after line breaks
Expand Down
24 changes: 6 additions & 18 deletions lib/commands/utils/validate/validate-translated-placeholders.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,11 @@ function validateTranslatedPlaceholders(
if (!placeholders.length) {
return;
}

let placeholderConfig = placeholders.map((str) => {
pattern.lastIndex = 0;
let [
fullResult,
placeholder,
quoteSymbol1,
,
,
content,
quoteSymbol2,
] = pattern.exec(str);
let [fullResult, placeholder, quoteSymbol1, , , content, quoteSymbol2] =
pattern.exec(str);
return {
fullResult,
placeholder,
Expand All @@ -54,15 +48,8 @@ function validateTranslatedPlaceholders(
let translatedPlaceholders = translation.match(pattern) || [];
let translatedPlaceholderConfig = translatedPlaceholders.map((str) => {
pattern.lastIndex = 0;
let [
fullResult,
placeholder,
quoteSymbol1,
,
,
content,
quoteSymbol2,
] = pattern.exec(str);
let [fullResult, placeholder, quoteSymbol1, , , content, quoteSymbol2] =
pattern.exec(str);
return {
fullResult,
placeholder,
Expand Down Expand Up @@ -98,6 +85,7 @@ function validateTranslatedPlaceholders(
if (id === translation) {
return;
}

let invalidTranslatedPlaceholder = translatedPlaceholderConfig.find(
(config) => {
return config.content === content;
Expand Down
6 changes: 3 additions & 3 deletions node-tests/fixtures/extract/expected.pot
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: tests/dummy/app/controllers/application.js:12:10
#: tests/dummy/app/controllers/application.js:14:10
#: tests/dummy/app/templates/test-page.hbs:19:0
#: tests/dummy/app/templates/test-page.hbs:20:0
msgid "en"
msgstr ""

#: tests/dummy/app/controllers/application.js:13:10
#: tests/dummy/app/controllers/application.js:15:10
msgid "de"
msgstr ""

#: tests/dummy/app/controllers/application.js:14:10
#: tests/dummy/app/controllers/application.js:16:10
msgid "ko"
msgstr ""

Expand Down
Loading

0 comments on commit 53c49fe

Please sign in to comment.