Skip to content

Commit

Permalink
Convert to V2 addon
Browse files Browse the repository at this point in the history
  • Loading branch information
herzzanu committed May 9, 2023
1 parent 2f1940d commit ea2a036
Show file tree
Hide file tree
Showing 76 changed files with 1,155 additions and 900 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'v*'
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 16

Expand Down Expand Up @@ -63,7 +67,6 @@ jobs:
- ember-release
- ember-beta
- ember-canary
- ember-classic
- embroider-safe
- embroider-optimized

Expand All @@ -77,4 +80,5 @@ jobs:
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Run Tests
run: ./node_modules/.bin/ember try:one ${{ matrix.try-scenario }}
run: yarn ember try:one ${{ matrix.try-scenario }}
working-directory: test-app
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"endOfLine":"auto",
"endOfLine": "auto",
"singleQuote": true,
"overrides": [
{
Expand Down
1 change: 0 additions & 1 deletion app/helpers/variation.js

This file was deleted.

25 changes: 0 additions & 25 deletions ember-cli-build.js

This file was deleted.

8 changes: 8 additions & 0 deletions ember-launch-darkly/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/

# misc
/coverage/
42 changes: 42 additions & 0 deletions ember-launch-darkly/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {},
overrides: [
// node files
{
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.template-lintrc.js',
'./addon-main.js',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
extends: ['plugin:n/recommended'],
},
],
};
25 changes: 25 additions & 0 deletions ember-launch-darkly/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
dist/

# dependencies
node_modules/

# misc
/.env*
/.pnp*
/.pnpm-debug.log
/.sass-cache
.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/package.json.ember-try
/yarn.lock.ember-try
File renamed without changes.
4 changes: 4 additions & 0 deletions ember-launch-darkly/addon-main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

const { addonV1Shim } = require('@embroider/addon-shim');
module.exports = addonV1Shim(__dirname);
7 changes: 7 additions & 0 deletions ember-launch-darkly/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@embroider/addon-dev/template-colocation-plugin"
]
}
79 changes: 79 additions & 0 deletions ember-launch-darkly/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "ember-launch-darkly",
"version": "3.0.0",
"description": "A modern Ember addon to wrap the Launch Darkly service",
"keywords": [
"ember-addon"
],
"repository": "https://github.com/adopted-ember-addons/ember-launch-darkly",
"license": "MIT",
"author": "The Ember Launch Darkly Team",
"directories": {
"doc": "doc",
"test": "tests"
},
"files": [
"addon-main.js",
"dist"
],
"scripts": {
"build": "rollup --config",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint . --no-error-on-unmatched-pattern",
"lint:js": "eslint . --cache",
"lint:hbs:fix": "ember-template-lint . --fix --no-error-on-unmatched-pattern",
"lint:js:fix": "eslint . --fix",
"start": "rollup --config --watch",
"test": "echo 'A v2 addon does not have tests, run tests in test-app'",
"prepack": "rollup --config"
},
"dependencies": {
"@embroider/addon-shim": "^1.0.0",
"launchdarkly-js-client-sdk": "^3.1.1",
"tracked-maps-and-sets": "^3.0.2"
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@embroider/addon-dev": "^3.0.0",
"@rollup/plugin-babel": "^6.0.3",
"babel-eslint": "^10.1.0",
"concurrently": "^7.6.0",
"ember-source": "4.11.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-ember": "^11.4.7",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.4",
"prettier": "^2.8.4",
"rollup": "^3.19.1",
"rollup-plugin-copy": "3.4.0"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"version": 2,
"type": "addon",
"main": "addon-main.js",
"app-js": {
"./helpers/variation.js": "./dist/_app_/helpers/variation.js"
}
},
"exports": {
".": "./dist/index.js",
"./*": {
"default": "./dist/*.js"
},
"./test-support": "./dist/test-support/index.js",
"./-sdk": "./dist/-sdk/index.js",
"./-sdk/context": "./dist/-sdk/context.js",
"./-sdk/identify": "./dist/-sdk/identify.js",
"./-sdk/initialize": "./dist/-sdk/initialize.js",
"./-sdk/variation": "./dist/-sdk/variation.js",
"./addon-main.js": "./addon-main.js"
}
}
51 changes: 51 additions & 0 deletions ember-launch-darkly/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import babel from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import { Addon } from '@embroider/addon-dev/rollup';

const addon = new Addon({
srcDir: 'src',
destDir: 'dist',
});

