Skip to content

Commit

Permalink
Merge pull request #255 from salsify/upgrade-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman authored Nov 19, 2021
2 parents 794ffbe + 0991f79 commit 232c564
Show file tree
Hide file tree
Showing 278 changed files with 11,377 additions and 11,572 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Lint
run: yarn workspace ember-css-modules lint:js
- name: Browser Tests
- name: Run Tests
run: yarn workspace ember-css-modules test
- name: Node Tests
run: yarn workspace ember-css-modules test:node

test-old-dependencies:
name: Oldest Supported Env
Expand All @@ -48,7 +44,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 6
node-version: 12
- name: Install Dependencies
run: yarn install --frozen-lockfile
working-directory: test-packages/old-app
Expand All @@ -66,7 +62,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Install Latest `ember-cli`
Expand All @@ -85,11 +81,11 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: yarn workspace ember-css-modules test
run: yarn workspace ember-css-modules test:ember

test-try:
name: Ember Try
Expand All @@ -107,7 +103,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Try Scenario
Expand All @@ -123,20 +119,16 @@ jobs:
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Embroider App
run: yarn workspace embroider-app test
run: yarn workspace embroider-app test:ember
- name: Sass App
run: yarn workspace sass-app test
- name: Dummy Addon
run: yarn workspace dummy-addon test
run: yarn workspace sass-app test:ember
- name: Plugin Addon
run: yarn workspace plugin-addon test
run: yarn workspace plugin-addon test:ember
- name: Octane Addon
run: yarn workspace octane-addon test
- name: Dummy Addon With Custom moduleName
run: yarn workspace @my-namespace/dummy-addon test
- name: Octane Addon With Custom moduleName
run: yarn workspace @my-namespace/octane-addon test
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
"private": true,
"workspaces": [
"packages/ember-css-modules",
"test-packages/dummy-addon",
"test-packages/dummy-addon-with-module-name",
"test-packages/embroider-app",
"test-packages/octane-addon",
"test-packages/octane-addon-with-module-name",
Expand Down
1 change: 0 additions & 1 deletion packages/ember-css-modules/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
5 changes: 4 additions & 1 deletion packages/ember-css-modules/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
/tests/dummy*/node_modules
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
71 changes: 40 additions & 31 deletions packages/ember-css-modules/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,65 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: [
'ember'
],
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
'browser': true
browser: true,
},
rules: {
'ember/no-new-mixins': 'off'
// TODO: enable all these for v2 when we don't need to test these constructs ourselves
'ember/no-mixins': 'off',
'ember/no-new-mixins': 'off',
'ember/no-classic-classes': 'off',
'ember/no-classic-components': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
'ember/require-tagless-components': 'off',
'ember/classic-decorator-no-classic-methods': 'off',
'ember/no-component-lifecycle-hooks': 'off',
},
overrides: [
// node files
{
files: [
'.template-lintrc.js',
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js',
'tests-node/**/*.js',
'lib/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy*/app/**',
'tests/dummy*/addon/**'
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./tests/dummy/config/**/*.js',
'./lib/**/*.js',
'./tests-node/**/*.js',
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
env: {
browser: false,
node: true
node: true,
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here
}),
}
]
extends: ['plugin:node/recommended'],
},
{
// Test files:
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
3 changes: 3 additions & 0 deletions packages/ember-css-modules/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
Expand Down
8 changes: 7 additions & 1 deletion packages/ember-css-modules/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@
# misc
/.editorconfig
/.ember-cli
/.env*
/.eslintcache
/.eslintignore
/.eslintrc.js
/.git/
/.gitignore
/.watchmanconfig
/.prettierignore
/.prettierrc.js
/.template-lintrc.js
/.travis.yml
/config/ember-try.js
/dist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# misc
/coverage/
!.*
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'recommended'
singleQuote: true,
};
4 changes: 2 additions & 2 deletions packages/ember-css-modules/.template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
module.exports = {
extends: 'recommended',
rules: {
quotes: false
}
quotes: false,
},
};
45 changes: 26 additions & 19 deletions packages/ember-css-modules/addon/decorators.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ import { assert } from '@ember/debug';
@param {...string} classNames - The list of local classes to be applied to the component
*/
export const localClassNames = (...classNames) => (...desc) => {
assert(
`The @localClassNames decorator must be provided strings, received: ${classNames}`,
classNames.every(className => typeof className === 'string')
);
export const localClassNames =
(...classNames) =>
(...desc) => {
assert(
`The @localClassNames decorator must be provided strings, received: ${classNames}`,
classNames.every((className) => typeof className === 'string')
);

if (isStage1ClassDescriptor(desc)) {
collapseAndMerge(desc[0].prototype, 'localClassNames', ...classNames);
} else {
desc[0].finisher = target => {
collapseAndMerge(target.prototype, 'localClassNames', ...classNames);
};
}
};
if (isStage1ClassDescriptor(desc)) {
collapseAndMerge(desc[0].prototype, 'localClassNames', ...classNames);
} else {
desc[0].finisher = (target) => {
collapseAndMerge(target.prototype, 'localClassNames', ...classNames);
};
}
};