export default {
// This provides defaults that work well alongside `publicEntrypoints` below.
// You can augment this if you need to.
output: addon.output(),

plugins: [
// These are the modules that users should be able to import from your
// addon. Anything not listed here may get optimized away.
addon.publicEntrypoints(['**/*.js']),

// These are the modules that should get reexported into the traditional
// "app" tree. Things in here should also be in publicEntrypoints above, but
// not everything in publicEntrypoints necessarily needs to go here.
addon.appReexports(['helpers/**/*.js']),

// This babel config should *not* apply presets or compile away ES modules.
// It exists only to provide development niceties for you, like automatic
// template colocation.
//
// By default, this will load the actual babel config from the file
// babel.config.json.
babel({
babelHelpers: 'bundled',
}),

// Follow the V2 Addon rules about dependencies. Your code can import from
// `dependencies` and `peerDependencies` as well as standard Ember-provided
// package names.
addon.dependencies(),

// Remove leftover build artifacts when starting a new build.
addon.clean(),

// Copy Readme and License into published package
copy({
targets: [
{ src: '../README.md', dest: '.' },
{ src: '../LICENSE.md', dest: '.' },
],
}),
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
95 changes: 18 additions & 77 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,30 @@
{
"name": "ember-launch-darkly",
"version": "2.2.0",
"description": "A modern Ember addon to wrap the Launch Darkly service",
"keywords": [
"ember-addon"
"version": "3.0.0",
"private": true,
"workspaces": [
"ember-launch-darkly",
"test-app"
],
"repository": "https://github.com/adopted-ember-addons/ember-launch-darkly",
"license": "MIT",
"author": "The Ember Launch Darkly Team",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build --environment=production",
"lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"",
"lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"",
"lint:hbs": "ember-template-lint .",
"lint:hbs:fix": "ember-template-lint . --fix",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"start": "ember serve",
"test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
"test:ember": "ember test",
"test:ember-compatibility": "ember try:each"
},
"dependencies": {
"ember-auto-import": "^2.6.1",
"ember-cli-babel": "^7.26.11",
"ember-cli-htmlbars": "^6.2.0",
"ember-test-waiters": "^2.1.3",
"launchdarkly-js-client-sdk": "^2.24.2",
"tracked-maps-and-sets": "^3.0.2"
"build": "yarn workspace ember-launch-darkly run build",
"lint": "yarn workspaces run lint",
"lint:fix": "yarn workspaces run lint:fix",
"prepare": "yarn build",
"start": "concurrently 'npm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
"start:addon": "yarn workspace ember-launch-darkly run start",
"start:test": "yarn workspace test-app run start",
"test": "yarn workspaces run test"
},
"devDependencies": {
"@ember/optional-features": "^2.0.0",
"@ember/string": "^3.0.1",
"@ember/test-helpers": "^2.9.3",
"@embroider/test-setup": "^2.1.1",
"@glimmer/component": "^1.1.2",
"@glimmer/tracking": "^1.1.2",
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^7.6.0",
"ember-cli": "~4.11.0",
"ember-cli-babili": "^0.2.0",
"ember-cli-dependency-checker": "^3.3.1",
"ember-cli-inject-live-reload": "^2.1.0",
"ember-cli-sri": "^2.1.1",
"ember-cli-terser": "^4.0.2",
"ember-code-snippet": "^3.0.0",
"ember-load-initializers": "^2.1.2",
"ember-page-title": "^7.0.0",
"ember-qunit": "^6.2.0",
"ember-resolver": "^10.0.0",
"ember-source": "~4.11.0",
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^5.6.0",
"ember-truth-helpers": "^3.1.1",
"ember-try": "^2.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-ember": "^11.4.7",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-qunit": "^7.3.4",
"loader.js": "^4.7.0",
"prettier": "^2.8.4",
"qunit": "^2.19.4",
"qunit-dom": "^2.0.0",
"release-it": "^15.8.0",
"release-it-lerna-changelog": "^5.0.0",
"webpack": "^5.75.0"
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0"
},
"engines": {
"node": "14.* || 16.* || >= 18"
},
"ember": {
"edition": "octane"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"@release-it-plugins/lerna-changelog": "5.0.0",
"@release-it-plugins/workspaces": "3.2.0",
"concurrently": "7.6.0",
"prettier": "2.8.4",
"release-it": "15.8.0"
},
"release-it": {
"plugins": {
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion .eslintignore → test-app/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

# misc
/coverage/
/nodetests/**/
!.*
.*/
.eslintcache
Expand Down
Loading

0 comments on commit ea2a036

Please sign in to comment.