/**
Decorator which indicates that the field or computed should be bound to the
Expand Down Expand Up @@ -64,14 +66,14 @@ export const localClassName = (...params) => {
return (...desc) => {
assert(
`The @localClassName decorator may only receive strings as parameters. Received: ${params}`,
params.every(className => typeof className === 'string')
params.every((className) => typeof className === 'string')
);

if (isStage1FieldDescriptor(desc)) {
let [prototype, key, descriptor] = desc;
setUpLocalClassField(params, prototype, key, descriptor);
} else if (isStage2FieldDescriptor(desc)) {
desc[0].finisher = target => {
desc[0].finisher = (target) => {
const { key, descriptor } = desc[0];
setUpLocalClassField(params, target.prototype, key, descriptor);
};
Expand All @@ -93,7 +95,9 @@ function setUpLocalClassField(params, prototype, key, descriptor) {
// explicit `writable` flag, default to not being writable in Babel. Since
// by default fields _are_ writable and this decorator should not change
// that, we enable the `writable` flag in this specific case.
if (!('get' in descriptor || 'set' in descriptor || 'writable' in descriptor)) {
if (
!('get' in descriptor || 'set' in descriptor || 'writable' in descriptor)
) {
descriptor.writable = true;
}

Expand All @@ -102,7 +106,7 @@ function setUpLocalClassField(params, prototype, key, descriptor) {
// This is a no-op in Babel 7 (since `initializer` isn't part of the property descriptor)
// and can be dropped when we remove support for Babel 6
if (descriptor.initializer === null) {
descriptor.initializer = function() {
descriptor.initializer = function () {
return get(this, key);
};
}
Expand All @@ -114,7 +118,7 @@ function collapseAndMerge(prototype, property, ...items) {

if (property in prototype) {
const parentElements = prototype[property];
items.unshift(...parentElements)
items.unshift(...parentElements);
}

prototype[property] = items;
Expand All @@ -135,7 +139,10 @@ function isStage1ClassDescriptor(possibleDesc) {
}

function isFieldDescriptor(possibleDesc) {
return isStage1FieldDescriptor(possibleDesc) || isStage2FieldDescriptor(possibleDesc);
return (
isStage1FieldDescriptor(possibleDesc) ||
isStage2FieldDescriptor(possibleDesc)
);
}

function isStage2FieldDescriptor(possibleDesc) {
Expand Down
13 changes: 10 additions & 3 deletions packages/ember-css-modules/addon/helpers/local-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import require from 'require';

export function localClass(params, hash) {
assert('No source specified to local-class lookup', 'from' in hash);
if (!hash.from) { return ''; }
if (!hash.from) {
return '';
}

let styles = resolveSource(hash.from);
let classes = (params[0] || '').split(/\s+/);

return classes.map(style => styles[style]).filter(Boolean).join(' ');
return classes
.map((style) => styles[style])
.filter(Boolean)
.join(' ');
}

export default helper(localClass);
Expand All @@ -19,7 +24,9 @@ function resolveSource(source) {
if (require.has(source)) {
return require(source).default;
} else {
throw new Error(`Unable to resolve local class names from ${source}; does the styles file exist?`);
throw new Error(
`Unable to resolve local class names from ${source}; does the styles file exist?`
);
}
} else {
return source;
Expand Down
Loading

0 comments on commit 232c564

Please sign in to comment.